akanjs 3.3.0-rc.72 → 3.3.0-rc.73
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/constant/index.ts +1 -0
- package/constant/types.ts +10 -9
- package/dictionary/agent.dictionary.ts +4 -0
- package/fetch/client/fetchClient.ts +1 -1
- package/fetch/client/signalCatalog.ts +9 -4
- package/package.json +1 -1
- package/server/routing/apiRouter.ts +12 -1
- package/service/agent.service.ts +1 -0
- package/service/agentLoop/agentLoop.ts +3 -0
- package/service/predefinedAdaptor/anthropicLlm.ts +168 -35
- package/service/predefinedAdaptor/llm.adaptor.ts +12 -0
- package/service/predefinedAdaptor/llmOverflow.ts +12 -0
- package/signal/endpointInfo.ts +2 -1
- package/signal/internalInfo.ts +2 -2
- package/types/constant/index.d.ts +1 -1
- package/types/constant/types.d.ts +6 -5
- package/types/dictionary/agent.dictionary.d.ts +1 -1
- package/types/dictionary/dictionary.d.ts +4 -4
- package/types/fetch/client/signalCatalog.d.ts +2 -1
- package/types/service/agent.service.d.ts +1 -0
- package/types/service/agentLoop/agentLoop.d.ts +2 -1
- package/types/service/predefinedAdaptor/anthropicLlm.d.ts +44 -11
- package/types/service/predefinedAdaptor/llm.adaptor.d.ts +11 -0
- package/types/service/predefinedAdaptor/llmOverflow.d.ts +5 -0
- package/types/signal/agent.signal.d.ts +1 -0
- package/types/signal/endpointInfo.d.ts +2 -2
- package/types/signal/internalInfo.d.ts +2 -2
package/constant/index.ts
CHANGED
package/constant/types.ts
CHANGED
|
@@ -4,30 +4,31 @@ export type QueryOf<_T = any> = any;
|
|
|
4
4
|
|
|
5
5
|
export type ConstantType = "input" | "object" | "full" | "light" | "insight" | "scalar";
|
|
6
6
|
|
|
7
|
-
type ObjectToId<O> = O extends BaseObject
|
|
7
|
+
type ObjectToId<O, Unset> = O extends BaseObject
|
|
8
8
|
? string
|
|
9
9
|
: O extends BaseObject[]
|
|
10
10
|
? string[]
|
|
11
11
|
: O extends Dayjs
|
|
12
12
|
? Dayjs
|
|
13
13
|
: O extends object
|
|
14
|
-
? DocumentModel<O>
|
|
14
|
+
? DocumentModel<O, Unset>
|
|
15
15
|
: O;
|
|
16
16
|
|
|
17
|
-
type Docify<T, _StateKeys extends keyof GetStateObject<T> = keyof GetStateObject<T>> = unknown extends T
|
|
17
|
+
type Docify<T, Unset, _StateKeys extends keyof GetStateObject<T> = keyof GetStateObject<T>> = unknown extends T
|
|
18
18
|
? T
|
|
19
|
-
: { [K in _StateKeys as null extends T[K] ? never : K]-?: ObjectToId<NonNullable<T[K]
|
|
20
|
-
[K in _StateKeys as null extends T[K] ? K : never]?: ObjectToId<NonNullable<T[K]
|
|
19
|
+
: { [K in _StateKeys as null extends T[K] ? never : K]-?: ObjectToId<NonNullable<T[K]>, Unset> } & {
|
|
20
|
+
[K in _StateKeys as null extends T[K] ? K : never]?: ObjectToId<NonNullable<T[K]>, Unset> | Unset | undefined;
|
|
21
21
|
};
|
|
22
|
-
export type DocumentModel<T> = unknown extends T
|
|
22
|
+
export type DocumentModel<T, Unset = undefined> = unknown extends T
|
|
23
23
|
? T
|
|
24
24
|
: T extends (infer S)[]
|
|
25
|
-
? DocumentModel<S>[]
|
|
25
|
+
? DocumentModel<S, Unset>[]
|
|
26
26
|
: T extends string | number | boolean | Dayjs | File | Uint8Array
|
|
27
27
|
? T
|
|
28
28
|
: T extends Map<infer K, infer V>
|
|
29
|
-
? Map<K, DocumentModel<V>>
|
|
30
|
-
: Docify<T>;
|
|
29
|
+
? Map<K, DocumentModel<V, Unset>>
|
|
30
|
+
: Docify<T, Unset>;
|
|
31
|
+
export type ServerReturnModel<T> = DocumentModel<T, null>;
|
|
31
32
|
|
|
32
33
|
export type ServerArgModel<T> = unknown extends T
|
|
33
34
|
? T
|
|
@@ -29,6 +29,10 @@ export const agentDictionary = serviceDictionary(["en", "ko"])
|
|
|
29
29
|
"{provider} refused this turn with status {status}",
|
|
30
30
|
"{provider}가 이번 턴을 거절했습니다 (status {status})",
|
|
31
31
|
],
|
|
32
|
+
llmDeclined: [
|
|
33
|
+
"The model at {provider} declined to answer this turn",
|
|
34
|
+
"{provider}의 모델이 이번 턴에 답하지 않겠다고 했습니다",
|
|
35
|
+
],
|
|
32
36
|
|
|
33
37
|
contextOverflow: [
|
|
34
38
|
"This conversation no longer fits the model's context window at {provider}. Use /compact to summarize it, or /new to start over",
|
|
@@ -368,7 +368,7 @@ export class FetchClient {
|
|
|
368
368
|
}
|
|
369
369
|
#makeHttpFn(key: string, endpoint: SerializedEndpoint, prefix?: string) {
|
|
370
370
|
const argLength = endpoint.args.length;
|
|
371
|
-
const serializerMap = makeArgSerializer(endpoint.args);
|
|
371
|
+
const serializerMap = makeArgSerializer(endpoint.args, this.ErrorCls);
|
|
372
372
|
const parseReturn = refusingUndeclaredNull(key, endpoint, makeReturnParser(endpoint.returns));
|
|
373
373
|
const { bodyArgs, uploadArgs } = FetchClient.classifyHttpArgs(endpoint.args);
|
|
374
374
|
const requestOf = (argData: unknown[]) => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PrimitiveRegistry } from "akanjs/base";
|
|
2
2
|
import { ConstantRegistry, deserialize, serialize } from "akanjs/constant";
|
|
3
3
|
import type { SerializedArg, SerializedEndpoint, SerializedReturns, SerializedSignal } from "akanjs/signal";
|
|
4
|
+
import { type ErrorConstructor, restoreRemoteError } from "./remoteError";
|
|
4
5
|
|
|
5
6
|
interface SharedSignalRegistry {
|
|
6
7
|
signal: { [key: string]: SerializedSignal };
|
|
@@ -83,7 +84,7 @@ export const helpersOf = (signal: SerializedSignal) => {
|
|
|
83
84
|
const write = update || !!mountedGuards(signal, "create") || !!mountedGuards(signal, "remove");
|
|
84
85
|
return { view: get, edit: get && write, merge: update };
|
|
85
86
|
};
|
|
86
|
-
export const makeArgSerializer = (args: SerializedArg[]) => {
|
|
87
|
+
export const makeArgSerializer = (args: SerializedArg[], ErrorCls?: ErrorConstructor) => {
|
|
87
88
|
const serializerMap = new Map(
|
|
88
89
|
args.map((arg) => {
|
|
89
90
|
const argRef = arg.modelType
|
|
@@ -91,10 +92,14 @@ export const makeArgSerializer = (args: SerializedArg[]) => {
|
|
|
91
92
|
: PrimitiveRegistry.get(arg.refName);
|
|
92
93
|
return [
|
|
93
94
|
arg.name,
|
|
94
|
-
(value: unknown) =>
|
|
95
|
-
|
|
95
|
+
(value: unknown) => {
|
|
96
|
+
|
|
97
|
+
if (arg.type === "param" && (value ?? "") === "")
|
|
98
|
+
throw restoreRemoteError({ error: "base.error.requiredArgument", data: { name: arg.name } }, 400, ErrorCls);
|
|
99
|
+
return serialize(argRef, arg.arrDepth ?? 0, value, "input", {
|
|
96
100
|
nullable: arg.nullable ?? arg.type === "search",
|
|
97
|
-
})
|
|
101
|
+
});
|
|
102
|
+
},
|
|
98
103
|
] as const;
|
|
99
104
|
}),
|
|
100
105
|
);
|
package/package.json
CHANGED
|
@@ -117,7 +117,7 @@ export class ApiRouter {
|
|
|
117
117
|
},
|
|
118
118
|
...Object.fromEntries(endpointEntries),
|
|
119
119
|
...Object.fromEntries(builtinEntries),
|
|
120
|
-
...(renderEnvRoutes ?? {}),
|
|
120
|
+
...ApiRouter.#refuseUnknownApiPaths(renderEnvRoutes ?? {}, prefix),
|
|
121
121
|
} as NonNullHttpRoutes;
|
|
122
122
|
const proxied = webProxyRunner
|
|
123
123
|
? ApiRouter.#wrapRoutesWithWebProxy(routeTable, webProxyRunner, prefix, endpointPaths)
|
|
@@ -436,6 +436,17 @@ export class ApiRouter {
|
|
|
436
436
|
return path === normalized || path.startsWith(`${normalized}/`);
|
|
437
437
|
}
|
|
438
438
|
|
|
439
|
+
static #refuseUnknownApiPaths(routes: NonNullHttpRoutes, apiPrefix: string): NonNullHttpRoutes {
|
|
440
|
+
const catchAll = routes["/*"];
|
|
441
|
+
if (!catchAll || !apiPrefix.replace(/\/$/, "")) return routes;
|
|
442
|
+
const refused = ApiRouter.#mapRoute(catchAll, (handler) => (req) => {
|
|
443
|
+
const { pathname } = new URL(req.url);
|
|
444
|
+
if (!ApiRouter.#isApiRoute(pathname, apiPrefix)) return handler(req);
|
|
445
|
+
return SignalFailure.response(new AkanError("routeNotFound", `No endpoint at ${pathname}`, { statusCode: 404 }));
|
|
446
|
+
});
|
|
447
|
+
return { ...routes, "/*": refused } as NonNullHttpRoutes;
|
|
448
|
+
}
|
|
449
|
+
|
|
439
450
|
static #isInternalRenderRoute(path: string): boolean {
|
|
440
451
|
return path === "/__csr" || path === "/__rsc" || path.startsWith("/__rsc/") || path.startsWith("/_akan/");
|
|
441
452
|
}
|
package/service/agent.service.ts
CHANGED
|
@@ -51,6 +51,7 @@ export class AgentService extends serve("agent" as const, ({ plug }) => ({
|
|
|
51
51
|
stop: answer.stop,
|
|
52
52
|
...(answer.usage ? { usage: answer.usage } : {}),
|
|
53
53
|
...(answer.model ? { model: answer.model } : {}),
|
|
54
|
+
...(answer.providerContent ? { providerContent: answer.providerContent } : {}),
|
|
54
55
|
...(this.llm.limits ? { limits: this.llm.limits } : {}),
|
|
55
56
|
};
|
|
56
57
|
}
|
|
@@ -7,6 +7,7 @@ import { AgentRelayPolicy, type AgentTurnContext } from "../agentRelayPolicy";
|
|
|
7
7
|
import type { AgentTool, AgentToolsAdaptor } from "../predefinedAdaptor/agentTools.adaptor";
|
|
8
8
|
import type {
|
|
9
9
|
AgentWireMessage,
|
|
10
|
+
AgentWireProviderContent,
|
|
10
11
|
AgentWireToolCall,
|
|
11
12
|
AgentWireToolResult,
|
|
12
13
|
LlmTurnRequest,
|
|
@@ -37,6 +38,7 @@ export interface AgentLoopAnswer {
|
|
|
37
38
|
stop: "end" | "toolUse" | "length";
|
|
38
39
|
usage?: LlmUsage;
|
|
39
40
|
model?: string;
|
|
41
|
+
providerContent?: AgentWireProviderContent;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
export interface AgentLoopPort {
|
|
@@ -160,6 +162,7 @@ export class AgentLoop {
|
|
|
160
162
|
role: "assistant",
|
|
161
163
|
...(answer.text ? { text: answer.text } : {}),
|
|
162
164
|
...(answer.toolCalls.length ? { toolCalls: answer.toolCalls } : {}),
|
|
165
|
+
...(answer.providerContent ? { providerContent: answer.providerContent } : {}),
|
|
163
166
|
...mark,
|
|
164
167
|
};
|
|
165
168
|
if (LoopTranscript.carries(message)) await this.#append(message);
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
type AgentWireAttachment,
|
|
5
5
|
type AgentWireContext,
|
|
6
6
|
type AgentWireMessage,
|
|
7
|
+
type AgentWireProviderContent,
|
|
7
8
|
type AgentWireTool,
|
|
8
9
|
type AgentWireToolResult,
|
|
9
10
|
type LlmAccepts,
|
|
@@ -26,8 +27,12 @@ type AnthropicContentBlock =
|
|
|
26
27
|
| { type: "text"; text: string }
|
|
27
28
|
| { type: "image"; source: AnthropicSource }
|
|
28
29
|
| { type: "document"; source: AnthropicSource };
|
|
30
|
+
type AnthropicThinkingBlock =
|
|
31
|
+
| { type: "thinking"; thinking: string; signature: string }
|
|
32
|
+
| { type: "redacted_thinking"; data: string };
|
|
29
33
|
type AnthropicBlock =
|
|
30
34
|
| AnthropicContentBlock
|
|
35
|
+
| AnthropicThinkingBlock
|
|
31
36
|
| { type: "tool_use"; id: string; name: string; input: Record<string, unknown> }
|
|
32
37
|
| { type: "tool_result"; tool_use_id: string; content: string | AnthropicContentBlock[] };
|
|
33
38
|
interface AnthropicMessage {
|
|
@@ -40,19 +45,43 @@ interface AnthropicUsage {
|
|
|
40
45
|
cache_read_input_tokens?: number | null;
|
|
41
46
|
cache_creation_input_tokens?: number | null;
|
|
42
47
|
}
|
|
48
|
+
interface AnthropicAnswerBlock {
|
|
49
|
+
type?: string;
|
|
50
|
+
text?: string;
|
|
51
|
+
id?: string;
|
|
52
|
+
name?: string;
|
|
53
|
+
input?: Record<string, unknown>;
|
|
54
|
+
thinking?: string;
|
|
55
|
+
signature?: string;
|
|
56
|
+
data?: string;
|
|
57
|
+
}
|
|
58
|
+
interface AnthropicStopDetails {
|
|
59
|
+
category?: unknown;
|
|
60
|
+
explanation?: unknown;
|
|
61
|
+
}
|
|
43
62
|
interface AnthropicAnswer {
|
|
44
|
-
content?:
|
|
63
|
+
content?: AnthropicAnswerBlock[];
|
|
45
64
|
stop_reason?: string;
|
|
65
|
+
stop_details?: AnthropicStopDetails | null;
|
|
46
66
|
usage?: AnthropicUsage;
|
|
47
67
|
}
|
|
68
|
+
type AnthropicThinkingReplay = "drop" | "strip";
|
|
48
69
|
interface AnthropicStreamEvent {
|
|
49
70
|
type?: string;
|
|
50
71
|
error?: { type?: string; message?: string };
|
|
51
72
|
message?: { usage?: AnthropicUsage };
|
|
52
73
|
usage?: AnthropicUsage;
|
|
53
74
|
index?: number;
|
|
54
|
-
content_block?:
|
|
55
|
-
delta?: {
|
|
75
|
+
content_block?: AnthropicAnswerBlock;
|
|
76
|
+
delta?: {
|
|
77
|
+
type?: string;
|
|
78
|
+
text?: string;
|
|
79
|
+
partial_json?: string;
|
|
80
|
+
thinking?: string;
|
|
81
|
+
signature?: string;
|
|
82
|
+
stop_reason?: string;
|
|
83
|
+
stop_details?: AnthropicStopDetails | null;
|
|
84
|
+
};
|
|
56
85
|
}
|
|
57
86
|
|
|
58
87
|
/** Anthropic's Messages API, which reads images and PDFs. `model` is required and has no default. */
|
|
@@ -73,6 +102,12 @@ export class AnthropicLlm
|
|
|
73
102
|
*/
|
|
74
103
|
static readonly imageTypes = new Set(["image/jpeg", "image/png", "image/gif", "image/webp"]);
|
|
75
104
|
|
|
105
|
+
static readonly dialect = "anthropic";
|
|
106
|
+
/** The API refuses `thinking.block_binding` without it. */
|
|
107
|
+
static readonly thinkingBindingBeta = "thinking-binding-controls-2026-08-01";
|
|
108
|
+
|
|
109
|
+
readonly #historyChecked = new Set<string>();
|
|
110
|
+
|
|
76
111
|
get #host() {
|
|
77
112
|
return this.llmOption.host ?? "https://api.anthropic.com/v1";
|
|
78
113
|
}
|
|
@@ -101,18 +136,22 @@ export class AnthropicLlm
|
|
|
101
136
|
try {
|
|
102
137
|
const { accepts } = this;
|
|
103
138
|
const maxTokens = this.llmOption.maxTokens;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
);
|
|
109
|
-
return { ...this.#reported(AnthropicLlm.turnAnswer(answer)), model };
|
|
110
|
-
}
|
|
111
|
-
const body = await this.#apiStream(
|
|
112
|
-
AnthropicLlm.requestBody(model, request, { accepts, stream: true, maxTokens }),
|
|
139
|
+
const stream = !!onDelta;
|
|
140
|
+
const response = await this.#send(
|
|
141
|
+
model,
|
|
142
|
+
(thinking) => AnthropicLlm.requestBody(model, request, { accepts, stream, maxTokens, thinking }),
|
|
113
143
|
signal,
|
|
114
144
|
);
|
|
115
|
-
|
|
145
|
+
if (!onDelta)
|
|
146
|
+
return {
|
|
147
|
+
...this.#reported(AnthropicLlm.turnAnswer((await response.json()) as AnthropicAnswer, this.#host)),
|
|
148
|
+
model,
|
|
149
|
+
};
|
|
150
|
+
if (!response.body) throw await AnthropicLlm.refusal(this.#host, response);
|
|
151
|
+
return {
|
|
152
|
+
...this.#reported(await AnthropicLlm.consumeStream(response.body, onDelta, this.#host, request.tools)),
|
|
153
|
+
model,
|
|
154
|
+
};
|
|
116
155
|
} catch (error) {
|
|
117
156
|
if (!signal?.aborted)
|
|
118
157
|
this.logger.error(`Anthropic turn failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -136,26 +175,45 @@ export class AnthropicLlm
|
|
|
136
175
|
};
|
|
137
176
|
}
|
|
138
177
|
|
|
139
|
-
async #
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
178
|
+
async #send(
|
|
179
|
+
model: string,
|
|
180
|
+
bodyOf: (thinking?: AnthropicThinkingReplay) => { messages: AnthropicMessage[] },
|
|
181
|
+
signal?: AbortSignal,
|
|
182
|
+
): Promise<Response> {
|
|
183
|
+
let thinking: AnthropicThinkingReplay | undefined = this.#historyChecked.has(model) ? "drop" : undefined;
|
|
184
|
+
for (;;) {
|
|
185
|
+
const body = bodyOf(thinking);
|
|
186
|
+
const response: Response = await fetch(`${this.#host}/messages`, {
|
|
187
|
+
method: "POST",
|
|
188
|
+
headers:
|
|
189
|
+
thinking === "drop"
|
|
190
|
+
? { ...this.#headers, "anthropic-beta": AnthropicLlm.thinkingBindingBeta }
|
|
191
|
+
: this.#headers,
|
|
192
|
+
body: JSON.stringify(body),
|
|
193
|
+
signal: llmCallSignal(signal),
|
|
194
|
+
});
|
|
195
|
+
if (response.ok) return response;
|
|
196
|
+
const reason = await AnthropicLlm.reasonOf(response);
|
|
197
|
+
const retry: AnthropicThinkingReplay | null =
|
|
198
|
+
response.status === 400 && (thinking === "drop" || AnthropicLlm.replaysThinking(body.messages))
|
|
199
|
+
? AnthropicLlm.thinkingRetry(thinking, reason)
|
|
200
|
+
: null;
|
|
201
|
+
if (!retry) throw LlmOverflow.refusal(this.#host, response.status, reason);
|
|
202
|
+
if (retry === "drop") this.#historyChecked.add(model);
|
|
203
|
+
thinking = retry;
|
|
204
|
+
}
|
|
148
205
|
}
|
|
149
206
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
207
|
+
static thinkingRetry(sent: AnthropicThinkingReplay | undefined, reason: string): AnthropicThinkingReplay | null {
|
|
208
|
+
if (sent === "strip") return null;
|
|
209
|
+
if (!sent && /block_binding|different conversation/i.test(reason)) return "drop";
|
|
210
|
+
return /thinking|beta/i.test(reason) ? "strip" : null;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
static replaysThinking(messages: AnthropicMessage[]): boolean {
|
|
214
|
+
return messages.some((message) =>
|
|
215
|
+
message.content.some((block) => block.type === "thinking" || block.type === "redacted_thinking"),
|
|
216
|
+
);
|
|
159
217
|
}
|
|
160
218
|
|
|
161
219
|
static async refusal(host: string, response: Response): Promise<Error> {
|
|
@@ -173,17 +231,32 @@ export class AnthropicLlm
|
|
|
173
231
|
return response.statusText || "no reason given";
|
|
174
232
|
}
|
|
175
233
|
|
|
234
|
+
/** `thinking: "drop"` needs `thinkingBindingBeta` in the `anthropic-beta` header. */
|
|
176
235
|
static requestBody(
|
|
177
236
|
model: string,
|
|
178
237
|
request: LlmTurnRequest,
|
|
179
|
-
{
|
|
238
|
+
{
|
|
239
|
+
accepts,
|
|
240
|
+
stream,
|
|
241
|
+
maxTokens,
|
|
242
|
+
thinking,
|
|
243
|
+
}: { accepts?: LlmAccepts; stream?: boolean; maxTokens?: number; thinking?: AnthropicThinkingReplay } = {},
|
|
180
244
|
) {
|
|
245
|
+
const messages =
|
|
246
|
+
thinking === "strip"
|
|
247
|
+
? request.messages.map((message) =>
|
|
248
|
+
message.providerContent ? { ...message, providerContent: undefined } : message,
|
|
249
|
+
)
|
|
250
|
+
: request.messages;
|
|
181
251
|
return {
|
|
182
252
|
model,
|
|
183
253
|
max_tokens: maxTokens ?? AnthropicLlm.defaultMaxTokens,
|
|
184
254
|
...(stream ? { stream: true } : {}),
|
|
255
|
+
...(thinking === "drop"
|
|
256
|
+
? { thinking: { type: "adaptive", block_binding: { prefix_mismatch_behavior: "drop_block" } } }
|
|
257
|
+
: {}),
|
|
185
258
|
system: AnthropicLlm.systemPrompt(request),
|
|
186
|
-
messages: AnthropicLlm.contextual(AnthropicLlm.providerMessages(
|
|
259
|
+
messages: AnthropicLlm.contextual(AnthropicLlm.providerMessages(messages, accepts), request.context),
|
|
187
260
|
...(request.tools.length
|
|
188
261
|
? {
|
|
189
262
|
tools: request.tools.map((tool) => ({
|
|
@@ -242,7 +315,7 @@ export class AnthropicLlm
|
|
|
242
315
|
if (message.role === "assistant")
|
|
243
316
|
return {
|
|
244
317
|
role: "assistant",
|
|
245
|
-
content: [
|
|
318
|
+
content: AnthropicLlm.replayed(message) ?? [
|
|
246
319
|
...(message.text ? [{ type: "text" as const, text: message.text }] : []),
|
|
247
320
|
...(message.toolCalls ?? []).map((call) => ({
|
|
248
321
|
type: "tool_use" as const,
|
|
@@ -255,6 +328,46 @@ export class AnthropicLlm
|
|
|
255
328
|
return { role: "user", content: AnthropicLlm.userContent(message, accepts) };
|
|
256
329
|
}
|
|
257
330
|
|
|
331
|
+
static replayed(message: AgentWireMessage): AnthropicBlock[] | null {
|
|
332
|
+
const own = message.providerContent;
|
|
333
|
+
if (own?.dialect !== AnthropicLlm.dialect || !Array.isArray(own.content)) return null;
|
|
334
|
+
const calls = new Map((message.toolCalls ?? []).map((call) => [call.id, call]));
|
|
335
|
+
const blocks: AnthropicBlock[] = [];
|
|
336
|
+
let text = "";
|
|
337
|
+
for (const block of own.content as (AnthropicAnswerBlock | null)[]) {
|
|
338
|
+
const call = block?.type === "tool_use" && block.id ? calls.get(block.id) : undefined;
|
|
339
|
+
if (block?.type === "thinking" && typeof block.thinking === "string" && typeof block.signature === "string")
|
|
340
|
+
blocks.push({ type: "thinking", thinking: block.thinking, signature: block.signature });
|
|
341
|
+
else if (block?.type === "redacted_thinking" && typeof block.data === "string")
|
|
342
|
+
blocks.push({ type: "redacted_thinking", data: block.data });
|
|
343
|
+
else if (block?.type === "text" && typeof block.text === "string" && block.text) {
|
|
344
|
+
text += block.text;
|
|
345
|
+
blocks.push({ type: "text", text: block.text });
|
|
346
|
+
} else if (call) {
|
|
347
|
+
calls.delete(call.id);
|
|
348
|
+
blocks.push({ type: "tool_use", id: call.id, name: call.name, input: call.args });
|
|
349
|
+
} else return null;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
return calls.size || text !== (message.text ?? "") ? null : blocks;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
static providerContentOf(blocks: AnthropicAnswerBlock[]): AgentWireProviderContent | undefined {
|
|
356
|
+
if (!blocks.some((block) => block.type === "thinking" || block.type === "redacted_thinking")) return undefined;
|
|
357
|
+
const content: unknown[] = [];
|
|
358
|
+
for (const block of blocks) {
|
|
359
|
+
if (block.type === "thinking") {
|
|
360
|
+
if (!block.signature) return undefined;
|
|
361
|
+
content.push({ type: "thinking", thinking: block.thinking ?? "", signature: block.signature });
|
|
362
|
+
} else if (block.type === "redacted_thinking") {
|
|
363
|
+
if (!block.data) return undefined;
|
|
364
|
+
content.push({ type: "redacted_thinking", data: block.data });
|
|
365
|
+
} else if (block.type === "text" && block.text) content.push({ type: "text", text: block.text });
|
|
366
|
+
else if (block.type === "tool_use" && block.id) content.push({ type: "tool_use", id: block.id });
|
|
367
|
+
}
|
|
368
|
+
return { dialect: AnthropicLlm.dialect, content };
|
|
369
|
+
}
|
|
370
|
+
|
|
258
371
|
static userContent(message: AgentWireMessage, accepts?: LlmAccepts): AnthropicBlock[] {
|
|
259
372
|
const notes: string[] = [];
|
|
260
373
|
const blocks = AnthropicLlm.attachmentBlocks(message.attachments ?? [], accepts, notes);
|
|
@@ -320,7 +433,12 @@ export class AnthropicLlm
|
|
|
320
433
|
return null;
|
|
321
434
|
}
|
|
322
435
|
|
|
323
|
-
static turnAnswer(answer: AnthropicAnswer): LlmTurnAnswer {
|
|
436
|
+
static turnAnswer(answer: AnthropicAnswer, host = "The model provider"): LlmTurnAnswer {
|
|
437
|
+
if (answer.stop_reason === "refusal") {
|
|
438
|
+
const declined = LlmOverflow.declined(host, answer.stop_details?.category, answer.stop_details?.explanation);
|
|
439
|
+
throw answer.usage ? LlmSpend.attach(declined, { usage: AnthropicLlm.usageOf(answer.usage) }) : declined;
|
|
440
|
+
}
|
|
441
|
+
const providerContent = AnthropicLlm.providerContentOf(answer.content ?? []);
|
|
324
442
|
const text = (answer.content ?? [])
|
|
325
443
|
.flatMap((block) => (block.type === "text" && block.text ? [block.text] : []))
|
|
326
444
|
.join("");
|
|
@@ -334,6 +452,7 @@ export class AnthropicLlm
|
|
|
334
452
|
...(toolCalls.length ? { toolCalls } : {}),
|
|
335
453
|
stop: AnthropicLlm.stopOf(answer.stop_reason, toolCalls.length),
|
|
336
454
|
...(answer.usage ? { usage: AnthropicLlm.usageOf(answer.usage) } : {}),
|
|
455
|
+
...(providerContent ? { providerContent } : {}),
|
|
337
456
|
};
|
|
338
457
|
}
|
|
339
458
|
|
|
@@ -360,6 +479,7 @@ export class AnthropicLlm
|
|
|
360
479
|
tools: AgentWireTool[] = [],
|
|
361
480
|
): Promise<LlmTurnAnswer> {
|
|
362
481
|
const calls = new Map<number, { id?: string; name?: string; args: string }>();
|
|
482
|
+
const blocks = new Map<number, AnthropicAnswerBlock>();
|
|
363
483
|
let text = "";
|
|
364
484
|
let stopReason: string | null = null;
|
|
365
485
|
let stopped = false;
|
|
@@ -376,11 +496,18 @@ export class AnthropicLlm
|
|
|
376
496
|
);
|
|
377
497
|
if (event.type === "message_stop") stopped = true;
|
|
378
498
|
const index = event.index ?? 0;
|
|
499
|
+
if (event.type === "content_block_start" && event.content_block) blocks.set(index, { ...event.content_block });
|
|
379
500
|
if (event.type === "content_block_start" && event.content_block?.type === "tool_use")
|
|
380
501
|
calls.set(index, { id: event.content_block.id, name: event.content_block.name, args: "" });
|
|
381
502
|
if (event.type === "content_block_delta") {
|
|
503
|
+
const block = blocks.get(index);
|
|
504
|
+
if (block && event.delta?.type === "thinking_delta")
|
|
505
|
+
block.thinking = (block.thinking ?? "") + (event.delta.thinking ?? "");
|
|
506
|
+
if (block && event.delta?.type === "signature_delta")
|
|
507
|
+
block.signature = (block.signature ?? "") + (event.delta.signature ?? "");
|
|
382
508
|
if (event.delta?.type === "text_delta" && event.delta.text) {
|
|
383
509
|
text += event.delta.text;
|
|
510
|
+
if (block) block.text = (block.text ?? "") + event.delta.text;
|
|
384
511
|
onDelta(event.delta.text);
|
|
385
512
|
}
|
|
386
513
|
if (event.delta?.type === "input_json_delta" && event.delta.partial_json) {
|
|
@@ -390,6 +517,8 @@ export class AnthropicLlm
|
|
|
390
517
|
}
|
|
391
518
|
}
|
|
392
519
|
if (event.type === "message_delta" && event.delta?.stop_reason) stopReason = event.delta.stop_reason;
|
|
520
|
+
if (event.type === "message_delta" && event.delta?.stop_reason === "refusal")
|
|
521
|
+
failure = LlmOverflow.declined(host, event.delta.stop_details?.category, event.delta.stop_details?.explanation);
|
|
393
522
|
|
|
394
523
|
if (event.type === "message_start" && event.message?.usage) usage = { ...usage, ...event.message.usage };
|
|
395
524
|
if (event.type === "message_delta" && event.usage) {
|
|
@@ -412,6 +541,9 @@ export class AnthropicLlm
|
|
|
412
541
|
const toolCalls = [...calls.entries()]
|
|
413
542
|
.sort(([a], [b]) => a - b)
|
|
414
543
|
.flatMap(([, call]) => (call.id && call.name ? [toolCallOf(call.id, call.name, call.args)] : []));
|
|
544
|
+
const providerContent = AnthropicLlm.providerContentOf(
|
|
545
|
+
[...blocks.entries()].sort(([a], [b]) => a - b).map(([, block]) => block),
|
|
546
|
+
);
|
|
415
547
|
return {
|
|
416
548
|
...(text ? { text } : {}),
|
|
417
549
|
...(toolCalls.length ? { toolCalls } : {}),
|
|
@@ -427,6 +559,7 @@ export class AnthropicLlm
|
|
|
427
559
|
? "length"
|
|
428
560
|
: AnthropicLlm.stopOf(stopReason, toolCalls.length),
|
|
429
561
|
...(Object.keys(usage).length ? { usage: AnthropicLlm.usageOf(usage) } : {}),
|
|
562
|
+
...(providerContent ? { providerContent } : {}),
|
|
430
563
|
};
|
|
431
564
|
}
|
|
432
565
|
|
|
@@ -68,6 +68,17 @@ export interface AgentWireMessage {
|
|
|
68
68
|
toolkits?: string[];
|
|
69
69
|
/** On a summary `agentService.loop` wrote: the tools its run had found with `findTools` and still listed. */
|
|
70
70
|
foundTools?: string[];
|
|
71
|
+
/** On an assistant message: what its provider must be sent back unchanged, which no other dialect reads. */
|
|
72
|
+
providerContent?: AgentWireProviderContent;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Anthropic's thinking blocks, signatures included, in answer order: replayed verbatim, the model keeps its reasoning
|
|
77
|
+
* across tool rounds; edited, the API refuses the turn. Store it with the message as it came.
|
|
78
|
+
*/
|
|
79
|
+
export interface AgentWireProviderContent {
|
|
80
|
+
dialect: string;
|
|
81
|
+
content: unknown[];
|
|
71
82
|
}
|
|
72
83
|
|
|
73
84
|
export interface AgentWireTool {
|
|
@@ -108,6 +119,7 @@ export interface LlmTurnAnswer {
|
|
|
108
119
|
usage?: LlmUsage;
|
|
109
120
|
/** The model that answered, as the adaptor named it to the provider. */
|
|
110
121
|
model?: string;
|
|
122
|
+
providerContent?: AgentWireProviderContent;
|
|
111
123
|
}
|
|
112
124
|
|
|
113
125
|
/** `inputTokens` is the whole prompt, cached part included; `cachedTokens` is the share billed at the cache rate. */
|
|
@@ -60,6 +60,18 @@ export class LlmOverflow {
|
|
|
60
60
|
return new Err("agent.error.llmRequestFailed", { provider, status: String(status) });
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
/**
|
|
64
|
+
* A model that declined on a successful response (Anthropic's `stop_reason: "refusal"`), its partial answer
|
|
65
|
+
* discarded. `category` is the provider's policy class, kept for an app to branch on; `explanation` stays here.
|
|
66
|
+
*/
|
|
67
|
+
static declined(host: string, category?: unknown, explanation?: unknown): Error {
|
|
68
|
+
const provider = llmProviderOf(host);
|
|
69
|
+
LlmOverflow.#logger.warn(
|
|
70
|
+
`${provider} declined a turn${typeof category === "string" ? ` (${category})` : ""}${typeof explanation === "string" && explanation ? `: ${explanation}` : ""}`,
|
|
71
|
+
);
|
|
72
|
+
return new Err("agent.error.llmDeclined", { provider, ...(typeof category === "string" ? { category } : {}) });
|
|
73
|
+
}
|
|
74
|
+
|
|
63
75
|
static #count(text: string | undefined): number | undefined {
|
|
64
76
|
const count = text ? Number(text.replace(/,/g, "")) : Number.NaN;
|
|
65
77
|
return Number.isFinite(count) && count > 0 ? count : undefined;
|
package/signal/endpointInfo.ts
CHANGED
|
@@ -17,6 +17,7 @@ import type {
|
|
|
17
17
|
PlainTypeToFieldType,
|
|
18
18
|
PurifiedModel,
|
|
19
19
|
ServerArgModel,
|
|
20
|
+
ServerReturnModel,
|
|
20
21
|
UploadableClientArg,
|
|
21
22
|
} from "akanjs/constant";
|
|
22
23
|
import type { ServiceModel } from "akanjs/service";
|
|
@@ -292,7 +293,7 @@ export class EndpointInfo<
|
|
|
292
293
|
...args: [...ServerArgs, ...InternalArgs]
|
|
293
294
|
) => ReqType extends "pubsub"
|
|
294
295
|
? Promise<void> | void
|
|
295
|
-
: PromiseOrObject<
|
|
296
|
+
: PromiseOrObject<ServerReturnModel<FieldToValue<Returns>> | (Nullable extends true ? null | undefined : never)>,
|
|
296
297
|
>(
|
|
297
298
|
execFn: ExecFn,
|
|
298
299
|
): EndpointInfo<
|
package/signal/internalInfo.ts
CHANGED
|
@@ -3,10 +3,10 @@ import type {
|
|
|
3
3
|
ConstantCls,
|
|
4
4
|
ConstantField,
|
|
5
5
|
ConstantFieldTypeInput,
|
|
6
|
-
DocumentModel,
|
|
7
6
|
FieldObject,
|
|
8
7
|
FieldToValue,
|
|
9
8
|
PlainTypeToFieldType,
|
|
9
|
+
ServerReturnModel,
|
|
10
10
|
} from "akanjs/constant";
|
|
11
11
|
import type { AkanJob, ServiceModel } from "akanjs/service";
|
|
12
12
|
import { type ArgInfo, EndpointInfo, type InternalArgInfo, type ReturnInfo } from "./endpointInfo";
|
|
@@ -92,7 +92,7 @@ export class InternalInfo<
|
|
|
92
92
|
}
|
|
93
93
|
exec<
|
|
94
94
|
ExecReturn extends ReqType extends "process" | "resolveField"
|
|
95
|
-
? PromiseOrObject<
|
|
95
|
+
? PromiseOrObject<ServerReturnModel<FieldToValue<Returns>> | (Nullable extends true ? null : never)>
|
|
96
96
|
: PromiseOrObject<void>,
|
|
97
97
|
>(execFn: (this: Srvs, ...args: [...Args, ...DefaultArgs, ...InternalArgs]) => ExecReturn) {
|
|
98
98
|
if (this.execFn) throw new SignalDeclarationError("handlerAlreadySet", "Query function is already set");
|
|
@@ -17,5 +17,5 @@ export { RequestValue } from "./requestValue.d.ts";
|
|
|
17
17
|
export { deserialize, type Serialized, serialize } from "./serialize.d.ts";
|
|
18
18
|
export { TextFieldPathSet } from "./textFieldPathSet.d.ts";
|
|
19
19
|
export { TextFieldPaths, type TextFieldRole, textFieldRoles } from "./textFieldPaths.d.ts";
|
|
20
|
-
export { BaseInsight, BaseObject, type ConstantType, DEFAULT_PAGE_SIZE, type DefaultOf, type DefaultOfSchema, type DocumentModel, type FieldState, type GetPlainObject, MAX_PAGE_SIZE, type NonFunctionalKeys, type ProtoAppInfo, type ProtoFile, type ProtoLightFile, type ProtoPatch, type QueryOf, Responsive, resolvePageLimit, resolvePageSkip, responsiveWidths, type ServerArgModel, unsetDate, } from "./types.d.ts";
|
|
20
|
+
export { BaseInsight, BaseObject, type ConstantType, DEFAULT_PAGE_SIZE, type DefaultOf, type DefaultOfSchema, type DocumentModel, type FieldState, type GetPlainObject, MAX_PAGE_SIZE, type NonFunctionalKeys, type ProtoAppInfo, type ProtoFile, type ProtoLightFile, type ProtoPatch, type QueryOf, Responsive, resolvePageLimit, resolvePageSkip, responsiveWidths, type ServerArgModel, type ServerReturnModel, unsetDate, } from "./types.d.ts";
|
|
21
21
|
export { type ConstantCls, type ConstantMethods, type ConstantModelRef, type ConstantStatics, type DatabaseConstantStatics, type DocumentConstantModelRef, via, } from "./via.d.ts";
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { type Dayjs, type GetStateObject } from "akanjs/base";
|
|
2
2
|
export type QueryOf<_T = any> = any;
|
|
3
3
|
export type ConstantType = "input" | "object" | "full" | "light" | "insight" | "scalar";
|
|
4
|
-
type ObjectToId<O> = O extends BaseObject ? string : O extends BaseObject[] ? string[] : O extends Dayjs ? Dayjs : O extends object ? DocumentModel<O> : O;
|
|
5
|
-
type Docify<T, _StateKeys extends keyof GetStateObject<T> = keyof GetStateObject<T>> = unknown extends T ? T : {
|
|
6
|
-
[K in _StateKeys as null extends T[K] ? never : K]-?: ObjectToId<NonNullable<T[K]
|
|
4
|
+
type ObjectToId<O, Unset> = O extends BaseObject ? string : O extends BaseObject[] ? string[] : O extends Dayjs ? Dayjs : O extends object ? DocumentModel<O, Unset> : O;
|
|
5
|
+
type Docify<T, Unset, _StateKeys extends keyof GetStateObject<T> = keyof GetStateObject<T>> = unknown extends T ? T : {
|
|
6
|
+
[K in _StateKeys as null extends T[K] ? never : K]-?: ObjectToId<NonNullable<T[K]>, Unset>;
|
|
7
7
|
} & {
|
|
8
|
-
[K in _StateKeys as null extends T[K] ? K : never]?: ObjectToId<NonNullable<T[K]
|
|
8
|
+
[K in _StateKeys as null extends T[K] ? K : never]?: ObjectToId<NonNullable<T[K]>, Unset> | Unset | undefined;
|
|
9
9
|
};
|
|
10
|
-
export type DocumentModel<T> = unknown extends T ? T : T extends (infer S)[] ? DocumentModel<S>[] : T extends string | number | boolean | Dayjs | File | Uint8Array ? T : T extends Map<infer K, infer V> ? Map<K, DocumentModel<V>> : Docify<T>;
|
|
10
|
+
export type DocumentModel<T, Unset = undefined> = unknown extends T ? T : T extends (infer S)[] ? DocumentModel<S, Unset>[] : T extends string | number | boolean | Dayjs | File | Uint8Array ? T : T extends Map<infer K, infer V> ? Map<K, DocumentModel<V, Unset>> : Docify<T, Unset>;
|
|
11
|
+
export type ServerReturnModel<T> = DocumentModel<T, null>;
|
|
11
12
|
export type ServerArgModel<T> = unknown extends T ? T : T extends Uint8Array ? Uint8Array<ArrayBuffer> : T extends (infer S)[] ? ServerArgModel<S>[] : DocumentModel<T>;
|
|
12
13
|
export type FieldState<T> = T extends {
|
|
13
14
|
id: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const agentDictionary: import("./dictInfo.d.ts").ServiceDictInfo<[string, string], "runAgentTurn", "llmUnavailable" | "llmRequestFailed" | "contextOverflow" | "quotaExceeded" | "requestRefused" | "answerRefused" | "clientToolsRefused" | "accountResolverMissing", never>;
|
|
1
|
+
export declare const agentDictionary: import("./dictInfo.d.ts").ServiceDictInfo<[string, string], "runAgentTurn", "llmUnavailable" | "llmRequestFailed" | "llmDeclined" | "contextOverflow" | "quotaExceeded" | "requestRefused" | "answerRefused" | "clientToolsRefused" | "accountResolverMissing", never>;
|
|
2
2
|
export declare const agentTurnDictionary: import("./dictInfo.d.ts").ScalarDictInfo<[string, string], "text" | "toolCalls" | "stop", "agentStop", never, never>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { AgentEndpoint, AgentTurn, BaseEndpoint } from "akanjs/signal";
|
|
2
2
|
export declare const dictionary: {
|
|
3
|
-
base: import("./locale.d.ts").DictModule<import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "unauthorized" | "edit" | "ok" | "retry" | "approve" | "agent" | "view" | "remove" | "skip" | "success" | "save" | "refresh" | "password" | "stop" | "connecting" | "send" | "cancel" | "copy" | "createModel" | "updateModel" | "removeModel" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "cameraDeniedTitle" | "cameraDeniedMessage" | "cameraDeniedSettings" | "cameraDeniedLater" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "pageLoadFailed" | "loadFailed" | "pageNotFound" | "goBack" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createSuccess" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new">, "base.error.documentNotFound" | "base.error.gatewayTimeout" | "base.error.payloadTooLarge" | "base.error.tooManyRequests" | "base.error.serverUnavailable" | "base.error.serverUnreachable" | "base.error.idempotencyInFlight" | "base.error.unexpectedResponse" | "base.error.
|
|
3
|
+
base: import("./locale.d.ts").DictModule<import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "unauthorized" | "edit" | "ok" | "retry" | "approve" | "agent" | "view" | "remove" | "skip" | "success" | "save" | "refresh" | "password" | "stop" | "connecting" | "send" | "cancel" | "copy" | "createModel" | "updateModel" | "removeModel" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "cameraDeniedTitle" | "cameraDeniedMessage" | "cameraDeniedSettings" | "cameraDeniedLater" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "pageLoadFailed" | "loadFailed" | "pageNotFound" | "goBack" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createSuccess" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new">, "base.error.documentNotFound" | "base.error.gatewayTimeout" | "base.error.payloadTooLarge" | "base.error.tooManyRequests" | "base.error.serverUnavailable" | "base.error.serverUnreachable" | "base.error.idempotencyInFlight" | "base.error.unexpectedResponse" | "base.error.requiredArgument" | "base.error.mutationInApp" | "base.error.mutationInRender" | "base.error.liveRoomLimit" | "base.error.immutableField" | "base.error.invalidArgument" | "base.error.invalidField" | "base.error.relationNotFound" | "base.error.endpointClosed" | "base.error.readOnlyDeployment">;
|
|
4
4
|
agentTurn: import("./locale.d.ts").DictModule<import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc`, never>;
|
|
5
|
-
agent: import("./locale.d.ts").DictModule<import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, "agent.error.llmUnavailable" | "agent.error.llmRequestFailed" | "agent.error.contextOverflow" | "agent.error.quotaExceeded" | "agent.error.requestRefused" | "agent.error.answerRefused" | "agent.error.clientToolsRefused" | "agent.error.accountResolverMissing">;
|
|
5
|
+
agent: import("./locale.d.ts").DictModule<import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, "agent.error.llmUnavailable" | "agent.error.llmRequestFailed" | "agent.error.llmDeclined" | "agent.error.contextOverflow" | "agent.error.quotaExceeded" | "agent.error.requestRefused" | "agent.error.answerRefused" | "agent.error.clientToolsRefused" | "agent.error.accountResolverMissing">;
|
|
6
6
|
};
|
|
7
|
-
export declare const Err: import("./trans.d.ts").ErrConstructor<"base.error.documentNotFound" | "base.error.gatewayTimeout" | "base.error.payloadTooLarge" | "base.error.tooManyRequests" | "base.error.serverUnavailable" | "base.error.serverUnreachable" | "base.error.idempotencyInFlight" | "base.error.unexpectedResponse" | "base.error.
|
|
7
|
+
export declare const Err: import("./trans.d.ts").ErrConstructor<"base.error.documentNotFound" | "base.error.gatewayTimeout" | "base.error.payloadTooLarge" | "base.error.tooManyRequests" | "base.error.serverUnavailable" | "base.error.serverUnreachable" | "base.error.idempotencyInFlight" | "base.error.unexpectedResponse" | "base.error.requiredArgument" | "base.error.mutationInApp" | "base.error.mutationInRender" | "base.error.liveRoomLimit" | "base.error.immutableField" | "base.error.invalidArgument" | "base.error.invalidField" | "base.error.relationNotFound" | "base.error.endpointClosed" | "base.error.readOnlyDeployment" | "agent.error.llmUnavailable" | "agent.error.llmRequestFailed" | "agent.error.llmDeclined" | "agent.error.contextOverflow" | "agent.error.quotaExceeded" | "agent.error.requestRefused" | "agent.error.answerRefused" | "agent.error.clientToolsRefused" | "agent.error.accountResolverMissing">, translate: (lang: "en" | "ko" | (string & {}) | "zhChs" | "zhCht" | "ja", key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "unauthorized" | "edit" | "ok" | "retry" | "approve" | "agent" | "view" | "remove" | "skip" | "success" | "save" | "refresh" | "password" | "stop" | "connecting" | "send" | "cancel" | "copy" | "createModel" | "updateModel" | "removeModel" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "cameraDeniedTitle" | "cameraDeniedMessage" | "cameraDeniedSettings" | "cameraDeniedLater" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "pageLoadFailed" | "loadFailed" | "pageNotFound" | "goBack" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createSuccess" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, data?: import("./trans.d.ts").TranslationData) => string, msg: {
|
|
8
8
|
error: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "unauthorized" | "edit" | "ok" | "retry" | "approve" | "agent" | "view" | "remove" | "skip" | "success" | "save" | "refresh" | "password" | "stop" | "connecting" | "send" | "cancel" | "copy" | "createModel" | "updateModel" | "removeModel" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "cameraDeniedTitle" | "cameraDeniedMessage" | "cameraDeniedSettings" | "cameraDeniedLater" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "pageLoadFailed" | "loadFailed" | "pageNotFound" | "goBack" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createSuccess" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, option?: import("./trans.d.ts").TransMessageOption) => void;
|
|
9
9
|
info: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "unauthorized" | "edit" | "ok" | "retry" | "approve" | "agent" | "view" | "remove" | "skip" | "success" | "save" | "refresh" | "password" | "stop" | "connecting" | "send" | "cancel" | "copy" | "createModel" | "updateModel" | "removeModel" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "cameraDeniedTitle" | "cameraDeniedMessage" | "cameraDeniedSettings" | "cameraDeniedLater" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "pageLoadFailed" | "loadFailed" | "pageNotFound" | "goBack" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createSuccess" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, option?: import("./trans.d.ts").TransMessageOption) => void;
|
|
10
10
|
warning: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "unauthorized" | "edit" | "ok" | "retry" | "approve" | "agent" | "view" | "remove" | "skip" | "success" | "save" | "refresh" | "password" | "stop" | "connecting" | "send" | "cancel" | "copy" | "createModel" | "updateModel" | "removeModel" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "cameraDeniedTitle" | "cameraDeniedMessage" | "cameraDeniedSettings" | "cameraDeniedLater" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "pageLoadFailed" | "loadFailed" | "pageNotFound" | "goBack" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createSuccess" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, option?: import("./trans.d.ts").TransMessageOption) => void;
|
|
11
11
|
success: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "unauthorized" | "edit" | "ok" | "retry" | "approve" | "agent" | "view" | "remove" | "skip" | "success" | "save" | "refresh" | "password" | "stop" | "connecting" | "send" | "cancel" | "copy" | "createModel" | "updateModel" | "removeModel" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "cameraDeniedTitle" | "cameraDeniedMessage" | "cameraDeniedSettings" | "cameraDeniedLater" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "pageLoadFailed" | "loadFailed" | "pageNotFound" | "goBack" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createSuccess" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, option?: import("./trans.d.ts").TransMessageOption) => void;
|
|
12
12
|
loading: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "unauthorized" | "edit" | "ok" | "retry" | "approve" | "agent" | "view" | "remove" | "skip" | "success" | "save" | "refresh" | "password" | "stop" | "connecting" | "send" | "cancel" | "copy" | "createModel" | "updateModel" | "removeModel" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "cameraDeniedTitle" | "cameraDeniedMessage" | "cameraDeniedSettings" | "cameraDeniedLater" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "pageLoadFailed" | "loadFailed" | "pageNotFound" | "goBack" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createSuccess" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, option?: import("./trans.d.ts").TransMessageOption) => void;
|
|
13
|
-
}, getDictionary: (lang: "en" | "ko" | (string & {}) | "zhChs" | "zhCht" | "ja") => object, getAllDictionary: () => import("./trans.d.ts").RootDictionary, __Dict_Key__: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "unauthorized" | "edit" | "ok" | "retry" | "approve" | "agent" | "view" | "remove" | "skip" | "success" | "save" | "refresh" | "password" | "stop" | "connecting" | "send" | "cancel" | "copy" | "createModel" | "updateModel" | "removeModel" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "cameraDeniedTitle" | "cameraDeniedMessage" | "cameraDeniedSettings" | "cameraDeniedLater" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "pageLoadFailed" | "loadFailed" | "pageNotFound" | "goBack" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createSuccess" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, __Error_Key__: "base.error.documentNotFound" | "base.error.gatewayTimeout" | "base.error.payloadTooLarge" | "base.error.tooManyRequests" | "base.error.serverUnavailable" | "base.error.serverUnreachable" | "base.error.idempotencyInFlight" | "base.error.unexpectedResponse" | "base.error.
|
|
13
|
+
}, getDictionary: (lang: "en" | "ko" | (string & {}) | "zhChs" | "zhCht" | "ja") => object, getAllDictionary: () => import("./trans.d.ts").RootDictionary, __Dict_Key__: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "unauthorized" | "edit" | "ok" | "retry" | "approve" | "agent" | "view" | "remove" | "skip" | "success" | "save" | "refresh" | "password" | "stop" | "connecting" | "send" | "cancel" | "copy" | "createModel" | "updateModel" | "removeModel" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "cameraDeniedTitle" | "cameraDeniedMessage" | "cameraDeniedSettings" | "cameraDeniedLater" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "pageLoadFailed" | "loadFailed" | "pageNotFound" | "goBack" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createSuccess" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, __Error_Key__: "base.error.documentNotFound" | "base.error.gatewayTimeout" | "base.error.payloadTooLarge" | "base.error.tooManyRequests" | "base.error.serverUnavailable" | "base.error.serverUnreachable" | "base.error.idempotencyInFlight" | "base.error.unexpectedResponse" | "base.error.requiredArgument" | "base.error.mutationInApp" | "base.error.mutationInRender" | "base.error.liveRoomLimit" | "base.error.immutableField" | "base.error.invalidArgument" | "base.error.invalidField" | "base.error.relationNotFound" | "base.error.endpointClosed" | "base.error.readOnlyDeployment" | "agent.error.llmUnavailable" | "agent.error.llmRequestFailed" | "agent.error.llmDeclined" | "agent.error.contextOverflow" | "agent.error.quotaExceeded" | "agent.error.requestRefused" | "agent.error.answerRefused" | "agent.error.clientToolsRefused" | "agent.error.accountResolverMissing";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SerializedArg, SerializedEndpoint, SerializedReturns, SerializedSignal } from "akanjs/signal";
|
|
2
|
+
import { type ErrorConstructor } from "./remoteError.d.ts";
|
|
2
3
|
interface SharedSignalRegistry {
|
|
3
4
|
signal: {
|
|
4
5
|
[key: string]: SerializedSignal;
|
|
@@ -15,7 +16,7 @@ export declare const helpersOf: (signal: SerializedSignal) => {
|
|
|
15
16
|
edit: boolean;
|
|
16
17
|
merge: boolean;
|
|
17
18
|
};
|
|
18
|
-
export declare const makeArgSerializer: (args: SerializedArg[]) => Map<string, (value: unknown) => object[] | null>;
|
|
19
|
+
export declare const makeArgSerializer: (args: SerializedArg[], ErrorCls?: ErrorConstructor) => Map<string, (value: unknown) => object[] | null>;
|
|
19
20
|
export declare const refusingUndeclaredNull: <Parse extends (value: unknown, option?: {
|
|
20
21
|
crystalize?: boolean;
|
|
21
22
|
}) => unknown>(key: string, endpoint: SerializedEndpoint, parse: Parse) => Parse;
|
|
@@ -13,6 +13,7 @@ export declare class AgentService extends AgentService_base {
|
|
|
13
13
|
loop(request: AgentLoopRequest): AsyncIterable<AgentLoopEvent>;
|
|
14
14
|
runTurn(request: LlmTurnRequest, options?: AgentTurnOptions | ((delta: string) => void)): Promise<{
|
|
15
15
|
limits?: import("./predefinedAdaptor.d.ts").LlmLimits | undefined;
|
|
16
|
+
providerContent?: import("./predefinedAdaptor.d.ts").AgentWireProviderContent | undefined;
|
|
16
17
|
model?: string | undefined;
|
|
17
18
|
usage?: import("./predefinedAdaptor.d.ts").LlmUsage | undefined;
|
|
18
19
|
text: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentToolsAdaptor } from "../predefinedAdaptor/agentTools.adaptor";
|
|
2
|
-
import type { AgentWireToolCall, LlmTurnRequest, LlmUsage } from "../predefinedAdaptor/llm.adaptor";
|
|
2
|
+
import type { AgentWireProviderContent, AgentWireToolCall, LlmTurnRequest, LlmUsage } from "../predefinedAdaptor/llm.adaptor";
|
|
3
3
|
import type { AgentLoopEvent, AgentLoopRequest } from "./agentLoopTypes.d.ts";
|
|
4
4
|
export interface AgentLoopAnswer {
|
|
5
5
|
text: string;
|
|
@@ -7,6 +7,7 @@ export interface AgentLoopAnswer {
|
|
|
7
7
|
stop: "end" | "toolUse" | "length";
|
|
8
8
|
usage?: LlmUsage;
|
|
9
9
|
model?: string;
|
|
10
|
+
providerContent?: AgentWireProviderContent;
|
|
10
11
|
}
|
|
11
12
|
export interface AgentLoopPort {
|
|
12
13
|
tools: AgentToolsAdaptor;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AgentWireAttachment, type AgentWireContext, type AgentWireMessage, type AgentWireTool, type AgentWireToolResult, type LlmAccepts, type LlmAdaptor, type LlmLimits, type LlmOption, type LlmTurnAnswer, type LlmTurnRequest, type LlmUsage } from "./llm.adaptor";
|
|
1
|
+
import { type AgentWireAttachment, type AgentWireContext, type AgentWireMessage, type AgentWireProviderContent, type AgentWireTool, type AgentWireToolResult, type LlmAccepts, type LlmAdaptor, type LlmLimits, type LlmOption, type LlmTurnAnswer, type LlmTurnRequest, type LlmUsage } from "./llm.adaptor";
|
|
2
2
|
type AnthropicSource = {
|
|
3
3
|
type: "base64";
|
|
4
4
|
media_type: string;
|
|
@@ -17,7 +17,15 @@ type AnthropicContentBlock = {
|
|
|
17
17
|
type: "document";
|
|
18
18
|
source: AnthropicSource;
|
|
19
19
|
};
|
|
20
|
-
type
|
|
20
|
+
type AnthropicThinkingBlock = {
|
|
21
|
+
type: "thinking";
|
|
22
|
+
thinking: string;
|
|
23
|
+
signature: string;
|
|
24
|
+
} | {
|
|
25
|
+
type: "redacted_thinking";
|
|
26
|
+
data: string;
|
|
27
|
+
};
|
|
28
|
+
type AnthropicBlock = AnthropicContentBlock | AnthropicThinkingBlock | {
|
|
21
29
|
type: "tool_use";
|
|
22
30
|
id: string;
|
|
23
31
|
name: string;
|
|
@@ -37,17 +45,27 @@ interface AnthropicUsage {
|
|
|
37
45
|
cache_read_input_tokens?: number | null;
|
|
38
46
|
cache_creation_input_tokens?: number | null;
|
|
39
47
|
}
|
|
48
|
+
interface AnthropicAnswerBlock {
|
|
49
|
+
type?: string;
|
|
50
|
+
text?: string;
|
|
51
|
+
id?: string;
|
|
52
|
+
name?: string;
|
|
53
|
+
input?: Record<string, unknown>;
|
|
54
|
+
thinking?: string;
|
|
55
|
+
signature?: string;
|
|
56
|
+
data?: string;
|
|
57
|
+
}
|
|
58
|
+
interface AnthropicStopDetails {
|
|
59
|
+
category?: unknown;
|
|
60
|
+
explanation?: unknown;
|
|
61
|
+
}
|
|
40
62
|
interface AnthropicAnswer {
|
|
41
|
-
content?:
|
|
42
|
-
type?: string;
|
|
43
|
-
text?: string;
|
|
44
|
-
id?: string;
|
|
45
|
-
name?: string;
|
|
46
|
-
input?: Record<string, unknown>;
|
|
47
|
-
}[];
|
|
63
|
+
content?: AnthropicAnswerBlock[];
|
|
48
64
|
stop_reason?: string;
|
|
65
|
+
stop_details?: AnthropicStopDetails | null;
|
|
49
66
|
usage?: AnthropicUsage;
|
|
50
67
|
}
|
|
68
|
+
type AnthropicThinkingReplay = "drop" | "strip";
|
|
51
69
|
declare const AnthropicLlm_base: import("..").AdaptorCls<{}, {
|
|
52
70
|
llmOption: import("..").InjectInfo<"use", LlmOption, never, never>;
|
|
53
71
|
}>;
|
|
@@ -63,16 +81,23 @@ export declare class AnthropicLlm extends AnthropicLlm_base implements LlmAdapto
|
|
|
63
81
|
* 400, and no `AttachReader` can refuse an image before it gets here.
|
|
64
82
|
*/
|
|
65
83
|
static readonly imageTypes: Set<string>;
|
|
84
|
+
static readonly dialect = "anthropic";
|
|
85
|
+
/** The API refuses `thinking.block_binding` without it. */
|
|
86
|
+
static readonly thinkingBindingBeta = "thinking-binding-controls-2026-08-01";
|
|
66
87
|
get limits(): LlmLimits;
|
|
67
88
|
get accepts(): LlmAccepts;
|
|
68
89
|
chat(request: LlmTurnRequest, onDelta?: (delta: string) => void, signal?: AbortSignal): Promise<LlmTurnAnswer | null>;
|
|
90
|
+
static thinkingRetry(sent: AnthropicThinkingReplay | undefined, reason: string): AnthropicThinkingReplay | null;
|
|
91
|
+
static replaysThinking(messages: AnthropicMessage[]): boolean;
|
|
69
92
|
static refusal(host: string, response: Response): Promise<Error>;
|
|
70
93
|
/** The API answers a refusal as `{ error: { type, message } }`, and the sentence is the half worth printing. */
|
|
71
94
|
static reasonOf(response: Response): Promise<string>;
|
|
72
|
-
|
|
95
|
+
/** `thinking: "drop"` needs `thinkingBindingBeta` in the `anthropic-beta` header. */
|
|
96
|
+
static requestBody(model: string, request: LlmTurnRequest, { accepts, stream, maxTokens, thinking, }?: {
|
|
73
97
|
accepts?: LlmAccepts;
|
|
74
98
|
stream?: boolean;
|
|
75
99
|
maxTokens?: number;
|
|
100
|
+
thinking?: AnthropicThinkingReplay;
|
|
76
101
|
}): {
|
|
77
102
|
tools?: {
|
|
78
103
|
input_schema: Record<string, unknown>;
|
|
@@ -81,6 +106,12 @@ export declare class AnthropicLlm extends AnthropicLlm_base implements LlmAdapto
|
|
|
81
106
|
}[] | undefined;
|
|
82
107
|
system: string;
|
|
83
108
|
messages: AnthropicMessage[];
|
|
109
|
+
thinking?: {
|
|
110
|
+
type: string;
|
|
111
|
+
block_binding: {
|
|
112
|
+
prefix_mismatch_behavior: string;
|
|
113
|
+
};
|
|
114
|
+
} | undefined;
|
|
84
115
|
stream?: boolean | undefined;
|
|
85
116
|
model: string;
|
|
86
117
|
max_tokens: number;
|
|
@@ -90,6 +121,8 @@ export declare class AnthropicLlm extends AnthropicLlm_base implements LlmAdapto
|
|
|
90
121
|
/** The API takes strictly alternating roles, so tool results and the user's next ask merge into one user turn. */
|
|
91
122
|
static providerMessages(messages: AgentWireMessage[], accepts?: LlmAccepts): AnthropicMessage[];
|
|
92
123
|
static providerMessage(message: AgentWireMessage, accepts?: LlmAccepts): AnthropicMessage;
|
|
124
|
+
static replayed(message: AgentWireMessage): AnthropicBlock[] | null;
|
|
125
|
+
static providerContentOf(blocks: AnthropicAnswerBlock[]): AgentWireProviderContent | undefined;
|
|
93
126
|
static userContent(message: AgentWireMessage, accepts?: LlmAccepts): AnthropicBlock[];
|
|
94
127
|
/** A string while the call returned no file, so a transcript without one posts what it always did. */
|
|
95
128
|
static toolResult(result: AgentWireToolResult, accepts?: LlmAccepts): AnthropicBlock;
|
|
@@ -98,7 +131,7 @@ export declare class AnthropicLlm extends AnthropicLlm_base implements LlmAdapto
|
|
|
98
131
|
static typed(source: AnthropicSource, mimeType: string): AnthropicSource;
|
|
99
132
|
/** Bytes beat a URL: the default storage serves a path only the app can resolve, so the provider cannot fetch it. */
|
|
100
133
|
static sourceOf(attachment: AgentWireAttachment): AnthropicSource | null;
|
|
101
|
-
static turnAnswer(answer: AnthropicAnswer): LlmTurnAnswer;
|
|
134
|
+
static turnAnswer(answer: AnthropicAnswer, host?: string): LlmTurnAnswer;
|
|
102
135
|
static usageOf(usage: AnthropicUsage): LlmUsage;
|
|
103
136
|
static stopOf(reason: string | null | undefined, calls: number): LlmTurnAnswer["stop"];
|
|
104
137
|
static consumeStream(body: ReadableStream<Uint8Array>, onDelta: (delta: string) => void, host?: string, tools?: AgentWireTool[]): Promise<LlmTurnAnswer>;
|
|
@@ -64,6 +64,16 @@ export interface AgentWireMessage {
|
|
|
64
64
|
toolkits?: string[];
|
|
65
65
|
/** On a summary `agentService.loop` wrote: the tools its run had found with `findTools` and still listed. */
|
|
66
66
|
foundTools?: string[];
|
|
67
|
+
/** On an assistant message: what its provider must be sent back unchanged, which no other dialect reads. */
|
|
68
|
+
providerContent?: AgentWireProviderContent;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Anthropic's thinking blocks, signatures included, in answer order: replayed verbatim, the model keeps its reasoning
|
|
72
|
+
* across tool rounds; edited, the API refuses the turn. Store it with the message as it came.
|
|
73
|
+
*/
|
|
74
|
+
export interface AgentWireProviderContent {
|
|
75
|
+
dialect: string;
|
|
76
|
+
content: unknown[];
|
|
67
77
|
}
|
|
68
78
|
export interface AgentWireTool {
|
|
69
79
|
name: string;
|
|
@@ -100,6 +110,7 @@ export interface LlmTurnAnswer {
|
|
|
100
110
|
usage?: LlmUsage;
|
|
101
111
|
/** The model that answered, as the adaptor named it to the provider. */
|
|
102
112
|
model?: string;
|
|
113
|
+
providerContent?: AgentWireProviderContent;
|
|
103
114
|
}
|
|
104
115
|
/** `inputTokens` is the whole prompt, cached part included; `cachedTokens` is the share billed at the cache rate. */
|
|
105
116
|
export interface LlmUsage {
|
|
@@ -13,4 +13,9 @@ export declare class LlmOverflow {
|
|
|
13
13
|
static match(reason: string): LlmOverflowFacts | null;
|
|
14
14
|
/** `contextOverflow` when the prompt did not fit (the chat compacts and asks again), else `llmRequestFailed`. */
|
|
15
15
|
static refusal(host: string, status: number, reason: string): Error;
|
|
16
|
+
/**
|
|
17
|
+
* A model that declined on a successful response (Anthropic's `stop_reason: "refusal"`), its partial answer
|
|
18
|
+
* discarded. `category` is the provider's policy class, kept for an app to branch on; `explanation` stays here.
|
|
19
|
+
*/
|
|
20
|
+
static declined(host: string, category?: unknown, explanation?: unknown): Error;
|
|
16
21
|
}
|
|
@@ -11,6 +11,7 @@ declare const AgentEndpoint_base: import("./endpoint.d.ts").EndpointCls<import("
|
|
|
11
11
|
agentService: import("akanjs/service").AgentService;
|
|
12
12
|
}, ["messages", "tools", "context", "instructions"], [arg: unknown[], arg: unknown[], arg: unknown[], arg?: string | null | undefined], [arg: Bun.BunRequest<string>, arg: {} | null, arg: string | null], [arg: unknown[], arg: unknown[], arg: unknown[], arg: string | undefined], typeof AgentTurn, AgentTurn, Promise<AgentTurn | {
|
|
13
13
|
limits?: import("akanjs/service").LlmLimits | undefined;
|
|
14
|
+
providerContent?: import("akanjs/service").AgentWireProviderContent | undefined;
|
|
14
15
|
model?: string | undefined;
|
|
15
16
|
usage?: import("akanjs/service").LlmUsage | undefined;
|
|
16
17
|
text: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Dayjs, type EnumInstance, type PromiseOrObject } from "akanjs/base";
|
|
2
|
-
import type { ConstantFieldType, ConstantFieldTypeInput, DocumentModel, FieldToValue, ParamFieldType, PlainTypeToFieldType, PurifiedModel, ServerArgModel, UploadableClientArg } from "akanjs/constant";
|
|
2
|
+
import type { ConstantFieldType, ConstantFieldTypeInput, DocumentModel, FieldToValue, ParamFieldType, PlainTypeToFieldType, PurifiedModel, ServerArgModel, ServerReturnModel, UploadableClientArg } from "akanjs/constant";
|
|
3
3
|
import type { ServiceModel } from "akanjs/service";
|
|
4
4
|
import type { InternalArgCls } from "./internalArg.d.ts";
|
|
5
5
|
import type { ArgType, SignalOption, SrvMap } from "./types.d.ts";
|
|
@@ -54,7 +54,7 @@ export declare class EndpointInfo<ReqType extends EndpointType = EndpointType, S
|
|
|
54
54
|
with<ArgType, Optional extends boolean = false>(argRef: InternalArgCls<ArgType>, option?: InternalArgProps<Optional>): EndpointInfo<ReqType, Srvs, ArgNames, Args, [...InternalArgs, arg: NonNullable<ArgType> | (Optional extends true ? null : never)], ServerArgs, Returns, ClientReturns, ServerReturns, Nullable>;
|
|
55
55
|
_addRoomArgs(args: ArgInfo<EndpointArgProps<boolean>>[]): this;
|
|
56
56
|
_addInternalArgs(args: InternalArgInfo<boolean>[]): this;
|
|
57
|
-
exec<ExecFn extends (this: Srvs, ...args: [...ServerArgs, ...InternalArgs]) => ReqType extends "pubsub" ? Promise<void> | void : PromiseOrObject<
|
|
57
|
+
exec<ExecFn extends (this: Srvs, ...args: [...ServerArgs, ...InternalArgs]) => ReqType extends "pubsub" ? Promise<void> | void : PromiseOrObject<ServerReturnModel<FieldToValue<Returns>> | (Nullable extends true ? null | undefined : never)>>(execFn: ExecFn): EndpointInfo<ReqType, Srvs, ArgNames, Args, InternalArgs, ServerArgs, Returns, FieldToValue<Returns>, ReturnType<ExecFn>, Nullable>;
|
|
58
58
|
getPath(key: string): string;
|
|
59
59
|
/** The route the server mounts, below the global prefix; the fetch client is handed it to call the same one. */
|
|
60
60
|
getRoutePath(key: string, defaultPrefix?: string): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Any, type FIELD_META, type PromiseOrObject } from "akanjs/base";
|
|
2
|
-
import type { ConstantCls, ConstantField, ConstantFieldTypeInput,
|
|
2
|
+
import type { ConstantCls, ConstantField, ConstantFieldTypeInput, FieldObject, FieldToValue, PlainTypeToFieldType, ServerReturnModel } from "akanjs/constant";
|
|
3
3
|
import type { AkanJob, ServiceModel } from "akanjs/service";
|
|
4
4
|
import { type ArgInfo, type InternalArgInfo, type ReturnInfo } from "./endpointInfo.d.ts";
|
|
5
5
|
import type { InternalArgCls } from "./internalArg.d.ts";
|
|
@@ -23,7 +23,7 @@ export declare class InternalInfo<ReqType extends InternalType = InternalType, S
|
|
|
23
23
|
constructor(type: ReqType, returnRef: Returns, signalOption?: SignalOption<Returns, Nullable>);
|
|
24
24
|
msg<ExplicitType, Arg extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, Nullable extends boolean = false, _FieldToValue = FieldToValue<Arg>>(name: string, arg: Arg, option?: InternalArgProps<Nullable>): InternalInfo<ReqType, Srvs, [...Args, arg: _FieldToValue | (Nullable extends true ? undefined : never)], InternalArgs, DefaultArgs, Returns, ServerReturns, Nullable>;
|
|
25
25
|
with<ArgType, Optional extends boolean = false>(argRef: InternalArgCls<ArgType>, option?: InternalArgProps<Optional>): InternalInfo<ReqType, Srvs, Args, [...InternalArgs, arg: NonNullable<ArgType> | (Optional extends true ? null : ReqType extends "resolveField" ? null : never)], DefaultArgs, Returns, ServerReturns, Nullable>;
|
|
26
|
-
exec<ExecReturn extends ReqType extends "process" | "resolveField" ? PromiseOrObject<
|
|
26
|
+
exec<ExecReturn extends ReqType extends "process" | "resolveField" ? PromiseOrObject<ServerReturnModel<FieldToValue<Returns>> | (Nullable extends true ? null : never)> : PromiseOrObject<void>>(execFn: (this: Srvs, ...args: [...Args, ...DefaultArgs, ...InternalArgs]) => ExecReturn): InternalInfo<ReqType, Srvs, Args, InternalArgs, DefaultArgs, Returns, ExecReturn, Nullable>;
|
|
27
27
|
}
|
|
28
28
|
type InternalInfoEmptyParts = {
|
|
29
29
|
reqType: never;
|