@jungjaehoon/mama-os 0.51.2 → 0.52.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/agent-loop.d.ts +58 -0
- package/dist/agent/agent-loop.d.ts.map +1 -1
- package/dist/agent/agent-loop.js +503 -142
- package/dist/agent/agent-loop.js.map +1 -1
- package/dist/agent/claude-cli-wrapper.d.ts.map +1 -1
- package/dist/agent/claude-cli-wrapper.js +3 -2
- package/dist/agent/claude-cli-wrapper.js.map +1 -1
- package/dist/agent/cline-cli-adapter.d.ts +2 -0
- package/dist/agent/cline-cli-adapter.d.ts.map +1 -1
- package/dist/agent/cline-cli-adapter.js +2 -0
- package/dist/agent/cline-cli-adapter.js.map +1 -1
- package/dist/agent/code-act/constants.d.ts +1 -1
- package/dist/agent/code-act/constants.d.ts.map +1 -1
- package/dist/agent/code-act/constants.js +5 -2
- package/dist/agent/code-act/constants.js.map +1 -1
- package/dist/agent/code-act/host-bridge.d.ts.map +1 -1
- package/dist/agent/code-act/host-bridge.js +102 -4
- package/dist/agent/code-act/host-bridge.js.map +1 -1
- package/dist/agent/code-act/tool-catalog.d.ts +2 -0
- package/dist/agent/code-act/tool-catalog.d.ts.map +1 -1
- package/dist/agent/code-act/tool-catalog.js +20 -7
- package/dist/agent/code-act/tool-catalog.js.map +1 -1
- package/dist/agent/codex-app-server-process.d.ts +112 -0
- package/dist/agent/codex-app-server-process.d.ts.map +1 -1
- package/dist/agent/codex-app-server-process.js +518 -1
- package/dist/agent/codex-app-server-process.js.map +1 -1
- package/dist/agent/gateway-tool-executor.d.ts +17 -0
- package/dist/agent/gateway-tool-executor.d.ts.map +1 -1
- package/dist/agent/gateway-tool-executor.js +236 -53
- package/dist/agent/gateway-tool-executor.js.map +1 -1
- package/dist/agent/gateway-tools.md +9 -3
- package/dist/agent/model-runner.d.ts +16 -0
- package/dist/agent/model-runner.d.ts.map +1 -1
- package/dist/agent/model-runner.js.map +1 -1
- package/dist/agent/persistent-cli-adapter.d.ts +5 -0
- package/dist/agent/persistent-cli-adapter.d.ts.map +1 -1
- package/dist/agent/persistent-cli-adapter.js +7 -0
- package/dist/agent/persistent-cli-adapter.js.map +1 -1
- package/dist/agent/persistent-cli-process.d.ts.map +1 -1
- package/dist/agent/persistent-cli-process.js +27 -2
- package/dist/agent/persistent-cli-process.js.map +1 -1
- package/dist/agent/skill-loader.d.ts +7 -2
- package/dist/agent/skill-loader.d.ts.map +1 -1
- package/dist/agent/skill-loader.js +29 -8
- package/dist/agent/skill-loader.js.map +1 -1
- package/dist/agent/subagent-run-reconcile.d.ts +23 -0
- package/dist/agent/subagent-run-reconcile.d.ts.map +1 -0
- package/dist/agent/subagent-run-reconcile.js +56 -0
- package/dist/agent/subagent-run-reconcile.js.map +1 -0
- package/dist/agent/tool-registry.d.ts.map +1 -1
- package/dist/agent/tool-registry.js +126 -3
- package/dist/agent/tool-registry.js.map +1 -1
- package/dist/agent/types.d.ts +52 -2
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/api/graph-api.d.ts.map +1 -1
- package/dist/api/graph-api.js +0 -22
- package/dist/api/graph-api.js.map +1 -1
- package/dist/cli/commands/start.d.ts +8 -7
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +154 -74
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/config/types.d.ts.map +1 -1
- package/dist/cli/config/types.js +2 -1
- package/dist/cli/config/types.js.map +1 -1
- package/dist/cli/runtime/agent-loop-init.d.ts.map +1 -1
- package/dist/cli/runtime/agent-loop-init.js +1 -0
- package/dist/cli/runtime/agent-loop-init.js.map +1 -1
- package/dist/cli/runtime/api-routes-init.d.ts +1 -0
- package/dist/cli/runtime/api-routes-init.d.ts.map +1 -1
- package/dist/cli/runtime/api-routes-init.js +82 -58
- package/dist/cli/runtime/api-routes-init.js.map +1 -1
- package/dist/db/migrations/operator-procedures.d.ts +4 -0
- package/dist/db/migrations/operator-procedures.d.ts.map +1 -0
- package/dist/db/migrations/operator-procedures.js +63 -0
- package/dist/db/migrations/operator-procedures.js.map +1 -0
- package/dist/gateways/message-router.d.ts +6 -3
- package/dist/gateways/message-router.d.ts.map +1 -1
- package/dist/gateways/message-router.js +43 -131
- package/dist/gateways/message-router.js.map +1 -1
- package/dist/gateways/telegram-format.d.ts.map +1 -1
- package/dist/gateways/telegram-format.js +2 -0
- package/dist/gateways/telegram-format.js.map +1 -1
- package/dist/gateways/telegram-response-presenter.d.ts.map +1 -1
- package/dist/gateways/telegram-response-presenter.js +4 -0
- package/dist/gateways/telegram-response-presenter.js.map +1 -1
- package/dist/mcp/code-act-mcp-config.d.ts +49 -0
- package/dist/mcp/code-act-mcp-config.d.ts.map +1 -0
- package/dist/mcp/code-act-mcp-config.js +124 -0
- package/dist/mcp/code-act-mcp-config.js.map +1 -0
- package/dist/multi-agent/runtime-process.d.ts +10 -0
- package/dist/multi-agent/runtime-process.d.ts.map +1 -1
- package/dist/multi-agent/runtime-process.js +8 -0
- package/dist/multi-agent/runtime-process.js.map +1 -1
- package/dist/operator/board-delta-gate.d.ts +34 -10
- package/dist/operator/board-delta-gate.d.ts.map +1 -1
- package/dist/operator/board-delta-gate.js +68 -24
- package/dist/operator/board-delta-gate.js.map +1 -1
- package/dist/operator/board-refresh-gate.d.ts +11 -6
- package/dist/operator/board-refresh-gate.d.ts.map +1 -1
- package/dist/operator/board-refresh-gate.js +12 -11
- package/dist/operator/board-refresh-gate.js.map +1 -1
- package/dist/operator/board-slot-instructions.d.ts +30 -0
- package/dist/operator/board-slot-instructions.d.ts.map +1 -1
- package/dist/operator/board-slot-instructions.js +110 -6
- package/dist/operator/board-slot-instructions.js.map +1 -1
- package/dist/operator/console-brief.d.ts +26 -13
- package/dist/operator/console-brief.d.ts.map +1 -1
- package/dist/operator/console-brief.js +159 -83
- package/dist/operator/console-brief.js.map +1 -1
- package/dist/operator/experience-evidence.d.ts +18 -0
- package/dist/operator/experience-evidence.d.ts.map +1 -0
- package/dist/operator/experience-evidence.js +82 -0
- package/dist/operator/experience-evidence.js.map +1 -0
- package/dist/operator/experience-hints.d.ts +44 -0
- package/dist/operator/experience-hints.d.ts.map +1 -0
- package/dist/operator/experience-hints.js +98 -0
- package/dist/operator/experience-hints.js.map +1 -0
- package/dist/operator/mama-memory-port.js +1 -3
- package/dist/operator/mama-memory-port.js.map +1 -1
- package/dist/operator/operator-trigger-loop.d.ts.map +1 -1
- package/dist/operator/operator-trigger-loop.js +3 -2
- package/dist/operator/operator-trigger-loop.js.map +1 -1
- package/dist/operator/owner-action-effects.d.ts +13 -1
- package/dist/operator/owner-action-effects.d.ts.map +1 -1
- package/dist/operator/owner-action-effects.js +17 -4
- package/dist/operator/owner-action-effects.js.map +1 -1
- package/dist/operator/owner-event-inbox.d.ts +7 -1
- package/dist/operator/owner-event-inbox.d.ts.map +1 -1
- package/dist/operator/owner-event-inbox.js +8 -0
- package/dist/operator/owner-event-inbox.js.map +1 -1
- package/dist/operator/owner-event-loop.d.ts +28 -2
- package/dist/operator/owner-event-loop.d.ts.map +1 -1
- package/dist/operator/owner-event-loop.js +60 -2
- package/dist/operator/owner-event-loop.js.map +1 -1
- package/dist/operator/owner-event-policy.d.ts +20 -0
- package/dist/operator/owner-event-policy.d.ts.map +1 -1
- package/dist/operator/owner-event-policy.js +34 -5
- package/dist/operator/owner-event-policy.js.map +1 -1
- package/dist/operator/owner-event-prompt.d.ts +13 -4
- package/dist/operator/owner-event-prompt.d.ts.map +1 -1
- package/dist/operator/owner-event-prompt.js +31 -38
- package/dist/operator/owner-event-prompt.js.map +1 -1
- package/dist/operator/owner-runtime-journal.d.ts.map +1 -1
- package/dist/operator/owner-runtime-journal.js +7 -3
- package/dist/operator/owner-runtime-journal.js.map +1 -1
- package/dist/operator/owner-runtime.d.ts +6 -0
- package/dist/operator/owner-runtime.d.ts.map +1 -1
- package/dist/operator/owner-runtime.js +48 -5
- package/dist/operator/owner-runtime.js.map +1 -1
- package/dist/operator/procedure-activation.d.ts +7 -0
- package/dist/operator/procedure-activation.d.ts.map +1 -0
- package/dist/operator/procedure-activation.js +132 -0
- package/dist/operator/procedure-activation.js.map +1 -0
- package/dist/operator/procedure-projection.d.ts +25 -0
- package/dist/operator/procedure-projection.d.ts.map +1 -0
- package/dist/operator/procedure-projection.js +80 -0
- package/dist/operator/procedure-projection.js.map +1 -0
- package/dist/operator/procedure-runtime.d.ts +45 -0
- package/dist/operator/procedure-runtime.d.ts.map +1 -0
- package/dist/operator/procedure-runtime.js +496 -0
- package/dist/operator/procedure-runtime.js.map +1 -0
- package/dist/operator/procedure-store.d.ts +97 -0
- package/dist/operator/procedure-store.d.ts.map +1 -0
- package/dist/operator/procedure-store.js +368 -0
- package/dist/operator/procedure-store.js.map +1 -0
- package/dist/operator/subagent-stimulus.d.ts +34 -0
- package/dist/operator/subagent-stimulus.d.ts.map +1 -0
- package/dist/operator/subagent-stimulus.js +145 -0
- package/dist/operator/subagent-stimulus.js.map +1 -0
- package/dist/operator/task-ledger.d.ts +40 -3
- package/dist/operator/task-ledger.d.ts.map +1 -1
- package/dist/operator/task-ledger.js +63 -10
- package/dist/operator/task-ledger.js.map +1 -1
- package/dist/operator/thread-brief-memory.d.ts +29 -0
- package/dist/operator/thread-brief-memory.d.ts.map +1 -0
- package/dist/operator/thread-brief-memory.js +61 -0
- package/dist/operator/thread-brief-memory.js.map +1 -0
- package/dist/operator/trigger-author.d.ts +2 -1
- package/dist/operator/trigger-author.d.ts.map +1 -1
- package/dist/operator/trigger-author.js +23 -0
- package/dist/operator/trigger-author.js.map +1 -1
- package/dist/operator/trigger-matcher.js +1 -0
- package/dist/operator/trigger-matcher.js.map +1 -1
- package/dist/operator/trigger-registry.d.ts +5 -4
- package/dist/operator/trigger-registry.d.ts.map +1 -1
- package/dist/operator/trigger-registry.js +78 -24
- package/dist/operator/trigger-registry.js.map +1 -1
- package/dist/operator/trigger-review.d.ts +1 -1
- package/dist/operator/trigger-review.d.ts.map +1 -1
- package/dist/operator/trigger-review.js +24 -4
- package/dist/operator/trigger-review.js.map +1 -1
- package/dist/operator/trigger-types.d.ts +10 -1
- package/dist/operator/trigger-types.d.ts.map +1 -1
- package/dist/operator/worker-run.d.ts +13 -1
- package/dist/operator/worker-run.d.ts.map +1 -1
- package/dist/operator/worker-run.js +5 -2
- package/dist/operator/worker-run.js.map +1 -1
- package/dist/operator/workorder-consumer.d.ts +106 -14
- package/dist/operator/workorder-consumer.d.ts.map +1 -1
- package/dist/operator/workorder-consumer.js +295 -93
- package/dist/operator/workorder-consumer.js.map +1 -1
- package/dist/operator/workorder-hooks.d.ts +42 -9
- package/dist/operator/workorder-hooks.d.ts.map +1 -1
- package/dist/operator/workorder-hooks.js +52 -13
- package/dist/operator/workorder-hooks.js.map +1 -1
- package/dist/operator/workorder-publishers.d.ts +9 -1
- package/dist/operator/workorder-publishers.d.ts.map +1 -1
- package/dist/operator/workorder-publishers.js +21 -2
- package/dist/operator/workorder-publishers.js.map +1 -1
- package/package.json +2 -2
- package/dist/operator/learning-context.d.ts +0 -49
- package/dist/operator/learning-context.d.ts.map +0 -1
- package/dist/operator/learning-context.js +0 -129
- package/dist/operator/learning-context.js.map +0 -1
- package/dist/operator/learning-markers.d.ts +0 -19
- package/dist/operator/learning-markers.d.ts.map +0 -1
- package/dist/operator/learning-markers.js +0 -147
- package/dist/operator/learning-markers.js.map +0 -1
- package/dist/operator/learning-read.d.ts +0 -16
- package/dist/operator/learning-read.d.ts.map +0 -1
- package/dist/operator/learning-read.js +0 -18
- package/dist/operator/learning-read.js.map +0 -1
- package/dist/operator/turn-observer.d.ts +0 -34
- package/dist/operator/turn-observer.d.ts.map +0 -1
- package/dist/operator/turn-observer.js +0 -79
- package/dist/operator/turn-observer.js.map +0 -1
- package/templates/skills/heartbeat-report.md +0 -75
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { hashProcedureDocument } from './procedure-projection.js';
|
|
1
2
|
import { type PrivateConnectorPolicy } from '../connectors/private-connector-policy.js';
|
|
2
3
|
/** Full-replace ceiling with headroom for a mature manual while preventing a
|
|
3
4
|
* runaway self-edit from bloating every future prompt. */
|
|
4
5
|
export declare const CONSOLE_BRIEF_MAX_CHARS = 32000;
|
|
5
|
-
export declare const CONSOLE_BRIEF_DEFAULT = "# Owner Console Operating Brief\n\nThis file is
|
|
6
|
+
export declare const CONSOLE_BRIEF_DEFAULT = "# Owner Console Operating Brief\n\nThis file is yours; upgrades never overwrite it. It holds standing operating rules only.\nHow you work is learned from the owner's corrections: store each one with procedure_update\n(when_to_use / when_not_to_use) in the turn it arrives. This brief is not a lesson log.\nCorrect one of its rules with console_brief_update (replace or retire an exact target with the\nexpected_hash from procedure_read({id:\"owner-console-brief\"})). Saving is not proof of changed behavior.\n";
|
|
7
|
+
/** Upgrade only the known, code-owned legacy tool mechanism when rendering a modern runtime.
|
|
8
|
+
* The stored original and all owner business rules remain untouched. */
|
|
9
|
+
export declare function modernizeLegacyBriefMechanism(raw: string): string;
|
|
6
10
|
export declare function consoleBriefPath(homeDir?: string): string;
|
|
7
11
|
/** Boot seeding - write the packaged default ONLY when missing (agent/user
|
|
8
12
|
* edits always win; deliberate no-auto-upgrade, mirroring ensureBriefs). */
|
|
@@ -11,17 +15,26 @@ export declare function ensureConsoleBrief(homeDir?: string): boolean;
|
|
|
11
15
|
export declare function loadConsoleBrief(homeDir?: string): string;
|
|
12
16
|
/** Project a user-owned brief for one prompt without modifying its file. */
|
|
13
17
|
export declare function projectConsoleBriefForPrompt(raw: string, policy: PrivateConnectorPolicy): string;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
export declare const hashConsoleBrief: typeof hashProcedureDocument;
|
|
19
|
+
export declare function readConsoleBriefSnapshot(homeDir?: string): {
|
|
20
|
+
path: string;
|
|
21
|
+
text: string;
|
|
22
|
+
hash: string | null;
|
|
23
|
+
};
|
|
24
|
+
export interface ConsoleBriefUpdate {
|
|
25
|
+
operation: 'append' | 'replace' | 'retire';
|
|
26
|
+
lesson?: string;
|
|
27
|
+
target?: string;
|
|
28
|
+
replacement?: string;
|
|
29
|
+
expectedHash?: string;
|
|
30
|
+
}
|
|
31
|
+
/** Pure preparation: the canonical store commits this text and its old revision
|
|
32
|
+
* before attempting Markdown publication. No full-document replace operation.
|
|
25
33
|
*/
|
|
26
|
-
export declare function
|
|
34
|
+
export declare function prepareConsoleBriefUpdate(input: ConsoleBriefUpdate, current: string): {
|
|
35
|
+
text: string;
|
|
36
|
+
priorHash: string;
|
|
37
|
+
hash: string;
|
|
38
|
+
};
|
|
39
|
+
/** Legacy append-only API, preserving its return value and seed-on-missing behavior. */
|
|
27
40
|
//# sourceMappingURL=console-brief.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console-brief.d.ts","sourceRoot":"","sources":["../../src/operator/console-brief.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AAOxF;0DAC0D;AAC1D,eAAO,MAAM,uBAAuB,QAAS,CAAC;AAU9C,eAAO,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"console-brief.d.ts","sourceRoot":"","sources":["../../src/operator/console-brief.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AAOxF;0DAC0D;AAC1D,eAAO,MAAM,uBAAuB,QAAS,CAAC;AAU9C,eAAO,MAAM,qBAAqB,mgBAOjC,CAAC;AAEF;wEACwE;AACxE,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAmDjE;AAED,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,MAAkB,GAAG,MAAM,CAEpE;AAED;6EAC6E;AAC7E,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,MAAkB,GAAG,OAAO,CAkBvE;AAED,+EAA+E;AAC/E,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,MAAkB,GAAG,MAAM,CAIpE;AAeD,4EAA4E;AAC5E,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,sBAAsB,GAAG,MAAM,CAWhG;AAED,eAAO,MAAM,gBAAgB,8BAAwB,CAAC;AAEtD,wBAAgB,wBAAwB,CAAC,OAAO,GAAE,MAAkB,GAAG;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,CAIA;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,kBAAkB,EACzB,OAAO,EAAE,MAAM,GACd;IACD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd,CA4FA;AAED,wFAAwF"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CONSOLE_BRIEF_DEFAULT = exports.CONSOLE_BRIEF_MAX_CHARS = void 0;
|
|
3
|
+
exports.hashConsoleBrief = exports.CONSOLE_BRIEF_DEFAULT = exports.CONSOLE_BRIEF_MAX_CHARS = void 0;
|
|
4
|
+
exports.modernizeLegacyBriefMechanism = modernizeLegacyBriefMechanism;
|
|
4
5
|
exports.consoleBriefPath = consoleBriefPath;
|
|
5
6
|
exports.ensureConsoleBrief = ensureConsoleBrief;
|
|
6
7
|
exports.loadConsoleBrief = loadConsoleBrief;
|
|
7
8
|
exports.projectConsoleBriefForPrompt = projectConsoleBriefForPrompt;
|
|
8
|
-
exports.
|
|
9
|
+
exports.readConsoleBriefSnapshot = readConsoleBriefSnapshot;
|
|
10
|
+
exports.prepareConsoleBriefUpdate = prepareConsoleBriefUpdate;
|
|
9
11
|
/**
|
|
10
12
|
* Owner-console operating brief - the agent-owned operations manual.
|
|
11
13
|
*
|
|
@@ -26,6 +28,8 @@ exports.appendConsoleBriefLesson = appendConsoleBriefLesson;
|
|
|
26
28
|
*/
|
|
27
29
|
const node_fs_1 = require("node:fs");
|
|
28
30
|
const node_os_1 = require("node:os");
|
|
31
|
+
const node_crypto_1 = require("node:crypto");
|
|
32
|
+
const procedure_projection_js_1 = require("./procedure-projection.js");
|
|
29
33
|
const node_path_1 = require("node:path");
|
|
30
34
|
const private_prompt_overlay_js_1 = require("../connectors/private-prompt-overlay.js");
|
|
31
35
|
/** Full-replace ceiling with headroom for a mature manual while preventing a
|
|
@@ -40,50 +44,60 @@ const LEGACY_CONSOLE_PRIVATE_LINES = new Set([
|
|
|
40
44
|
]);
|
|
41
45
|
exports.CONSOLE_BRIEF_DEFAULT = `# Owner Console Operating Brief
|
|
42
46
|
|
|
43
|
-
This file is
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
failure.
|
|
49
|
-
|
|
50
|
-
## Reporting philosophy
|
|
51
|
-
|
|
52
|
-
- A report is analysis, not a listing. Cross-check at least two sources
|
|
53
|
-
(board/tasks vs channel messages) before stating a situation.
|
|
54
|
-
- Cite where each claim came from, with the source timestamp. An uncited
|
|
55
|
-
claim is a guess.
|
|
56
|
-
- Quote the key channel line when it drives a conclusion; name the room and
|
|
57
|
-
sender exactly as the source shows them.
|
|
58
|
-
- Lead with what changed and what needs the owner; keep the quiet parts to
|
|
59
|
-
one line.
|
|
60
|
-
|
|
61
|
-
## Procedure recipes (grow this section from experience)
|
|
62
|
-
|
|
63
|
-
- Status questions: artifacts first (board_read, audit_findings_read), then
|
|
64
|
-
live queries; memory recall last and cited.
|
|
65
|
-
- Business data: use only tools present in the current run catalog. Start with
|
|
66
|
-
a broad summary, narrow to active entities or tasks, then inspect specific
|
|
67
|
-
channels without widening a supplied time window.
|
|
68
|
-
- Cross-channel synthesis: anchor items on their task id (relatedTaskId)
|
|
69
|
-
so the same work seen in two rooms stays one item.
|
|
70
|
-
|
|
71
|
-
## Situational awareness
|
|
72
|
-
|
|
73
|
-
- Delta events name what changed since your last look; answer against the
|
|
74
|
-
delta first, then the wider window.
|
|
75
|
-
- After a context gap (compaction, restart), rebuild from storage - recall
|
|
76
|
-
and artifacts - never from what you assume you remember.
|
|
77
|
-
|
|
78
|
-
## Self-update rule
|
|
79
|
-
|
|
80
|
-
- When the owner corrects your working style, or a recipe above proves
|
|
81
|
-
wrong, call console_brief_update({lesson}) in the same turn and say you
|
|
82
|
-
did. One concrete lesson per call; the file itself is curated by the
|
|
83
|
-
owner - you only ever add.
|
|
84
|
-
|
|
85
|
-
## Lessons
|
|
47
|
+
This file is yours; upgrades never overwrite it. It holds standing operating rules only.
|
|
48
|
+
How you work is learned from the owner's corrections: store each one with procedure_update
|
|
49
|
+
(when_to_use / when_not_to_use) in the turn it arrives. This brief is not a lesson log.
|
|
50
|
+
Correct one of its rules with console_brief_update (replace or retire an exact target with the
|
|
51
|
+
expected_hash from procedure_read({id:"owner-console-brief"})). Saving is not proof of changed behavior.
|
|
86
52
|
`;
|
|
53
|
+
/** Upgrade only the known, code-owned legacy tool mechanism when rendering a modern runtime.
|
|
54
|
+
* The stored original and all owner business rules remain untouched. */
|
|
55
|
+
function modernizeLegacyBriefMechanism(raw) {
|
|
56
|
+
const shortIntroduction = 'When the owner corrects how you work, or a procedure fails and you learn the\n' +
|
|
57
|
+
'fix, record it with console_brief_update({lesson}) - one durable lesson per\n' +
|
|
58
|
+
"call, appended below with today's date while everything above is preserved.";
|
|
59
|
+
const oldIntroduction = shortIntroduction +
|
|
60
|
+
'\n' +
|
|
61
|
+
'This is how your operating manual grows; losing a lesson means repeating the\n' +
|
|
62
|
+
'failure.';
|
|
63
|
+
const oldSelfUpdate = '- When the owner corrects your working style, or a recipe above proves\n' +
|
|
64
|
+
' wrong, call console_brief_update({lesson}) in the same turn and say you\n' +
|
|
65
|
+
' did. One concrete lesson per call; the file itself is curated by the\n' +
|
|
66
|
+
' owner - you only ever add.';
|
|
67
|
+
const correctedIntroduction = 'Store owner corrections with procedure_update (when_to_use / when_not_to_use). Correct one existing brief rule with console_brief_update replace or retire and expected_hash; the brief is not a lesson log. Saving is not proof of changed behavior.';
|
|
68
|
+
const replacements = [
|
|
69
|
+
// Replace the longer seed first so its obsolete continuation cannot survive.
|
|
70
|
+
[oldIntroduction, correctedIntroduction],
|
|
71
|
+
[shortIntroduction, correctedIntroduction],
|
|
72
|
+
[
|
|
73
|
+
oldSelfUpdate,
|
|
74
|
+
'- Store the correction with procedure_update in the same turn; correct a contradicted brief rule with console_brief_update replace or retire and expected_hash, preserving unrelated rules.',
|
|
75
|
+
],
|
|
76
|
+
];
|
|
77
|
+
const project = (text) => replacements.reduce((value, [before, after]) => value
|
|
78
|
+
.replace(before, after)
|
|
79
|
+
.replace(before.replace(/\n/g, '\r\n'), after.replace(/\n/g, '\r\n')), text);
|
|
80
|
+
let output = '';
|
|
81
|
+
let prose = '';
|
|
82
|
+
let fence = null;
|
|
83
|
+
for (const line of raw.match(/[^\n]*(?:\n|$)/g) ?? []) {
|
|
84
|
+
const marker = line.match(/^ {0,3}(`{3,}|~{3,})/);
|
|
85
|
+
if (!fence && marker) {
|
|
86
|
+
output += project(prose) + line;
|
|
87
|
+
prose = '';
|
|
88
|
+
fence = { char: marker[1][0], length: marker[1].length };
|
|
89
|
+
}
|
|
90
|
+
else if (fence) {
|
|
91
|
+
output += line;
|
|
92
|
+
if (marker && marker[1][0] === fence.char && marker[1].length >= fence.length)
|
|
93
|
+
fence = null;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
prose += line;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return output + project(prose);
|
|
100
|
+
}
|
|
87
101
|
function consoleBriefPath(homeDir = (0, node_os_1.homedir)()) {
|
|
88
102
|
return (0, node_path_1.join)(homeDir, '.mama', 'briefs', 'brief-owner-console.md');
|
|
89
103
|
}
|
|
@@ -94,10 +108,22 @@ function ensureConsoleBrief(homeDir = (0, node_os_1.homedir)()) {
|
|
|
94
108
|
if ((0, node_fs_1.existsSync)(path))
|
|
95
109
|
return false;
|
|
96
110
|
(0, node_fs_1.mkdirSync)((0, node_path_1.join)(homeDir, '.mama', 'briefs'), { recursive: true });
|
|
97
|
-
const tmpPath = `${path}.tmp`;
|
|
98
|
-
(0, node_fs_1.writeFileSync)(tmpPath, exports.CONSOLE_BRIEF_DEFAULT, '
|
|
99
|
-
|
|
100
|
-
|
|
111
|
+
const tmpPath = `${path}.${(0, node_crypto_1.randomUUID)()}.tmp`;
|
|
112
|
+
(0, node_fs_1.writeFileSync)(tmpPath, exports.CONSOLE_BRIEF_DEFAULT, { encoding: 'utf8', flag: 'wx', mode: 0o600 });
|
|
113
|
+
try {
|
|
114
|
+
// Exclusive publication keeps a concurrent human-created brief intact.
|
|
115
|
+
(0, node_fs_1.linkSync)(tmpPath, path);
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
if (error.code === 'EEXIST') {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
throw error;
|
|
123
|
+
}
|
|
124
|
+
finally {
|
|
125
|
+
(0, node_fs_1.unlinkSync)(tmpPath);
|
|
126
|
+
}
|
|
101
127
|
}
|
|
102
128
|
/** Read the current brief; empty string when absent (caller seeds on boot). */
|
|
103
129
|
function loadConsoleBrief(homeDir = (0, node_os_1.homedir)()) {
|
|
@@ -128,43 +154,93 @@ function projectConsoleBriefForPrompt(raw, policy) {
|
|
|
128
154
|
const separator = projected.endsWith('\n\n') ? '' : projected.endsWith('\n') ? '\n' : '\n\n';
|
|
129
155
|
return `${projected}${separator}${overlay}\n`;
|
|
130
156
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
*
|
|
139
|
-
* Loud validation, no fallback: an empty lesson is refused, and a brief that
|
|
140
|
-
* would exceed the ceiling is refused (the manual needs owner curation),
|
|
141
|
-
* never truncated.
|
|
157
|
+
exports.hashConsoleBrief = procedure_projection_js_1.hashProcedureDocument;
|
|
158
|
+
function readConsoleBriefSnapshot(homeDir = (0, node_os_1.homedir)()) {
|
|
159
|
+
const path = consoleBriefPath(homeDir);
|
|
160
|
+
const text = loadConsoleBrief(homeDir);
|
|
161
|
+
return { path, text, hash: (0, node_fs_1.existsSync)(path) ? (0, exports.hashConsoleBrief)(text) : null };
|
|
162
|
+
}
|
|
163
|
+
/** Pure preparation: the canonical store commits this text and its old revision
|
|
164
|
+
* before attempting Markdown publication. No full-document replace operation.
|
|
142
165
|
*/
|
|
143
|
-
function
|
|
144
|
-
const
|
|
145
|
-
if (
|
|
146
|
-
throw new Error('console brief update refused:
|
|
166
|
+
function prepareConsoleBriefUpdate(input, current) {
|
|
167
|
+
const priorHash = (0, exports.hashConsoleBrief)(current);
|
|
168
|
+
if (input.expectedHash !== undefined && input.expectedHash !== priorHash) {
|
|
169
|
+
throw new Error('console brief update refused: expected hash conflict');
|
|
147
170
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
existing = loadConsoleBrief(homeDir);
|
|
171
|
+
let text;
|
|
172
|
+
if (input.operation === 'append') {
|
|
173
|
+
// Retired 2026-09-09: dated lesson lines accreted into a 10K brief with contradictory
|
|
174
|
+
// rules. Corrections are procedures now; the brief only ever changes by exact target.
|
|
175
|
+
throw new Error('console brief update refused: append is retired; store the correction with procedure_update');
|
|
154
176
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
177
|
+
else if (input.operation === 'replace' || input.operation === 'retire') {
|
|
178
|
+
if (!input.expectedHash) {
|
|
179
|
+
throw new Error('console brief update refused: expected hash required');
|
|
180
|
+
}
|
|
181
|
+
const target = input.target;
|
|
182
|
+
if (!target?.trim() || target.trim() === current.trim()) {
|
|
183
|
+
throw new Error('console brief update refused: exact partial target required');
|
|
184
|
+
}
|
|
185
|
+
const offset = current.indexOf(target);
|
|
186
|
+
if (offset < 0 || current.indexOf(target, offset + 1) >= 0) {
|
|
187
|
+
throw new Error('console brief update refused: missing or ambiguous target');
|
|
188
|
+
}
|
|
189
|
+
const end = offset + target.length;
|
|
190
|
+
if ((offset > 0 && current[offset - 1] !== '\n') ||
|
|
191
|
+
(end < current.length && !target.endsWith('\n') && !/^[\r\n]/.test(current.slice(end)))) {
|
|
192
|
+
throw new Error('console brief update refused: target must contain a complete rule or section');
|
|
193
|
+
}
|
|
194
|
+
const section = /^(#{2,6})[ \t]+/.exec(target);
|
|
195
|
+
if (section) {
|
|
196
|
+
const level = section[1].length;
|
|
197
|
+
const nextHeading = /^(#{1,6})[ \t]+/gm;
|
|
198
|
+
nextHeading.lastIndex = offset + target.split('\n')[0].length + 1;
|
|
199
|
+
let boundary = current.length;
|
|
200
|
+
let match;
|
|
201
|
+
while ((match = nextHeading.exec(current)) !== null) {
|
|
202
|
+
if (match[1].length <= level) {
|
|
203
|
+
boundary = match.index;
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
if (end > boundary || current.slice(end, boundary).trim()) {
|
|
208
|
+
throw new Error('console brief update refused: target must contain exactly one complete section');
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
const isListRule = /^[-*+] |^\d+[.)] /.test(target);
|
|
213
|
+
const precedingLine = current
|
|
214
|
+
.slice(0, offset)
|
|
215
|
+
.replace(/\r?\n$/, '')
|
|
216
|
+
.split(/\r?\n/)
|
|
217
|
+
.pop() ?? '';
|
|
218
|
+
if (/^#/.test(target) ||
|
|
219
|
+
/\n(?:#{1,6} |[-*+] |\d+[.)] )/.test(target) ||
|
|
220
|
+
(!isListRule && (precedingLine.trim() || /\r?\n\s*\r?\n/.test(target.trim())))) {
|
|
221
|
+
throw new Error('console brief update refused: target must contain one complete rule or section');
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
if (!section) {
|
|
225
|
+
const remainder = current.slice(end).replace(/^\r?\n/, '');
|
|
226
|
+
const followingLine = remainder.split(/\r?\n/)[0];
|
|
227
|
+
if (followingLine.trim() && !/^(?:#{1,6} |[-*+] |\d+[.)] )/.test(followingLine)) {
|
|
228
|
+
throw new Error('console brief update refused: target must contain the complete wrapped rule');
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
const replacement = input.operation === 'retire' ? '' : input.replacement;
|
|
232
|
+
if (replacement === undefined || (input.operation === 'replace' && !replacement.trim())) {
|
|
233
|
+
throw new Error('console brief update refused: nonempty replacement required');
|
|
234
|
+
}
|
|
235
|
+
text = current.slice(0, offset) + replacement + current.slice(end);
|
|
162
236
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
(
|
|
167
|
-
|
|
168
|
-
|
|
237
|
+
else {
|
|
238
|
+
throw new Error('console brief update refused: unsupported operation');
|
|
239
|
+
}
|
|
240
|
+
if (text.length > exports.CONSOLE_BRIEF_MAX_CHARS) {
|
|
241
|
+
throw new Error(`console brief update refused: ${text.length} chars exceeds ${exports.CONSOLE_BRIEF_MAX_CHARS}`);
|
|
242
|
+
}
|
|
243
|
+
return { text, priorHash, hash: (0, exports.hashConsoleBrief)(text) };
|
|
169
244
|
}
|
|
245
|
+
/** Legacy append-only API, preserving its return value and seed-on-missing behavior. */
|
|
170
246
|
//# sourceMappingURL=console-brief.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console-brief.js","sourceRoot":"","sources":["../../src/operator/console-brief.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"console-brief.js","sourceRoot":"","sources":["../../src/operator/console-brief.ts"],"names":[],"mappings":";;;AAqDA,sEAmDC;AAED,4CAEC;AAID,gDAkBC;AAGD,4CAIC;AAgBD,oEAWC;AAID,4DAQC;AAaD,8DAmGC;AAhSD;;;;;;;;;;;;;;;;;GAiBG;AACH,qCAAmG;AACnG,qCAAkC;AAClC,6CAAyC;AACzC,uEAAkE;AAClE,yCAAiC;AAEjC,uFAIiD;AAEjD;0DAC0D;AAC7C,QAAA,uBAAuB,GAAG,MAAM,CAAC;AAE9C,MAAM,4BAA4B,GAAG,IAAI,GAAG,CAAC;IAC3C,sEAAsE;IACtE,wEAAwE;IACxE,uEAAuE;IACvE,sCAAsC;IACtC,8BAA8B;CAC/B,CAAC,CAAC;AAEU,QAAA,qBAAqB,GAAG;;;;;;;CAOpC,CAAC;AAEF;wEACwE;AACxE,SAAgB,6BAA6B,CAAC,GAAW;IACvD,MAAM,iBAAiB,GACrB,gFAAgF;QAChF,+EAA+E;QAC/E,6EAA6E,CAAC;IAChF,MAAM,eAAe,GACnB,iBAAiB;QACjB,IAAI;QACJ,gFAAgF;QAChF,UAAU,CAAC;IACb,MAAM,aAAa,GACjB,0EAA0E;QAC1E,6EAA6E;QAC7E,0EAA0E;QAC1E,8BAA8B,CAAC;IACjC,MAAM,qBAAqB,GACzB,uPAAuP,CAAC;IAC1P,MAAM,YAAY,GAAG;QACnB,6EAA6E;QAC7E,CAAC,eAAe,EAAE,qBAAqB,CAAC;QACxC,CAAC,iBAAiB,EAAE,qBAAqB,CAAC;QAC1C;YACE,aAAa;YACb,6LAA6L;SAC9L;KACF,CAAC;IACF,MAAM,OAAO,GAAG,CAAC,IAAY,EAAU,EAAE,CACvC,YAAY,CAAC,MAAM,CACjB,CAAC,KAAK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,IAAI,KAAK,CACb,6EAA6E,CAC9E,CAAC;YACJ,CAAC;QACH,CAAC;QACD,MAAM,WAAW,GAAG,KAAK,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC;QAC1E,IAAI,WAAW,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;YACxF,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;QACjF,CAAC;QACD,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACrE,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACzE,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,GAAG,+BAAuB,EAAE,CAAC;QAC1C,MAAM,IAAI,KAAK,CACb,iCAAiC,IAAI,CAAC,MAAM,kBAAkB,+BAAuB,EAAE,CACxF,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAA,wBAAgB,EAAC,IAAI,CAAC,EAAE,CAAC;AAC3D,CAAC;AAED,wFAAwF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ProcedureAccess } from './procedure-store.js';
|
|
2
|
+
export interface ExecutionEvidence {
|
|
3
|
+
input: unknown;
|
|
4
|
+
result: unknown;
|
|
5
|
+
inputHash: string | null;
|
|
6
|
+
resultHash: string | null;
|
|
7
|
+
completeness: 'complete' | 'redacted' | 'oversized' | 'unserializable';
|
|
8
|
+
redactions: string[];
|
|
9
|
+
}
|
|
10
|
+
export declare function safeExperienceSummary(text: string): string;
|
|
11
|
+
/** Preserve comparable execution evidence, never turn an error into an action recipe. */
|
|
12
|
+
export declare function captureExecutionEvidence(input: unknown, result: unknown): ExecutionEvidence;
|
|
13
|
+
export declare function traceReadScope(access: ProcedureAccess): {
|
|
14
|
+
owner_scope: string;
|
|
15
|
+
project_id: string;
|
|
16
|
+
channel_id?: string;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=experience-evidence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"experience-evidence.d.ts","sourceRoot":"","sources":["../../src/operator/experience-evidence.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAM5D,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,EAAE,UAAU,GAAG,UAAU,GAAG,WAAW,GAAG,gBAAgB,CAAC;IACvE,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAeD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI1D;AAED,yFAAyF;AACzF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,iBAAiB,CA4C3F;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,GAAG;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CASA"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.safeExperienceSummary = safeExperienceSummary;
|
|
4
|
+
exports.captureExecutionEvidence = captureExecutionEvidence;
|
|
5
|
+
exports.traceReadScope = traceReadScope;
|
|
6
|
+
const node_crypto_1 = require("node:crypto");
|
|
7
|
+
const secret_filter_js_1 = require("../memory/secret-filter.js");
|
|
8
|
+
const MAX_EVIDENCE_BYTES = 65_536;
|
|
9
|
+
const SECRET_FIELD = /^(password|passphrase|api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|cookie|secret|private[_-]?key)$/i;
|
|
10
|
+
const CREDENTIAL_TEXT = /(?:["']?\b(?:password|passphrase|api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|cookie|secret|private[_-]?key)["']?\s*[:=]\s*[^\s,;}]+|--(?:password|token|api-key)\s+\S+)/i;
|
|
11
|
+
function hasSecretField(value, depth = 0) {
|
|
12
|
+
if (depth > 32)
|
|
13
|
+
return true;
|
|
14
|
+
if (typeof value === 'string')
|
|
15
|
+
return CREDENTIAL_TEXT.test(value);
|
|
16
|
+
if (!value || typeof value !== 'object')
|
|
17
|
+
return false;
|
|
18
|
+
return Object.entries(value).some(([key, entry]) => (SECRET_FIELD.test(key) && entry !== null && entry !== '') || hasSecretField(entry, depth + 1));
|
|
19
|
+
}
|
|
20
|
+
function safeExperienceSummary(text) {
|
|
21
|
+
return !(0, secret_filter_js_1.scanForSecrets)(text).clean || CREDENTIAL_TEXT.test(text)
|
|
22
|
+
? '[redacted execution summary]'
|
|
23
|
+
: text;
|
|
24
|
+
}
|
|
25
|
+
/** Preserve comparable execution evidence, never turn an error into an action recipe. */
|
|
26
|
+
function captureExecutionEvidence(input, result) {
|
|
27
|
+
let inputText;
|
|
28
|
+
let resultText;
|
|
29
|
+
try {
|
|
30
|
+
inputText = JSON.stringify(input ?? null);
|
|
31
|
+
resultText = JSON.stringify(result ?? null);
|
|
32
|
+
if (typeof inputText !== 'string' || typeof resultText !== 'string')
|
|
33
|
+
throw new Error('non-JSON evidence');
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return {
|
|
37
|
+
input: null,
|
|
38
|
+
result: null,
|
|
39
|
+
inputHash: null,
|
|
40
|
+
resultHash: null,
|
|
41
|
+
completeness: 'unserializable',
|
|
42
|
+
redactions: [],
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const inputHash = (0, node_crypto_1.createHash)('sha256').update(inputText).digest('hex');
|
|
46
|
+
const resultHash = (0, node_crypto_1.createHash)('sha256').update(resultText).digest('hex');
|
|
47
|
+
const common = { inputHash, resultHash };
|
|
48
|
+
if (Buffer.byteLength(inputText) + Buffer.byteLength(resultText) > MAX_EVIDENCE_BYTES) {
|
|
49
|
+
return { ...common, input: null, result: null, completeness: 'oversized', redactions: [] };
|
|
50
|
+
}
|
|
51
|
+
const inputValue = JSON.parse(inputText);
|
|
52
|
+
const resultValue = JSON.parse(resultText);
|
|
53
|
+
const scan = (0, secret_filter_js_1.scanForSecrets)(inputText + '\n' + resultText);
|
|
54
|
+
const secretFields = hasSecretField(inputValue) || hasSecretField(resultValue);
|
|
55
|
+
if (!scan.clean || secretFields) {
|
|
56
|
+
return {
|
|
57
|
+
...common,
|
|
58
|
+
input: null,
|
|
59
|
+
result: null,
|
|
60
|
+
completeness: 'redacted',
|
|
61
|
+
redactions: [...scan.matches, ...(secretFields ? ['credential-field'] : [])],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
...common,
|
|
66
|
+
input: inputValue,
|
|
67
|
+
result: resultValue,
|
|
68
|
+
completeness: 'complete',
|
|
69
|
+
redactions: [],
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function traceReadScope(access) {
|
|
73
|
+
if (access.ownerScope !== 'owner:runtime' && !access.channelId) {
|
|
74
|
+
throw new Error('Execution evidence member channel required');
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
owner_scope: access.ownerScope,
|
|
78
|
+
project_id: access.projectId,
|
|
79
|
+
...(access.ownerScope === 'owner:runtime' ? {} : { channel_id: access.channelId }),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=experience-evidence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,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,UAAU,CAAC,IAAI,cAAc,CAAC,WAAW,CAAC,CAAC;IAC/E,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,YAAY,EAAE,CAAC;QAChC,OAAO;YACL,GAAG,MAAM;YACT,KAAK,EAAE,IAAI;YACX,MAAM,EAAE,IAAI;YACZ,YAAY,EAAE,UAAU;YACxB,UAAU,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SAC7E,CAAC;IACJ,CAAC;IACD,OAAO;QACL,GAAG,MAAM;QACT,KAAK,EAAE,UAAU;QACjB,MAAM,EAAE,WAAW;QACnB,YAAY,EAAE,UAAU;QACxB,UAAU,EAAE,EAAE;KACf,CAAC;AACJ,CAAC;AAED,SAAgB,cAAc,CAAC,MAAuB;IAKpD,IAAI,MAAM,CAAC,UAAU,KAAK,eAAe,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QAC/D,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IACD,OAAO;QACL,WAAW,EAAE,MAAM,CAAC,UAAU;QAC9B,UAAU,EAAE,MAAM,CAAC,SAAS;QAC5B,GAAG,CAAC,MAAM,CAAC,UAAU,KAAK,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC;KACnF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-thread procedure hints.
|
|
3
|
+
*
|
|
4
|
+
* Shape reused from the working Kagemusha loop (agent-loop.ts buildBrainContext): rank
|
|
5
|
+
* by the current message, at most three hits, about 1200 chars when a thread is opened or
|
|
6
|
+
* re-opened and about 600 inside a live thread, and never repeat the same hint to the same
|
|
7
|
+
* thread. The host selects and budgets; whether a hint applies stays the agent's judgment,
|
|
8
|
+
* so a hint carries conditions and an entrance to the original, never an action order.
|
|
9
|
+
*/
|
|
10
|
+
/** Stored text is data inside a host block: it must not be able to author markup. */
|
|
11
|
+
export declare function escapePromptMarkup(text: string): string;
|
|
12
|
+
export declare const FRESH_HINT_CHARS = 1200;
|
|
13
|
+
export declare const CONTINUE_HINT_CHARS = 600;
|
|
14
|
+
export interface ProcedureHintCandidate {
|
|
15
|
+
id: string;
|
|
16
|
+
revision: number;
|
|
17
|
+
title: string;
|
|
18
|
+
description: string;
|
|
19
|
+
whenToUse: string;
|
|
20
|
+
whenNotToUse: string;
|
|
21
|
+
updatedAt: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* What one backend thread has been told: id -> the revision rendered to it, or null when
|
|
25
|
+
* the thread only saw the id counted in a catalog total. Absent ids are new to the thread.
|
|
26
|
+
*/
|
|
27
|
+
export type ThreadHintMemory = Map<string, number | null>;
|
|
28
|
+
export declare function selectProcedureHints(input: {
|
|
29
|
+
stimulus: string;
|
|
30
|
+
candidates: readonly ProcedureHintCandidate[];
|
|
31
|
+
maxHits?: number;
|
|
32
|
+
/** Omit on a fresh thread: everything is new to it. */
|
|
33
|
+
seen?: ThreadHintMemory;
|
|
34
|
+
}): ProcedureHintCandidate[];
|
|
35
|
+
export declare function renderProcedureHints(input: {
|
|
36
|
+
hits: readonly ProcedureHintCandidate[];
|
|
37
|
+
total: number;
|
|
38
|
+
maxChars: number;
|
|
39
|
+
fresh: boolean;
|
|
40
|
+
}): {
|
|
41
|
+
text: string;
|
|
42
|
+
rendered: ProcedureHintCandidate[];
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=experience-hints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"experience-hints.d.ts","sourceRoot":"","sources":["../../src/operator/experience-hints.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,qFAAqF;AACrF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKvD;AAED,eAAO,MAAM,gBAAgB,OAAO,CAAC;AACrC,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAIvC,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;AAoB1D,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,IAAI,CAAC,EAAE,gBAAgB,CAAC;CACzB,GAAG,sBAAsB,EAAE,CAgB3B;AAmBD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,IAAI,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,sBAAsB,EAAE,CAAA;CAAE,CAuBvD"}
|