@inhuman.tools/turn 0.0.0-stage → 0.2.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.md +7 -0
- package/dist/agent-calls/acceptance.d.ts +12 -0
- package/dist/agent-calls/acceptance.d.ts.map +1 -0
- package/dist/agent-calls/acceptance.js +64 -0
- package/dist/agent-calls/acceptance.js.map +1 -0
- package/dist/agent-calls/callbacks.d.ts +14 -0
- package/dist/agent-calls/callbacks.d.ts.map +1 -0
- package/dist/agent-calls/callbacks.js +59 -0
- package/dist/agent-calls/callbacks.js.map +1 -0
- package/dist/agent-calls/delivery.d.ts +7 -0
- package/dist/agent-calls/delivery.d.ts.map +1 -0
- package/dist/agent-calls/delivery.js +16 -0
- package/dist/agent-calls/delivery.js.map +1 -0
- package/dist/agent-calls/index.d.ts +7 -0
- package/dist/agent-calls/index.d.ts.map +1 -0
- package/dist/agent-calls/index.js +6 -0
- package/dist/agent-calls/index.js.map +1 -0
- package/dist/agent-calls/operator.d.ts +21 -0
- package/dist/agent-calls/operator.d.ts.map +1 -0
- package/dist/agent-calls/operator.js +78 -0
- package/dist/agent-calls/operator.js.map +1 -0
- package/dist/agent-calls/runtime.d.ts +99 -0
- package/dist/agent-calls/runtime.d.ts.map +1 -0
- package/dist/agent-calls/runtime.js +245 -0
- package/dist/agent-calls/runtime.js.map +1 -0
- package/dist/agent-calls/types.d.ts +31 -0
- package/dist/agent-calls/types.d.ts.map +1 -0
- package/dist/agent-calls/types.js +2 -0
- package/dist/agent-calls/types.js.map +1 -0
- package/dist/context/compact-floors.d.ts +43 -0
- package/dist/context/compact-floors.d.ts.map +1 -0
- package/dist/context/compact-floors.js +52 -0
- package/dist/context/compact-floors.js.map +1 -0
- package/dist/context/compact.d.ts +42 -0
- package/dist/context/compact.d.ts.map +1 -0
- package/dist/context/compact.js +155 -0
- package/dist/context/compact.js.map +1 -0
- package/dist/context/delivery.d.ts +13 -0
- package/dist/context/delivery.d.ts.map +1 -0
- package/dist/context/delivery.js +6 -0
- package/dist/context/delivery.js.map +1 -0
- package/dist/context/history.d.ts +66 -0
- package/dist/context/history.d.ts.map +1 -0
- package/dist/context/history.js +573 -0
- package/dist/context/history.js.map +1 -0
- package/dist/context/index.d.ts +10 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +10 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/observations.d.ts +7 -0
- package/dist/context/observations.d.ts.map +1 -0
- package/dist/context/observations.js +11 -0
- package/dist/context/observations.js.map +1 -0
- package/dist/context/retention/defaults.d.ts +10 -0
- package/dist/context/retention/defaults.d.ts.map +1 -0
- package/dist/context/retention/defaults.js +47 -0
- package/dist/context/retention/defaults.js.map +1 -0
- package/dist/context/retention/index.d.ts +14 -0
- package/dist/context/retention/index.d.ts.map +1 -0
- package/dist/context/retention/index.js +21 -0
- package/dist/context/retention/index.js.map +1 -0
- package/dist/context/retention/narrow.d.ts +22 -0
- package/dist/context/retention/narrow.d.ts.map +1 -0
- package/dist/context/retention/narrow.js +140 -0
- package/dist/context/retention/narrow.js.map +1 -0
- package/dist/context/retention/render.d.ts +37 -0
- package/dist/context/retention/render.d.ts.map +1 -0
- package/dist/context/retention/render.js +149 -0
- package/dist/context/retention/render.js.map +1 -0
- package/dist/context/retention/resolve.d.ts +51 -0
- package/dist/context/retention/resolve.d.ts.map +1 -0
- package/dist/context/retention/resolve.js +254 -0
- package/dist/context/retention/resolve.js.map +1 -0
- package/dist/context/retention/schema.d.ts +345 -0
- package/dist/context/retention/schema.d.ts.map +1 -0
- package/dist/context/retention/schema.js +149 -0
- package/dist/context/retention/schema.js.map +1 -0
- package/dist/context/retention/stamp.d.ts +25 -0
- package/dist/context/retention/stamp.d.ts.map +1 -0
- package/dist/context/retention/stamp.js +103 -0
- package/dist/context/retention/stamp.js.map +1 -0
- package/dist/context/retention/step.d.ts +33 -0
- package/dist/context/retention/step.d.ts.map +1 -0
- package/dist/context/retention/step.js +74 -0
- package/dist/context/retention/step.js.map +1 -0
- package/dist/context/retention/view.d.ts +57 -0
- package/dist/context/retention/view.d.ts.map +1 -0
- package/dist/context/retention/view.js +121 -0
- package/dist/context/retention/view.js.map +1 -0
- package/dist/context/squeeze.d.ts +45 -0
- package/dist/context/squeeze.d.ts.map +1 -0
- package/dist/context/squeeze.js +182 -0
- package/dist/context/squeeze.js.map +1 -0
- package/dist/context/tools.d.ts +16 -0
- package/dist/context/tools.d.ts.map +1 -0
- package/dist/context/tools.js +73 -0
- package/dist/context/tools.js.map +1 -0
- package/dist/context/transcript.d.ts +151 -0
- package/dist/context/transcript.d.ts.map +1 -0
- package/dist/context/transcript.js +659 -0
- package/dist/context/transcript.js.map +1 -0
- package/dist/policy-processor/bypass.d.ts +95 -0
- package/dist/policy-processor/bypass.d.ts.map +1 -0
- package/dist/policy-processor/bypass.js +188 -0
- package/dist/policy-processor/bypass.js.map +1 -0
- package/dist/policy-processor/classifier.d.ts +47 -0
- package/dist/policy-processor/classifier.d.ts.map +1 -0
- package/dist/policy-processor/classifier.js +671 -0
- package/dist/policy-processor/classifier.js.map +1 -0
- package/dist/policy-processor/cluster.d.ts +7 -0
- package/dist/policy-processor/cluster.d.ts.map +1 -0
- package/dist/policy-processor/cluster.js +32 -0
- package/dist/policy-processor/cluster.js.map +1 -0
- package/dist/policy-processor/evidence.d.ts +26 -0
- package/dist/policy-processor/evidence.d.ts.map +1 -0
- package/dist/policy-processor/evidence.js +204 -0
- package/dist/policy-processor/evidence.js.map +1 -0
- package/dist/policy-processor/explain.d.ts +59 -0
- package/dist/policy-processor/explain.d.ts.map +1 -0
- package/dist/policy-processor/explain.js +224 -0
- package/dist/policy-processor/explain.js.map +1 -0
- package/dist/policy-processor/index.d.ts +6 -0
- package/dist/policy-processor/index.d.ts.map +1 -0
- package/dist/policy-processor/index.js +6 -0
- package/dist/policy-processor/index.js.map +1 -0
- package/dist/policy-processor/license.d.ts +23 -0
- package/dist/policy-processor/license.d.ts.map +1 -0
- package/dist/policy-processor/license.js +47 -0
- package/dist/policy-processor/license.js.map +1 -0
- package/dist/policy-processor/peel-cwd.d.ts +2 -0
- package/dist/policy-processor/peel-cwd.d.ts.map +1 -0
- package/dist/policy-processor/peel-cwd.js +2 -0
- package/dist/policy-processor/peel-cwd.js.map +1 -0
- package/dist/policy-processor/real-path.d.ts +7 -0
- package/dist/policy-processor/real-path.d.ts.map +1 -0
- package/dist/policy-processor/real-path.js +42 -0
- package/dist/policy-processor/real-path.js.map +1 -0
- package/dist/policy-processor/scope.d.ts +111 -0
- package/dist/policy-processor/scope.d.ts.map +1 -0
- package/dist/policy-processor/scope.js +629 -0
- package/dist/policy-processor/scope.js.map +1 -0
- package/dist/policy-processor/self-protect.d.ts +10 -0
- package/dist/policy-processor/self-protect.d.ts.map +1 -0
- package/dist/policy-processor/self-protect.js +48 -0
- package/dist/policy-processor/self-protect.js.map +1 -0
- package/dist/policy-processor/soft-deny.d.ts +75 -0
- package/dist/policy-processor/soft-deny.d.ts.map +1 -0
- package/dist/policy-processor/soft-deny.js +185 -0
- package/dist/policy-processor/soft-deny.js.map +1 -0
- package/dist/policy-processor/unattended-guard.d.ts +28 -0
- package/dist/policy-processor/unattended-guard.d.ts.map +1 -0
- package/dist/policy-processor/unattended-guard.js +145 -0
- package/dist/policy-processor/unattended-guard.js.map +1 -0
- package/dist/session/cancel.d.ts +14 -0
- package/dist/session/cancel.d.ts.map +1 -0
- package/dist/session/cancel.js +32 -0
- package/dist/session/cancel.js.map +1 -0
- package/dist/session/commands.d.ts +41 -0
- package/dist/session/commands.d.ts.map +1 -0
- package/dist/session/commands.js +241 -0
- package/dist/session/commands.js.map +1 -0
- package/dist/session/compact-actor.d.ts +23 -0
- package/dist/session/compact-actor.d.ts.map +1 -0
- package/dist/session/compact-actor.js +91 -0
- package/dist/session/compact-actor.js.map +1 -0
- package/dist/session/compact-env.d.ts +54 -0
- package/dist/session/compact-env.d.ts.map +1 -0
- package/dist/session/compact-env.js +345 -0
- package/dist/session/compact-env.js.map +1 -0
- package/dist/session/compact.d.ts +42 -0
- package/dist/session/compact.d.ts.map +1 -0
- package/dist/session/compact.js +68 -0
- package/dist/session/compact.js.map +1 -0
- package/dist/session/index.d.ts +9 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +8 -0
- package/dist/session/index.js.map +1 -0
- package/dist/session/park.d.ts +16 -0
- package/dist/session/park.d.ts.map +1 -0
- package/dist/session/park.js +73 -0
- package/dist/session/park.js.map +1 -0
- package/dist/session/side-channel-reminder.d.ts +41 -0
- package/dist/session/side-channel-reminder.d.ts.map +1 -0
- package/dist/session/side-channel-reminder.js +132 -0
- package/dist/session/side-channel-reminder.js.map +1 -0
- package/dist/session/types.d.ts +44 -0
- package/dist/session/types.d.ts.map +1 -0
- package/dist/session/types.js +2 -0
- package/dist/session/types.js.map +1 -0
- package/dist/tool-catalog/catalog.d.ts +77 -0
- package/dist/tool-catalog/catalog.d.ts.map +1 -0
- package/dist/tool-catalog/catalog.js +380 -0
- package/dist/tool-catalog/catalog.js.map +1 -0
- package/dist/tool-catalog/index.d.ts +4 -0
- package/dist/tool-catalog/index.d.ts.map +1 -0
- package/dist/tool-catalog/index.js +3 -0
- package/dist/tool-catalog/index.js.map +1 -0
- package/dist/tool-catalog/recipes.d.ts +36 -0
- package/dist/tool-catalog/recipes.d.ts.map +1 -0
- package/dist/tool-catalog/recipes.js +121 -0
- package/dist/tool-catalog/recipes.js.map +1 -0
- package/dist/tool-catalog/types.d.ts +103 -0
- package/dist/tool-catalog/types.d.ts.map +1 -0
- package/dist/tool-catalog/types.js +5 -0
- package/dist/tool-catalog/types.js.map +1 -0
- package/dist/tool-runtime/approval/approved.d.ts +13 -0
- package/dist/tool-runtime/approval/approved.d.ts.map +1 -0
- package/dist/tool-runtime/approval/approved.js +20 -0
- package/dist/tool-runtime/approval/approved.js.map +1 -0
- package/dist/tool-runtime/approval/dist.d.ts +6 -0
- package/dist/tool-runtime/approval/dist.d.ts.map +1 -0
- package/dist/tool-runtime/approval/dist.js +28 -0
- package/dist/tool-runtime/approval/dist.js.map +1 -0
- package/dist/tool-runtime/approval/inbound.d.ts +7 -0
- package/dist/tool-runtime/approval/inbound.d.ts.map +1 -0
- package/dist/tool-runtime/approval/inbound.js +48 -0
- package/dist/tool-runtime/approval/inbound.js.map +1 -0
- package/dist/tool-runtime/approval/unattended.d.ts +8 -0
- package/dist/tool-runtime/approval/unattended.d.ts.map +1 -0
- package/dist/tool-runtime/approval/unattended.js +23 -0
- package/dist/tool-runtime/approval/unattended.js.map +1 -0
- package/dist/tool-runtime/blob-port.d.ts +46 -0
- package/dist/tool-runtime/blob-port.d.ts.map +1 -0
- package/dist/tool-runtime/blob-port.js +47 -0
- package/dist/tool-runtime/blob-port.js.map +1 -0
- package/dist/tool-runtime/extra-root.d.ts +3 -0
- package/dist/tool-runtime/extra-root.d.ts.map +1 -0
- package/dist/tool-runtime/extra-root.js +14 -0
- package/dist/tool-runtime/extra-root.js.map +1 -0
- package/dist/tool-runtime/handler.d.ts +29 -0
- package/dist/tool-runtime/handler.d.ts.map +1 -0
- package/dist/tool-runtime/handler.js +460 -0
- package/dist/tool-runtime/handler.js.map +1 -0
- package/dist/tool-runtime/index.d.ts +14 -0
- package/dist/tool-runtime/index.d.ts.map +1 -0
- package/dist/tool-runtime/index.js +14 -0
- package/dist/tool-runtime/index.js.map +1 -0
- package/dist/tool-runtime/peel.d.ts +19 -0
- package/dist/tool-runtime/peel.d.ts.map +1 -0
- package/dist/tool-runtime/peel.js +74 -0
- package/dist/tool-runtime/peel.js.map +1 -0
- package/dist/tool-runtime/plugin-context.d.ts +13 -0
- package/dist/tool-runtime/plugin-context.d.ts.map +1 -0
- package/dist/tool-runtime/plugin-context.js +55 -0
- package/dist/tool-runtime/plugin-context.js.map +1 -0
- package/dist/tool-runtime/recall.d.ts +18 -0
- package/dist/tool-runtime/recall.d.ts.map +1 -0
- package/dist/tool-runtime/recall.js +100 -0
- package/dist/tool-runtime/recall.js.map +1 -0
- package/dist/tool-runtime/run-system-tool.d.ts +13 -0
- package/dist/tool-runtime/run-system-tool.d.ts.map +1 -0
- package/dist/tool-runtime/run-system-tool.js +230 -0
- package/dist/tool-runtime/run-system-tool.js.map +1 -0
- package/dist/tool-runtime/tool-error.d.ts +6 -0
- package/dist/tool-runtime/tool-error.d.ts.map +1 -0
- package/dist/tool-runtime/tool-error.js +6 -0
- package/dist/tool-runtime/tool-error.js.map +1 -0
- package/dist/tool-runtime/worker-tools.d.ts +8 -0
- package/dist/tool-runtime/worker-tools.d.ts.map +1 -0
- package/dist/tool-runtime/worker-tools.js +65 -0
- package/dist/tool-runtime/worker-tools.js.map +1 -0
- package/dist/tool-runtime/write-admit.d.ts +21 -0
- package/dist/tool-runtime/write-admit.d.ts.map +1 -0
- package/dist/tool-runtime/write-admit.js +89 -0
- package/dist/tool-runtime/write-admit.js.map +1 -0
- package/package.json +114 -3
- package/policy/auto-mode-ask.scm +201 -0
- package/policy/bypass-detect.prompt +55 -0
- package/policy/classifier-bash-incomplete.prompt +46 -0
- package/policy/classifier-bash.prompt +45 -0
- package/policy/classifier-mcp.prompt +45 -0
- package/policy/classifier-read.prompt +44 -0
- package/policy/classifier-write-outside.prompt +46 -0
- package/policy/classifier-write-risky.prompt +45 -0
- package/policy/classifier-write-workspace.prompt +46 -0
- package/policy/classifier-write.prompt +45 -0
- package/policy/soft-deny-round1.prompt +51 -0
- package/policy/soft-deny-round2.prompt +60 -0
- package/src/agent-calls/acceptance.ts +71 -0
- package/src/agent-calls/callbacks.ts +75 -0
- package/src/agent-calls/delivery.ts +15 -0
- package/src/agent-calls/index.ts +16 -0
- package/src/agent-calls/operator.ts +99 -0
- package/src/agent-calls/runtime.ts +310 -0
- package/src/agent-calls/types.ts +33 -0
- package/src/context/compact-floors.ts +76 -0
- package/src/context/compact.ts +176 -0
- package/src/context/delivery.ts +15 -0
- package/src/context/history.ts +725 -0
- package/src/context/index.ts +35 -0
- package/src/context/observations.ts +13 -0
- package/src/context/retention/defaults.ts +58 -0
- package/src/context/retention/index.ts +45 -0
- package/src/context/retention/narrow.ts +123 -0
- package/src/context/retention/render.ts +177 -0
- package/src/context/retention/resolve.ts +306 -0
- package/src/context/retention/schema.ts +173 -0
- package/src/context/retention/stamp.ts +121 -0
- package/src/context/retention/step.ts +85 -0
- package/src/context/retention/view.ts +161 -0
- package/src/context/squeeze.ts +218 -0
- package/src/context/tools.ts +92 -0
- package/src/context/transcript.ts +705 -0
- package/src/policy-processor/README.md +43 -0
- package/src/policy-processor/bypass.ts +246 -0
- package/src/policy-processor/classifier.ts +711 -0
- package/src/policy-processor/cluster.ts +31 -0
- package/src/policy-processor/evidence.ts +214 -0
- package/src/policy-processor/explain.ts +310 -0
- package/src/policy-processor/index.ts +6 -0
- package/src/policy-processor/license.ts +45 -0
- package/src/policy-processor/peel-cwd.ts +1 -0
- package/src/policy-processor/real-path.ts +41 -0
- package/src/policy-processor/scope.ts +655 -0
- package/src/policy-processor/self-protect.ts +46 -0
- package/src/policy-processor/soft-deny.ts +225 -0
- package/src/policy-processor/unattended-guard.ts +158 -0
- package/src/session/cancel.ts +34 -0
- package/src/session/commands.ts +292 -0
- package/src/session/compact-actor.ts +132 -0
- package/src/session/compact-env.ts +539 -0
- package/src/session/compact.ts +95 -0
- package/src/session/index.ts +18 -0
- package/src/session/park.ts +73 -0
- package/src/session/side-channel-reminder.ts +148 -0
- package/src/session/types.ts +50 -0
- package/src/tool-catalog/catalog.ts +282 -0
- package/src/tool-catalog/index.ts +26 -0
- package/src/tool-catalog/recipes.ts +154 -0
- package/src/tool-catalog/types.ts +110 -0
- package/src/tool-runtime/approval/approved.ts +20 -0
- package/src/tool-runtime/approval/dist.ts +29 -0
- package/src/tool-runtime/approval/inbound.ts +50 -0
- package/src/tool-runtime/approval/unattended.ts +24 -0
- package/src/tool-runtime/blob-port.ts +64 -0
- package/src/tool-runtime/extra-root.ts +16 -0
- package/src/tool-runtime/handler.ts +576 -0
- package/src/tool-runtime/index.ts +21 -0
- package/src/tool-runtime/peel.ts +91 -0
- package/src/tool-runtime/plugin-context.ts +68 -0
- package/src/tool-runtime/recall.ts +104 -0
- package/src/tool-runtime/run-system-tool.ts +273 -0
- package/src/tool-runtime/tool-error.ts +6 -0
- package/src/tool-runtime/worker-tools.ts +76 -0
- package/src/tool-runtime/write-admit.ts +90 -0
- package/README.md +0 -3
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nags for side-channel tools the model skips.
|
|
3
|
+
*
|
|
4
|
+
* Title (`update_metadata`) and context_need keep separate clocks. A call
|
|
5
|
+
* of one does not reset the other. Each nag is attached to the completion
|
|
6
|
+
* being armed, as `systemNote`. The TUI paints tape cells and does not
|
|
7
|
+
* paint that field, so the nag stays off the
|
|
8
|
+
* transcript. A user message or a tape cell would show it.
|
|
9
|
+
*
|
|
10
|
+
* Only a sealed successful session completion on the visible tape counts.
|
|
11
|
+
* The count starts after the latest cutoff, same as `spine()`:
|
|
12
|
+
* rounds behind the summary are off the wire, and a call buried there
|
|
13
|
+
* must not keep the nag dark. An uncommitted compact is not a boundary.
|
|
14
|
+
* Representation cells and the isolated summarizer child are not rounds.
|
|
15
|
+
* A failure, an isolated intern, and the round still being armed are not
|
|
16
|
+
* rounds the model spent skipping the tool. A scheme inner call counts:
|
|
17
|
+
* display already reads that job.
|
|
18
|
+
*
|
|
19
|
+
* `offered === null` means the wire is still the live catalog, which lists
|
|
20
|
+
* both tools. A frozen tool set is the wire list — omit a nag whose tool
|
|
21
|
+
* is absent from it.
|
|
22
|
+
*
|
|
23
|
+
* Due on the armed round when (quiet + 1) is a multiple of the period.
|
|
24
|
+
* `quiet % period` fires one round late.
|
|
25
|
+
*/
|
|
26
|
+
import { type SystemPrompt } from "@inhuman.tools/harness-commons";
|
|
27
|
+
import { SessionTurn } from "@inhuman.tools/harness-model";
|
|
28
|
+
/** Quiet sealed session rounds before the armed round carries the nag. */
|
|
29
|
+
export declare const SIDE_CHANNEL_REMINDER_EVERY = 5;
|
|
30
|
+
export declare const TITLE_UPDATE_REMINDER: SystemPrompt;
|
|
31
|
+
export declare const CONTEXT_NEED_REMINDER: SystemPrompt;
|
|
32
|
+
export type SideChannelRound = {
|
|
33
|
+
readonly calls: readonly string[];
|
|
34
|
+
};
|
|
35
|
+
export declare function quietRoundsSince(rounds: readonly SideChannelRound[], tool: string): number;
|
|
36
|
+
export declare function sideChannelReminderDue(quietRounds: number, every?: number): boolean;
|
|
37
|
+
export declare function joinSystemNotes(notes: readonly SystemPrompt[]): SystemPrompt;
|
|
38
|
+
export declare function sideChannelReminderNote(rounds: readonly SideChannelRound[], every?: number, offered?: readonly string[] | null): SystemPrompt;
|
|
39
|
+
/** Oldest first. The armed completion is not sealed yet, so it is absent. */
|
|
40
|
+
export declare function sealedActorRounds(turn: SessionTurn): readonly SideChannelRound[];
|
|
41
|
+
//# sourceMappingURL=side-channel-reminder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"side-channel-reminder.d.ts","sourceRoot":"","sources":["../../src/session/side-channel-reminder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAIL,WAAW,EAMZ,MAAM,8BAA8B,CAAC;AAEtC,0EAA0E;AAC1E,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C,eAAO,MAAM,qBAAqB,cAA2Q,CAAC;AAE9S,eAAO,MAAM,qBAAqB,cAAmU,CAAC;AAEtW,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,gBAAgB,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ1F;AAED,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,GAAE,MAAoC,GAAG,OAAO,CAIhH;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,GAAG,YAAY,CAM5E;AAED,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,SAAS,gBAAgB,EAAE,EACnC,KAAK,GAAE,MAAoC,EAC3C,OAAO,GAAE,SAAS,MAAM,EAAE,GAAG,IAAW,GACvC,YAAY,CAYd;AAED,6EAA6E;AAC7E,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,SAAS,gBAAgB,EAAE,CAwChF"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nags for side-channel tools the model skips.
|
|
3
|
+
*
|
|
4
|
+
* Title (`update_metadata`) and context_need keep separate clocks. A call
|
|
5
|
+
* of one does not reset the other. Each nag is attached to the completion
|
|
6
|
+
* being armed, as `systemNote`. The TUI paints tape cells and does not
|
|
7
|
+
* paint that field, so the nag stays off the
|
|
8
|
+
* transcript. A user message or a tape cell would show it.
|
|
9
|
+
*
|
|
10
|
+
* Only a sealed successful session completion on the visible tape counts.
|
|
11
|
+
* The count starts after the latest cutoff, same as `spine()`:
|
|
12
|
+
* rounds behind the summary are off the wire, and a call buried there
|
|
13
|
+
* must not keep the nag dark. An uncommitted compact is not a boundary.
|
|
14
|
+
* Representation cells and the isolated summarizer child are not rounds.
|
|
15
|
+
* A failure, an isolated intern, and the round still being armed are not
|
|
16
|
+
* rounds the model spent skipping the tool. A scheme inner call counts:
|
|
17
|
+
* display already reads that job.
|
|
18
|
+
*
|
|
19
|
+
* `offered === null` means the wire is still the live catalog, which lists
|
|
20
|
+
* both tools. A frozen tool set is the wire list — omit a nag whose tool
|
|
21
|
+
* is absent from it.
|
|
22
|
+
*
|
|
23
|
+
* Due on the armed round when (quiet + 1) is a multiple of the period.
|
|
24
|
+
* `quiet % period` fires one round late.
|
|
25
|
+
*/
|
|
26
|
+
import { prompt } from "@inhuman.tools/harness-commons";
|
|
27
|
+
import { CompactJob, CONTEXT_NEED_TOOL_NAME, ProgrammaticJob, SessionTurn, tapeCompletion, ToolCallJob, UPDATE_METADATA_TOOL_NAME, } from "@inhuman.tools/harness-model";
|
|
28
|
+
/** Quiet sealed session rounds before the armed round carries the nag. */
|
|
29
|
+
export const SIDE_CHANNEL_REMINDER_EVERY = 5;
|
|
30
|
+
export const TITLE_UPDATE_REMINDER = prompt.system `Call update_metadata in this completion, last among your other tool calls — not as its own round. Record this turn's title and a short description. This is bookkeeping: do not mention this note or the call in your reply, and do not address the user.`;
|
|
31
|
+
export const CONTEXT_NEED_REMINDER = prompt.system `Call context_need in this completion, last among your other tool calls — not as its own round. Put what to keep in the call's arguments only. This is bookkeeping: do not mention this note or the call in your reply, do not describe what you will keep, and do not address the user. Do not wait for a result.`;
|
|
32
|
+
export function quietRoundsSince(rounds, tool) {
|
|
33
|
+
let quiet = 0;
|
|
34
|
+
for (let index = rounds.length - 1; index >= 0; index -= 1) {
|
|
35
|
+
const round = rounds[index];
|
|
36
|
+
if (round.calls.includes(tool))
|
|
37
|
+
return quiet;
|
|
38
|
+
quiet += 1;
|
|
39
|
+
}
|
|
40
|
+
return quiet;
|
|
41
|
+
}
|
|
42
|
+
export function sideChannelReminderDue(quietRounds, every = SIDE_CHANNEL_REMINDER_EVERY) {
|
|
43
|
+
if (!Number.isInteger(every) || every < 1)
|
|
44
|
+
return false;
|
|
45
|
+
if (!Number.isInteger(quietRounds) || quietRounds < 0)
|
|
46
|
+
return false;
|
|
47
|
+
return (quietRounds + 1) % every === 0;
|
|
48
|
+
}
|
|
49
|
+
export function joinSystemNotes(notes) {
|
|
50
|
+
const text = notes
|
|
51
|
+
.map((note) => note.trim())
|
|
52
|
+
.filter((note) => note !== "")
|
|
53
|
+
.join("\n\n");
|
|
54
|
+
return prompt.system `${text}`;
|
|
55
|
+
}
|
|
56
|
+
export function sideChannelReminderNote(rounds, every = SIDE_CHANNEL_REMINDER_EVERY, offered = null) {
|
|
57
|
+
const allow = offered == null ? null : new Set(offered);
|
|
58
|
+
return joinSystemNotes([
|
|
59
|
+
allow?.has(UPDATE_METADATA_TOOL_NAME) !== false &&
|
|
60
|
+
sideChannelReminderDue(quietRoundsSince(rounds, UPDATE_METADATA_TOOL_NAME), every)
|
|
61
|
+
? TITLE_UPDATE_REMINDER
|
|
62
|
+
: prompt.system ``,
|
|
63
|
+
allow?.has(CONTEXT_NEED_TOOL_NAME) !== false &&
|
|
64
|
+
sideChannelReminderDue(quietRoundsSince(rounds, CONTEXT_NEED_TOOL_NAME), every)
|
|
65
|
+
? CONTEXT_NEED_REMINDER
|
|
66
|
+
: prompt.system ``,
|
|
67
|
+
]);
|
|
68
|
+
}
|
|
69
|
+
/** Oldest first. The armed completion is not sealed yet, so it is absent. */
|
|
70
|
+
export function sealedActorRounds(turn) {
|
|
71
|
+
const newestFirst = [];
|
|
72
|
+
const seen = new Set();
|
|
73
|
+
let cell = turn;
|
|
74
|
+
while (cell instanceof SessionTurn && !seen.has(cell)) {
|
|
75
|
+
seen.add(cell);
|
|
76
|
+
newestFirst.push(cell);
|
|
77
|
+
cell = cell.turnTail;
|
|
78
|
+
}
|
|
79
|
+
const oldestFirst = newestFirst.toReversed();
|
|
80
|
+
const cutoff = latestCutoff(oldestFirst);
|
|
81
|
+
const rounds = [];
|
|
82
|
+
const start = cutoff == null ? 0 : Math.max(0, oldestFirst.indexOf(cutoff.turn));
|
|
83
|
+
for (const head of oldestFirst.slice(start)) {
|
|
84
|
+
let chunks = head.doneWork;
|
|
85
|
+
if (cutoff?.turn === head) {
|
|
86
|
+
const at = chunks.indexOf(cutoff.compact);
|
|
87
|
+
if (at !== -1)
|
|
88
|
+
chunks = chunks.slice(at + 1);
|
|
89
|
+
}
|
|
90
|
+
let round = null;
|
|
91
|
+
for (const chunk of chunks) {
|
|
92
|
+
const pew = tapeCompletion(chunk);
|
|
93
|
+
if (pew != null) {
|
|
94
|
+
if (pew.completionMode === "isolated" || pew.outcome !== "successful") {
|
|
95
|
+
round = null;
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
round = { calls: [] };
|
|
99
|
+
for (const call of pew.responseCalls)
|
|
100
|
+
noteMetaCall(round, call.name);
|
|
101
|
+
rounds.push(round);
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (round == null)
|
|
105
|
+
continue;
|
|
106
|
+
if (chunk instanceof ToolCallJob)
|
|
107
|
+
noteMetaCall(round, chunk.name);
|
|
108
|
+
if (chunk instanceof ProgrammaticJob) {
|
|
109
|
+
for (const inner of chunk.toolCalls)
|
|
110
|
+
noteMetaCall(round, inner.name);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return rounds;
|
|
115
|
+
}
|
|
116
|
+
function noteMetaCall(round, name) {
|
|
117
|
+
if (name !== UPDATE_METADATA_TOOL_NAME && name !== CONTEXT_NEED_TOOL_NAME)
|
|
118
|
+
return;
|
|
119
|
+
if (round.calls.includes(name))
|
|
120
|
+
return;
|
|
121
|
+
round.calls.push(name);
|
|
122
|
+
}
|
|
123
|
+
function latestCutoff(turns) {
|
|
124
|
+
for (const head of turns.toReversed()) {
|
|
125
|
+
for (const chunk of head.doneWork.toReversed()) {
|
|
126
|
+
if (chunk instanceof CompactJob && chunk.cutoff)
|
|
127
|
+
return { turn: head, compact: chunk };
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=side-channel-reminder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"side-channel-reminder.js","sourceRoot":"","sources":["../../src/session/side-channel-reminder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,MAAM,EAAqB,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EACL,UAAU,EACV,sBAAsB,EACtB,eAAe,EACf,WAAW,EACX,cAAc,EACd,WAAW,EACX,yBAAyB,GAG1B,MAAM,8B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B,SAAS;YACX,CAAC;YACD,IAAI,KAAK,IAAI,IAAI;gBAAE,SAAS;YAC5B,IAAI,KAAK,YAAY,WAAW;gBAAE,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YAClE,IAAI,KAAK,YAAY,eAAe,EAAE,CAAC;gBACrC,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,SAAS;oBAAE,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YACvE,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,YAAY,CAAC,KAA0B,EAAE,IAAY;IAC5D,IAAI,IAAI,KAAK,yBAAyB,IAAI,IAAI,KAAK,sBAAsB;QAAE,OAAO;IAClF,IAAI,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO;IACvC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED,SAAS,YAAY,CAAC,KAA6B;IACjD,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,UAAU,EAAE,EAAE,CAAC;QACtC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,CAAC;YAC/C,IAAI,KAAK,YAAY,UAAU,IAAI,KAAK,CAAC,MAAM;gBAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QACzF,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host surfaces this package observes. Kernel/project/harness daemons stay
|
|
3
|
+
* outside; composition supplies commands and park abort through these.
|
|
4
|
+
*/
|
|
5
|
+
import type { UserPrompt } from "@inhuman.tools/harness-commons";
|
|
6
|
+
import type { CompletionExpectation, RegisteredToolsSet, SessionRoot, SessionSystemPrompt, SessionTurn, SkillSpec } from "@inhuman.tools/harness-model";
|
|
7
|
+
import type { Job, WorkExpectation } from "@inhuman.tools/plexus-expectations";
|
|
8
|
+
export type SessionCommandHost = {
|
|
9
|
+
readonly session: SessionRoot;
|
|
10
|
+
readonly constitution: string;
|
|
11
|
+
env(): Record<string, string>;
|
|
12
|
+
toolsFor(tail: SessionSystemPrompt | SessionTurn | null): RegisteredToolsSet | null;
|
|
13
|
+
queuedVerbs(): ReadonlySet<string>;
|
|
14
|
+
/** R1: the resolved context-retention policy JSON a new turn is stamped with. Omit = unstamped (legacy). */
|
|
15
|
+
retentionJson?(): string;
|
|
16
|
+
/**
|
|
17
|
+
* Skill slash split. `prompt` stays what was typed. `derived` is the model
|
|
18
|
+
* injection when it differs, otherwise null.
|
|
19
|
+
*/
|
|
20
|
+
expandSkill?(prompt: UserPrompt, skills: readonly SkillSpec[], verbs: ReadonlySet<string>): {
|
|
21
|
+
readonly prompt: UserPrompt;
|
|
22
|
+
readonly derived: UserPrompt | null;
|
|
23
|
+
};
|
|
24
|
+
syncSkills?(): void;
|
|
25
|
+
applyBotNotice?(turn: SessionTurn): void;
|
|
26
|
+
restorePluginState?(): void;
|
|
27
|
+
cancelOwned(turn: SessionTurn): void;
|
|
28
|
+
skipBackoff?(completion: CompletionExpectation): void;
|
|
29
|
+
loadTurn?(id: string): SessionTurn | undefined;
|
|
30
|
+
rename?(title: string): {
|
|
31
|
+
readonly ok: true;
|
|
32
|
+
readonly title: string;
|
|
33
|
+
};
|
|
34
|
+
log?(message: string): void;
|
|
35
|
+
/** `compactKeepTurns` dial, recorded on a `/compact` job when it is minted (F8). */
|
|
36
|
+
compactKeepTurns?(): number;
|
|
37
|
+
readonly closed?: boolean;
|
|
38
|
+
};
|
|
39
|
+
export type ParkWork = {
|
|
40
|
+
abortJob(job: Job, reason?: unknown): void;
|
|
41
|
+
inFlightJobs(): Iterable<Job>;
|
|
42
|
+
abortExpectation?(expectation: WorkExpectation, reason?: unknown):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;IACrC,WAAW,CAAC,CAAC,UAAU,EAAE,qBAAqB,GAAG,IAAI,CAAC;IACtD,QAAQ,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;IAC/C,MAAM,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG;QAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACtE,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,oFAAoF;IACpF,gBAAgB,CAAC,IAAI,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3C,YAAY,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC9B,gBAAgB,CAAC,CAAC,WAAW,EAAE,eAAe,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CACzE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/session/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-instance tool catalog.
|
|
3
|
+
*
|
|
4
|
+
* catalog = registered ∪ expand(connection)
|
|
5
|
+
* Registered entries and recipes are contributions from outside this package.
|
|
6
|
+
* Connection entries come from a host attached as `connectionHost`.
|
|
7
|
+
*
|
|
8
|
+
* wireName — model tools[] projection (regenerate freely).
|
|
9
|
+
* connection source — kernel ConnectionSpec map key + server tool; never re-parse wireName.
|
|
10
|
+
*/
|
|
11
|
+
import { DisposableClass, type SystemPrompt } from "@inhuman.tools/harness-commons";
|
|
12
|
+
import { type CatalogRecipe } from "./recipes.js";
|
|
13
|
+
import { type CatalogEntry, type WorkerToolHost } from "./types.js";
|
|
14
|
+
export type CompiledPluginContribution = {
|
|
15
|
+
readonly compiledRecipes: readonly CatalogRecipe[];
|
|
16
|
+
};
|
|
17
|
+
export declare class KernelToolCatalog extends DisposableClass {
|
|
18
|
+
#private;
|
|
19
|
+
private readonly source?;
|
|
20
|
+
private readonly permits?;
|
|
21
|
+
constructor(source?: KernelToolCatalog | undefined, permits?: ((name: string) => boolean) | undefined);
|
|
22
|
+
/**
|
|
23
|
+
* Product composition may replace this. Empty until a roster is registered —
|
|
24
|
+
* this package does not name host tools.
|
|
25
|
+
*/
|
|
26
|
+
TOOLS_SYSTEM_ADDENDUM: SystemPrompt;
|
|
27
|
+
/** Set by the host. Views inherit it from their source. */
|
|
28
|
+
workerHost: WorkerToolHost;
|
|
29
|
+
accessor packEntries: CatalogEntry[];
|
|
30
|
+
/** Named-agent recipes authored on KernelRoot.bots / ProjectRoot.bots. */
|
|
31
|
+
accessor recipes: CatalogRecipe[];
|
|
32
|
+
/** Plugin-compiled bot recipes. Not written to KernelRoot.bots. */
|
|
33
|
+
accessor compiledRecipes: CatalogRecipe[];
|
|
34
|
+
/** Installed plugins' `.prompt` bots. An authored or compiled recipe of the same name wins. */
|
|
35
|
+
accessor surfaceRecipes: CatalogRecipe[];
|
|
36
|
+
/**
|
|
37
|
+
* Program revision of each enabled plugin bot, keyed by bot name. A behavior
|
|
38
|
+
* plugin has no compiled install, so this is the revision `isCallPaused`
|
|
39
|
+
* compares a call against. Empty while no behavior has been pinned.
|
|
40
|
+
*/
|
|
41
|
+
accessor botRevisions: ReadonlyMap<string, string>;
|
|
42
|
+
/** Project-dir overlay copied onto session views. Kernel catalog field stays empty. */
|
|
43
|
+
accessor projectRecipes: CatalogRecipe[];
|
|
44
|
+
accessor connectionHost: {
|
|
45
|
+
readonly connectionEntries: readonly CatalogEntry[];
|
|
46
|
+
} | undefined;
|
|
47
|
+
/** Worker-only private bundled MCP tools (not in foreground catalog). */
|
|
48
|
+
accessor privateWorkerEntries: CatalogEntry[];
|
|
49
|
+
/** Tools declared by this agent's pinned behavior. The behavior is their grant. */
|
|
50
|
+
accessor behaviorEntries: CatalogEntry[];
|
|
51
|
+
get connectionEntries(): readonly CatalogEntry[];
|
|
52
|
+
recipe(name: string): CatalogRecipe | undefined;
|
|
53
|
+
allRecipes(): readonly CatalogRecipe[];
|
|
54
|
+
replaceCompiledPlugins(state: CompiledPluginContribution): void;
|
|
55
|
+
/** Returns the bots skipped because another recipe already owns the name. */
|
|
56
|
+
replaceSurfaceRecipes(recipes: readonly CatalogRecipe[]): string[];
|
|
57
|
+
replaceRecipes(recipes: readonly CatalogRecipe[]): void;
|
|
58
|
+
catalogEntry(wireName: string): CatalogEntry | undefined;
|
|
59
|
+
catalogEntries(): readonly CatalogEntry[];
|
|
60
|
+
catalogWireNames(): readonly string[];
|
|
61
|
+
replacePack(entries: readonly CatalogEntry[]): void;
|
|
62
|
+
bindProjectRecipes(workspacePath: string, recipes: readonly CatalogRecipe[]): void;
|
|
63
|
+
unbindProjectRecipes(workspacePath: string): void;
|
|
64
|
+
projectRecipesOf(workspacePath: string | undefined): readonly CatalogRecipe[];
|
|
65
|
+
/** Filtered view of this catalog. Recipe fields are shared; overlay fields stay on the caller. */
|
|
66
|
+
view(permits?: (name: string) => boolean): KernelToolCatalog;
|
|
67
|
+
protected dispose(): void;
|
|
68
|
+
}
|
|
69
|
+
export declare function catalogTriggersReactLoop(catalog: KernelToolCatalog, wire: string): boolean;
|
|
70
|
+
export declare function requireCatalog<T extends KernelToolCatalog>(catalog: T | undefined, what: string): T;
|
|
71
|
+
/** Tools the session's pinned behavior declares. Replaced whenever the pin reattaches. */
|
|
72
|
+
export declare const bindBehaviorEntries: (root: object, entries: readonly CatalogEntry[]) => void;
|
|
73
|
+
export declare function behaviorEntriesOf(root: object | undefined | null): readonly CatalogEntry[];
|
|
74
|
+
/** Bind a session (or test) root to a kernel catalog. */
|
|
75
|
+
export declare function bindSessionCatalog(root: object, catalog: KernelToolCatalog): void;
|
|
76
|
+
export declare function catalogOf(root: object | undefined | null): KernelToolCatalog | undefined;
|
|
77
|
+
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/tool-catalog/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,eAAe,EAA2B,KAAK,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAI7G,OAAO,EAAE,KAAK,aAAa,EAA8C,MAAM,cAAc,CAAC;AAC9F,OAAO,EAAE,KAAK,YAAY,EAAqB,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAEvF,MAAM,MAAM,0BAA0B,GAAG;IACvC,QAAQ,CAAC,eAAe,EAAE,SAAS,aAAa,EAAE,CAAC;CACpD,CAAC;AAEF,qBAAa,iBAAkB,SAAQ,eAAe;;IAElD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;gBADR,MAAM,CAAC,EAAE,iBAAiB,YAAA,EAC1B,OAAO,CAAC,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,aAAA;IAatD;;;OAGG;IACH,qBAAqB,EAAE,YAAY,CAAmB;IACtD,2DAA2D;IAC3D,UAAU,EAAE,cAAc,CAAqB;IAE/C,QAAQ,CAAC,WAAW,EAAE,YAAY,EAAE,CAAM;IAC1C,0EAA0E;IAE1E,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,CAAM;IACvC,mEAAmE;IAEnE,QAAQ,CAAC,eAAe,EAAE,aAAa,EAAE,CAAM;IAC/C,+FAA+F;IAE/F,QAAQ,CAAC,cAAc,EAAE,aAAa,EAAE,CAAM;IAC9C;;;;OAIG;IAEH,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAa;IAC/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