Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agents/cosmo-tutor/protocol.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ agent:
thinking: THINKING
webSearch: true
agentic: true
imageModel: openai/gpt-image-1
imageModel: openai/gpt-image-2.5-flare
skills:
- crawl-urls

Expand Down
12 changes: 6 additions & 6 deletions lib/octavus-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* Long-lived /api/trigger streams use the process-wide fetch dispatcher. When
* that pool is saturated (or pipelined behind a streaming response), a normal
* `octavus.agentSessions.create()` can stall until the stream ends — which
* `octavus.sessions.create()` can stall until the stream ends — which
* blocks "New chat" in the UI. Routing creates through their own Agent keeps
* session creation independent of in-flight triggers.
*/
Expand All @@ -28,7 +28,7 @@ export async function createAgentSession({ baseUrl, apiKey, agentId, input = {}
if (!baseUrl) throw new Error('OCTAVUS_API_URL is not configured');
if (!agentId) throw new Error('Octavus agent id is not configured');

const url = `${String(baseUrl).replace(/\/$/, '')}/api/agent-sessions`;
const url = `${String(baseUrl).replace(/\/$/, '')}/api/v1/sessions`;
const headers = { 'Content-Type': 'application/json' };
if (apiKey) headers.Authorization = `Bearer ${apiKey}`;

Expand All @@ -46,9 +46,9 @@ export async function createAgentSession({ baseUrl, apiKey, agentId, input = {}
);
}

const data = await res.json();
if (typeof data?.sessionId !== 'string' || !data.sessionId) {
throw new Error('Agent session create returned no sessionId');
const session = await res.json();
if (typeof session?.id !== 'string' || !session.id) {
throw new Error('Agent session create returned no session id');
}
return data.sessionId;
return session.id;
}
41 changes: 21 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"pack": "node scripts/pack-dist.mjs"
},
"dependencies": {
"@octavus/client-sdk": "^6.10.0",
"@octavus/server-sdk": "^6.10.0",
"@octavus/client-sdk": "^7.2.0",
"@octavus/server-sdk": "^7.2.0",
"dotenv": "^17.4.2",
"express": "^4.19.2",
"highlight.js": "^11.11.1",
Expand All @@ -29,7 +29,7 @@
"undici": "^8.10.0"
},
"devDependencies": {
"@octavus/cli": "^6.10.0",
"@octavus/cli": "^7.2.0",
"concurrently": "^10.0.1",
"cross-env": "^7.0.3",
"esbuild": "^0.28.0",
Expand Down
4 changes: 2 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ app.post('/api/upload-urls', async (req, res) => {
return res.status(400).json({ error: 'sessionId and files[] are required' });
}
try {
const result = await octavus.files.getUploadUrls(sessionId, files);
const result = await octavus.files.create(files, { sessionId });
res.json(result);
} catch (err) {
console.error('[upload-urls] Error:', err);
Expand All @@ -364,7 +364,7 @@ app.post('/api/trigger', async (req, res) => {
return res.status(400).json({ error: 'sessionId is required' });
}

const session = octavus.agentSessions.attach(sessionId);
const session = octavus.sessions.attach(sessionId);
const events = session.execute(payload);
const stream = toSSEStream(events);

Expand Down
12 changes: 6 additions & 6 deletions tests/octavus-create.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ describe('createAgentSession', () => {
fetchMock.mockReset();
});

it('POSTs to /api/agent-sessions on a dedicated dispatcher', async () => {
it('POSTs to /api/v1/sessions on a dedicated dispatcher', async () => {
fetchMock.mockResolvedValue({
ok: true,
json: async () => ({ sessionId: 'sess-123' }),
json: async () => ({ id: 'sess-123', agentId: 'agent-1', status: 'active', createdAt: '2026-11-10T00:00:00.000Z' }),
});

const id = await createAgentSession({
Expand All @@ -38,7 +38,7 @@ describe('createAgentSession', () => {
expect(id).toBe('sess-123');
expect(fetchMock).toHaveBeenCalledOnce();
const [url, init] = fetchMock.mock.calls[0];
expect(url).toBe('https://octavus.example/api/agent-sessions');
expect(url).toBe('https://octavus.example/api/v1/sessions');
expect(init.method).toBe('POST');
expect(init.headers.Authorization).toBe('Bearer secret');
expect(JSON.parse(init.body)).toEqual({ agentId: 'agent-1', input: { MODEL: 'x' } });
Expand Down Expand Up @@ -67,10 +67,10 @@ describe('createAgentSession', () => {
).rejects.toThrow(/OCTAVUS_API_URL/);
});

it('throws when a 200 response has no string sessionId', async () => {
it('throws when a 200 response has no string session id', async () => {
fetchMock.mockResolvedValue({
ok: true,
json: async () => ({ sessionId: null }),
json: async () => ({ id: null }),
});

await expect(
Expand All @@ -79,6 +79,6 @@ describe('createAgentSession', () => {
apiKey: 'secret',
agentId: 'agent-1',
}),
).rejects.toThrow(/no sessionId/);
).rejects.toThrow(/no session id/);
});
});
6 changes: 3 additions & 3 deletions tests/server.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ vi.mock('fs/promises', () => ({
vi.mock('@octavus/server-sdk', () => {
return {
OctavusClient: function () {
this.agentSessions = {
create: vi.fn().mockResolvedValue('new-session-id'),
this.sessions = {
create: vi.fn().mockResolvedValue({ id: 'new-session-id', status: 'active' }),
attach: vi.fn().mockReturnValue({ execute: vi.fn() }),
};
this.files = {
getUploadUrls: vi.fn().mockResolvedValue({ urls: [] }),
create: vi.fn().mockResolvedValue({ files: [] }),
};
},
toSSEStream: vi.fn(),
Expand Down
Loading