@usestratus/sdk 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/azure/chat-completions-model.d.ts +23 -0
- package/dist/azure/chat-completions-model.d.ts.map +1 -0
- package/dist/azure/chat-completions-model.js +293 -0
- package/dist/azure/chat-completions-model.js.map +1 -0
- package/dist/azure/endpoint.d.ts +18 -0
- package/dist/azure/endpoint.d.ts.map +1 -0
- package/dist/azure/endpoint.js +57 -0
- package/dist/azure/endpoint.js.map +1 -0
- package/dist/azure/index.d.ts +5 -0
- package/dist/azure/index.d.ts.map +1 -0
- package/dist/azure/index.js +3 -0
- package/dist/azure/index.js.map +1 -0
- package/dist/azure/responses-model.d.ts +25 -0
- package/dist/azure/responses-model.d.ts.map +1 -0
- package/dist/azure/responses-model.js +557 -0
- package/dist/azure/responses-model.js.map +1 -0
- package/dist/azure/sse-parser.d.ts +2 -0
- package/dist/azure/sse-parser.d.ts.map +1 -0
- package/dist/azure/sse-parser.js +39 -0
- package/dist/azure/sse-parser.js.map +1 -0
- package/dist/core/agent.d.ts +47 -0
- package/dist/core/agent.d.ts.map +1 -0
- package/dist/core/agent.js +74 -0
- package/dist/core/agent.js.map +1 -0
- package/dist/core/builtin-tools.d.ts +41 -0
- package/dist/core/builtin-tools.d.ts.map +1 -0
- package/dist/core/builtin-tools.js +80 -0
- package/dist/core/builtin-tools.js.map +1 -0
- package/dist/core/codemode/executor.d.ts +62 -0
- package/dist/core/codemode/executor.d.ts.map +1 -0
- package/dist/core/codemode/executor.js +188 -0
- package/dist/core/codemode/executor.js.map +1 -0
- package/dist/core/codemode/index.d.ts +62 -0
- package/dist/core/codemode/index.d.ts.map +1 -0
- package/dist/core/codemode/index.js +104 -0
- package/dist/core/codemode/index.js.map +1 -0
- package/dist/core/codemode/types.d.ts +24 -0
- package/dist/core/codemode/types.d.ts.map +1 -0
- package/dist/core/codemode/types.js +405 -0
- package/dist/core/codemode/types.js.map +1 -0
- package/dist/core/context.d.ts +10 -0
- package/dist/core/context.d.ts.map +1 -0
- package/dist/core/context.js +32 -0
- package/dist/core/context.js.map +1 -0
- package/dist/core/cost.d.ts +9 -0
- package/dist/core/cost.d.ts.map +1 -0
- package/dist/core/cost.js +14 -0
- package/dist/core/cost.js.map +1 -0
- package/dist/core/errors.d.ts +48 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +85 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/guardrails.d.ts +39 -0
- package/dist/core/guardrails.d.ts.map +1 -0
- package/dist/core/guardrails.js +40 -0
- package/dist/core/guardrails.js.map +1 -0
- package/dist/core/handoff.d.ts +35 -0
- package/dist/core/handoff.d.ts.map +1 -0
- package/dist/core/handoff.js +39 -0
- package/dist/core/handoff.js.map +1 -0
- package/dist/core/hooks.d.ts +154 -0
- package/dist/core/hooks.d.ts.map +1 -0
- package/dist/core/hooks.js +2 -0
- package/dist/core/hooks.js.map +1 -0
- package/dist/core/hosted-tool.d.ts +11 -0
- package/dist/core/hosted-tool.d.ts.map +1 -0
- package/dist/core/hosted-tool.js +7 -0
- package/dist/core/hosted-tool.js.map +1 -0
- package/dist/core/index.d.ts +35 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +18 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/model.d.ts +56 -0
- package/dist/core/model.d.ts.map +1 -0
- package/dist/core/model.js +2 -0
- package/dist/core/model.js.map +1 -0
- package/dist/core/result.d.ts +34 -0
- package/dist/core/result.d.ts.map +1 -0
- package/dist/core/result.js +31 -0
- package/dist/core/result.js.map +1 -0
- package/dist/core/run.d.ts +52 -0
- package/dist/core/run.d.ts.map +1 -0
- package/dist/core/run.js +972 -0
- package/dist/core/run.js.map +1 -0
- package/dist/core/session.d.ts +77 -0
- package/dist/core/session.d.ts.map +1 -0
- package/dist/core/session.js +160 -0
- package/dist/core/session.js.map +1 -0
- package/dist/core/subagent.d.ts +30 -0
- package/dist/core/subagent.d.ts.map +1 -0
- package/dist/core/subagent.js +52 -0
- package/dist/core/subagent.js.map +1 -0
- package/dist/core/todo.d.ts +56 -0
- package/dist/core/todo.d.ts.map +1 -0
- package/dist/core/todo.js +76 -0
- package/dist/core/todo.js.map +1 -0
- package/dist/core/tool.d.ts +26 -0
- package/dist/core/tool.d.ts.map +1 -0
- package/dist/core/tool.js +23 -0
- package/dist/core/tool.js.map +1 -0
- package/dist/core/tracing.d.ts +31 -0
- package/dist/core/tracing.d.ts.map +1 -0
- package/dist/core/tracing.js +62 -0
- package/dist/core/tracing.js.map +1 -0
- package/dist/core/types.d.ts +106 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +2 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/utils/zod.d.ts +5 -0
- package/dist/core/utils/zod.d.ts.map +1 -0
- package/dist/core/utils/zod.js +7 -0
- package/dist/core/utils/zod.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/package.json +36 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { ChatMessage, HostedToolDefinition, ModelSettings, ResponseFormat, ToolCall, ToolDefinition } from "./types";
|
|
2
|
+
export interface ModelRequest {
|
|
3
|
+
messages: ChatMessage[];
|
|
4
|
+
tools?: (ToolDefinition | HostedToolDefinition)[];
|
|
5
|
+
modelSettings?: ModelSettings;
|
|
6
|
+
responseFormat?: ResponseFormat;
|
|
7
|
+
previousResponseId?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface UsageInfo {
|
|
10
|
+
promptTokens: number;
|
|
11
|
+
completionTokens: number;
|
|
12
|
+
totalTokens: number;
|
|
13
|
+
cacheReadTokens?: number;
|
|
14
|
+
cacheCreationTokens?: number;
|
|
15
|
+
reasoningTokens?: number;
|
|
16
|
+
}
|
|
17
|
+
export type FinishReason = "stop" | "length" | "tool_calls" | "content_filter";
|
|
18
|
+
export interface ModelResponse {
|
|
19
|
+
content: string | null;
|
|
20
|
+
toolCalls: ToolCall[];
|
|
21
|
+
usage?: UsageInfo;
|
|
22
|
+
finishReason?: FinishReason;
|
|
23
|
+
responseId?: string;
|
|
24
|
+
}
|
|
25
|
+
export type StreamEvent = {
|
|
26
|
+
type: "content_delta";
|
|
27
|
+
content: string;
|
|
28
|
+
} | {
|
|
29
|
+
type: "tool_call_start";
|
|
30
|
+
toolCall: {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
};
|
|
34
|
+
} | {
|
|
35
|
+
type: "tool_call_delta";
|
|
36
|
+
toolCallId: string;
|
|
37
|
+
arguments: string;
|
|
38
|
+
} | {
|
|
39
|
+
type: "tool_call_done";
|
|
40
|
+
toolCallId: string;
|
|
41
|
+
} | {
|
|
42
|
+
type: "hosted_tool_call";
|
|
43
|
+
toolType: string;
|
|
44
|
+
status: "in_progress" | "completed" | "searching" | "generating" | "interpreting";
|
|
45
|
+
} | {
|
|
46
|
+
type: "done";
|
|
47
|
+
response: ModelResponse;
|
|
48
|
+
};
|
|
49
|
+
export interface ModelRequestOptions {
|
|
50
|
+
signal?: AbortSignal;
|
|
51
|
+
}
|
|
52
|
+
export interface Model {
|
|
53
|
+
getResponse(request: ModelRequest, options?: ModelRequestOptions): Promise<ModelResponse>;
|
|
54
|
+
getStreamedResponse(request: ModelRequest, options?: ModelRequestOptions): AsyncIterable<StreamEvent>;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/core/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,WAAW,EACX,oBAAoB,EACpB,aAAa,EACb,cAAc,EACd,QAAQ,EACR,cAAc,EACd,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,YAAY;IAC5B,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,KAAK,CAAC,EAA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AAG,YAAY,GAAG,cAAc,CAAC;CACjF,GACD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,aAAa,CAAA;CAAE,CAAC;AAE7C,MAAM,WAAW,mBAAmB;IACnC,MAAM,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,KAAK;IACrB,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAC1F,mBAAmB,CAClB,OAAO,EAAE,YAAY,EACrB,OAAO,CAAC,EAAE,mBAAmB,GAC3B,aAAa,CAAC,WAAW,CAAC,CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/core/model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Agent } from "./agent";
|
|
2
|
+
import type { GuardrailRunResult } from "./guardrails";
|
|
3
|
+
import type { FinishReason, UsageInfo } from "./model";
|
|
4
|
+
import type { ChatMessage } from "./types";
|
|
5
|
+
export interface RunResultOptions<TOutput = undefined> {
|
|
6
|
+
output: string;
|
|
7
|
+
messages: ChatMessage[];
|
|
8
|
+
usage: UsageInfo;
|
|
9
|
+
lastAgent: Agent<any, any>;
|
|
10
|
+
finalOutput?: TOutput;
|
|
11
|
+
finishReason?: FinishReason;
|
|
12
|
+
numTurns?: number;
|
|
13
|
+
totalCostUsd?: number;
|
|
14
|
+
responseId?: string;
|
|
15
|
+
inputGuardrailResults?: GuardrailRunResult[];
|
|
16
|
+
outputGuardrailResults?: GuardrailRunResult[];
|
|
17
|
+
}
|
|
18
|
+
export declare class RunResult<TOutput = undefined> {
|
|
19
|
+
readonly output: string;
|
|
20
|
+
readonly finalOutput: TOutput extends undefined ? undefined : TOutput;
|
|
21
|
+
readonly messages: ChatMessage[];
|
|
22
|
+
readonly usage: UsageInfo;
|
|
23
|
+
readonly lastAgent: Agent<any, any>;
|
|
24
|
+
readonly finishReason?: FinishReason;
|
|
25
|
+
readonly numTurns: number;
|
|
26
|
+
readonly totalCostUsd: number;
|
|
27
|
+
readonly responseId?: string;
|
|
28
|
+
readonly inputGuardrailResults: readonly GuardrailRunResult[];
|
|
29
|
+
readonly outputGuardrailResults: readonly GuardrailRunResult[];
|
|
30
|
+
constructor(opts: RunResultOptions<TOutput>);
|
|
31
|
+
/** Convert the result's messages into a format suitable for chaining as input to another run */
|
|
32
|
+
toInputList(): ChatMessage[];
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/core/result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,WAAW,gBAAgB,CAAC,OAAO,GAAG,SAAS;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,KAAK,EAAE,SAAS,CAAC;IACjB,SAAS,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qBAAqB,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC7C,sBAAsB,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAC9C;AAED,qBAAa,SAAS,CAAC,OAAO,GAAG,SAAS;IACzC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,OAAO,SAAS,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IACtE,QAAQ,CAAC,QAAQ,EAAE,WAAW,EAAE,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACpC,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,qBAAqB,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAC9D,QAAQ,CAAC,sBAAsB,EAAE,SAAS,kBAAkB,EAAE,CAAC;gBAEnD,IAAI,EAAE,gBAAgB,CAAC,OAAO,CAAC;IAc3C,gGAAgG;IAChG,WAAW,IAAI,WAAW,EAAE;CAG5B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export class RunResult {
|
|
2
|
+
output;
|
|
3
|
+
finalOutput;
|
|
4
|
+
messages;
|
|
5
|
+
usage;
|
|
6
|
+
lastAgent;
|
|
7
|
+
finishReason;
|
|
8
|
+
numTurns;
|
|
9
|
+
totalCostUsd;
|
|
10
|
+
responseId;
|
|
11
|
+
inputGuardrailResults;
|
|
12
|
+
outputGuardrailResults;
|
|
13
|
+
constructor(opts) {
|
|
14
|
+
this.output = opts.output;
|
|
15
|
+
this.messages = opts.messages;
|
|
16
|
+
this.usage = opts.usage;
|
|
17
|
+
this.lastAgent = opts.lastAgent;
|
|
18
|
+
this.finalOutput = opts.finalOutput;
|
|
19
|
+
this.finishReason = opts.finishReason;
|
|
20
|
+
this.numTurns = opts.numTurns ?? 0;
|
|
21
|
+
this.totalCostUsd = opts.totalCostUsd ?? 0;
|
|
22
|
+
this.responseId = opts.responseId;
|
|
23
|
+
this.inputGuardrailResults = opts.inputGuardrailResults ?? [];
|
|
24
|
+
this.outputGuardrailResults = opts.outputGuardrailResults ?? [];
|
|
25
|
+
}
|
|
26
|
+
/** Convert the result's messages into a format suitable for chaining as input to another run */
|
|
27
|
+
toInputList() {
|
|
28
|
+
return this.messages.filter((m) => m.role !== "system");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.js","sourceRoot":"","sources":["../../src/core/result.ts"],"names":[],"mappings":"AAmBA,MAAM,OAAO,SAAS;IACZ,MAAM,CAAS;IACf,WAAW,CAAkD;IAC7D,QAAQ,CAAgB;IACxB,KAAK,CAAY;IACjB,SAAS,CAAkB;IAC3B,YAAY,CAAgB;IAC5B,QAAQ,CAAS;IACjB,YAAY,CAAS;IACrB,UAAU,CAAU;IACpB,qBAAqB,CAAgC;IACrD,sBAAsB,CAAgC;IAE/D,YAAY,IAA+B;QAC1C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAA8D,CAAC;QACvF,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QACtC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC;QACnC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,qBAAqB,IAAI,EAAE,CAAC;QAC9D,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,sBAAsB,IAAI,EAAE,CAAC;IACjE,CAAC;IAED,gGAAgG;IAChG,WAAW;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;IACzD,CAAC;CACD"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Agent } from "./agent";
|
|
2
|
+
import type { CostEstimator } from "./cost";
|
|
3
|
+
import type { ToolInputGuardrail, ToolOutputGuardrail } from "./guardrails";
|
|
4
|
+
import type { RunHooks } from "./hooks";
|
|
5
|
+
import type { Model, ModelRequest, StreamEvent } from "./model";
|
|
6
|
+
import { RunResult } from "./result";
|
|
7
|
+
import type { ChatMessage } from "./types";
|
|
8
|
+
export type ToolErrorFormatter = (toolName: string, error: unknown) => string;
|
|
9
|
+
export type CallModelInputFilter<TContext> = (params: {
|
|
10
|
+
agent: Agent<TContext, any>;
|
|
11
|
+
request: ModelRequest;
|
|
12
|
+
context: TContext;
|
|
13
|
+
}) => ModelRequest;
|
|
14
|
+
export type MaxTurnsErrorHandler<TContext, TOutput> = (params: {
|
|
15
|
+
agent: Agent<TContext, any>;
|
|
16
|
+
messages: ChatMessage[];
|
|
17
|
+
context: TContext;
|
|
18
|
+
maxTurns: number;
|
|
19
|
+
}) => RunResult<TOutput> | Promise<RunResult<TOutput>>;
|
|
20
|
+
export interface RunOptions<TContext, TOutput = undefined> {
|
|
21
|
+
context?: TContext;
|
|
22
|
+
model?: Model;
|
|
23
|
+
maxTurns?: number;
|
|
24
|
+
signal?: AbortSignal;
|
|
25
|
+
costEstimator?: CostEstimator;
|
|
26
|
+
maxBudgetUsd?: number;
|
|
27
|
+
/** Run-level hooks that fire across all agents */
|
|
28
|
+
runHooks?: RunHooks<TContext>;
|
|
29
|
+
/** Custom formatter for tool error messages sent to the LLM */
|
|
30
|
+
toolErrorFormatter?: ToolErrorFormatter;
|
|
31
|
+
/** Transform model requests before they're sent to the API */
|
|
32
|
+
callModelInputFilter?: CallModelInputFilter<TContext>;
|
|
33
|
+
/** Handle max_turns gracefully instead of throwing */
|
|
34
|
+
errorHandlers?: {
|
|
35
|
+
maxTurns?: MaxTurnsErrorHandler<TContext, TOutput>;
|
|
36
|
+
};
|
|
37
|
+
/** Tool guardrails that run before tool execution */
|
|
38
|
+
toolInputGuardrails?: ToolInputGuardrail<TContext>[];
|
|
39
|
+
/** Tool guardrails that run after tool execution */
|
|
40
|
+
toolOutputGuardrails?: ToolOutputGuardrail<TContext>[];
|
|
41
|
+
/** Reset tool_choice to "auto" after the first LLM call to prevent infinite loops */
|
|
42
|
+
resetToolChoice?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export declare function run<TContext, TOutput = undefined>(agent: Agent<TContext, TOutput>, input: string | ChatMessage[], options?: RunOptions<TContext, TOutput>): Promise<RunResult<TOutput>>;
|
|
45
|
+
export interface StreamOptions<TContext, TOutput = undefined> extends RunOptions<TContext, TOutput> {
|
|
46
|
+
}
|
|
47
|
+
export interface StreamedRunResult<TOutput = undefined> {
|
|
48
|
+
stream: AsyncGenerator<StreamEvent>;
|
|
49
|
+
result: Promise<RunResult<TOutput>>;
|
|
50
|
+
}
|
|
51
|
+
export declare function stream<TContext, TOutput = undefined>(agent: Agent<TContext, TOutput>, input: string | ChatMessage[], options?: StreamOptions<TContext, TOutput>): StreamedRunResult<TOutput>;
|
|
52
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/core/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAe5C,O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