stitchkit 0.135.0 → 0.135.1
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/CHANGELOG.md +8 -0
- package/dist/agent-runtime/providers/openrouter-audio.d.ts +122 -0
- package/dist/agent-runtime/providers/openrouter-audio.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter-catalog-cache.d.ts.map +1 -1
- package/dist/agent-runtime/providers/openrouter-catalog.d.ts +2 -0
- package/dist/agent-runtime/providers/openrouter-catalog.d.ts.map +1 -1
- package/dist/agent-runtime/providers/openrouter-http.d.ts +100 -0
- package/dist/agent-runtime/providers/openrouter-http.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter-media.d.ts +160 -0
- package/dist/agent-runtime/providers/openrouter-media.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter-models.d.ts +1 -1
- package/dist/agent-runtime/providers/openrouter-models.d.ts.map +1 -1
- package/dist/agent-runtime/providers/openrouter-options.d.ts +2 -0
- package/dist/agent-runtime/providers/openrouter-options.d.ts.map +1 -1
- package/dist/agent-runtime/providers/openrouter-response.d.ts.map +1 -1
- package/dist/agent-runtime/providers/openrouter-retrieval.d.ts +114 -0
- package/dist/agent-runtime/providers/openrouter-retrieval.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter-spend.d.ts +5 -1
- package/dist/agent-runtime/providers/openrouter-spend.d.ts.map +1 -1
- package/dist/agent-runtime/providers/openrouter-stream.d.ts +29 -0
- package/dist/agent-runtime/providers/openrouter-stream.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter-systemone.d.ts +82 -0
- package/dist/agent-runtime/providers/openrouter-systemone.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter-url.d.ts +13 -0
- package/dist/agent-runtime/providers/openrouter-url.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter.d.ts +4 -1
- package/dist/agent-runtime/providers/openrouter.d.ts.map +1 -1
- package/dist/agent-runtime/providers/provider-http.d.ts +15 -1
- package/dist/agent-runtime/providers/provider-http.d.ts.map +1 -1
- package/dist/agent-runtime/stores/branch-observations.d.ts +42 -42
- package/dist/agent-runtime/testing/store-conformance-lifecycle.d.ts +20 -20
- package/dist/agent-runtime/testing/store-conformance-support.d.ts +10 -10
- package/dist/entrypoints/agent-runtime/anthropic.js +1 -1
- package/dist/entrypoints/agent-runtime/openai.js +1 -1
- package/dist/entrypoints/agent-runtime/openrouter.d.ts +7 -0
- package/dist/entrypoints/agent-runtime/openrouter.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/openrouter.js +1444 -241
- package/dist/{index-zfrysr1e.js → index-ht71v1ag.js} +52 -32
- package/llms/agent-runtime-openrouter.txt +11 -3
- package/llms/agent-runtime.2.txt +333 -224
- package/llms/agent-runtime.3.txt +225 -380
- package/llms/agent-runtime.4.txt +381 -158
- package/llms/agent-runtime.5.txt +157 -152
- package/llms/agent-runtime.6.txt +164 -0
- package/llms/agent-runtime.txt +30 -332
- package/llms/spend.txt +17 -1
- package/llms-full.txt +54 -4
- package/llms.txt +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type OpenRouterTransportOptions } from './openrouter-http.js';
|
|
3
|
+
import { type OpenRouterProviderRouting } from './openrouter-options.js';
|
|
4
|
+
declare const EmbeddingsResponseSchema: z.ZodObject<{
|
|
5
|
+
model: z.ZodOptional<z.ZodString>;
|
|
6
|
+
data: z.ZodArray<z.ZodObject<{
|
|
7
|
+
index: z.ZodInt;
|
|
8
|
+
embedding: z.ZodUnion<readonly [z.ZodArray<z.ZodNumber>, z.ZodString]>;
|
|
9
|
+
}, z.core.$loose>>;
|
|
10
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
11
|
+
prompt_tokens: z.ZodOptional<z.ZodInt>;
|
|
12
|
+
completion_tokens: z.ZodOptional<z.ZodInt>;
|
|
13
|
+
input_tokens: z.ZodOptional<z.ZodInt>;
|
|
14
|
+
output_tokens: z.ZodOptional<z.ZodInt>;
|
|
15
|
+
total_tokens: z.ZodOptional<z.ZodInt>;
|
|
16
|
+
cost: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
is_byok: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
}, z.core.$loose>>;
|
|
19
|
+
}, z.core.$loose>;
|
|
20
|
+
/** Parsed OpenRouter `POST /embeddings` wire response. */
|
|
21
|
+
export type OpenRouterEmbeddingsResponse = z.infer<typeof EmbeddingsResponseSchema>;
|
|
22
|
+
/** Input options for {@link openRouterEmbeddings} (`POST /embeddings`). */
|
|
23
|
+
export interface OpenRouterEmbeddingsInput extends OpenRouterTransportOptions {
|
|
24
|
+
/** Embedding model identifier (for example `'openai/text-embedding-3-small'`). */
|
|
25
|
+
readonly model: string;
|
|
26
|
+
/** Single text or non-empty array of texts to embed. */
|
|
27
|
+
readonly input: string | readonly string[];
|
|
28
|
+
/** Vector encoding format (`'float'` or `'base64'`). */
|
|
29
|
+
readonly encodingFormat?: 'float' | 'base64';
|
|
30
|
+
/** Optional output embedding dimension count (positive safe integer). */
|
|
31
|
+
readonly dimensions?: number;
|
|
32
|
+
/** Optional stable end-user identifier forwarded to OpenRouter. */
|
|
33
|
+
readonly user?: string;
|
|
34
|
+
/** Optional OpenRouter upstream provider routing preferences. */
|
|
35
|
+
readonly provider?: OpenRouterProviderRouting;
|
|
36
|
+
/** Optional additional provider-specific body fields that do not shadow owned request keys. */
|
|
37
|
+
readonly extraBody?: Readonly<Record<string, unknown>>;
|
|
38
|
+
/** Maximum JSON response size in bytes (default 16 MiB). */
|
|
39
|
+
readonly maxResponseBytes?: number;
|
|
40
|
+
}
|
|
41
|
+
/** Generated embedding vectors and OpenRouter metadata returned by {@link openRouterEmbeddings}. */
|
|
42
|
+
export interface OpenRouterEmbeddingsResult {
|
|
43
|
+
readonly model?: string;
|
|
44
|
+
readonly data: OpenRouterEmbeddingsResponse['data'];
|
|
45
|
+
readonly usage?: OpenRouterEmbeddingsResponse['usage'];
|
|
46
|
+
readonly raw: OpenRouterEmbeddingsResponse;
|
|
47
|
+
readonly status: number;
|
|
48
|
+
readonly generationId?: string;
|
|
49
|
+
readonly requestId?: string;
|
|
50
|
+
readonly costUsd?: number;
|
|
51
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
52
|
+
}
|
|
53
|
+
/** Generate vector embeddings through OpenRouter's `POST /embeddings` endpoint. */
|
|
54
|
+
export declare function openRouterEmbeddings(input: OpenRouterEmbeddingsInput): Promise<OpenRouterEmbeddingsResult>;
|
|
55
|
+
declare const RerankResponseSchema: z.ZodObject<{
|
|
56
|
+
results: z.ZodArray<z.ZodObject<{
|
|
57
|
+
index: z.ZodInt;
|
|
58
|
+
relevance_score: z.ZodNumber;
|
|
59
|
+
document: z.ZodOptional<z.ZodObject<{
|
|
60
|
+
text: z.ZodString;
|
|
61
|
+
}, z.core.$loose>>;
|
|
62
|
+
}, z.core.$loose>>;
|
|
63
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
64
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
65
|
+
prompt_tokens: z.ZodOptional<z.ZodInt>;
|
|
66
|
+
completion_tokens: z.ZodOptional<z.ZodInt>;
|
|
67
|
+
input_tokens: z.ZodOptional<z.ZodInt>;
|
|
68
|
+
output_tokens: z.ZodOptional<z.ZodInt>;
|
|
69
|
+
total_tokens: z.ZodOptional<z.ZodInt>;
|
|
70
|
+
cost: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
is_byok: z.ZodOptional<z.ZodBoolean>;
|
|
72
|
+
}, z.core.$loose>>;
|
|
73
|
+
}, z.core.$loose>;
|
|
74
|
+
/** Parsed OpenRouter `POST /rerank` wire response. */
|
|
75
|
+
export type OpenRouterRerankResponse = z.infer<typeof RerankResponseSchema>;
|
|
76
|
+
/** Input options for {@link openRouterRerank} (`POST /rerank`). */
|
|
77
|
+
export interface OpenRouterRerankInput extends OpenRouterTransportOptions {
|
|
78
|
+
/** Reranking model identifier (for example `'cohere/rerank-v3.5'`). */
|
|
79
|
+
readonly model: string;
|
|
80
|
+
/** Query string against which candidate documents are scored. */
|
|
81
|
+
readonly query: string;
|
|
82
|
+
/** Non-empty list of candidate documents to rank. */
|
|
83
|
+
readonly documents: readonly string[];
|
|
84
|
+
/** Optional maximum number of top-ranked results to return (positive safe integer). */
|
|
85
|
+
readonly topN?: number;
|
|
86
|
+
/** Optional OpenRouter upstream provider routing preferences. */
|
|
87
|
+
readonly provider?: OpenRouterProviderRouting;
|
|
88
|
+
/** Optional additional provider-specific body fields that do not shadow owned request keys. */
|
|
89
|
+
readonly extraBody?: Readonly<Record<string, unknown>>;
|
|
90
|
+
/** Maximum JSON response size in bytes (default 16 MiB). */
|
|
91
|
+
readonly maxResponseBytes?: number;
|
|
92
|
+
}
|
|
93
|
+
/** Ranked relevance results and OpenRouter metadata returned by {@link openRouterRerank}. */
|
|
94
|
+
export interface OpenRouterRerankResult {
|
|
95
|
+
readonly results: readonly {
|
|
96
|
+
readonly index: number;
|
|
97
|
+
readonly relevanceScore: number;
|
|
98
|
+
readonly document?: {
|
|
99
|
+
readonly text: string;
|
|
100
|
+
};
|
|
101
|
+
}[];
|
|
102
|
+
readonly meta?: OpenRouterRerankResponse['meta'];
|
|
103
|
+
readonly usage?: OpenRouterRerankResponse['usage'];
|
|
104
|
+
readonly raw: OpenRouterRerankResponse;
|
|
105
|
+
readonly status: number;
|
|
106
|
+
readonly generationId?: string;
|
|
107
|
+
readonly requestId?: string;
|
|
108
|
+
readonly costUsd?: number;
|
|
109
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
110
|
+
}
|
|
111
|
+
/** Rerank candidate documents against a query through OpenRouter's `POST /rerank` endpoint. */
|
|
112
|
+
export declare function openRouterRerank(input: OpenRouterRerankInput): Promise<OpenRouterRerankResult>;
|
|
113
|
+
export {};
|
|
114
|
+
//# sourceMappingURL=openrouter-retrieval.d.ts.map
|
|
@@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gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC;AAED,6FAA6F;AAC7F,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,SAAS;QACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;QAChC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC;KAC/C,EAAE,CAAC;IACJ,QAAQ,CAAC,IAAI,CAAC,EAAE,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACjD,QAAQ,CAAC,KAAK,CAAC,EAAE,wBAAwB,CAAC,OAAO,CAAC,CAAC;IACnD,QAAQ,CAAC,GAAG,EAAE,wBAAwB,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACpD;AAED,+FAA+F;AAC/F,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAAC,sBAAsB,CAAC,CA8CjC"}
|
|
@@ -2,10 +2,12 @@ import type { SpendProvider } from '../../spend/gateway.js';
|
|
|
2
2
|
import type { SpendReconciler } from '../../spend/reconcile.js';
|
|
3
3
|
import type { SpendRecord } from '../../spend/schemas.js';
|
|
4
4
|
import { type OpenRouterCatalogFetch } from './openrouter-models.js';
|
|
5
|
-
/** OpenRouter as a `stitchkit/spend` gateway provider: its origin, its key,
|
|
5
|
+
/** OpenRouter as a `stitchkit/spend` gateway provider: its origin, its key, and chat + non-chat usage facts. */
|
|
6
6
|
export declare function openRouterSpendProvider(options: {
|
|
7
7
|
/** Read per call, so a rotated key needs no restart. */
|
|
8
8
|
apiKey: () => string | Promise<string>;
|
|
9
|
+
/** Optional OpenRouter API root override (defaults to `OPENROUTER_API_BASE_URL`); its origin is trusted. */
|
|
10
|
+
baseUrl?: string;
|
|
9
11
|
}): SpendProvider;
|
|
10
12
|
/**
|
|
11
13
|
* Ask OpenRouter what an attempt cost (`GET /api/v1/generation?id=`), by the
|
|
@@ -18,6 +20,8 @@ export declare function createOpenRouterSpendReconciler(options: {
|
|
|
18
20
|
* function when keys differ per space or per caller.
|
|
19
21
|
*/
|
|
20
22
|
apiKey: string | ((record: SpendRecord) => string | Promise<string>);
|
|
23
|
+
/** Optional OpenRouter API root override (defaults to `OPENROUTER_API_BASE_URL`). */
|
|
24
|
+
baseUrl?: string;
|
|
21
25
|
fetcher?: OpenRouterCatalogFetch;
|
|
22
26
|
timeoutMs?: number;
|
|
23
27
|
}): SpendReconciler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openrouter-spend.d.ts","sourceRoot":"","sources":["../../../src/agent-runtime/providers/openrouter-spend.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"openrouter-spend.d.ts","sourceRoot":"","sources":["../../../src/agent-runtime/providers/openrouter-spend.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAEL,KAAK,sBAAsB,EAI5B,MAAM,qBAAqB,CAAC;AAqD7B,gHAAgH;AAChH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE;IAC/C,wDAAwD;IACxD,MAAM,EAAE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvC,4GAA4G;IAC5G,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,aAAa,CAQhB;AAeD;;;;GAIG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,EAAE;IACvD;;;OAGG;IACH,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IACrE,qFAAqF;IACrF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,eAAe,CAoClB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type OpenRouterHttpMethod, type OpenRouterTransportOptions } from './openrouter-http.js';
|
|
2
|
+
import type { OpenRouterQueryParams } from './openrouter-url.js';
|
|
3
|
+
/** Input options for {@link openRouterRequestStream}. */
|
|
4
|
+
export interface OpenRouterRequestStreamOptions extends OpenRouterTransportOptions {
|
|
5
|
+
/** Relative OpenRouter API v1 path such as `'/audio/speech'` or `'/videos/{id}/content'`. */
|
|
6
|
+
readonly path: string;
|
|
7
|
+
/** HTTP method (defaults to `'POST'` when `body` is supplied, otherwise `'GET'`). */
|
|
8
|
+
readonly method?: OpenRouterHttpMethod;
|
|
9
|
+
/** Optional query string parameters merged onto the resolved URL. */
|
|
10
|
+
readonly query?: OpenRouterQueryParams;
|
|
11
|
+
/** JSON-serializable body or `FormData` multipart payload. */
|
|
12
|
+
readonly body?: unknown;
|
|
13
|
+
}
|
|
14
|
+
/** Streaming response and OpenRouter metadata returned by {@link openRouterRequestStream}. */
|
|
15
|
+
export interface OpenRouterStreamResponse {
|
|
16
|
+
readonly body: ReadableStream<Uint8Array>;
|
|
17
|
+
readonly contentType: string;
|
|
18
|
+
readonly status: number;
|
|
19
|
+
readonly generationId?: string;
|
|
20
|
+
readonly requestId?: string;
|
|
21
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Issue a streaming request to any OpenRouter API v1 endpoint (such as `/audio/speech` or `/videos/{id}/content`).
|
|
25
|
+
* `timeoutMs` bounds opening the response headers and reading any non-2xx error body, and is disarmed once the
|
|
26
|
+
* 2xx stream opens; caller `signal` continues to cancel the stream until completion or cancel.
|
|
27
|
+
*/
|
|
28
|
+
export declare function openRouterRequestStream(input: OpenRouterRequestStreamOptions): Promise<OpenRouterStreamResponse>;
|
|
29
|
+
//# sourceMappingURL=openrouter-stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openrouter-stream.d.ts","sourceRoot":"","sources":["../../../src/agent-runtime/providers/openrouter-stream.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAGhC,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAQ9D,yDAAyD;AACzD,MAAM,WAAW,8BAA+B,SAAQ,0BAA0B;IAChF,6FAA6F;IAC7F,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qFAAqF;IACrF,QAAQ,CAAC,MAAM,CAAC,EAAE,oBAAoB,CAAC;IACvC,qEAAqE;IACrE,QAAQ,CAAC,KAAK,CAAC,EAAE,qBAAqB,CAAC;IACvC,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,8FAA8F;AAC9F,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAC1C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACpD;AA2DD;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,wBAAwB,CAAC,CAoFnC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type OpenRouterTransportOptions } from './openrouter-http.js';
|
|
3
|
+
import { type OpenRouterProviderRouting } from './openrouter-options.js';
|
|
4
|
+
declare const SystemOneQuestionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
5
|
+
type: z.ZodLiteral<"noul">;
|
|
6
|
+
instructions: z.ZodString;
|
|
7
|
+
criteria: z.ZodOptional<z.ZodObject<{
|
|
8
|
+
true: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
9
|
+
false: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
10
|
+
}, z.core.$loose>>;
|
|
11
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
12
|
+
type: z.ZodLiteral<"choice">;
|
|
13
|
+
instructions: z.ZodString;
|
|
14
|
+
criteria: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>;
|
|
15
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
16
|
+
type: z.ZodLiteral<"score">;
|
|
17
|
+
instructions: z.ZodString;
|
|
18
|
+
criteria: z.ZodArray<z.ZodString>;
|
|
19
|
+
}, z.core.$strict>], "type">;
|
|
20
|
+
/** Structured question definition for OpenRouter's `POST /systemone` decision endpoint (`noul`, `choice`, or `score`). */
|
|
21
|
+
export type OpenRouterSystemOneQuestion = z.infer<typeof SystemOneQuestionSchema>;
|
|
22
|
+
/** Zod schema validating OpenRouter's `POST /systemone` wire response envelope. */
|
|
23
|
+
export declare const OpenRouterSystemOneResponseSchema: z.ZodObject<{
|
|
24
|
+
id: z.ZodOptional<z.ZodString>;
|
|
25
|
+
model: z.ZodOptional<z.ZodString>;
|
|
26
|
+
answers: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
27
|
+
type: z.ZodLiteral<"noul">;
|
|
28
|
+
noul: z.ZodNumber;
|
|
29
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
30
|
+
type: z.ZodLiteral<"choice">;
|
|
31
|
+
choice: z.ZodString;
|
|
32
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
probabilities: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
34
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
35
|
+
type: z.ZodLiteral<"score">;
|
|
36
|
+
score: z.ZodNumber;
|
|
37
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
legend: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodString>]>>;
|
|
39
|
+
probabilities: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
40
|
+
}, z.core.$loose>], "type">>;
|
|
41
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
42
|
+
input_tokens: z.ZodOptional<z.ZodInt>;
|
|
43
|
+
output_tokens: z.ZodOptional<z.ZodInt>;
|
|
44
|
+
prompt_tokens: z.ZodOptional<z.ZodInt>;
|
|
45
|
+
completion_tokens: z.ZodOptional<z.ZodInt>;
|
|
46
|
+
total_tokens: z.ZodOptional<z.ZodInt>;
|
|
47
|
+
cost: z.ZodOptional<z.ZodNumber>;
|
|
48
|
+
}, z.core.$loose>>;
|
|
49
|
+
}, z.core.$loose>;
|
|
50
|
+
/** Parsed OpenRouter `POST /systemone` wire response inferred from `OpenRouterSystemOneResponseSchema`. */
|
|
51
|
+
export type OpenRouterSystemOneResponse = z.infer<typeof OpenRouterSystemOneResponseSchema>;
|
|
52
|
+
/** Input options for {@link openRouterSystemOne} (`POST /systemone`). */
|
|
53
|
+
export interface OpenRouterSystemOneInput extends OpenRouterTransportOptions {
|
|
54
|
+
/** Decision model identifier (for example `'typesafe/jev-1.13'`). */
|
|
55
|
+
readonly model: string;
|
|
56
|
+
/** Application state evaluated by the decision model (plain text or structured JSON object). */
|
|
57
|
+
readonly state: string | Readonly<Record<string, unknown>>;
|
|
58
|
+
/** Named map of typed decision questions (`noul`, `choice`, or `score`); must contain at least one question. */
|
|
59
|
+
readonly questions: Readonly<Record<string, OpenRouterSystemOneQuestion>>;
|
|
60
|
+
/** Optional OpenRouter upstream provider routing preferences. */
|
|
61
|
+
readonly provider?: OpenRouterProviderRouting;
|
|
62
|
+
/** Optional additional provider-specific body fields that do not shadow owned request keys. */
|
|
63
|
+
readonly extraBody?: Readonly<Record<string, unknown>>;
|
|
64
|
+
/** Maximum JSON response size in bytes (default 16 MiB). */
|
|
65
|
+
readonly maxResponseBytes?: number;
|
|
66
|
+
}
|
|
67
|
+
/** Structured decision answers and OpenRouter metadata returned by {@link openRouterSystemOne}. */
|
|
68
|
+
export interface OpenRouterSystemOneResult {
|
|
69
|
+
readonly model?: string;
|
|
70
|
+
readonly answers: OpenRouterSystemOneResponse['answers'];
|
|
71
|
+
readonly usage?: OpenRouterSystemOneResponse['usage'];
|
|
72
|
+
readonly raw: OpenRouterSystemOneResponse;
|
|
73
|
+
readonly status: number;
|
|
74
|
+
readonly generationId?: string;
|
|
75
|
+
readonly requestId?: string;
|
|
76
|
+
readonly costUsd?: number;
|
|
77
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
78
|
+
}
|
|
79
|
+
/** Call OpenRouter's `POST /systemone` decision endpoint with typed questions and calibrated probability answers. */
|
|
80
|
+
export declare function openRouterSystemOne(input: OpenRouterSystemOneInput): Promise<OpenRouterSystemOneResult>;
|
|
81
|
+
export {};
|
|
82
|
+
//# sourceMappingURL=openrouter-systemone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openrouter-systemone.d.ts","sourceRoot":"","sources":["../../../src/agent-runtime/providers/openrouter-systemone.ts"],"names":[],"m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AAO,EAAE,2BAA2B,CAAC,SAAS,CAAC,CAAC;IACzD,QAAQ,CAAC,KAAK,CAAC,EAAE,2BAA2B,CAAC,OAAO,CAAC,CAAC;IACtD,QAAQ,CAAC,GAAG,EAAE,2BAA2B,CAAC;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACpD;AAQD,qHAAqH;AACrH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,wBAAwB,GAC9B,OAAO,CAAC,yBAAyB,CAAC,CAqCpC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Canonical default OpenRouter API v1 base URL. */
|
|
2
|
+
export declare const OPENROUTER_API_BASE_URL: 'https://openrouter.ai/api/v1';
|
|
3
|
+
/** Query parameter map accepted by OpenRouter URL helpers and generic requests. */
|
|
4
|
+
export type OpenRouterQueryParams = Readonly<Record<string, string | number | boolean | undefined>> | URLSearchParams;
|
|
5
|
+
/** Validate an OpenRouter API root URL (`http:`/`https:`, no embedded credentials or fragment). */
|
|
6
|
+
export declare function validateOpenRouterBaseUrl(raw?: string): URL;
|
|
7
|
+
/** Validate an HTTP(S) media or callback URL without embedded credentials. */
|
|
8
|
+
export declare function assertOpenRouterHttpUrl(name: string, value: string): string;
|
|
9
|
+
/** Validate a single path segment identifier (such as a video job id) against traversal or injection. */
|
|
10
|
+
export declare function assertOpenRouterPathSegment(name: string, value: string): string;
|
|
11
|
+
/** Resolve a validated relative OpenRouter path and optional query onto a validated `baseUrl`. */
|
|
12
|
+
export declare function resolveOpenRouterUrl(baseUrl: string | undefined, path: string, query?: OpenRouterQueryParams): URL;
|
|
13
|
+
//# sourceMappingURL=openrouter-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openrouter-url.d.ts","sourceRoot":"","sources":["../../../src/agent-runtime/providers/openrouter-url.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,eAAO,MAAM,uBAAuB,EAAG,8BAAuC,CAAC;AAa/E,mFAAmF;AACnF,MAAM,MAAM,qBAAqB,GAC7B,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC,GAC/D,eAAe,CAAC;AAEpB,mGAAmG;AACnG,wBAAgB,yBAAyB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG,CAsB3D;AAED,8EAA8E;AAC9E,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAY3E;AAED,yGAAyG;AACzG,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAgB/E;AAED,kGAAkG;AAClG,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,qBAAqB,GAC5B,GAAG,CA+CL"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { type AgentModelCatalog } from './models.js';
|
|
2
2
|
import type { AgentModelDriverFactory } from './models-driver.js';
|
|
3
|
+
import { type OpenRouterFetch } from './openrouter-http.js';
|
|
3
4
|
import { type OpenRouterCatalogFetch } from './openrouter-models.js';
|
|
4
5
|
import { type OpenRouterRequestPolicy } from './openrouter-options.js';
|
|
5
6
|
export type { OpenRouterCatalogFetch } from './openrouter-models.js';
|
|
6
7
|
export interface OpenRouterModelCatalogOptions {
|
|
7
8
|
apiKey?: string | (() => string | Promise<string>);
|
|
9
|
+
/** OpenRouter API v1 root URL override (defaults to `OPENROUTER_API_BASE_URL`). */
|
|
10
|
+
baseUrl?: string;
|
|
8
11
|
fetcher?: OpenRouterCatalogFetch;
|
|
9
12
|
timeoutMs?: number;
|
|
10
13
|
now?: () => Date;
|
|
@@ -23,7 +26,7 @@ export interface OpenRouterProviderSettings {
|
|
|
23
26
|
readonly appName?: string;
|
|
24
27
|
readonly appUrl?: string;
|
|
25
28
|
readonly providerApiKeys?: Readonly<Record<string, string>>;
|
|
26
|
-
readonly fetch?:
|
|
29
|
+
readonly fetch?: OpenRouterFetch;
|
|
27
30
|
readonly extraBody?: Readonly<Record<string, unknown>>;
|
|
28
31
|
}
|
|
29
32
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openrouter.d.ts","sourceRoot":"","sources":["../../../src/agent-runtime/providers/openrouter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAA2B,MAAM,UAAU,CAAC;AAC3E,OAAO,KAAK,EAEV,uBAAuB,EAExB,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EAGL,KAAK,sBAAsB,EAK5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAGL,KAAK,uBAAuB,EAG7B,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"openrouter.d.ts","sourceRoot":"","sources":["../../../src/agent-runtime/providers/openrouter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAA2B,MAAM,UAAU,CAAC;AAC3E,OAAO,KAAK,EAEV,uBAAuB,EAExB,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EAA8B,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAGL,KAAK,sBAAsB,EAK5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAGL,KAAK,uBAAuB,EAG7B,MAAM,sBAAsB,CAAC;AAqB9B,YAAY,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAIlE,MAAM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,uEAAuE;IACvE,aAAa,CAAC,CAAC,OAAO,EAAE,MAAM,GAAG,uBAAuB,GAAG,SAAS,CAAC;IACrE;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAwDD,oGAAoG;AACpG,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,0BAA0B,EACpC,MAAM,GAAE,wBAA6B,GACpC,uBAAuB,CAyDzB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AgentProviderFailureReason } from './provider-failure.js';
|
|
1
|
+
import { AgentProviderError, type AgentProviderFailureReason } from './provider-failure.js';
|
|
2
2
|
export declare const DEFAULT_MAX_ERROR_BODY_BYTES: number;
|
|
3
3
|
export declare const DEFAULT_MAX_JSON_BODY_BYTES: number;
|
|
4
4
|
/** Remove the pre-iteration abort guard once a stream consumer acquires the reader. */
|
|
@@ -53,6 +53,20 @@ export interface PostProviderStreamInput {
|
|
|
53
53
|
readonly maxErrorBytes?: number;
|
|
54
54
|
readonly maxJsonBytes?: number;
|
|
55
55
|
}
|
|
56
|
+
/** Read a trimmed non-empty request id from `x-request-id` or `request-id`. */
|
|
57
|
+
export declare function extractProviderRequestId(headers: Headers): string | undefined;
|
|
58
|
+
export interface BuildProviderHttpErrorInput {
|
|
59
|
+
readonly provider: string;
|
|
60
|
+
readonly response: Response;
|
|
61
|
+
readonly signal: AbortSignal;
|
|
62
|
+
readonly parseError: (payload: unknown, rawText: string, status: number) => ParsedProviderError;
|
|
63
|
+
readonly maxErrorBytes?: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Read a bounded error body prefix from a non-2xx provider response and build
|
|
67
|
+
* a redacted `AgentProviderError` with retry headers and structured metadata.
|
|
68
|
+
*/
|
|
69
|
+
export declare function buildProviderHttpError(input: BuildProviderHttpErrorInput): Promise<AgentProviderError>;
|
|
56
70
|
/**
|
|
57
71
|
* Issue one streaming POST request to a model provider with strict security and memory bounds:
|
|
58
72
|
* - `redirect: 'error'` so API keys are never forwarded across origins,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-http.d.ts","sourceRoot":"","sources":["../../../src/agent-runtime/providers/provider-http.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"provider-http.d.ts","sourceRoot":"","sources":["../../../src/agent-runtime/providers/provider-http.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,KAAK,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAEzF,eAAO,MAAM,4BAA4B,QAAY,CAAC;AACtD,eAAO,MAAM,2BAA2B,QAAmB,CAAC;AAc5D,uFAAuF;AACvF,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,IAAI,CAMnF;AAED,mFAAmF;AACnF,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAO5E;AAiBD;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,MAAM,EACX,QAAQ,SAA0B,GACjC,MAAM,CAqBR;AAED,6FAA6F;AAC7F,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,SAAa,GAAG,MAAM,GAAG,SAAS,CAiB1F;AAED,sGAAsG;AACtG,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQxE;AAED,wGAAwG;AACxG,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAgBvE;AAED,mGAAmG;AACnG,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,EACxD,SAAS,EAAE,SAAS,MAAM,EAAE,GAC3B,IAAI,CAQN;AAED,MAAM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CAAC,sBAAsB,CAAC,CA6HjC;AAED,oFAAoF;AACpF,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAEjE;AAED,mEAAmE;AACnE,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAI5F"}
|
|
@@ -9,20 +9,6 @@ export declare const SpillEventPayloadSchema: z.ZodObject<{
|
|
|
9
9
|
type Json = z.infer<ReturnType<typeof z.json>>;
|
|
10
10
|
/** Control observations are retained under an inert kind: no state/schedule/durability reader can replay them. */
|
|
11
11
|
export declare function branchObservation(ids: BranchIdentities, kind: string, raw: Json, inherited?: boolean): {
|
|
12
|
-
result: {
|
|
13
|
-
grade: "full";
|
|
14
|
-
restrictions: ("network-denied" | "process-contained" | "secrets-hidden" | "write-contained")[];
|
|
15
|
-
} | {
|
|
16
|
-
grade: "partial";
|
|
17
|
-
restrictions: ("network-denied" | "process-contained" | "secrets-hidden" | "write-contained")[];
|
|
18
|
-
gaps: ("network-denied" | "process-contained" | "secrets-hidden" | "write-contained")[];
|
|
19
|
-
} | {
|
|
20
|
-
grade: "unavailable";
|
|
21
|
-
reason: string;
|
|
22
|
-
};
|
|
23
|
-
required: ("network-denied" | "process-contained" | "secrets-hidden" | "write-contained")[];
|
|
24
|
-
missing: ("network-denied" | "process-contained" | "secrets-hidden" | "write-contained")[];
|
|
25
|
-
} | {
|
|
26
12
|
conversationId: string;
|
|
27
13
|
invocationId: string;
|
|
28
14
|
operationId: string;
|
|
@@ -54,17 +40,6 @@ export declare function branchObservation(ids: BranchIdentities, kind: string, r
|
|
|
54
40
|
models: string[];
|
|
55
41
|
payloadSha256: string;
|
|
56
42
|
};
|
|
57
|
-
} | {
|
|
58
|
-
conversationId: string;
|
|
59
|
-
invocationId: string;
|
|
60
|
-
operationId: string;
|
|
61
|
-
runId?: string | undefined;
|
|
62
|
-
type: "invocation/finished";
|
|
63
|
-
failure?: {
|
|
64
|
-
artifactId: string;
|
|
65
|
-
payloadSha256: string;
|
|
66
|
-
} | undefined;
|
|
67
|
-
status: "cancelled" | "failed" | "succeeded";
|
|
68
43
|
} | {
|
|
69
44
|
conversationId: string;
|
|
70
45
|
invocationId: string;
|
|
@@ -135,22 +110,33 @@ export declare function branchObservation(ids: BranchIdentities, kind: string, r
|
|
|
135
110
|
payloadOmitted?: "max-payload-bytes" | undefined;
|
|
136
111
|
payloadSha256: string;
|
|
137
112
|
} | {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
runId
|
|
142
|
-
|
|
113
|
+
conversationId: string;
|
|
114
|
+
invocationId: string;
|
|
115
|
+
operationId: string;
|
|
116
|
+
runId?: string | undefined;
|
|
117
|
+
type: "invocation/finished";
|
|
118
|
+
failure?: {
|
|
119
|
+
artifactId: string;
|
|
120
|
+
payloadSha256: string;
|
|
121
|
+
} | undefined;
|
|
122
|
+
status: "cancelled" | "failed" | "succeeded";
|
|
143
123
|
} | {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
124
|
+
result: {
|
|
125
|
+
grade: "full";
|
|
126
|
+
restrictions: ("network-denied" | "process-contained" | "secrets-hidden" | "write-contained")[];
|
|
127
|
+
} | {
|
|
128
|
+
grade: "partial";
|
|
129
|
+
restrictions: ("network-denied" | "process-contained" | "secrets-hidden" | "write-contained")[];
|
|
130
|
+
gaps: ("network-denied" | "process-contained" | "secrets-hidden" | "write-contained")[];
|
|
131
|
+
} | {
|
|
132
|
+
grade: "unavailable";
|
|
133
|
+
reason: string;
|
|
134
|
+
};
|
|
135
|
+
required: ("network-denied" | "process-contained" | "secrets-hidden" | "write-contained")[];
|
|
136
|
+
missing: ("network-denied" | "process-contained" | "secrets-hidden" | "write-contained")[];
|
|
150
137
|
} | {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
encoded?: string | undefined;
|
|
138
|
+
stepName: string;
|
|
139
|
+
encoded: string;
|
|
154
140
|
runId: string;
|
|
155
141
|
id?: string | undefined;
|
|
156
142
|
} | {
|
|
@@ -167,15 +153,29 @@ export declare function branchObservation(ids: BranchIdentities, kind: string, r
|
|
|
167
153
|
encoded?: string | undefined;
|
|
168
154
|
runId: string;
|
|
169
155
|
} | {
|
|
170
|
-
|
|
156
|
+
event: string;
|
|
157
|
+
id: string;
|
|
171
158
|
encoded: string;
|
|
172
159
|
runId: string;
|
|
160
|
+
} | {
|
|
161
|
+
effectName: string;
|
|
162
|
+
phase: "intent";
|
|
163
|
+
encoded?: string | undefined;
|
|
164
|
+
runId: string;
|
|
173
165
|
id?: string | undefined;
|
|
174
166
|
} | {
|
|
175
|
-
|
|
176
|
-
|
|
167
|
+
effectName: string;
|
|
168
|
+
phase: "accepted";
|
|
177
169
|
encoded: string;
|
|
170
|
+
via: "reconcile" | "run";
|
|
171
|
+
runId: string;
|
|
172
|
+
id?: string | undefined;
|
|
173
|
+
} | {
|
|
174
|
+
effectName: string;
|
|
175
|
+
phase: "uncertain";
|
|
176
|
+
encoded?: string | undefined;
|
|
178
177
|
runId: string;
|
|
178
|
+
id?: string | undefined;
|
|
179
179
|
} | {
|
|
180
180
|
bytes: number;
|
|
181
181
|
sha256?: string | undefined;
|
|
@@ -131,6 +131,11 @@ export declare function fencingPhase(store: AgentRuntimeStore, conversationId: s
|
|
|
131
131
|
role: "assistant" | "summary" | "system" | "tool" | "user";
|
|
132
132
|
status: "committed" | "completed" | "failed" | "interrupted" | "streaming" | "superseded";
|
|
133
133
|
parts: ({
|
|
134
|
+
type: "source";
|
|
135
|
+
sourceId: string;
|
|
136
|
+
url?: string | undefined;
|
|
137
|
+
title?: string | undefined;
|
|
138
|
+
} | {
|
|
134
139
|
type: "text";
|
|
135
140
|
text: string;
|
|
136
141
|
provider?: {
|
|
@@ -146,6 +151,11 @@ export declare function fencingPhase(store: AgentRuntimeStore, conversationId: s
|
|
|
146
151
|
provider: string;
|
|
147
152
|
data: Record<string, import("zod").JSONType>;
|
|
148
153
|
} | undefined;
|
|
154
|
+
} | {
|
|
155
|
+
type: "file";
|
|
156
|
+
mediaType: string;
|
|
157
|
+
reference: string;
|
|
158
|
+
filename?: string | undefined;
|
|
149
159
|
} | {
|
|
150
160
|
type: "tool-call";
|
|
151
161
|
callId: string;
|
|
@@ -167,16 +177,6 @@ export declare function fencingPhase(store: AgentRuntimeStore, conversationId: s
|
|
|
167
177
|
provider: string;
|
|
168
178
|
data: Record<string, import("zod").JSONType>;
|
|
169
179
|
} | undefined;
|
|
170
|
-
} | {
|
|
171
|
-
type: "file";
|
|
172
|
-
mediaType: string;
|
|
173
|
-
reference: string;
|
|
174
|
-
filename?: string | undefined;
|
|
175
|
-
} | {
|
|
176
|
-
type: "source";
|
|
177
|
-
sourceId: string;
|
|
178
|
-
url?: string | undefined;
|
|
179
|
-
title?: string | undefined;
|
|
180
180
|
} | {
|
|
181
181
|
type: "tool-approval-request";
|
|
182
182
|
approvalId: string;
|
|
@@ -321,6 +321,11 @@ export declare function fencingPhase(store: AgentRuntimeStore, conversationId: s
|
|
|
321
321
|
role: "assistant" | "summary" | "system" | "tool" | "user";
|
|
322
322
|
status: "committed" | "completed" | "failed" | "interrupted" | "streaming" | "superseded";
|
|
323
323
|
parts: ({
|
|
324
|
+
type: "source";
|
|
325
|
+
sourceId: string;
|
|
326
|
+
url?: string | undefined;
|
|
327
|
+
title?: string | undefined;
|
|
328
|
+
} | {
|
|
324
329
|
type: "text";
|
|
325
330
|
text: string;
|
|
326
331
|
provider?: {
|
|
@@ -336,6 +341,11 @@ export declare function fencingPhase(store: AgentRuntimeStore, conversationId: s
|
|
|
336
341
|
provider: string;
|
|
337
342
|
data: Record<string, import("zod").JSONType>;
|
|
338
343
|
} | undefined;
|
|
344
|
+
} | {
|
|
345
|
+
type: "file";
|
|
346
|
+
mediaType: string;
|
|
347
|
+
reference: string;
|
|
348
|
+
filename?: string | undefined;
|
|
339
349
|
} | {
|
|
340
350
|
type: "tool-call";
|
|
341
351
|
callId: string;
|
|
@@ -357,16 +367,6 @@ export declare function fencingPhase(store: AgentRuntimeStore, conversationId: s
|
|
|
357
367
|
provider: string;
|
|
358
368
|
data: Record<string, import("zod").JSONType>;
|
|
359
369
|
} | undefined;
|
|
360
|
-
} | {
|
|
361
|
-
type: "file";
|
|
362
|
-
mediaType: string;
|
|
363
|
-
reference: string;
|
|
364
|
-
filename?: string | undefined;
|
|
365
|
-
} | {
|
|
366
|
-
type: "source";
|
|
367
|
-
sourceId: string;
|
|
368
|
-
url?: string | undefined;
|
|
369
|
-
title?: string | undefined;
|
|
370
370
|
} | {
|
|
371
371
|
type: "tool-approval-request";
|
|
372
372
|
approvalId: string;
|
|
@@ -6,6 +6,11 @@ export declare function userMessage(conversationId: string, id: string): {
|
|
|
6
6
|
role: "assistant" | "summary" | "system" | "tool" | "user";
|
|
7
7
|
status: "committed" | "completed" | "failed" | "interrupted" | "streaming" | "superseded";
|
|
8
8
|
parts: ({
|
|
9
|
+
type: "source";
|
|
10
|
+
sourceId: string;
|
|
11
|
+
url?: string | undefined;
|
|
12
|
+
title?: string | undefined;
|
|
13
|
+
} | {
|
|
9
14
|
type: "text";
|
|
10
15
|
text: string;
|
|
11
16
|
provider?: {
|
|
@@ -21,6 +26,11 @@ export declare function userMessage(conversationId: string, id: string): {
|
|
|
21
26
|
provider: string;
|
|
22
27
|
data: Record<string, import("zod").JSONType>;
|
|
23
28
|
} | undefined;
|
|
29
|
+
} | {
|
|
30
|
+
type: "file";
|
|
31
|
+
mediaType: string;
|
|
32
|
+
reference: string;
|
|
33
|
+
filename?: string | undefined;
|
|
24
34
|
} | {
|
|
25
35
|
type: "tool-call";
|
|
26
36
|
callId: string;
|
|
@@ -42,16 +52,6 @@ export declare function userMessage(conversationId: string, id: string): {
|
|
|
42
52
|
provider: string;
|
|
43
53
|
data: Record<string, import("zod").JSONType>;
|
|
44
54
|
} | undefined;
|
|
45
|
-
} | {
|
|
46
|
-
type: "file";
|
|
47
|
-
mediaType: string;
|
|
48
|
-
reference: string;
|
|
49
|
-
filename?: string | undefined;
|
|
50
|
-
} | {
|
|
51
|
-
type: "source";
|
|
52
|
-
sourceId: string;
|
|
53
|
-
url?: string | undefined;
|
|
54
|
-
title?: string | undefined;
|
|
55
55
|
} | {
|
|
56
56
|
type: "tool-approval-request";
|
|
57
57
|
approvalId: string;
|