@duetso/agent 0.2.2 → 0.2.4
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/README.md +19 -11
- package/dist/package.json +4 -4
- package/dist/src/cli/config.d.ts +10 -0
- package/dist/src/cli/config.d.ts.map +1 -0
- package/dist/src/cli/config.js +24 -0
- package/dist/src/cli/config.js.map +1 -0
- package/dist/src/cli/help.d.ts.map +1 -1
- package/dist/src/cli/help.js +16 -13
- package/dist/src/cli/help.js.map +1 -1
- package/dist/src/cli/inline-slash.d.ts +2 -1
- package/dist/src/cli/inline-slash.d.ts.map +1 -1
- package/dist/src/cli/inline-slash.js +14 -5
- package/dist/src/cli/inline-slash.js.map +1 -1
- package/dist/src/cli/memory-query.d.ts +1 -1
- package/dist/src/cli/model.d.ts +1 -1
- package/dist/src/cli/model.d.ts.map +1 -1
- package/dist/src/cli/model.js +1 -1
- package/dist/src/cli/model.js.map +1 -1
- package/dist/src/cli/route.d.ts +84 -0
- package/dist/src/cli/route.d.ts.map +1 -0
- package/dist/src/cli/route.js +261 -0
- package/dist/src/cli/route.js.map +1 -0
- package/dist/src/cli/rpc.d.ts +52 -9
- package/dist/src/cli/rpc.d.ts.map +1 -1
- package/dist/src/cli/rpc.js +195 -28
- package/dist/src/cli/rpc.js.map +1 -1
- package/dist/src/cli/run.d.ts +8 -1
- package/dist/src/cli/run.d.ts.map +1 -1
- package/dist/src/cli/run.js +24 -7
- package/dist/src/cli/run.js.map +1 -1
- package/dist/src/cli/shared.d.ts +4 -3
- package/dist/src/cli/shared.d.ts.map +1 -1
- package/dist/src/cli/shared.js +3 -4
- package/dist/src/cli/shared.js.map +1 -1
- package/dist/src/cli/shutdown.d.ts +4 -2
- package/dist/src/cli/shutdown.d.ts.map +1 -1
- package/dist/src/cli/shutdown.js +4 -2
- package/dist/src/cli/shutdown.js.map +1 -1
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +12 -0
- package/dist/src/cli.js.map +1 -1
- package/dist/src/core/structured-output.d.ts +2 -0
- package/dist/src/core/structured-output.d.ts.map +1 -1
- package/dist/src/core/structured-output.js +1 -0
- package/dist/src/core/structured-output.js.map +1 -1
- package/dist/src/lib/system-reminder.d.ts +14 -0
- package/dist/src/lib/system-reminder.d.ts.map +1 -0
- package/dist/src/lib/system-reminder.js +53 -0
- package/dist/src/lib/system-reminder.js.map +1 -0
- package/dist/src/lib/walk-ancestors.d.ts +9 -0
- package/dist/src/lib/walk-ancestors.d.ts.map +1 -0
- package/dist/src/lib/walk-ancestors.js +28 -0
- package/dist/src/lib/walk-ancestors.js.map +1 -0
- package/dist/src/memory/observational-prompts.d.ts.map +1 -1
- package/dist/src/memory/observational-prompts.js +2 -1
- package/dist/src/memory/observational-prompts.js.map +1 -1
- package/dist/src/memory/observational.d.ts +31 -4
- package/dist/src/memory/observational.d.ts.map +1 -1
- package/dist/src/memory/observational.js +43 -4
- package/dist/src/memory/observational.js.map +1 -1
- package/dist/src/model-resolution/catalog.d.ts +2 -2
- package/dist/src/model-resolution/catalog.d.ts.map +1 -1
- package/dist/src/model-resolution/catalog.js +61 -33
- package/dist/src/model-resolution/catalog.js.map +1 -1
- package/dist/src/model-resolution/duet-gateway.d.ts +3 -3
- package/dist/src/model-resolution/duet-gateway.d.ts.map +1 -1
- package/dist/src/model-resolution/duet-gateway.js +119 -19
- package/dist/src/model-resolution/duet-gateway.js.map +1 -1
- package/dist/src/model-resolution/model-gateway.d.ts.map +1 -0
- package/dist/src/{cli → model-resolution}/model-gateway.js +10 -6
- package/dist/src/model-resolution/model-gateway.js.map +1 -0
- package/dist/src/model-resolution/resolver.d.ts +11 -4
- package/dist/src/model-resolution/resolver.d.ts.map +1 -1
- package/dist/src/model-resolution/resolver.js +39 -8
- package/dist/src/model-resolution/resolver.js.map +1 -1
- package/dist/src/model-routing/advisor-transcript.d.ts +36 -0
- package/dist/src/model-routing/advisor-transcript.d.ts.map +1 -0
- package/dist/src/model-routing/advisor-transcript.js +103 -0
- package/dist/src/model-routing/advisor-transcript.js.map +1 -0
- package/dist/src/model-routing/advisor.d.ts +27 -0
- package/dist/src/model-routing/advisor.d.ts.map +1 -0
- package/dist/src/model-routing/advisor.js +20 -0
- package/dist/src/model-routing/advisor.js.map +1 -0
- package/dist/src/model-routing/classifier.d.ts +57 -0
- package/dist/src/model-routing/classifier.d.ts.map +1 -0
- package/dist/src/model-routing/classifier.js +63 -0
- package/dist/src/model-routing/classifier.js.map +1 -0
- package/dist/src/model-routing/loader.d.ts +48 -0
- package/dist/src/model-routing/loader.d.ts.map +1 -0
- package/dist/src/model-routing/loader.js +79 -0
- package/dist/src/model-routing/loader.js.map +1 -0
- package/dist/src/model-routing/prompts.d.ts +22 -0
- package/dist/src/model-routing/prompts.d.ts.map +1 -0
- package/dist/src/model-routing/prompts.js +87 -0
- package/dist/src/model-routing/prompts.js.map +1 -0
- package/dist/src/model-routing/resolve.d.ts +40 -0
- package/dist/src/model-routing/resolve.d.ts.map +1 -0
- package/dist/src/model-routing/resolve.js +76 -0
- package/dist/src/model-routing/resolve.js.map +1 -0
- package/dist/src/model-routing/router.d.ts +149 -0
- package/dist/src/model-routing/router.d.ts.map +1 -0
- package/dist/src/model-routing/router.js +235 -0
- package/dist/src/model-routing/router.js.map +1 -0
- package/dist/src/model-routing/step-triggers.d.ts +27 -0
- package/dist/src/model-routing/step-triggers.d.ts.map +1 -0
- package/dist/src/model-routing/step-triggers.js +20 -0
- package/dist/src/model-routing/step-triggers.js.map +1 -0
- package/dist/src/model-routing/table.d.ts +126 -0
- package/dist/src/model-routing/table.d.ts.map +1 -0
- package/dist/src/model-routing/table.js +351 -0
- package/dist/src/model-routing/table.js.map +1 -0
- package/dist/src/session/session.d.ts +40 -23
- package/dist/src/session/session.d.ts.map +1 -1
- package/dist/src/session/session.js +173 -97
- package/dist/src/session/session.js.map +1 -1
- package/dist/src/tasks/quiescence.d.ts +13 -0
- package/dist/src/tasks/quiescence.d.ts.map +1 -0
- package/dist/src/tasks/quiescence.js +11 -0
- package/dist/src/tasks/quiescence.js.map +1 -0
- package/dist/src/tasks/task-manager.d.ts +101 -0
- package/dist/src/tasks/task-manager.d.ts.map +1 -0
- package/dist/src/tasks/task-manager.js +311 -0
- package/dist/src/tasks/task-manager.js.map +1 -0
- package/dist/src/tasks/types.d.ts +85 -0
- package/dist/src/tasks/types.d.ts.map +1 -0
- package/dist/src/tasks/types.js +2 -0
- package/dist/src/tasks/types.js.map +1 -0
- package/dist/src/tui/app.d.ts +1 -1
- package/dist/src/tui/app.d.ts.map +1 -1
- package/dist/src/tui/app.js +12 -2
- package/dist/src/tui/app.js.map +1 -1
- package/dist/src/tui/initial-prompt.d.ts.map +1 -1
- package/dist/src/tui/initial-prompt.js +0 -3
- package/dist/src/tui/initial-prompt.js.map +1 -1
- package/dist/src/tui/session-subscription.d.ts +3 -0
- package/dist/src/tui/session-subscription.d.ts.map +1 -1
- package/dist/src/tui/session-subscription.js +29 -5
- package/dist/src/tui/session-subscription.js.map +1 -1
- package/dist/src/tui/sidebar.d.ts +3 -0
- package/dist/src/tui/sidebar.d.ts.map +1 -1
- package/dist/src/tui/sidebar.js +19 -3
- package/dist/src/tui/sidebar.js.map +1 -1
- package/dist/src/tui/slash-commands.d.ts +12 -9
- package/dist/src/tui/slash-commands.d.ts.map +1 -1
- package/dist/src/tui/slash-commands.js +48 -10
- package/dist/src/tui/slash-commands.js.map +1 -1
- package/dist/src/tui/status-controller.d.ts +14 -9
- package/dist/src/tui/status-controller.d.ts.map +1 -1
- package/dist/src/tui/status-controller.js +26 -7
- package/dist/src/tui/status-controller.js.map +1 -1
- package/dist/src/tui/task-lane-renderer.d.ts +30 -0
- package/dist/src/tui/task-lane-renderer.d.ts.map +1 -0
- package/dist/src/tui/task-lane-renderer.js +93 -0
- package/dist/src/tui/task-lane-renderer.js.map +1 -0
- package/dist/src/tui/task-tree.d.ts +47 -0
- package/dist/src/tui/task-tree.d.ts.map +1 -0
- package/dist/src/tui/task-tree.js +190 -0
- package/dist/src/tui/task-tree.js.map +1 -0
- package/dist/src/tui/tool-formatters.js +3 -0
- package/dist/src/tui/tool-formatters.js.map +1 -1
- package/dist/src/turn-runner/agent-events.d.ts.map +1 -1
- package/dist/src/turn-runner/agent-events.js +1 -0
- package/dist/src/turn-runner/agent-events.js.map +1 -1
- package/dist/src/turn-runner/duration.d.ts +2 -2
- package/dist/src/turn-runner/duration.js +3 -3
- package/dist/src/turn-runner/duration.js.map +1 -1
- package/dist/src/turn-runner/prompts.d.ts +5 -1
- package/dist/src/turn-runner/prompts.d.ts.map +1 -1
- package/dist/src/turn-runner/prompts.js +30 -6
- package/dist/src/turn-runner/prompts.js.map +1 -1
- package/dist/src/turn-runner/runtime-clock.d.ts +20 -0
- package/dist/src/turn-runner/runtime-clock.d.ts.map +1 -0
- package/dist/src/turn-runner/runtime-clock.js +38 -0
- package/dist/src/turn-runner/runtime-clock.js.map +1 -0
- package/dist/src/turn-runner/shell-state-handle.d.ts +0 -3
- package/dist/src/turn-runner/shell-state-handle.d.ts.map +1 -1
- package/dist/src/turn-runner/shell-state-handle.js +5 -55
- package/dist/src/turn-runner/shell-state-handle.js.map +1 -1
- package/dist/src/turn-runner/skill-context.d.ts +6 -7
- package/dist/src/turn-runner/skill-context.d.ts.map +1 -1
- package/dist/src/turn-runner/skill-context.js +10 -10
- package/dist/src/turn-runner/skill-context.js.map +1 -1
- package/dist/src/turn-runner/skills.d.ts.map +1 -1
- package/dist/src/turn-runner/skills.js +2 -22
- package/dist/src/turn-runner/skills.js.map +1 -1
- package/dist/src/turn-runner/state-compaction.d.ts +7 -5
- package/dist/src/turn-runner/state-compaction.d.ts.map +1 -1
- package/dist/src/turn-runner/state-compaction.js +69 -10
- package/dist/src/turn-runner/state-compaction.js.map +1 -1
- package/dist/src/turn-runner/state-machine-decisions.d.ts +135 -0
- package/dist/src/turn-runner/state-machine-decisions.d.ts.map +1 -0
- package/dist/src/turn-runner/state-machine-decisions.js +443 -0
- package/dist/src/turn-runner/state-machine-decisions.js.map +1 -0
- package/dist/src/turn-runner/state-machine-session.d.ts +13 -28
- package/dist/src/turn-runner/state-machine-session.d.ts.map +1 -1
- package/dist/src/turn-runner/state-machine-session.js +18 -55
- package/dist/src/turn-runner/state-machine-session.js.map +1 -1
- package/dist/src/turn-runner/subagent.d.ts +156 -0
- package/dist/src/turn-runner/subagent.d.ts.map +1 -0
- package/dist/src/turn-runner/subagent.js +164 -0
- package/dist/src/turn-runner/subagent.js.map +1 -0
- package/dist/src/turn-runner/task-tools.d.ts +76 -0
- package/dist/src/turn-runner/task-tools.d.ts.map +1 -0
- package/dist/src/turn-runner/task-tools.js +370 -0
- package/dist/src/turn-runner/task-tools.js.map +1 -0
- package/dist/src/turn-runner/tools.d.ts +65 -17
- package/dist/src/turn-runner/tools.d.ts.map +1 -1
- package/dist/src/turn-runner/tools.js +173 -59
- package/dist/src/turn-runner/tools.js.map +1 -1
- package/dist/src/turn-runner/turn-runner.d.ts +205 -135
- package/dist/src/turn-runner/turn-runner.d.ts.map +1 -1
- package/dist/src/turn-runner/turn-runner.js +1311 -714
- package/dist/src/turn-runner/turn-runner.js.map +1 -1
- package/dist/src/turn-runner/usage-accounting.d.ts +4 -0
- package/dist/src/turn-runner/usage-accounting.d.ts.map +1 -1
- package/dist/src/turn-runner/usage-accounting.js +19 -0
- package/dist/src/turn-runner/usage-accounting.js.map +1 -1
- package/dist/src/types/config.d.ts +9 -1
- package/dist/src/types/config.d.ts.map +1 -1
- package/dist/src/types/config.js +2 -1
- package/dist/src/types/config.js.map +1 -1
- package/dist/src/types/protocol.d.ts +124 -30
- package/dist/src/types/protocol.d.ts.map +1 -1
- package/dist/src/types/state-machine.d.ts +10 -12
- package/dist/src/types/state-machine.d.ts.map +1 -1
- package/dist/src/types/state-machine.js.map +1 -1
- package/package.json +4 -4
- package/dist/src/cli/model-gateway.d.ts.map +0 -1
- package/dist/src/cli/model-gateway.js.map +0 -1
- package/dist/src/turn-runner/state-machine-controller.d.ts +0 -140
- package/dist/src/turn-runner/state-machine-controller.d.ts.map +0 -1
- package/dist/src/turn-runner/state-machine-controller.js +0 -501
- package/dist/src/turn-runner/state-machine-controller.js.map +0 -1
- /package/dist/src/{cli → model-resolution}/model-gateway.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shutdown.js","sourceRoot":"","sources":["../../../src/cli/shutdown.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"shutdown.js","sourceRoot":"","sources":["../../../src/cli/shutdown.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAA4B;IAClE,IAAI,YAAY,GAAG,KAAK,CAAC;IAEzB,MAAM,OAAO,GAAG,CAAC,MAAsB,EAAE,EAAE;QACzC,MAAM,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;QACpC,IAAI,YAAY,EAAE,CAAC;YACjB,sEAAsE;YACtE,uEAAuE;YACvE,qBAAqB;YACrB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;QACD,YAAY,GAAG,IAAI,CAAC;QAEpB,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,EAAE;YAC/B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;YAC/E,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC,EAAE,IAAI,CAAC,CAAC;QACT,QAAQ,CAAC,KAAK,EAAE,CAAC;QAEjB,OAAO,EAAE;aACN,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iCAAiC,OAAO,IAAI,CAAC,CAAC;QACrE,CAAC,CAAC;aACD,OAAO,CAAC,GAAG,EAAE;YACZ,YAAY,CAAC,QAAQ,CAAC,CAAC;YACvB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAE/B,OAAO,GAAG,EAAE;QACV,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC/B,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAClC,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,MAAsB;IAC5C,6DAA6D;IAC7D,IAAI,MAAM,KAAK,QAAQ;QAAE,OAAO,GAAG,CAAC;IACpC,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,GAAG,CAAC;IACrC,OAAO,CAAC,CAAC;AACX,CAAC"}
|
package/dist/src/cli.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export { runSkillsCommand } from "./cli/skills.js";
|
|
|
22
22
|
export { runUpgradeCommand } from "./cli/upgrade.js";
|
|
23
23
|
export { runMemoryCommand } from "./cli/memory.js";
|
|
24
24
|
export { runModelCommand } from "./cli/model.js";
|
|
25
|
+
export { runRouteCommand } from "./cli/route.js";
|
|
26
|
+
export { runConfigCommand } from "./cli/config.js";
|
|
25
27
|
export { runMemoryAddCommand } from "./cli/memory-add.js";
|
|
26
28
|
export { runMemoryRecallCommand } from "./cli/memory-recall.js";
|
|
27
29
|
export { runMemoryReflectCommand } from "./cli/memory-reflect.js";
|
package/dist/src/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;GAWG;
|
|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eAAe,EACf,UAAU,GACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,+BAA+B,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACjG,YAAY,EAAE,cAAc,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAC/F,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAO/D,wBAAsB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CA2D5C"}
|
package/dist/src/cli.js
CHANGED
|
@@ -13,11 +13,13 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import { pathToFileURL } from "node:url";
|
|
15
15
|
import packageJson from "../package.json" with { type: "json" };
|
|
16
|
+
import { runConfigCommand } from "./cli/config.js";
|
|
16
17
|
import { runEnvCommand } from "./cli/env.js";
|
|
17
18
|
import { runLoginCommand } from "./cli/login.js";
|
|
18
19
|
import { runMemoryCommand } from "./cli/memory.js";
|
|
19
20
|
import { runModelCommand } from "./cli/model.js";
|
|
20
21
|
import { runRpcCommand } from "./cli/rpc.js";
|
|
22
|
+
import { runRouteCommand } from "./cli/route.js";
|
|
21
23
|
import { runRunCommand } from "./cli/run.js";
|
|
22
24
|
import { runSendFeedbackCommand } from "./cli/send-feedback.js";
|
|
23
25
|
import { runSkillsCommand } from "./cli/skills.js";
|
|
@@ -31,6 +33,8 @@ export { runSkillsCommand } from "./cli/skills.js";
|
|
|
31
33
|
export { runUpgradeCommand } from "./cli/upgrade.js";
|
|
32
34
|
export { runMemoryCommand } from "./cli/memory.js";
|
|
33
35
|
export { runModelCommand } from "./cli/model.js";
|
|
36
|
+
export { runRouteCommand } from "./cli/route.js";
|
|
37
|
+
export { runConfigCommand } from "./cli/config.js";
|
|
34
38
|
export { runMemoryAddCommand } from "./cli/memory-add.js";
|
|
35
39
|
export { runMemoryRecallCommand } from "./cli/memory-recall.js";
|
|
36
40
|
export { runMemoryReflectCommand } from "./cli/memory-reflect.js";
|
|
@@ -72,6 +76,14 @@ export async function runCli() {
|
|
|
72
76
|
await runModelCommand(args.slice(1));
|
|
73
77
|
return;
|
|
74
78
|
}
|
|
79
|
+
if (subcommand === "route") {
|
|
80
|
+
await runRouteCommand(args.slice(1));
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (subcommand === "config") {
|
|
84
|
+
await runConfigCommand(args.slice(1));
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
75
87
|
if (subcommand === "train") {
|
|
76
88
|
await runTrainCommand(args.slice(1));
|
|
77
89
|
return;
|
package/dist/src/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,WAAW,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAOrD,OAAO,EAAE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
@@ -6,6 +6,8 @@ export interface StructuredOutputOptions<TSchemaValue extends TSchema> {
|
|
|
6
6
|
tool: Tool<TSchemaValue>;
|
|
7
7
|
prompt: StructuredOutputPrompt;
|
|
8
8
|
systemPrompt?: string;
|
|
9
|
+
/** Cancels the provider stream and surfaces an aborted completion to the caller. */
|
|
10
|
+
signal?: AbortSignal;
|
|
9
11
|
callOptions?: ProviderStreamOptions;
|
|
10
12
|
onUsage?: (usage: Usage) => void;
|
|
11
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structured-output.d.ts","sourceRoot":"","sources":["../../../src/core/structured-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EAEjB,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,IAAI,EAET,KAAK,KAAK,EACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAI/C,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,KAAK,CAAC,WAAW,GAAG,YAAY,CAAC,CAAC;AAEhF,MAAM,WAAW,uBAAuB,CAAC,YAAY,SAAS,OAAO;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IACzB,MAAM,EAAE,sBAAsB,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,qBAAqB,CAAC;IACpC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED,wBAAsB,wBAAwB,CAAC,YAAY,SAAS,OAAO,EACzE,OAAO,EAAE,uBAAuB,CAAC,YAAY,CAAC,GAC7C,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"structured-output.d.ts","sourceRoot":"","sources":["../../../src/core/structured-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EAEjB,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,IAAI,EAET,KAAK,KAAK,EACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAI/C,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,KAAK,CAAC,WAAW,GAAG,YAAY,CAAC,CAAC;AAEhF,MAAM,WAAW,uBAAuB,CAAC,YAAY,SAAS,OAAO;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IACzB,MAAM,EAAE,sBAAsB,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oFAAoF;IACpF,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,WAAW,CAAC,EAAE,qBAAqB,CAAC;IACpC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED,wBAAsB,wBAAwB,CAAC,YAAY,SAAS,OAAO,EACzE,OAAO,EAAE,uBAAuB,CAAC,YAAY,CAAC,GAC7C,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAuC/B"}
|
|
@@ -16,6 +16,7 @@ export async function generateStructuredOutput(options) {
|
|
|
16
16
|
messages: [{ role: "user", content: options.prompt, timestamp: Date.now() }],
|
|
17
17
|
}, {
|
|
18
18
|
...options.callOptions,
|
|
19
|
+
...(options.signal ? { signal: options.signal } : {}),
|
|
19
20
|
...(resolvedApiKey ? { apiKey: resolvedApiKey } : {}),
|
|
20
21
|
toolChoice: forcedToolChoice(model, options.tool.name),
|
|
21
22
|
onPayload: async (payload, payloadModel) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structured-output.js","sourceRoot":"","sources":["../../../src/core/structured-output.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,qB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Q,CAAyB,CAAC;AAC/E,CAAC;AAED,SAAS,eAAe,CAAC,KAAc,EAAE,IAAY;IACnD,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,IAAI,KAAK;QACf,KAAK,CAAC,IAAI,KAAK,UAAU;QACzB,MAAM,IAAI,KAAK;QACf,KAAK,CAAC,IAAI,KAAK,IAAI;QACnB,WAAW,IAAI,KAAK;QACpB,OAAO,KAAK,CAAC,SAAS,KAAK,QAAQ;QACnC,KAAK,CAAC,SAAS,KAAK,IAAI,CACzB,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAiB,EAAE,QAAgB;IAC3D,IAAI,KAAK,CAAC,GAAG,KAAK,oBAAoB,EAAE,CAAC;QACvC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAC1C,CAAC;IAED,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KAC7B,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAS,yBAAyB,CAAC,KAAiB,EAAE,OAAgB,EAAE,QAAgB;IACtF,IAAI,KAAK,CAAC,GAAG,KAAK,kBAAkB,IAAI,KAAK,CAAC,GAAG,KAAK,wBAAwB,EAAE,CAAC;QAC/E,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC;IACpE,OAAO;QACL,GAAI,OAAmC;QACvC,WAAW,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE;KAClD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrap runtime-injected text in a single `<system-reminder>` block — the one
|
|
3
|
+
* tag for everything the harness says in a user-facing channel. Idempotent:
|
|
4
|
+
* text that already IS one whole reminder block passes through unchanged.
|
|
5
|
+
*/
|
|
6
|
+
export declare function systemReminder(text: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Remove every `<system-reminder>…</system-reminder>` segment while keeping
|
|
9
|
+
* surrounding text. Memory observation and routing step-triggers project
|
|
10
|
+
* transcripts through this so harness plumbing never becomes a memory or a
|
|
11
|
+
* reroute signal.
|
|
12
|
+
*/
|
|
13
|
+
export declare function stripSystemReminders(text: string): string;
|
|
14
|
+
//# sourceMappingURL=system-reminder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-reminder.d.ts","sourceRoot":"","sources":["../../../src/lib/system-reminder.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAInD;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA8BzD"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const OPEN = "<system-reminder>";
|
|
2
|
+
const CLOSE = "</system-reminder>";
|
|
3
|
+
/**
|
|
4
|
+
* Wrap runtime-injected text in a single `<system-reminder>` block — the one
|
|
5
|
+
* tag for everything the harness says in a user-facing channel. Idempotent:
|
|
6
|
+
* text that already IS one whole reminder block passes through unchanged.
|
|
7
|
+
*/
|
|
8
|
+
export function systemReminder(text) {
|
|
9
|
+
const trimmed = text.trim();
|
|
10
|
+
if (trimmed.startsWith(OPEN) && trimmed.endsWith(CLOSE))
|
|
11
|
+
return trimmed;
|
|
12
|
+
return `${OPEN}\n${trimmed}\n${CLOSE}`;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Remove every `<system-reminder>…</system-reminder>` segment while keeping
|
|
16
|
+
* surrounding text. Memory observation and routing step-triggers project
|
|
17
|
+
* transcripts through this so harness plumbing never becomes a memory or a
|
|
18
|
+
* reroute signal.
|
|
19
|
+
*/
|
|
20
|
+
export function stripSystemReminders(text) {
|
|
21
|
+
let stripped = text;
|
|
22
|
+
let start = stripped.indexOf(OPEN);
|
|
23
|
+
while (start !== -1) {
|
|
24
|
+
// Depth-aware: injected reminders may nest (a wrapped message that itself
|
|
25
|
+
// contains a reminder block); strip to the MATCHING close, not the first.
|
|
26
|
+
let depth = 0;
|
|
27
|
+
let cursor = start;
|
|
28
|
+
let end = -1;
|
|
29
|
+
while (cursor < stripped.length) {
|
|
30
|
+
const nextOpen = stripped.indexOf(OPEN, cursor + 1);
|
|
31
|
+
const nextClose = stripped.indexOf(CLOSE, cursor + 1);
|
|
32
|
+
if (nextClose === -1)
|
|
33
|
+
break;
|
|
34
|
+
if (nextOpen !== -1 && nextOpen < nextClose) {
|
|
35
|
+
depth += 1;
|
|
36
|
+
cursor = nextOpen;
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (depth === 0) {
|
|
40
|
+
end = nextClose;
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
depth -= 1;
|
|
44
|
+
cursor = nextClose;
|
|
45
|
+
}
|
|
46
|
+
if (end === -1)
|
|
47
|
+
break;
|
|
48
|
+
stripped = `${stripped.slice(0, start)}\n${stripped.slice(end + CLOSE.length)}`;
|
|
49
|
+
start = stripped.indexOf(OPEN);
|
|
50
|
+
}
|
|
51
|
+
return stripped.trim();
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=system-reminder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-reminder.js","sourceRoot":"","sources":["../../../src/lib/system-reminder.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,MAAM,KAAK,GAAG,oBAAoB,CAAC;AAEnC;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,IAAI,OAAO,CAAC,UA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,EAAE,KAAK,CAAC,KAAK,QAAQ,CAAC,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QAChF,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Yields cwd, its parent, grandparent, ... up to the filesystem root. The
|
|
3
|
+
* home directory is excluded so global (home-scoped) configuration does not
|
|
4
|
+
* get double-counted as project configuration when cwd lives inside $HOME.
|
|
5
|
+
* Shared by skills discovery and routing-table discovery — the two must agree
|
|
6
|
+
* on what "project scope walks upward" means, so the walk has one owner.
|
|
7
|
+
*/
|
|
8
|
+
export declare function walkAncestors(cwd: string, home?: string): string[];
|
|
9
|
+
//# sourceMappingURL=walk-ancestors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walk-ancestors.d.ts","sourceRoot":"","sources":["../../../src/lib/walk-ancestors.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,MAAkB,GAAG,MAAM,EAAE,CAc7E"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
|
+
/**
|
|
4
|
+
* Yields cwd, its parent, grandparent, ... up to the filesystem root. The
|
|
5
|
+
* home directory is excluded so global (home-scoped) configuration does not
|
|
6
|
+
* get double-counted as project configuration when cwd lives inside $HOME.
|
|
7
|
+
* Shared by skills discovery and routing-table discovery — the two must agree
|
|
8
|
+
* on what "project scope walks upward" means, so the walk has one owner.
|
|
9
|
+
*/
|
|
10
|
+
export function walkAncestors(cwd, home = homedir()) {
|
|
11
|
+
const resolvedHome = resolve(home);
|
|
12
|
+
const seen = new Set();
|
|
13
|
+
const result = [];
|
|
14
|
+
let current = resolve(cwd);
|
|
15
|
+
while (true) {
|
|
16
|
+
if (seen.has(current))
|
|
17
|
+
break;
|
|
18
|
+
seen.add(current);
|
|
19
|
+
if (current !== resolvedHome)
|
|
20
|
+
result.push(current);
|
|
21
|
+
const parent = dirname(current);
|
|
22
|
+
if (parent === current)
|
|
23
|
+
break;
|
|
24
|
+
current = parent;
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=walk-ancestors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walk-ancestors.js","sourceRoot":"","sources":["../../../src/lib/walk-ancestors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW,EAAE,OAAe,OAAO,EAAE;IACjE,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3B,OAAO,IAAI,EAAE,CAAC;QACZ,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;YAAE,MAAM;QAC7B,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAClB,IAAI,OAAO,KAAK,YAAY;YAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;QAChC,IAAI,MAAM,KAAK,OAAO;YAAE,MAAM;QAC9B,OAAO,GAAG,MAAM,CAAC;IACnB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,C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;AAEF,wBAAgB,yBAAyB,CAAC,kBAAkB,UAAQ,GAAG,MAAM,CA6E5E;AAED,MAAM,WAAW,qBAAqB;IACpC;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,yBAAyB,CACvC,WAAW,CAAC,EAAE,MAAM,EACpB,kBAAkB,UAAQ,EAC1B,OAAO,GAAE,qBAA0B,GAClC,MAAM,CAyCR;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,gBAAgB,EAAE,EAC5B,oBAAoB,EAAE,MAAM,EAC5B,YAAY,EAAE,MAAM,EACpB,KAAK,CAAC,EAAE;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,EAChC,GAAG,OAAa,GACf,gBAAgB,CA0ClB;AAED,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,gBAAgB,CAYxF;AAMD,MAAM,WAAW,sBAAsB;IACrC;;;;;;OAMG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,0BAA0B,CACxC,WAAW,CAAC,EAAE,MAAM,EACpB,OAAO,GAAE,sBAA2B,GACnC,MAAM,CAkDR;AAED,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,KAAK,CAAC,EAAE;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,GAC/B,MAAM,CAkBR"}
|
|
@@ -335,7 +335,8 @@ export function buildReflectorSystemPrompt(instruction, context = {}) {
|
|
|
335
335
|
- ISO date stamps (\`YYYY-MM-DD\`, e.g. \`2026-05-16\`) anchor the timeline. Retain every distinct date that appears in the source observation-group headings or content verbatim, even when consolidating multiple observations from the same day into one row. A reflection that drops every date has destroyed chronology even if the narrative reads fluently. If the source pool spans multiple months, the final reflection MUST contain at least three distinct \`YYYY-MM-DD\` anchors so a future agent can sequence the work.
|
|
336
336
|
- Preserve canonical version tags and final-state PR numbers (\`v0.1.157\`, \`PR #1334\`) as durable identifiers. This is NOT a license to enumerate intermediate commit SHAs from a supersession chain — see the consolidation rule below. The distinction: a tagged release or a merged PR is a stable anchor a future agent can navigate to; a mid-chain commit SHA is just a step that has already been superseded by the final outcome.
|
|
337
337
|
- Preserve durable user preferences, conventions, and standing rules as recognizable phrases. "Always run \`bun format\` before commit", "PR titles use the \`[name] subject\` shape", "never use \`as any\`", "observability through OpenTelemetry only" — these are cross-session commitments that govern future work, not narrative fluff. They are easy to drop under noise because each one only appears once or twice in the source, but they are exactly what the future agent needs to honor the user's standing intent. Keep the literal trigger phrase (the command, the convention, the rule) so a future grep finds it.
|
|
338
|
-
- When the source records distinct strategic decisions — a feature/mode removed, a tool or library adopted, a provider or platform chosen, an architecture changed — each named decision must survive as a recognizable phrase in the output, with the WHY attached. Do not collapse "Plan mode removed", "Hyperframes adopted",
|
|
338
|
+
- When the source records distinct strategic decisions — a feature/mode removed, a tool or library adopted, a provider or platform chosen, an architecture changed, a feature deferred/postponed/descoped/ruled out of this pass, or a boundary drawn (which surfaces get a behavior and which are deliberately left plain, which data or module was split out from which) — each named decision must survive as a recognizable phrase in the output, with the WHY attached. Do not collapse "Plan mode removed", "Hyperframes adopted", "duet-gateway provider chosen", and "deferred SSO to next milestone because it needs an IdP contract" into a generic "several architecture changes" clause. The next agent needs to know which specific things are now true — and which were deliberately NOT done — so it doesn't relitigate them. Negative and scope-boundary decisions are the easiest to lose because nothing shipped for them, yet they are exactly the precedent that stops the next agent re-proposing what was already declined or re-merging what was deliberately separated; when a decision draws a line, name both sides of it.
|
|
339
|
+
- A strategic decision embedded inside a larger completed effort still earns its own recognizable phrase. When a row summarizes a big shipped arc (a multi-part feature, a release train, a migration, a marketing build), do not let the headline outcome absorb a deferral, a removal, or a scope split that happened along the way — those are the parts most likely to vanish when the arc is compressed to its result, and the parts a future agent most needs to avoid relitigating.
|
|
339
340
|
- Do not invent details. If a fact wasn't in the source, leave it out — but DO restate context that IS in the source even if it feels redundant within the row, because it won't be redundant when read cold.
|
|
340
341
|
- Length budget per row: roughly 150-600 tokens (one short paragraph). Going longer is fine when the journey genuinely needs it; staying very short is the failure mode to avoid.
|
|
341
342
|
${instruction ? `\nCustom instructions:\n${instruction}` : ""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observational-prompts.js","sourceRoot":"","sources":["../../../src/memory/observational-prompts.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAkC5B,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAA;;;;;;;;CAQlD,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAA;;CAE/C,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,sCAAsC,CAAC;AAClF,MAAM,CAAC,MAAM,wBAAwB,GACnC,uQAAuQ,CAAC;AAE1Q,MAAM,CAAC,MAAM,0BAA0B,GAAG,uBAAuB,CAAC;AAClE,MAAM,CAAC,MAAM,uBAAuB,GAClC,sOAAsO,CAAC;AAEzO,MAAM,CAAC,MAAM,gCAAgC,GAAG,MAAM,CAAA;;;;;;;;;;CAUrD,CAAC;AAEF,MAAM,gCAAgC,GAAG,MAAM,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgE9C,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAA;;;;;;;;;;;;;;;;;;;;;;CAsBxC,CAAC;AAEF,MAAM,UAAU,yBAAyB,CAAC,kBAAkB,GAAG,KAAK;IAClE,MAAM,kBAAkB,GAAG,kBAAkB;QAC3C,CAAC,CAAC,MAAM,CAAA;;OAEL;QACH,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO,MAAM,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAoET,kBAAkB;GACrB,CAAC;AACJ,CAAC;AA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AgentMessage } from "@earendil-works/pi-agent-core";
|
|
2
|
-
import type { Model, Usage } from "@earendil-works/pi-ai";
|
|
2
|
+
import type { ImageContent, Model, TextContent, Usage } from "@earendil-works/pi-ai";
|
|
3
3
|
import type { WireGuardHorizon } from "../types/protocol.js";
|
|
4
4
|
import type { MemoryContextCache } from "./store.js";
|
|
5
5
|
import type { MemorySession } from "./session.js";
|
|
@@ -203,10 +203,11 @@ export declare class ModelByInputTokens {
|
|
|
203
203
|
export interface ObservationalContextTransformOptions {
|
|
204
204
|
memory: MemoryContextCache;
|
|
205
205
|
/**
|
|
206
|
-
*
|
|
207
|
-
* model's hard limit
|
|
206
|
+
* Live caller-resolved effective context window, already clamped to the
|
|
207
|
+
* active model's hard limit. It is re-read on every transform invocation
|
|
208
|
+
* so a mid-turn model swap immediately changes compaction budgets.
|
|
208
209
|
*/
|
|
209
|
-
effectiveContext: number;
|
|
210
|
+
effectiveContext: number | (() => number);
|
|
210
211
|
settings?: ObservationalMemorySettingsInput;
|
|
211
212
|
/**
|
|
212
213
|
* Awaited inside the budget-trigger block, before the eviction walk
|
|
@@ -523,6 +524,31 @@ export declare function trimMessagesToTranscriptBudget(messages: RawMemoryMessag
|
|
|
523
524
|
export declare function getUnobservedMessageTail(messages: RawMemoryMessage[], observations: Observation[]): RawMemoryMessage[];
|
|
524
525
|
export declare function agentMessagesToRaw(messages: AgentMessage[]): RawMemoryMessage[];
|
|
525
526
|
export declare function agentMessageToRaw(message: AgentMessage): RawMemoryMessage | undefined;
|
|
527
|
+
/**
|
|
528
|
+
* Multimodal-preview projection of an `AgentMessage` used exclusively by the
|
|
529
|
+
* observer pipeline. The observer model reads `textPreview` as a transcript
|
|
530
|
+
* and the image blocks in `content` as inline attachments; structured
|
|
531
|
+
* provider blocks (`toolCall`, `thinking`, etc.) are flattened into compact
|
|
532
|
+
* `textPreview` snippets so the observer sees what was called and what came
|
|
533
|
+
* back without paying for the full serialized request body.
|
|
534
|
+
*/
|
|
535
|
+
interface ObserverMessagePreview {
|
|
536
|
+
content: Array<TextContent | ImageContent>;
|
|
537
|
+
textPreview: string;
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Project an `AgentMessage` into the compact transcript the observer model
|
|
541
|
+
* consumes. Text and image blocks pass through (text in `textPreview`,
|
|
542
|
+
* image bytes inline in `content`); tool calls are flattened into short
|
|
543
|
+
* `[toolCall name(args)]` snippets, tool-result content is truncated and
|
|
544
|
+
* prefixed with the tool name, and thinking blocks are dropped (see
|
|
545
|
+
* {@link structuredBlockPreview}).
|
|
546
|
+
*
|
|
547
|
+
* Not a wire-faithful round-trip — the actor's request to the provider is
|
|
548
|
+
* built separately. This projection is observer-only, which is why
|
|
549
|
+
* truncation and tagging are safe here.
|
|
550
|
+
*/
|
|
551
|
+
export declare function serializeMessageForObserver(message: AgentMessage): ObserverMessagePreview;
|
|
526
552
|
export declare function sanitizeObservationLines(observations: string): string;
|
|
527
553
|
/**
|
|
528
554
|
* Average characters per token assumed by the heuristic estimator. The
|
|
@@ -542,4 +568,5 @@ export declare const CHARS_PER_TOKEN = 3.2;
|
|
|
542
568
|
* consistent with the trigger arithmetic in this file.
|
|
543
569
|
*/
|
|
544
570
|
export declare function estimateTokens(text: string): number;
|
|
571
|
+
export {};
|
|
545
572
|
//# sourceMappingURL=observational.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observational.d.ts","sourceRoot":"","sources":["../../../src/memory/observational.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"observational.d.ts","sourceRoot":"","sources":["../../../src/memory/observational.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAcrF,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,EAAE,gBAAgB,EAAE,EAC5B,YAAY,EAAE,WAAW,EAAE,GAC1B,gBAAgB,EAAE,CAMpB;AA0BD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,gBAAgB,EAAE,CAI/E;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,YAAY,GAAG,gBAAgB,GAAG,SAAS,CAgBrF;AA2BD;;;;;;;GAOG;AACH,UAAU,sBAAsB;IAC9B,OAAO,EAAE,KAAK,CAAC,WAAW,GAAG,YAAY,CAAC,CAAC;IAC3C,WAAW,EAAE,MAAM,CAAC;CACrB;AAiBD;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,YAAY,GAAG,sBAAsB,CA6CzF;AAuHD,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAWrE;AAcD;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { nanoid } from "nanoid";
|
|
2
2
|
import { Type } from "typebox";
|
|
3
3
|
import { generateStructuredOutput } from "../core/structured-output.js";
|
|
4
|
+
import { stripSystemReminders } from "../lib/system-reminder.js";
|
|
4
5
|
import { applyEvictionHorizon, calculateWireBytes, calculateWireTokens, IMAGE_WIRE_TOKEN_ESTIMATE, findEvictionHorizon, WIRE_BYTE_TARGET, WIRE_BYTE_TRIGGER, } from "../turn-runner/wire-shaping.js";
|
|
5
6
|
import { appendObservation, bumpLastUsed, readSessionObservations, replaceAllObservations, replaceSessionObservations, } from "./storage.js";
|
|
6
7
|
import { parseObservationGroups, reconcileObservationGroupsFromReflection, renderObservationGroupsForReflection, stripObservationGroups, wrapInObservationGroup, } from "./observation-groups.js";
|
|
@@ -13,6 +14,14 @@ import { GLOBAL_OBSERVATIONS_HEADING, GLOBAL_OBSERVATIONS_HINT, LOCAL_OBSERVATIO
|
|
|
13
14
|
* for active tool work between compactions.
|
|
14
15
|
*/
|
|
15
16
|
export const DEFAULT_EFFECTIVE_CONTEXT = 200_000;
|
|
17
|
+
/**
|
|
18
|
+
* Reasoning effort for every observational-memory LLM call (observer +
|
|
19
|
+
* reflectors). Memory extraction is a cheap, bounded task, so we run it at LOW
|
|
20
|
+
* effort. This is honored by OpenAI-transport models (openai-responses, e.g.
|
|
21
|
+
* the default gpt-5.6-luna, which maps it through the request's reasoning
|
|
22
|
+
* effort) and silently ignored by anthropic-messages transports (e.g. haiku).
|
|
23
|
+
*/
|
|
24
|
+
const MEMORY_CALL_OPTIONS = { reasoningEffort: "low" };
|
|
16
25
|
/**
|
|
17
26
|
* Ratios of `effectiveContext` that govern the local-session budgets that
|
|
18
27
|
* count against the actor model's per-turn input. `messageTokens` caps the
|
|
@@ -299,9 +308,12 @@ export function validateObservationalMemorySettings(settings) {
|
|
|
299
308
|
}
|
|
300
309
|
}
|
|
301
310
|
export function createObservationalContextTransform(options) {
|
|
302
|
-
const settings = resolveObservationalMemorySettings(options.effectiveContext, options.settings);
|
|
303
|
-
validateObservationalMemorySettings(settings);
|
|
304
311
|
return async (messages) => {
|
|
312
|
+
const effectiveContext = typeof options.effectiveContext === "function"
|
|
313
|
+
? options.effectiveContext()
|
|
314
|
+
: options.effectiveContext;
|
|
315
|
+
const settings = resolveObservationalMemorySettings(effectiveContext, options.settings);
|
|
316
|
+
validateObservationalMemorySettings(settings);
|
|
305
317
|
const observableMessages = stripObservationalContextMessages(messages);
|
|
306
318
|
let retainedMessages = applyEvictionHorizon(observableMessages, options.horizon.evictionHorizon);
|
|
307
319
|
// Trigger condition: either budget exceeded under the current sticky
|
|
@@ -512,6 +524,28 @@ function buildContinuationMessage() {
|
|
|
512
524
|
export function stripObservationalContextMessages(messages) {
|
|
513
525
|
return messages.filter((message) => !isObservationalContextMessage(message));
|
|
514
526
|
}
|
|
527
|
+
/** Remove `<system-reminder>` segments (any role) from the observer's transcript projection. */
|
|
528
|
+
function stripSystemRemindersForObserver(messages) {
|
|
529
|
+
return messages
|
|
530
|
+
.map(stripSystemReminderSegments)
|
|
531
|
+
.filter((message) => message !== undefined);
|
|
532
|
+
}
|
|
533
|
+
function stripSystemReminderSegments(message) {
|
|
534
|
+
if (!("content" in message))
|
|
535
|
+
return message;
|
|
536
|
+
const { content } = message;
|
|
537
|
+
if (typeof content === "string") {
|
|
538
|
+
const stripped = stripSystemReminders(content);
|
|
539
|
+
// Same-shape rebuild; the cast re-asserts the union member the spread widened.
|
|
540
|
+
return stripped ? { ...message, content: stripped } : undefined;
|
|
541
|
+
}
|
|
542
|
+
const strippedBlocks = content
|
|
543
|
+
.map((block) => block.type === "text" ? { ...block, text: stripSystemReminders(block.text) } : block)
|
|
544
|
+
.filter((block) => block.type !== "text" || block.text.length > 0);
|
|
545
|
+
return strippedBlocks.length > 0
|
|
546
|
+
? { ...message, content: strippedBlocks }
|
|
547
|
+
: undefined;
|
|
548
|
+
}
|
|
515
549
|
function isObservationalContextMessage(message) {
|
|
516
550
|
if (message.role !== "user")
|
|
517
551
|
return false;
|
|
@@ -578,6 +612,7 @@ async function reflectObservations(args) {
|
|
|
578
612
|
tool: reflectorResultTool,
|
|
579
613
|
systemPrompt: buildReflectorSystemPrompt(settings.reflection.instruction, { cwd }),
|
|
580
614
|
prompt: buildReflectorPrompt(rendered, targetTokens),
|
|
615
|
+
callOptions: MEMORY_CALL_OPTIONS,
|
|
581
616
|
onUsage,
|
|
582
617
|
});
|
|
583
618
|
// The in-session reflector still produces a single observation row,
|
|
@@ -593,6 +628,7 @@ async function reflectObservations(args) {
|
|
|
593
628
|
tool: reflectorResultTool,
|
|
594
629
|
systemPrompt: buildReflectorSystemPrompt(settings.reflection.instruction, { cwd }),
|
|
595
630
|
prompt: buildReflectorPrompt(rendered, targetTokens, { actualTokens }),
|
|
631
|
+
callOptions: MEMORY_CALL_OPTIONS,
|
|
596
632
|
onUsage,
|
|
597
633
|
});
|
|
598
634
|
return joinReflectorRows(retryResult.reflections);
|
|
@@ -866,6 +902,7 @@ async function reflectBatch(args) {
|
|
|
866
902
|
tool: reflectorResultTool,
|
|
867
903
|
systemPrompt: buildReflectorSystemPrompt(settings.reflection.instruction),
|
|
868
904
|
prompt: buildReflectorPrompt(source, targetTokens),
|
|
905
|
+
callOptions: MEMORY_CALL_OPTIONS,
|
|
869
906
|
onUsage,
|
|
870
907
|
});
|
|
871
908
|
const rows = result.reflections ?? [];
|
|
@@ -940,6 +977,7 @@ async function observe(messages, previousLocalObservations, attributableMemories
|
|
|
940
977
|
tool: observerResultTool,
|
|
941
978
|
systemPrompt,
|
|
942
979
|
prompt,
|
|
980
|
+
callOptions: MEMORY_CALL_OPTIONS,
|
|
943
981
|
onUsage,
|
|
944
982
|
});
|
|
945
983
|
if (!result.hasMemory) {
|
|
@@ -957,6 +995,7 @@ async function observe(messages, previousLocalObservations, attributableMemories
|
|
|
957
995
|
tool: observerResultTool,
|
|
958
996
|
systemPrompt,
|
|
959
997
|
prompt: buildObserverPrompt(trimmedMessages, previousObservationText, observationLogBudget, { actualTokens }),
|
|
998
|
+
callOptions: MEMORY_CALL_OPTIONS,
|
|
960
999
|
onUsage,
|
|
961
1000
|
});
|
|
962
1001
|
return retryResult.observations;
|
|
@@ -1107,7 +1146,7 @@ function getLastObservedMessageIndex(messages, observations) {
|
|
|
1107
1146
|
return lastObservedIndex;
|
|
1108
1147
|
}
|
|
1109
1148
|
export function agentMessagesToRaw(messages) {
|
|
1110
|
-
return messages
|
|
1149
|
+
return stripSystemRemindersForObserver(messages)
|
|
1111
1150
|
.map((message) => agentMessageToRaw(message))
|
|
1112
1151
|
.filter((message) => Boolean(message));
|
|
1113
1152
|
}
|
|
@@ -1172,7 +1211,7 @@ function truncateForObserver(text, max) {
|
|
|
1172
1211
|
* built separately. This projection is observer-only, which is why
|
|
1173
1212
|
* truncation and tagging are safe here.
|
|
1174
1213
|
*/
|
|
1175
|
-
function serializeMessageForObserver(message) {
|
|
1214
|
+
export function serializeMessageForObserver(message) {
|
|
1176
1215
|
const isToolResult = message.role === "toolResult";
|
|
1177
1216
|
const maybeContent = message.content;
|
|
1178
1217
|
if (typeof maybeContent === "string") {
|