sarvam-agents-client 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apis/AgentsApi.d.ts +4 -4
- package/dist/apis/AgentsApi.js +4 -4
- package/dist/apis/AppsApi.d.ts +1 -0
- package/dist/apis/AppsApi.js +3 -0
- package/dist/apis/QueueApi.d.ts +1 -0
- package/dist/apis/QueueApi.js +3 -0
- package/dist/apis/ResponsesApi.d.ts +2 -0
- package/dist/apis/ResponsesApi.js +6 -0
- package/dist/compose/agent.d.ts +10 -3
- package/dist/compose/agent.js +8 -0
- package/dist/compose/deploy.d.ts +3 -2
- package/dist/compose/errors.d.ts +17 -0
- package/dist/compose/errors.js +17 -0
- package/dist/compose/events.d.ts +44 -0
- package/dist/compose/events.js +32 -2
- package/dist/compose/index.d.ts +3 -2
- package/dist/compose/output.d.ts +29 -0
- package/dist/compose/output.js +451 -0
- package/dist/compose/run.d.ts +45 -13
- package/dist/compose/run.js +68 -3
- package/dist/compose/runState.d.ts +2 -1
- package/dist/compose/settingsTransport.d.ts +3 -2
- package/dist/compose/transport.d.ts +3 -2
- package/dist/esm/apis/AgentsApi.d.ts +4 -4
- package/dist/esm/apis/AgentsApi.js +4 -4
- package/dist/esm/apis/AppsApi.d.ts +1 -0
- package/dist/esm/apis/AppsApi.js +3 -0
- package/dist/esm/apis/QueueApi.d.ts +1 -0
- package/dist/esm/apis/QueueApi.js +3 -0
- package/dist/esm/apis/ResponsesApi.d.ts +2 -0
- package/dist/esm/apis/ResponsesApi.js +6 -0
- package/dist/esm/compose/agent.d.ts +10 -3
- package/dist/esm/compose/agent.js +8 -0
- package/dist/esm/compose/deploy.d.ts +3 -2
- package/dist/esm/compose/errors.d.ts +17 -0
- package/dist/esm/compose/errors.js +17 -0
- package/dist/esm/compose/events.d.ts +44 -0
- package/dist/esm/compose/events.js +32 -2
- package/dist/esm/compose/index.d.ts +3 -2
- package/dist/esm/compose/output.d.ts +29 -0
- package/dist/esm/compose/output.js +445 -0
- package/dist/esm/compose/run.d.ts +45 -13
- package/dist/esm/compose/run.js +69 -4
- package/dist/esm/compose/runState.d.ts +2 -1
- package/dist/esm/compose/settingsTransport.d.ts +3 -2
- package/dist/esm/compose/transport.d.ts +3 -2
- package/dist/esm/models/AppResource.d.ts +29 -0
- package/dist/esm/models/AppResource.js +16 -0
- package/dist/esm/models/AppToolsResponse.d.ts +3 -4
- package/dist/esm/models/AppToolsResponse.js +3 -2
- package/dist/esm/models/AppView.d.ts +48 -0
- package/dist/esm/models/AppView.js +23 -0
- package/dist/esm/models/McpSecurityAppealView.d.ts +50 -0
- package/dist/esm/models/McpSecurityAppealView.js +47 -0
- package/dist/esm/models/McpSecurityView.d.ts +105 -0
- package/dist/esm/models/McpSecurityView.js +66 -0
- package/dist/esm/models/MessagesResponse.d.ts +6 -0
- package/dist/esm/models/MessagesResponse.js +2 -0
- package/dist/esm/models/ResponseDetail.d.ts +32 -0
- package/dist/esm/models/ResponseDetail.js +10 -0
- package/dist/esm/models/index.d.ts +2 -0
- package/dist/esm/models/index.js +2 -0
- package/dist/models/AppResource.d.ts +29 -0
- package/dist/models/AppResource.js +17 -1
- package/dist/models/AppToolsResponse.d.ts +3 -4
- package/dist/models/AppToolsResponse.js +3 -2
- package/dist/models/AppView.d.ts +48 -0
- package/dist/models/AppView.js +24 -1
- package/dist/models/McpSecurityAppealView.d.ts +50 -0
- package/dist/models/McpSecurityAppealView.js +54 -0
- package/dist/models/McpSecurityView.d.ts +105 -0
- package/dist/models/McpSecurityView.js +73 -0
- package/dist/models/MessagesResponse.d.ts +6 -0
- package/dist/models/MessagesResponse.js +2 -0
- package/dist/models/ResponseDetail.d.ts +32 -0
- package/dist/models/ResponseDetail.js +10 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.js +2 -0
- package/package.json +4 -3
- package/src/apis/AgentsApi.ts +4 -4
- package/src/apis/AppsApi.ts +5 -0
- package/src/apis/QueueApi.ts +5 -0
- package/src/apis/ResponsesApi.ts +10 -0
- package/src/compose/agent.ts +21 -6
- package/src/compose/deploy.ts +6 -5
- package/src/compose/errors.ts +28 -1
- package/src/compose/events.ts +61 -1
- package/src/compose/index.ts +3 -2
- package/src/compose/output.ts +415 -0
- package/src/compose/run.ts +114 -20
- package/src/compose/runState.ts +2 -1
- package/src/compose/settingsTransport.ts +4 -3
- package/src/compose/transport.ts +3 -2
- package/src/models/AppResource.ts +42 -0
- package/src/models/AppToolsResponse.ts +11 -4
- package/src/models/AppView.ts +73 -0
- package/src/models/McpSecurityAppealView.ts +89 -0
- package/src/models/McpSecurityView.ts +169 -0
- package/src/models/MessagesResponse.ts +8 -0
- package/src/models/ResponseDetail.ts +40 -0
- package/src/models/index.ts +2 -0
package/dist/compose/run.js
CHANGED
|
@@ -5,10 +5,17 @@ exports.run = run;
|
|
|
5
5
|
const runtime_js_1 = require("../runtime.js");
|
|
6
6
|
const deploy_js_1 = require("./deploy.js");
|
|
7
7
|
const errors_js_1 = require("./errors.js");
|
|
8
|
+
const output_js_1 = require("./output.js");
|
|
8
9
|
const runState_js_1 = require("./runState.js");
|
|
9
10
|
const MAX_RECONNECTS = 3;
|
|
10
11
|
/** The abort reason ResponseStream (src/streaming.ts) uses when a stream goes quiet. */
|
|
11
12
|
const IDLE_TIMEOUT_MESSAGE = "stream idle timeout";
|
|
13
|
+
/** Server cap kind (`data-turn-limit`) -> stop reason, named like the `limits` field that set it. */
|
|
14
|
+
const STOP_REASONS = {
|
|
15
|
+
max_turns: "max_turns",
|
|
16
|
+
tool_calls: "max_tool_calls",
|
|
17
|
+
tokens: "max_tokens",
|
|
18
|
+
};
|
|
12
19
|
function stateOf(conversationId, interruptions) {
|
|
13
20
|
if (conversationId === undefined)
|
|
14
21
|
throw new errors_js_1.UserError("this run has no conversation to resume");
|
|
@@ -21,7 +28,12 @@ class RunResult {
|
|
|
21
28
|
this.outputText = outcome.outputText;
|
|
22
29
|
this.newItems = outcome.newItems;
|
|
23
30
|
this.interruptions = outcome.interruptions;
|
|
31
|
+
this.stopReason = outcome.stopReason;
|
|
24
32
|
this.conversationId = outcome.conversationId;
|
|
33
|
+
this.outputCitations = outcome.outputCitations;
|
|
34
|
+
this.outputNote = outcome.outputNote;
|
|
35
|
+
this.outputSkipped = outcome.outputSkipped;
|
|
36
|
+
this.outputMode = outcome.outputMode;
|
|
25
37
|
}
|
|
26
38
|
/** A RunState to answer the interruptions and continue; throws UserError when the run has no conversation. */
|
|
27
39
|
get state() {
|
|
@@ -102,6 +114,9 @@ class Loop {
|
|
|
102
114
|
this.onConversation = onConversation;
|
|
103
115
|
this.conversationId = null;
|
|
104
116
|
this.items = [];
|
|
117
|
+
this.stopReason = undefined;
|
|
118
|
+
/** The turn's structured output (`data-output` / `data-output-error`), when the agent has an `outputType`. */
|
|
119
|
+
this.output = undefined;
|
|
105
120
|
// Text of the current segment, per text block. Kept per block so a resumed stream, which replays from the start
|
|
106
121
|
// of the block it dropped in, doesn't repeat text.
|
|
107
122
|
this.blocks = [];
|
|
@@ -246,6 +261,13 @@ class Loop {
|
|
|
246
261
|
if (this.signal.aborted)
|
|
247
262
|
throw new Cancelled();
|
|
248
263
|
throw new errors_js_1.RunError("stopped", `the turn was stopped on the server (${event.reason})`);
|
|
264
|
+
case "turn_limit":
|
|
265
|
+
this.stopReason = STOP_REASONS[event.capKind];
|
|
266
|
+
return false;
|
|
267
|
+
case "output":
|
|
268
|
+
case "output_error":
|
|
269
|
+
this.output = event;
|
|
270
|
+
return false;
|
|
249
271
|
case "text_start":
|
|
250
272
|
case "text_end":
|
|
251
273
|
this.onText(event);
|
|
@@ -360,8 +382,18 @@ function link(signal, controller) {
|
|
|
360
382
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
361
383
|
return () => signal.removeEventListener("abort", onAbort);
|
|
362
384
|
}
|
|
385
|
+
/** `finalOutput` for an agent with an `outputType`: the parsed value, or undefined when the turn produced none
|
|
386
|
+
* (`outputSkipped` says why). A mismatch throws `ModelBehaviorError`. */
|
|
387
|
+
function structuredOutput(outputType, event) {
|
|
388
|
+
if ((event === null || event === void 0 ? void 0 : event.kind) === "output_error")
|
|
389
|
+
throw new errors_js_1.ModelBehaviorError(event.rawText, event.errors, event.note);
|
|
390
|
+
if ((event === null || event === void 0 ? void 0 : event.kind) === "output" && event.output !== null && event.output !== undefined) {
|
|
391
|
+
return (0, output_js_1.parseOutput)(outputType, event.output, event.note);
|
|
392
|
+
}
|
|
393
|
+
return undefined;
|
|
394
|
+
}
|
|
363
395
|
async function execute(p, controller, emit) {
|
|
364
|
-
var _a, _b;
|
|
396
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
365
397
|
const signal = controller.signal;
|
|
366
398
|
const unlink = link(p.opts.signal, controller);
|
|
367
399
|
const stopper = new Stopper(p.transport, signal);
|
|
@@ -397,13 +429,34 @@ async function execute(p, controller, emit) {
|
|
|
397
429
|
}
|
|
398
430
|
cancelled = cancelled || signal.aborted;
|
|
399
431
|
const text = loop.text;
|
|
432
|
+
const outputType = p.agent.outputType;
|
|
433
|
+
let finalOutput;
|
|
434
|
+
if (interruptions.length || cancelled)
|
|
435
|
+
finalOutput = undefined;
|
|
436
|
+
else if (outputType !== undefined) {
|
|
437
|
+
try {
|
|
438
|
+
finalOutput = structuredOutput(outputType, loop.output);
|
|
439
|
+
}
|
|
440
|
+
catch (err) {
|
|
441
|
+
if (err instanceof errors_js_1.ModelBehaviorError)
|
|
442
|
+
err.conversationId = (_b = loop.conversationId) !== null && _b !== void 0 ? _b : fallbackConversation;
|
|
443
|
+
throw err;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
else
|
|
447
|
+
finalOutput = text;
|
|
400
448
|
return {
|
|
401
|
-
finalOutput
|
|
449
|
+
finalOutput,
|
|
402
450
|
outputText: text,
|
|
403
451
|
newItems: loop.items,
|
|
404
452
|
interruptions,
|
|
405
|
-
|
|
453
|
+
stopReason: loop.stopReason,
|
|
454
|
+
conversationId: (_c = loop.conversationId) !== null && _c !== void 0 ? _c : fallbackConversation,
|
|
406
455
|
cancelled,
|
|
456
|
+
outputCitations: ((_d = loop.output) === null || _d === void 0 ? void 0 : _d.kind) === "output" ? ((_e = loop.output.citations) !== null && _e !== void 0 ? _e : []).slice() : [],
|
|
457
|
+
outputNote: (_f = loop.output) === null || _f === void 0 ? void 0 : _f.note,
|
|
458
|
+
outputSkipped: ((_g = loop.output) === null || _g === void 0 ? void 0 : _g.kind) === "output" ? loop.output.skipped : undefined,
|
|
459
|
+
outputMode: ((_h = loop.output) === null || _h === void 0 ? void 0 : _h.kind) === "output" ? loop.output.mode : undefined,
|
|
407
460
|
};
|
|
408
461
|
}
|
|
409
462
|
// -- streaming ---------------------------------------------------------------------------------------------------
|
|
@@ -415,8 +468,15 @@ class StreamedRunResult {
|
|
|
415
468
|
this.outputText = "";
|
|
416
469
|
this.newItems = [];
|
|
417
470
|
this.interruptions = [];
|
|
471
|
+
/** Set when an agent.json limit ended the turn; read after `completed` settles. */
|
|
472
|
+
this.stopReason = undefined;
|
|
418
473
|
this.conversationId = undefined;
|
|
419
474
|
this.cancelled = false;
|
|
475
|
+
/** As on `RunResult`; read after `completed` settles. */
|
|
476
|
+
this.outputCitations = [];
|
|
477
|
+
this.outputNote = undefined;
|
|
478
|
+
this.outputSkipped = undefined;
|
|
479
|
+
this.outputMode = undefined;
|
|
420
480
|
this.queue = [];
|
|
421
481
|
this.waiters = [];
|
|
422
482
|
this.done = false;
|
|
@@ -429,8 +489,13 @@ class StreamedRunResult {
|
|
|
429
489
|
this.outputText = outcome.outputText;
|
|
430
490
|
this.newItems = outcome.newItems;
|
|
431
491
|
this.interruptions = outcome.interruptions;
|
|
492
|
+
this.stopReason = outcome.stopReason;
|
|
432
493
|
this.conversationId = outcome.conversationId;
|
|
433
494
|
this.cancelled = outcome.cancelled;
|
|
495
|
+
this.outputCitations = outcome.outputCitations;
|
|
496
|
+
this.outputNote = outcome.outputNote;
|
|
497
|
+
this.outputSkipped = outcome.outputSkipped;
|
|
498
|
+
this.outputMode = outcome.outputMode;
|
|
434
499
|
this.end();
|
|
435
500
|
}, (error) => {
|
|
436
501
|
this.failure = { error };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** RunState: what a paused run needs to continue (conversation, pending interruptions and the caller's answers). */
|
|
2
2
|
import type { Agent } from "./agent.js";
|
|
3
|
+
import type { OutputType } from "./output.js";
|
|
3
4
|
import type { ClarifyQuestion } from "./events.js";
|
|
4
5
|
export interface Interruption {
|
|
5
6
|
kind: "clarify";
|
|
@@ -22,5 +23,5 @@ export declare class RunState {
|
|
|
22
23
|
/** JSON in the format Python's `RunState.to_json()` writes. */
|
|
23
24
|
toString(): string;
|
|
24
25
|
/** Read a state written by `toString()` (or by Python's `to_json()`). */
|
|
25
|
-
static fromString(agent: Agent
|
|
26
|
+
static fromString(agent: Agent<OutputType | undefined>, s: string): Promise<RunState>;
|
|
26
27
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Configuration } from "../runtime.js";
|
|
2
2
|
import type { Agent } from "./agent.js";
|
|
3
|
+
import type { OutputType } from "./output.js";
|
|
3
4
|
import type { RemoteAgent, Transport, TurnStream } from "./transport.js";
|
|
4
5
|
export declare class SettingsTransport implements Transport {
|
|
5
6
|
private readonly config;
|
|
@@ -10,8 +11,8 @@ export declare class SettingsTransport implements Transport {
|
|
|
10
11
|
constructor(config: Configuration);
|
|
11
12
|
findAgents(sdkName: string): Promise<RemoteAgent[]>;
|
|
12
13
|
readAgent(agentId: string): Promise<RemoteAgent>;
|
|
13
|
-
createAgent(agent: Agent): Promise<RemoteAgent>;
|
|
14
|
-
updateAgent(agentId: string, agent: Agent): Promise<RemoteAgent>;
|
|
14
|
+
createAgent(agent: Agent<OutputType | undefined>): Promise<RemoteAgent>;
|
|
15
|
+
updateAgent(agentId: string, agent: Agent<OutputType | undefined>): Promise<RemoteAgent>;
|
|
15
16
|
deleteAgent(agentId: string): Promise<void>;
|
|
16
17
|
startTurn(agentId: string, conversationId: string | null, text: string, signal?: AbortSignal): Promise<TurnStream>;
|
|
17
18
|
answerClarify(conversationId: string, requestId: string, answers: Record<string, unknown>, signal?: AbortSignal): Promise<TurnStream>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Transport interface: the seam between the compose layer and the server. */
|
|
2
2
|
import type { Agent } from "./agent.js";
|
|
3
|
+
import type { OutputType } from "./output.js";
|
|
3
4
|
import type { Event } from "./events.js";
|
|
4
5
|
export interface SettingsWarning {
|
|
5
6
|
code: string;
|
|
@@ -24,8 +25,8 @@ export interface Transport {
|
|
|
24
25
|
readonly kind: "settings";
|
|
25
26
|
findAgents(sdkName: string): Promise<RemoteAgent[]>;
|
|
26
27
|
readAgent(agentId: string): Promise<RemoteAgent>;
|
|
27
|
-
createAgent(agent: Agent): Promise<RemoteAgent>;
|
|
28
|
-
updateAgent(agentId: string, agent: Agent): Promise<RemoteAgent>;
|
|
28
|
+
createAgent(agent: Agent<OutputType | undefined>): Promise<RemoteAgent>;
|
|
29
|
+
updateAgent(agentId: string, agent: Agent<OutputType | undefined>): Promise<RemoteAgent>;
|
|
29
30
|
deleteAgent(agentId: string): Promise<void>;
|
|
30
31
|
startTurn(agentId: string, conversationId: string | null, text: string, signal?: AbortSignal): Promise<TurnStream>;
|
|
31
32
|
answerClarify(conversationId: string, requestId: string, answers: Record<string, unknown>, signal?: AbortSignal): Promise<TurnStream>;
|
|
@@ -133,12 +133,12 @@ export declare class AgentsApi extends runtime.BaseAPI {
|
|
|
133
133
|
*/
|
|
134
134
|
createAgent(requestParameters: CreateAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentResource>;
|
|
135
135
|
/**
|
|
136
|
-
* Owner-only soft delete.
|
|
136
|
+
* Owner-only soft delete. The managed state lives on the agent row, so a deleted agent stops being a managed agent with it.
|
|
137
137
|
* Delete Agent
|
|
138
138
|
*/
|
|
139
139
|
deleteAgentRaw(requestParameters: DeleteAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
140
140
|
/**
|
|
141
|
-
* Owner-only soft delete.
|
|
141
|
+
* Owner-only soft delete. The managed state lives on the agent row, so a deleted agent stops being a managed agent with it.
|
|
142
142
|
* Delete Agent
|
|
143
143
|
*/
|
|
144
144
|
deleteAgent(requestParameters: DeleteAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
@@ -237,12 +237,12 @@ export declare class AgentsApi extends runtime.BaseAPI {
|
|
|
237
237
|
*/
|
|
238
238
|
listAgentTemplates(requestParameters?: ListAgentTemplatesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EntityListAgentTemplateResource>;
|
|
239
239
|
/**
|
|
240
|
-
* Flat, scope-filterable agent catalog (contract replaces v1\'s grouped ``GET /v1/agents``; the FE re-groups client-side from each row\'s ``scope``). One gateway call returns the caller\'s full visible set (the triple powers the gateway\'s ``visibility_scope`` clause). We then drop the operator-seeded editor agents, re-apply the visibility predicate (defence in depth — the gateway is identity-agnostic), and apply the ``?scope=``/``q`` filters before counting, so ``total`` is authoritative for the returned set. ``origin=managed_agents`` keeps only managed agents the caller owns (:func:`is_owner`). A teammate\'s published managed agent is visible to the caller but its sessions are owner-only, so listing it would only lead to a 403 on the session log. It always takes the fetch-all path below: the SQL catalog pages at the gateway, which
|
|
240
|
+
* Flat, scope-filterable agent catalog (contract replaces v1\'s grouped ``GET /v1/agents``; the FE re-groups client-side from each row\'s ``scope``). One gateway call returns the caller\'s full visible set (the triple powers the gateway\'s ``visibility_scope`` clause). We then drop the operator-seeded editor agents, re-apply the visibility predicate (defence in depth — the gateway is identity-agnostic), and apply the ``?scope=``/``q`` filters before counting, so ``total`` is authoritative for the returned set. ``origin=managed_agents`` keeps only managed agents the caller owns (:func:`is_owner`). A teammate\'s published managed agent is visible to the caller but its sessions are owner-only, so listing it would only lead to a 403 on the session log. It always takes the fetch-all path below: the SQL catalog pages at the gateway, which has no managed filter, so filtering its page here would return short pages and a wrong ``total``. Catalog-only filters are therefore a 400 with ``origin`` rather than silently ignored.
|
|
241
241
|
* List Agents
|
|
242
242
|
*/
|
|
243
243
|
listAgentsRaw(requestParameters: ListAgentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<EntityListAgentResource>>;
|
|
244
244
|
/**
|
|
245
|
-
* Flat, scope-filterable agent catalog (contract replaces v1\'s grouped ``GET /v1/agents``; the FE re-groups client-side from each row\'s ``scope``). One gateway call returns the caller\'s full visible set (the triple powers the gateway\'s ``visibility_scope`` clause). We then drop the operator-seeded editor agents, re-apply the visibility predicate (defence in depth — the gateway is identity-agnostic), and apply the ``?scope=``/``q`` filters before counting, so ``total`` is authoritative for the returned set. ``origin=managed_agents`` keeps only managed agents the caller owns (:func:`is_owner`). A teammate\'s published managed agent is visible to the caller but its sessions are owner-only, so listing it would only lead to a 403 on the session log. It always takes the fetch-all path below: the SQL catalog pages at the gateway, which
|
|
245
|
+
* Flat, scope-filterable agent catalog (contract replaces v1\'s grouped ``GET /v1/agents``; the FE re-groups client-side from each row\'s ``scope``). One gateway call returns the caller\'s full visible set (the triple powers the gateway\'s ``visibility_scope`` clause). We then drop the operator-seeded editor agents, re-apply the visibility predicate (defence in depth — the gateway is identity-agnostic), and apply the ``?scope=``/``q`` filters before counting, so ``total`` is authoritative for the returned set. ``origin=managed_agents`` keeps only managed agents the caller owns (:func:`is_owner`). A teammate\'s published managed agent is visible to the caller but its sessions are owner-only, so listing it would only lead to a 403 on the session log. It always takes the fetch-all path below: the SQL catalog pages at the gateway, which has no managed filter, so filtering its page here would return short pages and a wrong ``total``. Catalog-only filters are therefore a 400 with ``origin`` rather than silently ignored.
|
|
246
246
|
* List Agents
|
|
247
247
|
*/
|
|
248
248
|
listAgents(requestParameters?: ListAgentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EntityListAgentResource>;
|
|
@@ -98,7 +98,7 @@ export class AgentsApi extends runtime.BaseAPI {
|
|
|
98
98
|
return await response.value();
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
|
-
* Owner-only soft delete.
|
|
101
|
+
* Owner-only soft delete. The managed state lives on the agent row, so a deleted agent stops being a managed agent with it.
|
|
102
102
|
* Delete Agent
|
|
103
103
|
*/
|
|
104
104
|
async deleteAgentRaw(requestParameters, initOverrides) {
|
|
@@ -123,7 +123,7 @@ export class AgentsApi extends runtime.BaseAPI {
|
|
|
123
123
|
return new runtime.VoidApiResponse(response);
|
|
124
124
|
}
|
|
125
125
|
/**
|
|
126
|
-
* Owner-only soft delete.
|
|
126
|
+
* Owner-only soft delete. The managed state lives on the agent row, so a deleted agent stops being a managed agent with it.
|
|
127
127
|
* Delete Agent
|
|
128
128
|
*/
|
|
129
129
|
async deleteAgent(requestParameters, initOverrides) {
|
|
@@ -474,7 +474,7 @@ export class AgentsApi extends runtime.BaseAPI {
|
|
|
474
474
|
return await response.value();
|
|
475
475
|
}
|
|
476
476
|
/**
|
|
477
|
-
* Flat, scope-filterable agent catalog (contract replaces v1\'s grouped ``GET /v1/agents``; the FE re-groups client-side from each row\'s ``scope``). One gateway call returns the caller\'s full visible set (the triple powers the gateway\'s ``visibility_scope`` clause). We then drop the operator-seeded editor agents, re-apply the visibility predicate (defence in depth — the gateway is identity-agnostic), and apply the ``?scope=``/``q`` filters before counting, so ``total`` is authoritative for the returned set. ``origin=managed_agents`` keeps only managed agents the caller owns (:func:`is_owner`). A teammate\'s published managed agent is visible to the caller but its sessions are owner-only, so listing it would only lead to a 403 on the session log. It always takes the fetch-all path below: the SQL catalog pages at the gateway, which
|
|
477
|
+
* Flat, scope-filterable agent catalog (contract replaces v1\'s grouped ``GET /v1/agents``; the FE re-groups client-side from each row\'s ``scope``). One gateway call returns the caller\'s full visible set (the triple powers the gateway\'s ``visibility_scope`` clause). We then drop the operator-seeded editor agents, re-apply the visibility predicate (defence in depth — the gateway is identity-agnostic), and apply the ``?scope=``/``q`` filters before counting, so ``total`` is authoritative for the returned set. ``origin=managed_agents`` keeps only managed agents the caller owns (:func:`is_owner`). A teammate\'s published managed agent is visible to the caller but its sessions are owner-only, so listing it would only lead to a 403 on the session log. It always takes the fetch-all path below: the SQL catalog pages at the gateway, which has no managed filter, so filtering its page here would return short pages and a wrong ``total``. Catalog-only filters are therefore a 400 with ``origin`` rather than silently ignored.
|
|
478
478
|
* List Agents
|
|
479
479
|
*/
|
|
480
480
|
async listAgentsRaw(requestParameters, initOverrides) {
|
|
@@ -532,7 +532,7 @@ export class AgentsApi extends runtime.BaseAPI {
|
|
|
532
532
|
return new runtime.JSONApiResponse(response, (jsonValue) => EntityListAgentResourceFromJSON(jsonValue));
|
|
533
533
|
}
|
|
534
534
|
/**
|
|
535
|
-
* Flat, scope-filterable agent catalog (contract replaces v1\'s grouped ``GET /v1/agents``; the FE re-groups client-side from each row\'s ``scope``). One gateway call returns the caller\'s full visible set (the triple powers the gateway\'s ``visibility_scope`` clause). We then drop the operator-seeded editor agents, re-apply the visibility predicate (defence in depth — the gateway is identity-agnostic), and apply the ``?scope=``/``q`` filters before counting, so ``total`` is authoritative for the returned set. ``origin=managed_agents`` keeps only managed agents the caller owns (:func:`is_owner`). A teammate\'s published managed agent is visible to the caller but its sessions are owner-only, so listing it would only lead to a 403 on the session log. It always takes the fetch-all path below: the SQL catalog pages at the gateway, which
|
|
535
|
+
* Flat, scope-filterable agent catalog (contract replaces v1\'s grouped ``GET /v1/agents``; the FE re-groups client-side from each row\'s ``scope``). One gateway call returns the caller\'s full visible set (the triple powers the gateway\'s ``visibility_scope`` clause). We then drop the operator-seeded editor agents, re-apply the visibility predicate (defence in depth — the gateway is identity-agnostic), and apply the ``?scope=``/``q`` filters before counting, so ``total`` is authoritative for the returned set. ``origin=managed_agents`` keeps only managed agents the caller owns (:func:`is_owner`). A teammate\'s published managed agent is visible to the caller but its sessions are owner-only, so listing it would only lead to a 403 on the session log. It always takes the fetch-all path below: the SQL catalog pages at the gateway, which has no managed filter, so filtering its page here would return short pages and a wrong ``total``. Catalog-only filters are therefore a 400 with ``origin`` rather than silently ignored.
|
|
536
536
|
* List Agents
|
|
537
537
|
*/
|
|
538
538
|
async listAgents(requestParameters = {}, initOverrides) {
|
package/dist/esm/apis/AppsApi.js
CHANGED
|
@@ -350,6 +350,9 @@ export class AppsApi extends runtime.BaseAPI {
|
|
|
350
350
|
if (requestParameters['includeFilterOptions'] != null) {
|
|
351
351
|
queryParameters['includeFilterOptions'] = requestParameters['includeFilterOptions'];
|
|
352
352
|
}
|
|
353
|
+
if (requestParameters['custom'] != null) {
|
|
354
|
+
queryParameters['custom'] = requestParameters['custom'];
|
|
355
|
+
}
|
|
353
356
|
const headerParameters = {};
|
|
354
357
|
if (this.configuration && this.configuration.accessToken) {
|
|
355
358
|
const token = this.configuration.accessToken;
|
|
@@ -78,6 +78,9 @@ export class QueueApi extends runtime.BaseAPI {
|
|
|
78
78
|
if (requestParameters['xClientVersion'] != null) {
|
|
79
79
|
headerParameters['X-Client-Version'] = String(requestParameters['xClientVersion']);
|
|
80
80
|
}
|
|
81
|
+
if (requestParameters['xLoginId'] != null) {
|
|
82
|
+
headerParameters['X-Login-Id'] = String(requestParameters['xLoginId']);
|
|
83
|
+
}
|
|
81
84
|
if (this.configuration && this.configuration.accessToken) {
|
|
82
85
|
const token = this.configuration.accessToken;
|
|
83
86
|
const tokenString = await token("bearerAuth", []);
|
|
@@ -16,6 +16,7 @@ export interface CreateResponseRequest {
|
|
|
16
16
|
xClientFeatures?: string | null;
|
|
17
17
|
xClientPlatform?: string | null;
|
|
18
18
|
xClientVersion?: string | null;
|
|
19
|
+
xLoginId?: string | null;
|
|
19
20
|
}
|
|
20
21
|
export interface ReconnectStreamRequest {
|
|
21
22
|
conversationId: string;
|
|
@@ -30,6 +31,7 @@ export interface StopResponseRequest {
|
|
|
30
31
|
conversationId: string;
|
|
31
32
|
xClientPlatform?: string | null;
|
|
32
33
|
xClientVersion?: string | null;
|
|
34
|
+
xLoginId?: string | null;
|
|
33
35
|
}
|
|
34
36
|
/**
|
|
35
37
|
*
|
|
@@ -36,6 +36,9 @@ export class ResponsesApi extends runtime.BaseAPI {
|
|
|
36
36
|
if (requestParameters['xClientVersion'] != null) {
|
|
37
37
|
headerParameters['X-Client-Version'] = String(requestParameters['xClientVersion']);
|
|
38
38
|
}
|
|
39
|
+
if (requestParameters['xLoginId'] != null) {
|
|
40
|
+
headerParameters['X-Login-Id'] = String(requestParameters['xLoginId']);
|
|
41
|
+
}
|
|
39
42
|
if (this.configuration && this.configuration.accessToken) {
|
|
40
43
|
const token = this.configuration.accessToken;
|
|
41
44
|
const tokenString = await token("bearerAuth", []);
|
|
@@ -138,6 +141,9 @@ export class ResponsesApi extends runtime.BaseAPI {
|
|
|
138
141
|
if (requestParameters['xClientVersion'] != null) {
|
|
139
142
|
headerParameters['X-Client-Version'] = String(requestParameters['xClientVersion']);
|
|
140
143
|
}
|
|
144
|
+
if (requestParameters['xLoginId'] != null) {
|
|
145
|
+
headerParameters['X-Login-Id'] = String(requestParameters['xLoginId']);
|
|
146
|
+
}
|
|
141
147
|
if (this.configuration && this.configuration.accessToken) {
|
|
142
148
|
const token = this.configuration.accessToken;
|
|
143
149
|
const tokenString = await token("bearerAuth", []);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BuiltinTool } from "./tools.js";
|
|
2
|
+
import type { OutputType } from "./output.js";
|
|
2
3
|
export interface ModelSettings {
|
|
3
4
|
temperature?: number;
|
|
4
5
|
topP?: number;
|
|
@@ -13,7 +14,7 @@ export interface Limits {
|
|
|
13
14
|
maxToolCallsPerTurn?: number;
|
|
14
15
|
maxTokensPerTurn?: number;
|
|
15
16
|
}
|
|
16
|
-
export interface AgentOptions {
|
|
17
|
+
export interface AgentOptions<TOutput extends OutputType | undefined = undefined> {
|
|
17
18
|
name: string;
|
|
18
19
|
instructions?: string;
|
|
19
20
|
model?: string;
|
|
@@ -25,8 +26,12 @@ export interface AgentOptions {
|
|
|
25
26
|
tools?: BuiltinTool[];
|
|
26
27
|
limits?: Limits;
|
|
27
28
|
metadata?: Record<string, string>;
|
|
29
|
+
/** The shape of the final answer: `{ type: "json_schema", schema }` or a zod schema. `finalOutput` follows it. */
|
|
30
|
+
outputType?: TOutput;
|
|
28
31
|
}
|
|
29
|
-
|
|
32
|
+
/** An agent with any output type: use it for helpers that accept every agent (plain `Agent` means a text agent). */
|
|
33
|
+
export type AnyAgent = Agent<OutputType | undefined>;
|
|
34
|
+
export declare class Agent<TOutput extends OutputType | undefined = undefined> {
|
|
30
35
|
readonly name: string;
|
|
31
36
|
readonly instructions: string;
|
|
32
37
|
readonly model?: string;
|
|
@@ -36,7 +41,9 @@ export declare class Agent {
|
|
|
36
41
|
readonly tools?: readonly BuiltinTool[];
|
|
37
42
|
readonly limits?: Limits;
|
|
38
43
|
readonly metadata?: Record<string, string>;
|
|
39
|
-
|
|
44
|
+
/** Kept by reference and not frozen: a zod schema must stay usable. Non-enumerable, so deepFreeze skips it. */
|
|
45
|
+
readonly outputType: TOutput;
|
|
46
|
+
constructor(rawOpts: AgentOptions<TOutput>);
|
|
40
47
|
private check;
|
|
41
48
|
private baseSettings;
|
|
42
49
|
specHash(): string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NotSupportedError, UserError } from "./errors.js";
|
|
2
2
|
import { settingsFingerprint } from "./fingerprint.js";
|
|
3
3
|
import { BUILTIN_NAMES, checkWebSearchOptions } from "./builtins.js";
|
|
4
|
+
import { checkOutputType, outputSchema } from "./output.js";
|
|
4
5
|
const SLUG = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
5
6
|
const REASONING = ["off", "none", "low", "medium", "high", "xhigh", "max"];
|
|
6
7
|
const TOOL_CHOICES = ["auto", "none"];
|
|
@@ -89,6 +90,7 @@ export class Agent {
|
|
|
89
90
|
this.tools = clone(opts.tools);
|
|
90
91
|
this.limits = clone(opts.limits);
|
|
91
92
|
this.metadata = clone(opts.metadata);
|
|
93
|
+
Object.defineProperty(this, "outputType", { value: opts.outputType, enumerable: false, writable: false });
|
|
92
94
|
this.check();
|
|
93
95
|
deepFreeze(this);
|
|
94
96
|
}
|
|
@@ -97,6 +99,10 @@ export class Agent {
|
|
|
97
99
|
if (typeof this.name !== "string" || !SLUG.test(this.name)) {
|
|
98
100
|
throw new UserError(`name: ${JSON.stringify(this.name)} must match ${SLUG.source}`);
|
|
99
101
|
}
|
|
102
|
+
if (this.outputType !== undefined) {
|
|
103
|
+
checkOutputType(this.outputType);
|
|
104
|
+
outputSchema(this.outputType); // refuse what the server would, before anything is sent
|
|
105
|
+
}
|
|
100
106
|
for (const [key, value] of [["model", this.model], ["endpoint", this.endpoint]]) {
|
|
101
107
|
if (value !== undefined && (typeof value !== "string" || value === "")) {
|
|
102
108
|
throw new UserError(`${key}: must be a non-empty string`);
|
|
@@ -200,6 +206,8 @@ export class Agent {
|
|
|
200
206
|
}
|
|
201
207
|
out["builtin_tools"] = tools;
|
|
202
208
|
}
|
|
209
|
+
if (this.outputType !== undefined)
|
|
210
|
+
out["output_schema"] = outputSchema(this.outputType);
|
|
203
211
|
return out;
|
|
204
212
|
}
|
|
205
213
|
specHash() {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** deploy()/undeploy(): upsert a hosted agent by name, with fingerprint-based drift detection, and the deploy cache. */
|
|
2
2
|
import type { Configuration } from "../runtime.js";
|
|
3
3
|
import type { Agent } from "./agent.js";
|
|
4
|
+
import type { OutputType } from "./output.js";
|
|
4
5
|
import type { Transport } from "./transport.js";
|
|
5
6
|
export interface Deployment {
|
|
6
7
|
agentId: string;
|
|
@@ -10,7 +11,7 @@ export interface Deployment {
|
|
|
10
11
|
export declare function setDefaultClient(config: Configuration | null): void;
|
|
11
12
|
export declare function getDefaultClient(): Configuration | null;
|
|
12
13
|
export declare function resolveTransport(client?: Configuration, transport?: Transport): Transport;
|
|
13
|
-
export declare function deploy(agent: Agent
|
|
14
|
+
export declare function deploy(agent: Agent<OutputType | undefined>, opts?: {
|
|
14
15
|
client?: Configuration;
|
|
15
16
|
transport?: Transport;
|
|
16
17
|
strict?: boolean;
|
|
@@ -27,4 +28,4 @@ export declare function forget(name: string): void;
|
|
|
27
28
|
* Keyed by name, as the server is: a variant with the same name redeploys, chained after any in-flight deploy so
|
|
28
29
|
* deploys of one name never overlap.
|
|
29
30
|
*/
|
|
30
|
-
export declare function agentIdFor(agent: Agent
|
|
31
|
+
export declare function agentIdFor(agent: Agent<OutputType | undefined>, transport: Transport, owner: object): Promise<string>;
|
|
@@ -16,7 +16,24 @@ export declare class UserError extends AgentsError {
|
|
|
16
16
|
message?: string;
|
|
17
17
|
}>);
|
|
18
18
|
}
|
|
19
|
+
/** Where a `ModelBehaviorError` came from: the server's check, or the `outputType`'s own `parse`. */
|
|
20
|
+
export type ModelBehaviorErrorSource = "server" | "local_parse";
|
|
21
|
+
/**
|
|
22
|
+
* The agent's answer didn't match its `outputType`. `source` says where: `"server"` (no answer matched the schema
|
|
23
|
+
* after the server's retry; `rawText` is the model's last attempt) or `"local_parse"` (the server accepted the answer
|
|
24
|
+
* but the `outputType`'s `parse` refused it, for example a zod refinement; `rawText` is the server's JSON,
|
|
25
|
+
* re-serialised).
|
|
26
|
+
*/
|
|
19
27
|
export declare class ModelBehaviorError extends AgentsError {
|
|
28
|
+
readonly rawText: string;
|
|
29
|
+
readonly errors: string[];
|
|
30
|
+
/** The server's `outputNote`: the turn's size-refused `final_answer` was not the answer. */
|
|
31
|
+
readonly note: string | undefined;
|
|
32
|
+
readonly source: ModelBehaviorErrorSource;
|
|
33
|
+
/** The run's conversation, set when a run rejects with this, so the caller can continue it (`conversationId`) or
|
|
34
|
+
* fetch its `ResponseDetail`. */
|
|
35
|
+
conversationId: string | undefined;
|
|
36
|
+
constructor(rawText?: string, errors?: string[], note?: string, source?: ModelBehaviorErrorSource);
|
|
20
37
|
}
|
|
21
38
|
export declare class MaxTurnsExceededError extends AgentsError {
|
|
22
39
|
}
|
|
@@ -13,7 +13,24 @@ export class UserError extends AgentsError {
|
|
|
13
13
|
this.issues = issues;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* The agent's answer didn't match its `outputType`. `source` says where: `"server"` (no answer matched the schema
|
|
18
|
+
* after the server's retry; `rawText` is the model's last attempt) or `"local_parse"` (the server accepted the answer
|
|
19
|
+
* but the `outputType`'s `parse` refused it, for example a zod refinement; `rawText` is the server's JSON,
|
|
20
|
+
* re-serialised).
|
|
21
|
+
*/
|
|
16
22
|
export class ModelBehaviorError extends AgentsError {
|
|
23
|
+
constructor(rawText = "", errors = [], note, source = "server") {
|
|
24
|
+
const prefix = source === "server" ? "model output rejected" : "model output rejected by outputType";
|
|
25
|
+
super(errors.length ? `${prefix}: ` + errors.join("; ") : rawText);
|
|
26
|
+
/** The run's conversation, set when a run rejects with this, so the caller can continue it (`conversationId`) or
|
|
27
|
+
* fetch its `ResponseDetail`. */
|
|
28
|
+
this.conversationId = undefined;
|
|
29
|
+
this.rawText = rawText;
|
|
30
|
+
this.errors = errors.slice();
|
|
31
|
+
this.note = note;
|
|
32
|
+
this.source = source;
|
|
33
|
+
}
|
|
17
34
|
}
|
|
18
35
|
export class MaxTurnsExceededError extends AgentsError {
|
|
19
36
|
}
|
|
@@ -11,6 +11,14 @@ export interface FunctionCallRequest {
|
|
|
11
11
|
name: string;
|
|
12
12
|
arguments: Record<string, unknown>;
|
|
13
13
|
}
|
|
14
|
+
/** A source the structured output cited: the server's citation-manifest entry, passed through as sent. */
|
|
15
|
+
export interface OutputCitation {
|
|
16
|
+
cite_id: string;
|
|
17
|
+
type?: string;
|
|
18
|
+
url?: string;
|
|
19
|
+
title?: string;
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
}
|
|
14
22
|
export type Event = {
|
|
15
23
|
kind: "text_start";
|
|
16
24
|
id: string;
|
|
@@ -45,6 +53,42 @@ export type Event = {
|
|
|
45
53
|
} | {
|
|
46
54
|
kind: "stopped";
|
|
47
55
|
reason: string;
|
|
56
|
+
}
|
|
57
|
+
/** The turn's structured output (`data-output`); `output` is null and `skipped` says why when the turn ended
|
|
58
|
+
* without one: `limit`, `budget`, `paused` or `suppressed` (a cron turn that ended `[SILENT]`), passed through as
|
|
59
|
+
* sent, so a newer server's value arrives unchanged. */
|
|
60
|
+
| {
|
|
61
|
+
kind: "output";
|
|
62
|
+
output: unknown;
|
|
63
|
+
skipped?: string;
|
|
64
|
+
/** How the server produced it (`tool_in_loop`, `tool_oversize`, `forced_tool`, `native`, `prompted`), passed
|
|
65
|
+
* through as sent. `tool_oversize`: the model's `final_answer` was too large for the tool loop and the server
|
|
66
|
+
* validated it afterwards. */
|
|
67
|
+
mode?: string;
|
|
68
|
+
/** The sources `output` cited, first citation first; absent when it cited none. `output` itself carries no
|
|
69
|
+
* `[cite:...]` markers. */
|
|
70
|
+
citations?: OutputCitation[];
|
|
71
|
+
/** Set when the turn's `final_answer` was refused for size and was not the answer: `oversize_answer_invalid`
|
|
72
|
+
* (it did not validate) or `oversize_answer_dropped` (too large to check), so `output` came from the model's
|
|
73
|
+
* later text. */
|
|
74
|
+
note?: string;
|
|
75
|
+
}
|
|
76
|
+
/** No answer matched the agent's output schema (`data-output-error`); `note` as on `output`. */
|
|
77
|
+
| {
|
|
78
|
+
kind: "output_error";
|
|
79
|
+
errors: string[];
|
|
80
|
+
rawText: string;
|
|
81
|
+
note?: string;
|
|
82
|
+
}
|
|
83
|
+
/** An agent.json limit ended the turn (`data-turn-limit`); the wrap-up answer still follows. `capKind` is the
|
|
84
|
+
* server's cap name: `max_turns`, `tool_calls` or `tokens`. `limit` is the agent.json `limits` key that set it
|
|
85
|
+
* (`max_turns`, `max_tool_calls_per_turn` or `max_tokens_per_turn`) and `value` the configured number; both are
|
|
86
|
+
* absent from a server that predates them. */
|
|
87
|
+
| {
|
|
88
|
+
kind: "turn_limit";
|
|
89
|
+
capKind: string;
|
|
90
|
+
limit?: string;
|
|
91
|
+
value?: number;
|
|
48
92
|
} | {
|
|
49
93
|
kind: "turn_finished";
|
|
50
94
|
reason: string;
|
|
@@ -24,7 +24,7 @@ export function fromUiChunk(chunk) {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
function map(chunk) {
|
|
27
|
-
var _a, _b;
|
|
27
|
+
var _a, _b, _c;
|
|
28
28
|
const type = chunk["type"];
|
|
29
29
|
const data = isObject(chunk["data"]) ? chunk["data"] : {};
|
|
30
30
|
if (typeof type === "string" && IGNORED.indexOf(type) !== -1)
|
|
@@ -84,14 +84,44 @@ function map(chunk) {
|
|
|
84
84
|
ev.expiresAt = data["expiresAt"];
|
|
85
85
|
return ev;
|
|
86
86
|
}
|
|
87
|
+
case "data-turn-limit":
|
|
88
|
+
return {
|
|
89
|
+
kind: "turn_limit",
|
|
90
|
+
capKind: str(data["kind"], ""),
|
|
91
|
+
...(typeof data["limit"] === "string" && data["limit"] ? { limit: data["limit"] } : {}),
|
|
92
|
+
...(Number.isInteger(data["value"]) ? { value: data["value"] } : {}),
|
|
93
|
+
};
|
|
87
94
|
case "data-stopped":
|
|
88
95
|
return { kind: "stopped", reason: str(data["reason"], "stopped") };
|
|
89
96
|
case "error":
|
|
90
97
|
return { kind: "turn_failed", code: str(chunk["code"], "turn_failed"), message: text(chunk["errorText"]) };
|
|
91
98
|
case "finish":
|
|
92
99
|
return { kind: "turn_finished", reason: str(chunk["finishReason"], "stop") };
|
|
100
|
+
case "data-output": {
|
|
101
|
+
const ev = { kind: "output", output: (_c = data["output"]) !== null && _c !== void 0 ? _c : null };
|
|
102
|
+
if (typeof data["skipped"] === "string" && data["skipped"])
|
|
103
|
+
ev.skipped = data["skipped"];
|
|
104
|
+
if (typeof data["mode"] === "string" && data["mode"])
|
|
105
|
+
ev.mode = data["mode"];
|
|
106
|
+
const citations = Array.isArray(data["citations"]) ? data["citations"].filter(isObject) : [];
|
|
107
|
+
if (citations.length)
|
|
108
|
+
ev.citations = citations;
|
|
109
|
+
if (typeof data["note"] === "string" && data["note"])
|
|
110
|
+
ev.note = data["note"];
|
|
111
|
+
return ev;
|
|
112
|
+
}
|
|
113
|
+
case "data-output-error": {
|
|
114
|
+
const errors = data["errors"];
|
|
115
|
+
const ev = {
|
|
116
|
+
kind: "output_error",
|
|
117
|
+
errors: Array.isArray(errors) ? errors.map(String) : typeof errors === "string" ? [errors] : [],
|
|
118
|
+
rawText: text(data["rawText"]),
|
|
119
|
+
};
|
|
120
|
+
if (typeof data["note"] === "string" && data["note"])
|
|
121
|
+
ev.note = data["note"];
|
|
122
|
+
return ev;
|
|
123
|
+
}
|
|
93
124
|
default:
|
|
94
|
-
// data-output and data-output-error are unknown until structured output lands.
|
|
95
125
|
return { kind: "unknown", chunk };
|
|
96
126
|
}
|
|
97
127
|
}
|
|
@@ -2,12 +2,13 @@ export * from "./errors.js";
|
|
|
2
2
|
export * from "./fingerprint.js";
|
|
3
3
|
export * from "./tools.js";
|
|
4
4
|
export * from "./agent.js";
|
|
5
|
-
export type { Event, ClarifyQuestion, FunctionCallRequest } from "./events.js";
|
|
5
|
+
export type { Event, ClarifyQuestion, FunctionCallRequest, OutputCitation } from "./events.js";
|
|
6
6
|
export { SettingsTransport } from "./settingsTransport.js";
|
|
7
7
|
export type { RemoteAgent, SettingsWarning, TurnStream, Transport } from "./transport.js";
|
|
8
8
|
export { deploy, undeploy, setDefaultClient } from "./deploy.js";
|
|
9
9
|
export type { Deployment } from "./deploy.js";
|
|
10
10
|
export { run, RunResult, StreamedRunResult } from "./run.js";
|
|
11
|
-
export type { RunOptions, RunStreamEvent, ClarifyHandler } from "./run.js";
|
|
11
|
+
export type { RunOptions, RunStreamEvent, ClarifyHandler, StopReason } from "./run.js";
|
|
12
|
+
export type { JsonSchemaOutputType, OutputType, ResolvedOutput, SchemaLikeOutputType } from "./output.js";
|
|
12
13
|
export { RunState } from "./runState.js";
|
|
13
14
|
export type { Interruption } from "./runState.js";
|