@usine/agents 0.3.0 → 0.5.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/LICENSE +661 -21
- package/README.md +100 -30
- package/dist/child-host/child-host.d.ts +90 -0
- package/dist/child-host/child-host.d.ts.map +1 -0
- package/dist/child-host/child-host.js +119 -0
- package/dist/child-host/child-host.js.map +1 -0
- package/dist/child-host/command.d.ts +22 -0
- package/dist/child-host/command.d.ts.map +1 -0
- package/dist/child-host/command.js +43 -0
- package/dist/child-host/command.js.map +1 -0
- package/dist/openai-prices.d.ts +8 -0
- package/dist/openai-prices.d.ts.map +1 -0
- package/dist/openai-prices.js +28 -0
- package/dist/openai-prices.js.map +1 -0
- package/dist/pi/authentication.d.ts +11 -2
- package/dist/pi/authentication.d.ts.map +1 -1
- package/dist/pi/authentication.js +15 -2
- package/dist/pi/authentication.js.map +1 -1
- package/dist/pi/children.d.ts +1 -4
- package/dist/pi/children.d.ts.map +1 -1
- package/dist/pi/children.js +1 -4
- package/dist/pi/children.js.map +1 -1
- package/dist/pi/claude/claude.d.ts +10 -0
- package/dist/pi/claude/claude.d.ts.map +1 -0
- package/dist/pi/claude/claude.js +610 -0
- package/dist/pi/claude/claude.js.map +1 -0
- package/dist/pi/claude/codec.d.ts +67 -0
- package/dist/pi/claude/codec.d.ts.map +1 -0
- package/dist/pi/claude/codec.js +140 -0
- package/dist/pi/claude/codec.js.map +1 -0
- package/dist/pi/{claude.d.ts → claude/sdk.d.ts} +11 -10
- package/dist/pi/claude/sdk.d.ts.map +1 -0
- package/dist/pi/claude/sdk.js +63 -0
- package/dist/pi/claude/sdk.js.map +1 -0
- package/dist/pi/codex/account.d.ts +11 -5
- package/dist/pi/codex/account.d.ts.map +1 -1
- package/dist/pi/codex/account.js +23 -6
- package/dist/pi/codex/account.js.map +1 -1
- package/dist/pi/codex/app-server.d.ts +19 -7
- package/dist/pi/codex/app-server.d.ts.map +1 -1
- package/dist/pi/codex/app-server.js +41 -36
- package/dist/pi/codex/app-server.js.map +1 -1
- package/dist/pi/codex/codec.d.ts +10 -84
- package/dist/pi/codex/codec.d.ts.map +1 -1
- package/dist/pi/codex/codec.js +18 -80
- package/dist/pi/codex/codec.js.map +1 -1
- package/dist/pi/codex/codex.d.ts +0 -1
- package/dist/pi/codex/codex.d.ts.map +1 -1
- package/dist/pi/codex/codex.js +89 -18
- package/dist/pi/codex/codex.js.map +1 -1
- package/dist/pi/conversation.d.ts +33 -12
- package/dist/pi/conversation.d.ts.map +1 -1
- package/dist/pi/conversation.js +58 -18
- package/dist/pi/conversation.js.map +1 -1
- package/dist/pi/pi.d.ts +1 -4
- package/dist/pi/pi.d.ts.map +1 -1
- package/dist/pi/pi.js +29 -175
- package/dist/pi/pi.js.map +1 -1
- package/dist/pi/sdk.d.ts +18 -15
- package/dist/pi/sdk.d.ts.map +1 -1
- package/dist/pi/sdk.js +45 -55
- package/dist/pi/sdk.js.map +1 -1
- package/dist/pi/session.d.ts +13 -14
- package/dist/pi/session.d.ts.map +1 -1
- package/dist/pi/session.js +63 -24
- package/dist/pi/session.js.map +1 -1
- package/dist/pi/turns.d.ts +7 -7
- package/dist/pi/turns.d.ts.map +1 -1
- package/dist/pi/turns.js +22 -9
- package/dist/pi/turns.js.map +1 -1
- package/dist/pi/usage.d.ts +36 -22
- package/dist/pi/usage.d.ts.map +1 -1
- package/dist/pi/usage.js +79 -33
- package/dist/pi/usage.js.map +1 -1
- package/dist/preflight/command.d.ts +16 -4
- package/dist/preflight/command.d.ts.map +1 -1
- package/dist/preflight/command.js +29 -27
- package/dist/preflight/command.js.map +1 -1
- package/dist/preflight/preflight.d.ts +19 -7
- package/dist/preflight/preflight.d.ts.map +1 -1
- package/dist/preflight/preflight.js +73 -32
- package/dist/preflight/preflight.js.map +1 -1
- package/dist/prompt.d.ts +12 -9
- package/dist/prompt.d.ts.map +1 -1
- package/dist/prompt.js +33 -4
- package/dist/prompt.js.map +1 -1
- package/dist/protocol/codex.d.ts +122 -7
- package/dist/protocol/codex.d.ts.map +1 -1
- package/dist/protocol/codex.js +109 -1
- package/dist/protocol/codex.js.map +1 -1
- package/dist/protocol/count.d.ts +4 -0
- package/dist/protocol/count.d.ts.map +1 -0
- package/dist/protocol/count.js +4 -0
- package/dist/protocol/count.js.map +1 -0
- package/dist/runtime.d.ts +110 -55
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +114 -27
- package/dist/runtime.js.map +1 -1
- package/package.json +35 -19
- package/dist/pi/claude.d.ts.map +0 -1
- package/dist/pi/claude.js +0 -302
- package/dist/pi/claude.js.map +0 -1
- package/dist/pi/live.d.ts +0 -4
- package/dist/pi/live.d.ts.map +0 -1
- package/dist/pi/live.js +0 -11
- package/dist/pi/live.js.map +0 -1
- package/dist/pi/subagents.d.ts +0 -29
- package/dist/pi/subagents.d.ts.map +0 -1
- package/dist/pi/subagents.js +0 -120
- package/dist/pi/subagents.js.map +0 -1
- package/dist/pi/thinking.d.ts +0 -8
- package/dist/pi/thinking.d.ts.map +0 -1
- package/dist/pi/thinking.js +0 -15
- package/dist/pi/thinking.js.map +0 -1
package/dist/pi/usage.js
CHANGED
|
@@ -1,29 +1,47 @@
|
|
|
1
|
-
import { TokenCount } from "@usine/core/agent/session";
|
|
2
|
-
import { Option, Schema } from "effect";
|
|
3
|
-
|
|
1
|
+
import { TokenBreakdown, TokenCount, UsdAmount } from "@usine/core/agent/session";
|
|
2
|
+
import { flow, Option, Schema } from "effect";
|
|
3
|
+
import { UsageCount } from "../protocol/count.js";
|
|
4
|
+
const Dollars = Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0));
|
|
4
5
|
const PiUsage = Schema.Struct({
|
|
5
6
|
role: Schema.Literal("assistant"),
|
|
6
|
-
usage: Schema.Struct({
|
|
7
|
+
usage: Schema.Struct({
|
|
8
|
+
input: UsageCount,
|
|
9
|
+
output: UsageCount,
|
|
10
|
+
cacheWrite: UsageCount,
|
|
11
|
+
cost: Schema.optionalKey(Schema.Struct({ total: Dollars })),
|
|
12
|
+
}),
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* Returns the usage of one completed Pi assistant message: output plus uncached input, where cache
|
|
16
|
+
* writes count and cache reads do not, and the dollar cost if Pi reports one.
|
|
17
|
+
*/
|
|
18
|
+
export const piMessageUsage = flow(Schema.decodeUnknownOption(PiUsage), Option.map(({ usage }) => ({
|
|
19
|
+
totalTokens: TokenCount.make(usage.output + usage.input + usage.cacheWrite),
|
|
20
|
+
costUsd: Option.map(Option.fromNullishOr(usage.cost), ({ total }) => UsdAmount.make(total)),
|
|
21
|
+
})));
|
|
22
|
+
/** Adds a message's usage to a session total; the cost is `Some` once any message has a cost. */
|
|
23
|
+
export const addUsage = (total, message) => ({
|
|
24
|
+
totalTokens: TokenCount.make(total.totalTokens + message.totalTokens),
|
|
25
|
+
costUsd: Option.isNone(message.costUsd)
|
|
26
|
+
? total.costUsd
|
|
27
|
+
: Option.some(UsdAmount.make(Option.getOrElse(total.costUsd, () => 0) + message.costUsd.value)),
|
|
7
28
|
});
|
|
8
|
-
/** Pi assistant usage is per completed message, including cache tokens. */
|
|
9
|
-
export const piMessageTokens = Schema.decodeUnknownOption(PiUsage);
|
|
10
29
|
const ClaudeAssistantUsage = Schema.Struct({
|
|
11
30
|
type: Schema.Literal("assistant"),
|
|
12
31
|
message: Schema.Struct({
|
|
13
32
|
id: Schema.NonEmptyString,
|
|
14
33
|
usage: Schema.Struct({
|
|
15
|
-
input_tokens:
|
|
16
|
-
output_tokens:
|
|
17
|
-
|
|
18
|
-
cache_creation_input_tokens: Schema.optionalKey(Schema.NullOr(Count)),
|
|
34
|
+
input_tokens: UsageCount,
|
|
35
|
+
output_tokens: UsageCount,
|
|
36
|
+
cache_creation_input_tokens: Schema.optionalKey(Schema.NullOr(UsageCount)),
|
|
19
37
|
}),
|
|
20
38
|
}),
|
|
21
39
|
});
|
|
22
40
|
const ClaudeModelUsage = Schema.Struct({
|
|
23
|
-
inputTokens:
|
|
24
|
-
outputTokens:
|
|
25
|
-
|
|
26
|
-
|
|
41
|
+
inputTokens: UsageCount,
|
|
42
|
+
outputTokens: UsageCount,
|
|
43
|
+
cacheCreationInputTokens: UsageCount,
|
|
44
|
+
costUSD: Schema.optionalKey(Dollars),
|
|
27
45
|
});
|
|
28
46
|
const ClaudeResultUsage = Schema.Struct({
|
|
29
47
|
type: Schema.Literal("result"),
|
|
@@ -31,42 +49,70 @@ const ClaudeResultUsage = Schema.Struct({
|
|
|
31
49
|
});
|
|
32
50
|
const decodeAssistant = Schema.decodeUnknownOption(ClaudeAssistantUsage);
|
|
33
51
|
const decodeResult = Schema.decodeUnknownOption(ClaudeResultUsage);
|
|
34
|
-
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
52
|
+
/**
|
|
53
|
+
* Returns a Claude token meter: live message usage between results, reconciled with the cumulative
|
|
54
|
+
* `modelUsage` at each result. Consumption is output plus input plus cache creation, because the
|
|
55
|
+
* SDK's input counts exclude cache reads and writes; repeated blocks with one message ID count only
|
|
56
|
+
* their added tokens. The cost is the SDK's `costUSD` estimate and changes only at a result.
|
|
38
57
|
*/
|
|
39
58
|
export const claudeTokenMeter = () => {
|
|
40
59
|
let total = 0;
|
|
60
|
+
let cost = Option.none();
|
|
41
61
|
const messages = new Map();
|
|
42
62
|
return (message) => {
|
|
43
63
|
const assistant = decodeAssistant(message);
|
|
44
64
|
if (Option.isSome(assistant)) {
|
|
45
65
|
const { id, usage } = assistant.value.message;
|
|
46
|
-
const consumed = usage.input_tokens +
|
|
47
|
-
usage.output_tokens +
|
|
48
|
-
(usage.cache_read_input_tokens ?? 0) +
|
|
49
|
-
(usage.cache_creation_input_tokens ?? 0);
|
|
66
|
+
const consumed = usage.output_tokens + usage.input_tokens + (usage.cache_creation_input_tokens ?? 0);
|
|
50
67
|
const previous = messages.get(id) ?? 0;
|
|
51
68
|
total += Math.max(0, consumed - previous);
|
|
52
69
|
messages.set(id, Math.max(previous, consumed));
|
|
53
|
-
return Option.some(TokenCount.make(total));
|
|
70
|
+
return Option.some({ totalTokens: TokenCount.make(total), costUsd: cost });
|
|
54
71
|
}
|
|
55
72
|
const result = decodeResult(message);
|
|
56
73
|
if (Option.isNone(result))
|
|
57
74
|
return Option.none();
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
usage.outputTokens +
|
|
61
|
-
usage.cacheReadInputTokens +
|
|
62
|
-
usage.cacheCreationInputTokens, 0);
|
|
75
|
+
const models = Object.values(result.value.modelUsage);
|
|
76
|
+
const consumed = models.reduce((sum, usage) => sum + usage.outputTokens + usage.inputTokens + usage.cacheCreationInputTokens, 0);
|
|
63
77
|
total = Math.max(total, consumed);
|
|
64
|
-
|
|
78
|
+
const priced = models.flatMap(({ costUSD }) => (costUSD === undefined ? [] : [costUSD]));
|
|
79
|
+
if (priced.length > 0)
|
|
80
|
+
cost = Option.some(UsdAmount.make(priced.reduce((sum, value) => sum + value, 0)));
|
|
81
|
+
return Option.some({ totalTokens: TokenCount.make(total), costUsd: cost });
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
const NO_USAGE = { totalTokens: TokenCount.make(0), costUsd: Option.none() };
|
|
85
|
+
/**
|
|
86
|
+
* Returns a Claude token meter for a session that another process can resume. `read` returns the
|
|
87
|
+
* session's usage: the current process's, as `claudeTokenMeter` reads it, plus the earlier
|
|
88
|
+
* processes'. `restart` starts on a new process, which Claude counts from zero.
|
|
89
|
+
*/
|
|
90
|
+
export const claudeSessionMeter = () => {
|
|
91
|
+
let earlier = NO_USAGE;
|
|
92
|
+
let current = NO_USAGE;
|
|
93
|
+
let meter = claudeTokenMeter();
|
|
94
|
+
return {
|
|
95
|
+
read: (message) => Option.map(meter(message), (usage) => {
|
|
96
|
+
current = usage;
|
|
97
|
+
return addUsage(earlier, usage);
|
|
98
|
+
}),
|
|
99
|
+
restart: () => {
|
|
100
|
+
earlier = addUsage(earlier, current);
|
|
101
|
+
current = NO_USAGE;
|
|
102
|
+
meter = claudeTokenMeter();
|
|
103
|
+
},
|
|
65
104
|
};
|
|
66
105
|
};
|
|
67
|
-
/**
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
106
|
+
/**
|
|
107
|
+
* Returns a Codex thread's consumption: output plus uncached input. The thread's `totalTokens` counts
|
|
108
|
+
* the whole context on every turn, so it is not used.
|
|
109
|
+
*/
|
|
110
|
+
export const codexThreadTokens = (total) => TokenCount.make(total.outputTokens + Math.max(0, total.inputTokens - total.cachedInputTokens));
|
|
111
|
+
/** Returns a Codex thread's tokens per billing rate. */
|
|
112
|
+
export const codexTokenBreakdown = (total) => new TokenBreakdown({
|
|
113
|
+
input: Math.max(0, total.inputTokens - total.cachedInputTokens - total.cacheWriteInputTokens),
|
|
114
|
+
cachedInput: total.cachedInputTokens,
|
|
115
|
+
cacheWrite: total.cacheWriteInputTokens,
|
|
116
|
+
output: total.outputTokens,
|
|
71
117
|
});
|
|
72
118
|
//# sourceMappingURL=usage.js.map
|
package/dist/pi/usage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage.js","sourceRoot":"","sources":["../../src/pi/usage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"usage.js","sourceRoot":"","sources":["../../src/pi/usage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;AACtE,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;IAC5B,IAAI,EAAE,MAAM,C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AAO,GAAG,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACrC,OAAO,GAAG,QAAQ,CAAC;YACnB,KAAK,GAAG,gBAAgB,EAAE,CAAC;QAC7B,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAA6C,EAAc,EAAE,CAC7F,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC;AAEjG,wDAAwD;AACxD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAA6C,EAAE,EAAE,CACnF,IAAI,cAAc,CAAC;IACjB,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,iBAAiB,GAAG,KAAK,CAAC,qBAAqB,CAAC;IAC7F,WAAW,EAAE,KAAK,CAAC,iBAAiB;IACpC,UAAU,EAAE,KAAK,CAAC,qBAAqB;IACvC,MAAM,EAAE,KAAK,CAAC,YAAY;CAC3B,CAAC,CAAC"}
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Harness } from "@usine/core/agent/brain";
|
|
2
|
+
import { HarnessUnavailableError, type HarnessCapability } from "@usine/core/agent/capability";
|
|
2
3
|
import { Effect } from "effect";
|
|
3
|
-
import {
|
|
4
|
+
import { type ChildHost } from "../child-host/child-host.ts";
|
|
4
5
|
import { SessionOperationError } from "../runtime.ts";
|
|
5
|
-
/**
|
|
6
|
-
export declare const
|
|
6
|
+
/** Returns the error for a readiness command that exited non-zero; the message includes the command but not its output. */
|
|
7
|
+
export declare const probeFailed: (harness: Harness, capability: HarnessCapability, command: string, args: ReadonlyArray<string>) => HarnessUnavailableError;
|
|
8
|
+
/**
|
|
9
|
+
* Runs a readiness command on `host` with a 30-second timeout and returns its trimmed stdout and
|
|
10
|
+
* exit code; stderr is discarded. If the remote host is unreachable or the command times out, fails
|
|
11
|
+
* with `SessionOperationError`.
|
|
12
|
+
*/
|
|
13
|
+
export declare const probeOutput: (host: import("../child-host/child-host.ts").LocalProcess | import("../child-host/child-host.ts").RemoteShell, environment: Readonly<Record<string, string>>, harness: "claude" | "codex" | "pi", capability: "binary" | "login" | "version", command: string, args: readonly string[]) => Effect.Effect<{
|
|
14
|
+
stdout: string;
|
|
15
|
+
exitCode: import("effect/process/ChildProcessSpawner").ExitCode;
|
|
16
|
+
}, HarnessUnavailableError | SessionOperationError, import("effect/process/ChildProcessSpawner").ChildProcessSpawner>;
|
|
17
|
+
/** Runs a readiness command and returns its trimmed stdout. Fails with `HarnessUnavailableError` if the command exits non-zero. */
|
|
18
|
+
export declare const probeCommand: (host: ChildHost, environment: Readonly<Record<string, string>>, harness: Harness, capability: HarnessCapability, command: string, args: ReadonlyArray<string>) => Effect.Effect<string, HarnessUnavailableError | SessionOperationError, import("effect/process/ChildProcessSpawner").ChildProcessSpawner>;
|
|
7
19
|
//# sourceMappingURL=command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/preflight/command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/preflight/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,KAAK,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAC/F,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,KAAK,SAAS,EAAe,MAAM,6BAA6B,CAAC;AAE1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD,2HAA2H;AAC3H,eAAO,MAAM,WAAW,YACb,OAAO,cACJ,iBAAiB,WACpB,MAAM,QACT,aAAa,CAAC,MAAM,CAAC,4BAMzB,CAAC;AAEL;;;;GAIG;AACH,eAAO,MAAM,WAAW;;;qHAuCtB,CAAC;AAEH,mIAAmI;AACnI,eAAO,MAAM,YAAY,SACjB,SAAS,eACF,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,WACpC,OAAO,cACJ,iBAAiB,WACpB,MAAM,QACT,aAAa,CAAC,MAAM,CAAC,6IAQ1B,CAAC"}
|
|
@@ -1,35 +1,33 @@
|
|
|
1
1
|
import { HarnessUnavailableError } from "@usine/core/agent/capability";
|
|
2
|
-
import { Effect, Option
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { Effect, Option } from "effect";
|
|
3
|
+
import { SSH_FAILURE } from "../child-host/child-host.js";
|
|
4
|
+
import { hostOutput } from "../child-host/command.js";
|
|
5
5
|
import { SessionOperationError } from "../runtime.js";
|
|
6
|
-
/**
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return stdout.trim();
|
|
28
|
-
})).pipe(Effect.timeout("30 seconds"), Effect.catchTags({
|
|
6
|
+
/** Returns the error for a readiness command that exited non-zero; the message includes the command but not its output. */
|
|
7
|
+
export const probeFailed = (harness, capability, command, args) => new HarnessUnavailableError({
|
|
8
|
+
harness,
|
|
9
|
+
capability,
|
|
10
|
+
message: `${command} ${args.join(" ")} failed. Check the ${harness} installation and login on the worker.`,
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* Runs a readiness command on `host` with a 30-second timeout and returns its trimmed stdout and
|
|
14
|
+
* exit code; stderr is discarded. If the remote host is unreachable or the command times out, fails
|
|
15
|
+
* with `SessionOperationError`.
|
|
16
|
+
*/
|
|
17
|
+
export const probeOutput = Effect.fn("HarnessPreflight.command")(function* (host, environment, harness, capability, command, args) {
|
|
18
|
+
yield* Effect.annotateCurrentSpan({ harness, capability, host: host._tag });
|
|
19
|
+
return yield* hostOutput(host, { environment, command, args }).pipe(Effect.flatMap((output) => host._tag === "RemoteShell" && output.exitCode === SSH_FAILURE
|
|
20
|
+
? Effect.fail(new SessionOperationError({
|
|
21
|
+
operation: "launch",
|
|
22
|
+
sessionId: Option.none(),
|
|
23
|
+
message: `Can't reach ${host.destination} to run ${command}`,
|
|
24
|
+
cause: new Error(`${host.ssh.command} exited with code ${SSH_FAILURE}`),
|
|
25
|
+
}))
|
|
26
|
+
: Effect.succeed(output)), Effect.timeout("30 seconds"), Effect.catchTags({
|
|
29
27
|
PlatformError: () => new HarnessUnavailableError({
|
|
30
28
|
harness,
|
|
31
29
|
capability,
|
|
32
|
-
message: `
|
|
30
|
+
message: `The worker can't run ${command}`,
|
|
33
31
|
}),
|
|
34
32
|
TimeoutError: (cause) => new SessionOperationError({
|
|
35
33
|
operation: "launch",
|
|
@@ -39,4 +37,8 @@ export const probeCommand = Effect.fn("HarnessPreflight.command")(function* (har
|
|
|
39
37
|
}),
|
|
40
38
|
}));
|
|
41
39
|
});
|
|
40
|
+
/** Runs a readiness command and returns its trimmed stdout. Fails with `HarnessUnavailableError` if the command exits non-zero. */
|
|
41
|
+
export const probeCommand = (host, environment, harness, capability, command, args) => probeOutput(host, environment, harness, capability, command, args).pipe(Effect.flatMap(({ stdout, exitCode }) => exitCode === 0
|
|
42
|
+
? Effect.succeed(stdout)
|
|
43
|
+
: Effect.fail(probeFailed(harness, capability, command, args))));
|
|
42
44
|
//# sourceMappingURL=command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/preflight/command.ts"],"names":[],"mappings":"AACA,O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,CAAC,OAAO,CAAC,MAAM,CAAC;IACxB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CACjE,CACF,CAAC"}
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
import type { BrainSpec } from "@usine/core/agent/brain";
|
|
2
2
|
import { HarnessReady, HarnessUnavailableError } from "@usine/core/agent/capability";
|
|
3
|
-
import { Effect } from "effect";
|
|
3
|
+
import { Effect, Option } from "effect";
|
|
4
|
+
import type { ChildHost } from "../child-host/child-host.ts";
|
|
4
5
|
import { SessionOperationError } from "../runtime.ts";
|
|
5
6
|
import { CodexAppServer } from "../pi/codex/app-server.ts";
|
|
6
7
|
import { PiSdk } from "../pi/sdk.ts";
|
|
7
|
-
/**
|
|
8
|
-
export declare const CODEX_CLI_VERSION = "0.
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
/** The Codex CLI version of the pinned app-server protocol package used by the conformance check. */
|
|
9
|
+
export declare const CODEX_CLI_VERSION = "0.159.2";
|
|
10
|
+
/**
|
|
11
|
+
* The Codex CLI versions that preflight accepts, the conformance baseline first. Adding a version
|
|
12
|
+
* needs a review of its generated protocol types and a run of the live contracts.
|
|
13
|
+
*/
|
|
14
|
+
export declare const supportedCodexVersions: ReadonlyArray<string>;
|
|
15
|
+
/** Returns the error for `codex --version` output that names no supported Codex CLI version. */
|
|
16
|
+
export declare const unsupportedCodexVersion: (version: string) => Option.Option<HarnessUnavailableError>;
|
|
17
|
+
/**
|
|
18
|
+
* Checks `brain` on `host` without starting a prompt; each check process gets `environment` as its
|
|
19
|
+
* complete local environment, or on top of the remote host's environment (ADR 0011). Fails with
|
|
20
|
+
* `HarnessUnavailableError` for Pi on a remote host.
|
|
21
|
+
*/
|
|
22
|
+
export declare const verifyHarness: (brain: BrainSpec, host: import("../child-host/child-host.ts").LocalProcess | import("../child-host/child-host.ts").RemoteShell, environment: Readonly<Record<string, string>>) => Effect.Effect<HarnessReady, HarnessUnavailableError | SessionOperationError, import("effect/process/ChildProcessSpawner").ChildProcessSpawner | CodexAppServer | PiSdk>;
|
|
23
|
+
/** Checks only `brain` on `host`, with `environment` and the Worker user's configuration; does not run a prompt or log in. */
|
|
24
|
+
export declare const preflight: (brain: BrainSpec, host: ChildHost, environment: Readonly<Record<string, string>>) => Effect.Effect<HarnessReady, HarnessUnavailableError | SessionOperationError, import("effect/process/ChildProcessSpawner").ChildProcessSpawner>;
|
|
13
25
|
//# sourceMappingURL=preflight.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../../src/preflight/preflight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,
|
|
1
|
+
{"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../../src/preflight/preflight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAEL,YAAY,EACZ,uBAAuB,EACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AAEhD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAoB,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,cAAc,EAAsB,MAAM,2BAA2B,CAAC;AAE/E,OAAO,EAAE,KAAK,EAAyB,MAAM,cAAc,CAAC;AAG5D,qGAAqG;AACrG,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,aAAa,CAAC,MAAM,CAMxD,CAAC;AAEF,gGAAgG;AAChG,eAAO,MAAM,uBAAuB,YAAa,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,uBAAuB,CASxF,CAAC;AAYR;;;;GAIG;AACH,eAAO,MAAM,aAAa,4VAsIzB,CAAC;AAEF,8HAA8H;AAC9H,eAAO,MAAM,SAAS,UACb,SAAS,QACV,SAAS,eACF,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,mJAK5C,CAAC"}
|
|
@@ -1,42 +1,69 @@
|
|
|
1
|
-
import { HarnessReady, HarnessUnavailableError } from "@usine/core/agent/capability";
|
|
1
|
+
import { HarnessReady, HarnessUnavailableError, } from "@usine/core/agent/capability";
|
|
2
2
|
import { Effect, Option, Schema } from "effect";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { SessionOperationError, WorkingDirectory } from "../runtime.js";
|
|
5
5
|
import { CodexAppServer, codexAppServerLive } from "../pi/codex/app-server.js";
|
|
6
6
|
import { initializeCodex, verifyCodexAccount } from "../pi/codex/account.js";
|
|
7
7
|
import { PiSdk, piSdkLive, usePiStart } from "../pi/sdk.js";
|
|
8
|
-
import { probeCommand } from "./command.js";
|
|
9
|
-
/**
|
|
10
|
-
export const CODEX_CLI_VERSION = "0.
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
import { probeCommand, probeFailed, probeOutput } from "./command.js";
|
|
9
|
+
/** The Codex CLI version of the pinned app-server protocol package used by the conformance check. */
|
|
10
|
+
export const CODEX_CLI_VERSION = "0.159.2";
|
|
11
|
+
/**
|
|
12
|
+
* The Codex CLI versions that preflight accepts, the conformance baseline first. Adding a version
|
|
13
|
+
* needs a review of its generated protocol types and a run of the live contracts.
|
|
14
|
+
*/
|
|
15
|
+
export const supportedCodexVersions = [
|
|
16
|
+
CODEX_CLI_VERSION,
|
|
17
|
+
"0.159.0",
|
|
18
|
+
"0.159.1",
|
|
19
|
+
"0.159.3",
|
|
20
|
+
"0.153.4",
|
|
21
|
+
];
|
|
22
|
+
/** Returns the error for `codex --version` output that names no supported Codex CLI version. */
|
|
23
|
+
export const unsupportedCodexVersion = (version) => supportedCodexVersions.some((supported) => version === `codex-cli ${supported}`)
|
|
24
|
+
? Option.none()
|
|
25
|
+
: Option.some(new HarnessUnavailableError({
|
|
26
|
+
harness: "codex",
|
|
27
|
+
capability: "version",
|
|
28
|
+
message: `The worker has ${/^codex-cli [0-9]+\.[0-9]+\.[0-9]+$/u.test(version) ? version : "an unrecognized Codex version"}. Install a supported Codex CLI version: ${supportedCodexVersions.join(", ")}.`,
|
|
29
|
+
}));
|
|
13
30
|
const ClaudeAuthentication = Schema.Struct({
|
|
14
31
|
loggedIn: Schema.Boolean,
|
|
15
32
|
authMethod: Schema.String,
|
|
16
33
|
apiProvider: Schema.String,
|
|
17
34
|
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
35
|
+
const decodeClaudeAuthentication = Schema.decodeUnknownOption(Schema.fromJsonString(ClaudeAuthentication));
|
|
36
|
+
const CLAUDE_AUTH_STATUS = ["auth", "status", "--json"];
|
|
37
|
+
/**
|
|
38
|
+
* Checks `brain` on `host` without starting a prompt; each check process gets `environment` as its
|
|
39
|
+
* complete local environment, or on top of the remote host's environment (ADR 0011). Fails with
|
|
40
|
+
* `HarnessUnavailableError` for Pi on a remote host.
|
|
41
|
+
*/
|
|
42
|
+
export const verifyHarness = Effect.fn("HarnessPreflight.verify")(function* (brain, host, environment) {
|
|
43
|
+
yield* Effect.annotateCurrentSpan({
|
|
44
|
+
harness: brain.harness,
|
|
45
|
+
model: brain.model,
|
|
46
|
+
host: host._tag,
|
|
47
|
+
});
|
|
21
48
|
const loginError = (message) => new HarnessUnavailableError({
|
|
22
49
|
harness: brain.harness,
|
|
23
50
|
capability: "login",
|
|
24
51
|
message,
|
|
25
52
|
});
|
|
53
|
+
const probe = (capability, command, args) => probeCommand(host, environment, brain.harness, capability, command, args);
|
|
26
54
|
switch (brain.harness) {
|
|
27
55
|
case "codex": {
|
|
28
|
-
const version = yield*
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
capability: "version",
|
|
33
|
-
message: `Worker has ${/^codex-cli [0-9]+\.[0-9]+\.[0-9]+$/u.test(version) ? version : "an unrecognized Codex version"}; supported Codex CLI versions: ${supportedCodexVersions.join(", ")}`,
|
|
34
|
-
});
|
|
56
|
+
const version = yield* probe("binary", "codex", ["--version"]);
|
|
57
|
+
const unsupported = unsupportedCodexVersion(version);
|
|
58
|
+
if (Option.isSome(unsupported))
|
|
59
|
+
return yield* unsupported.value;
|
|
35
60
|
yield* Effect.scoped(Effect.gen(function* () {
|
|
36
61
|
const server = yield* CodexAppServer;
|
|
37
62
|
const connection = yield* server.open({
|
|
38
63
|
cwd: WorkingDirectory.make(homedir()),
|
|
39
64
|
sessionId: Option.none(),
|
|
65
|
+
environment,
|
|
66
|
+
host,
|
|
40
67
|
});
|
|
41
68
|
yield* initializeCodex(connection);
|
|
42
69
|
yield* verifyCodexAccount(connection, brain.model);
|
|
@@ -44,37 +71,50 @@ export const verifyHarness = Effect.fn("HarnessPreflight.verify")(function* (bra
|
|
|
44
71
|
break;
|
|
45
72
|
}
|
|
46
73
|
case "claude": {
|
|
47
|
-
yield*
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
74
|
+
yield* probe("binary", "claude", ["--version"]);
|
|
75
|
+
const status = yield* probeOutput(host, environment, "claude", "login", "claude", CLAUDE_AUTH_STATUS);
|
|
76
|
+
// Claude prints the same status and exits 1 when not logged in.
|
|
77
|
+
const auth = status.exitCode === 0 || status.exitCode === 1
|
|
78
|
+
? decodeClaudeAuthentication(status.stdout)
|
|
79
|
+
: Option.none();
|
|
80
|
+
if (Option.isNone(auth))
|
|
81
|
+
return yield* status.exitCode === 0
|
|
82
|
+
? loginError("Claude returned an unrecognized login status")
|
|
83
|
+
: probeFailed("claude", "login", "claude", CLAUDE_AUTH_STATUS);
|
|
84
|
+
const { loggedIn, authMethod, apiProvider } = auth.value;
|
|
85
|
+
if (status.exitCode !== 0 ||
|
|
86
|
+
!loggedIn ||
|
|
87
|
+
authMethod !== "claude.ai" ||
|
|
88
|
+
apiProvider !== "firstParty")
|
|
89
|
+
return yield* loginError("Claude Code needs a subscription login. Run claude auth login on the worker.");
|
|
56
90
|
break;
|
|
57
91
|
}
|
|
58
92
|
case "pi": {
|
|
59
|
-
|
|
93
|
+
if (host._tag === "RemoteShell")
|
|
94
|
+
return yield* new HarnessUnavailableError({
|
|
95
|
+
harness: "pi",
|
|
96
|
+
capability: "binary",
|
|
97
|
+
message: "Pi children run only on local workers",
|
|
98
|
+
});
|
|
99
|
+
// Pi runs from the SDK installed with this process, not from a CLI binary.
|
|
60
100
|
const sdk = yield* PiSdk;
|
|
61
101
|
yield* usePiStart((signal) => sdk.start({
|
|
62
102
|
cwd: homedir(),
|
|
103
|
+
environment: Option.some(environment),
|
|
63
104
|
extensions: [],
|
|
64
|
-
model:
|
|
105
|
+
model: brain.model,
|
|
65
106
|
signal,
|
|
66
107
|
thinkingLevel: brain.effort,
|
|
67
|
-
toolMode: "repository",
|
|
68
108
|
}), (cause) => new SessionOperationError({
|
|
69
109
|
operation: "launch",
|
|
70
110
|
sessionId: Option.none(),
|
|
71
|
-
message: `
|
|
111
|
+
message: `Can't check Pi authentication for "${brain.model}"`,
|
|
72
112
|
cause,
|
|
73
113
|
}), (acquired) => Effect.gen(function* () {
|
|
74
114
|
const result = acquired.result;
|
|
75
115
|
yield* Effect.sync(acquired.dispose);
|
|
76
116
|
if (result._tag !== "Started" || result.pool !== "apiKeys")
|
|
77
|
-
return yield* loginError(`Pi child model ${brain.model}
|
|
117
|
+
return yield* loginError(`Pi child model "${brain.model}" is unavailable, doesn't support effort ${brain.effort}, or doesn't use an API key`);
|
|
78
118
|
}));
|
|
79
119
|
break;
|
|
80
120
|
}
|
|
@@ -82,6 +122,7 @@ export const verifyHarness = Effect.fn("HarnessPreflight.verify")(function* (bra
|
|
|
82
122
|
yield* Effect.logInfo("Worker harness verified", {
|
|
83
123
|
harness: brain.harness,
|
|
84
124
|
model: brain.model,
|
|
125
|
+
host: host._tag,
|
|
85
126
|
});
|
|
86
127
|
return new HarnessReady({ harness: brain.harness });
|
|
87
128
|
}, (effect, brain) => effect.pipe(Effect.timeout("60 seconds"), Effect.catchTag("TimeoutError", (cause) => new SessionOperationError({
|
|
@@ -95,6 +136,6 @@ export const verifyHarness = Effect.fn("HarnessPreflight.verify")(function* (bra
|
|
|
95
136
|
errorTag: error._tag,
|
|
96
137
|
message: error.message,
|
|
97
138
|
}))));
|
|
98
|
-
/** Checks only
|
|
99
|
-
export const preflight = (brain) => verifyHarness(brain).pipe(Effect.provide(codexAppServerLive), Effect.provide(piSdkLive));
|
|
139
|
+
/** Checks only `brain` on `host`, with `environment` and the Worker user's configuration; does not run a prompt or log in. */
|
|
140
|
+
export const preflight = (brain, host, environment) => verifyHarness(brain, host, environment).pipe(Effect.provide(codexAppServerLive), Effect.provide(piSdkLive));
|
|
100
141
|
//# sourceMappingURL=preflight.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preflight.js","sourceRoot":"","sources":["../../src/preflight/preflight.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"preflight.js","sourceRoot":"","sources":["../../src/preflight/preflight.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,YAAY,EACZ,uBAAuB,GACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAE,SAAS,E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K,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,IAAI,CAC1C,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAClC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAC1B,CAAC"}
|
package/dist/prompt.d.ts
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AgentPersona, type AgentName } from "@usine/core/agent";
|
|
2
2
|
import type { AttemptTask } from "@usine/core/attempt";
|
|
3
|
+
import type { SalvagePushed } from "@usine/core/attempt/salvage";
|
|
3
4
|
import type { RepositoryName } from "@usine/core/repository";
|
|
4
|
-
import type
|
|
5
|
-
/** The
|
|
5
|
+
import { Option, type Schema } from "effect";
|
|
6
|
+
/** The trigger context, Agent instructions, and task for the parent prompt. */
|
|
6
7
|
export interface PromptParts {
|
|
7
8
|
readonly repository: RepositoryName;
|
|
8
9
|
readonly payload: Schema.Json;
|
|
9
10
|
readonly agent: AgentName;
|
|
10
11
|
readonly persona: AgentPersona;
|
|
11
12
|
readonly task: AttemptTask;
|
|
13
|
+
/** The previous Attempt's salvage checked out in the workspace, if the Run is retrying. */
|
|
14
|
+
readonly resume: Option.Option<SalvagePushed>;
|
|
15
|
+
/** The previous Attempt's salvage that conflicts with the current revision and is not in the workspace. */
|
|
16
|
+
readonly conflictingSalvage: Option.Option<SalvagePushed>;
|
|
12
17
|
}
|
|
13
|
-
/** The Agent
|
|
18
|
+
/** The Agent instructions and delegated task for a child prompt. */
|
|
14
19
|
export interface ChildPromptParts {
|
|
15
20
|
readonly agent: AgentName;
|
|
16
21
|
readonly persona: AgentPersona;
|
|
17
|
-
/** Free text
|
|
22
|
+
/** Free text written by the parent model, not the rendered Loop task. */
|
|
18
23
|
readonly task: string;
|
|
19
24
|
}
|
|
20
|
-
/**
|
|
21
|
-
export declare const githubSignature: (agent: AgentName) => string;
|
|
22
|
-
/** Builds the parent's instructions from the saved payload, effective task, and Agent persona, including GitHub attribution. */
|
|
25
|
+
/** Returns the parent's instructions, including GitHub attribution. */
|
|
23
26
|
export declare const assemblePrompt: (parts: PromptParts) => string;
|
|
24
|
-
/**
|
|
27
|
+
/** Returns a child's instructions, including GitHub attribution. */
|
|
25
28
|
export declare const assembleChildPrompt: (parts: ChildPromptParts) => string;
|
|
26
29
|
//# sourceMappingURL=prompt.d.ts.map
|
package/dist/prompt.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACvF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAG7C,+EAA+E;AAC/E,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,2FAA2F;IAC3F,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAC9C,2GAA2G;IAC3G,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;CAC3D;AAED,oEAAoE;AACpE,M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