@jungjaehoon/mama-os 0.20.1 → 0.22.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/CHANGELOG.md +31 -0
- package/README.md +12 -4
- package/dist/agent/agent-loop.d.ts.map +1 -1
- package/dist/agent/agent-loop.js +76 -11
- package/dist/agent/agent-loop.js.map +1 -1
- package/dist/agent/code-act/host-bridge.d.ts.map +1 -1
- package/dist/agent/code-act/host-bridge.js +88 -3
- package/dist/agent/code-act/host-bridge.js.map +1 -1
- package/dist/agent/codex-mcp-process.d.ts +1 -0
- package/dist/agent/codex-mcp-process.d.ts.map +1 -1
- package/dist/agent/codex-mcp-process.js +3 -2
- package/dist/agent/codex-mcp-process.js.map +1 -1
- package/dist/agent/gateway-tool-executor.d.ts +24 -11
- package/dist/agent/gateway-tool-executor.d.ts.map +1 -1
- package/dist/agent/gateway-tool-executor.js +349 -30
- package/dist/agent/gateway-tool-executor.js.map +1 -1
- package/dist/agent/gateway-tools.md +7 -2
- package/dist/agent/model-runner.d.ts +8 -0
- package/dist/agent/model-runner.d.ts.map +1 -1
- package/dist/agent/model-runner.js.map +1 -1
- package/dist/agent/os-agent-capabilities.md +13 -12
- package/dist/agent/persistent-cli-adapter.d.ts +6 -0
- package/dist/agent/persistent-cli-adapter.d.ts.map +1 -1
- package/dist/agent/persistent-cli-adapter.js +21 -10
- package/dist/agent/persistent-cli-adapter.js.map +1 -1
- package/dist/agent/tool-registry.d.ts.map +1 -1
- package/dist/agent/tool-registry.js +33 -2
- package/dist/agent/tool-registry.js.map +1 -1
- package/dist/agent/types.d.ts +30 -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 +78 -5
- package/dist/api/graph-api.js.map +1 -1
- package/dist/api/index.d.ts +8 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +18 -12
- package/dist/api/index.js.map +1 -1
- package/dist/api/operator-handler.d.ts +19 -0
- package/dist/api/operator-handler.d.ts.map +1 -0
- package/dist/api/operator-handler.js +106 -0
- package/dist/api/operator-handler.js.map +1 -0
- package/dist/api/operator-summary.d.ts +3 -0
- package/dist/api/operator-summary.d.ts.map +1 -0
- package/dist/api/operator-summary.js +72 -0
- package/dist/api/operator-summary.js.map +1 -0
- package/dist/api/operator-tasks-handler.d.ts +7 -0
- package/dist/api/operator-tasks-handler.d.ts.map +1 -0
- package/dist/api/operator-tasks-handler.js +165 -0
- package/dist/api/operator-tasks-handler.js.map +1 -0
- package/dist/api/report-handler.d.ts +7 -0
- package/dist/api/report-handler.d.ts.map +1 -1
- package/dist/api/report-handler.js +30 -0
- package/dist/api/report-handler.js.map +1 -1
- package/dist/api/report-persistence.d.ts +17 -0
- package/dist/api/report-persistence.d.ts.map +1 -0
- package/dist/api/report-persistence.js +91 -0
- package/dist/api/report-persistence.js.map +1 -0
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +402 -250
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/config/config-manager.d.ts.map +1 -1
- package/dist/cli/config/config-manager.js +93 -55
- package/dist/cli/config/config-manager.js.map +1 -1
- package/dist/cli/config/types.d.ts +17 -2
- package/dist/cli/config/types.d.ts.map +1 -1
- package/dist/cli/config/types.js +4 -0
- package/dist/cli/config/types.js.map +1 -1
- package/dist/cli/runtime/agent-loop-init.d.ts +3 -1
- package/dist/cli/runtime/agent-loop-init.d.ts.map +1 -1
- package/dist/cli/runtime/agent-loop-init.js +16 -7
- package/dist/cli/runtime/agent-loop-init.js.map +1 -1
- package/dist/cli/runtime/api-routes-init.d.ts.map +1 -1
- package/dist/cli/runtime/api-routes-init.js +503 -259
- package/dist/cli/runtime/api-routes-init.js.map +1 -1
- package/dist/cli/runtime/api-server-init.d.ts.map +1 -1
- package/dist/cli/runtime/api-server-init.js +12 -7
- package/dist/cli/runtime/api-server-init.js.map +1 -1
- package/dist/cli/runtime/connector-init.d.ts +19 -1
- package/dist/cli/runtime/connector-init.d.ts.map +1 -1
- package/dist/cli/runtime/connector-init.js +32 -2
- package/dist/cli/runtime/connector-init.js.map +1 -1
- package/dist/cli/runtime/gateway-init.d.ts.map +1 -1
- package/dist/cli/runtime/gateway-init.js +3 -1
- package/dist/cli/runtime/gateway-init.js.map +1 -1
- package/dist/cli/runtime/memory-agent-init.d.ts +2 -1
- package/dist/cli/runtime/memory-agent-init.d.ts.map +1 -1
- package/dist/cli/runtime/memory-agent-init.js +15 -3
- package/dist/cli/runtime/memory-agent-init.js.map +1 -1
- package/dist/cli/runtime/message-router-config.d.ts +4 -0
- package/dist/cli/runtime/message-router-config.d.ts.map +1 -0
- package/dist/cli/runtime/message-router-config.js +11 -0
- package/dist/cli/runtime/message-router-config.js.map +1 -0
- package/dist/cli/runtime/scheduler-init.d.ts.map +1 -1
- package/dist/cli/runtime/scheduler-init.js +12 -12
- package/dist/cli/runtime/scheduler-init.js.map +1 -1
- package/dist/connectors/framework/polling-scheduler.d.ts.map +1 -1
- package/dist/connectors/framework/polling-scheduler.js +53 -2
- package/dist/connectors/framework/polling-scheduler.js.map +1 -1
- package/dist/connectors/framework/types.d.ts +8 -0
- package/dist/connectors/framework/types.d.ts.map +1 -1
- package/dist/connectors/kagemusha/query-tools.d.ts.map +1 -1
- package/dist/connectors/kagemusha/query-tools.js +14 -3
- package/dist/connectors/kagemusha/query-tools.js.map +1 -1
- package/dist/connectors/slack/index.d.ts.map +1 -1
- package/dist/connectors/slack/index.js +3 -1
- package/dist/connectors/slack/index.js.map +1 -1
- package/dist/connectors/trello/index.d.ts.map +1 -1
- package/dist/connectors/trello/index.js +6 -2
- package/dist/connectors/trello/index.js.map +1 -1
- package/dist/db/agent-store.d.ts +5 -0
- package/dist/db/agent-store.d.ts.map +1 -1
- package/dist/db/agent-store.js +6 -3
- package/dist/db/agent-store.js.map +1 -1
- package/dist/db/migrations/agent-activity-tool-name.d.ts +8 -0
- package/dist/db/migrations/agent-activity-tool-name.d.ts.map +1 -0
- package/dist/db/migrations/agent-activity-tool-name.js +24 -0
- package/dist/db/migrations/agent-activity-tool-name.js.map +1 -0
- package/dist/db/migrations/wiki-artifacts.d.ts +3 -0
- package/dist/db/migrations/wiki-artifacts.d.ts.map +1 -0
- package/dist/db/migrations/wiki-artifacts.js +24 -0
- package/dist/db/migrations/wiki-artifacts.js.map +1 -0
- package/dist/envelope/run-guard.d.ts +10 -0
- package/dist/envelope/run-guard.d.ts.map +1 -0
- package/dist/envelope/run-guard.js +19 -0
- package/dist/envelope/run-guard.js.map +1 -0
- package/dist/gateways/message-router.d.ts.map +1 -1
- package/dist/gateways/message-router.js +15 -3
- package/dist/gateways/message-router.js.map +1 -1
- package/dist/gateways/types.d.ts +4 -0
- package/dist/gateways/types.d.ts.map +1 -1
- package/dist/multi-agent/agent-event-bus.d.ts +14 -0
- package/dist/multi-agent/agent-event-bus.d.ts.map +1 -1
- package/dist/multi-agent/agent-event-bus.js +34 -0
- package/dist/multi-agent/agent-event-bus.js.map +1 -1
- package/dist/multi-agent/conductor-persona.js +2 -2
- package/dist/multi-agent/dashboard-agent-persona.d.ts +6 -2
- package/dist/multi-agent/dashboard-agent-persona.d.ts.map +1 -1
- package/dist/multi-agent/dashboard-agent-persona.js +65 -32
- package/dist/multi-agent/dashboard-agent-persona.js.map +1 -1
- package/dist/multi-agent/memory-agent-persona.d.ts +1 -1
- package/dist/multi-agent/memory-agent-persona.d.ts.map +1 -1
- package/dist/multi-agent/memory-agent-persona.js +25 -4
- package/dist/multi-agent/memory-agent-persona.js.map +1 -1
- package/dist/multi-agent/runtime-process.d.ts +4 -2
- package/dist/multi-agent/runtime-process.d.ts.map +1 -1
- package/dist/multi-agent/runtime-process.js +7 -4
- package/dist/multi-agent/runtime-process.js.map +1 -1
- package/dist/multi-agent/types.d.ts +1 -1
- package/dist/multi-agent/wiki-agent-persona.d.ts +7 -1
- package/dist/multi-agent/wiki-agent-persona.d.ts.map +1 -1
- package/dist/multi-agent/wiki-agent-persona.js +82 -68
- package/dist/multi-agent/wiki-agent-persona.js.map +1 -1
- package/dist/operator/action-verifier.d.ts +50 -0
- package/dist/operator/action-verifier.d.ts.map +1 -0
- package/dist/operator/action-verifier.js +68 -0
- package/dist/operator/action-verifier.js.map +1 -0
- package/dist/operator/board-reconcile.d.ts +62 -0
- package/dist/operator/board-reconcile.d.ts.map +1 -0
- package/dist/operator/board-reconcile.js +160 -0
- package/dist/operator/board-reconcile.js.map +1 -0
- package/dist/operator/board-slot-instructions.d.ts +26 -0
- package/dist/operator/board-slot-instructions.d.ts.map +1 -0
- package/dist/operator/board-slot-instructions.js +76 -0
- package/dist/operator/board-slot-instructions.js.map +1 -0
- package/dist/operator/connector-delta-repo.d.ts +33 -0
- package/dist/operator/connector-delta-repo.d.ts.map +1 -0
- package/dist/operator/connector-delta-repo.js +0 -0
- package/dist/operator/connector-delta-repo.js.map +1 -0
- package/dist/operator/mama-memory-port.d.ts +13 -0
- package/dist/operator/mama-memory-port.d.ts.map +1 -0
- package/dist/operator/mama-memory-port.js +35 -0
- package/dist/operator/mama-memory-port.js.map +1 -0
- package/dist/operator/operator-interfaces.d.ts +136 -0
- package/dist/operator/operator-interfaces.d.ts.map +1 -0
- package/dist/operator/operator-interfaces.js +15 -0
- package/dist/operator/operator-interfaces.js.map +1 -0
- package/dist/operator/operator-trigger-loop.d.ts +119 -0
- package/dist/operator/operator-trigger-loop.d.ts.map +1 -0
- package/dist/operator/operator-trigger-loop.js +267 -0
- package/dist/operator/operator-trigger-loop.js.map +1 -0
- package/dist/operator/report-run.d.ts +78 -0
- package/dist/operator/report-run.d.ts.map +1 -0
- package/dist/operator/report-run.js +141 -0
- package/dist/operator/report-run.js.map +1 -0
- package/dist/operator/report-scheduler.d.ts +66 -0
- package/dist/operator/report-scheduler.d.ts.map +1 -0
- package/dist/operator/report-scheduler.js +135 -0
- package/dist/operator/report-scheduler.js.map +1 -0
- package/dist/operator/situation-report.d.ts +90 -0
- package/dist/operator/situation-report.d.ts.map +1 -0
- package/dist/operator/situation-report.js +221 -0
- package/dist/operator/situation-report.js.map +1 -0
- package/dist/operator/task-ledger.d.ts +96 -0
- package/dist/operator/task-ledger.d.ts.map +1 -0
- package/dist/operator/task-ledger.js +277 -0
- package/dist/operator/task-ledger.js.map +1 -0
- package/dist/operator/trigger-author.d.ts +45 -0
- package/dist/operator/trigger-author.d.ts.map +1 -0
- package/dist/operator/trigger-author.js +217 -0
- package/dist/operator/trigger-author.js.map +1 -0
- package/dist/operator/trigger-evolve.d.ts +31 -0
- package/dist/operator/trigger-evolve.d.ts.map +1 -0
- package/dist/operator/trigger-evolve.js +51 -0
- package/dist/operator/trigger-evolve.js.map +1 -0
- package/dist/operator/trigger-fire.d.ts +29 -0
- package/dist/operator/trigger-fire.d.ts.map +1 -0
- package/dist/operator/trigger-fire.js +41 -0
- package/dist/operator/trigger-fire.js.map +1 -0
- package/dist/operator/trigger-matcher.d.ts +19 -0
- package/dist/operator/trigger-matcher.d.ts.map +1 -0
- package/dist/operator/trigger-matcher.js +61 -0
- package/dist/operator/trigger-matcher.js.map +1 -0
- package/dist/operator/trigger-registry.d.ts +36 -0
- package/dist/operator/trigger-registry.d.ts.map +1 -0
- package/dist/operator/trigger-registry.js +135 -0
- package/dist/operator/trigger-registry.js.map +1 -0
- package/dist/operator/trigger-review.d.ts +23 -0
- package/dist/operator/trigger-review.d.ts.map +1 -0
- package/dist/operator/trigger-review.js +127 -0
- package/dist/operator/trigger-review.js.map +1 -0
- package/dist/operator/trigger-types.d.ts +84 -0
- package/dist/operator/trigger-types.d.ts.map +1 -0
- package/dist/operator/trigger-types.js +14 -0
- package/dist/operator/trigger-types.js.map +1 -0
- package/dist/scheduler/cron-worker.d.ts.map +1 -1
- package/dist/scheduler/cron-worker.js +3 -1
- package/dist/scheduler/cron-worker.js.map +1 -1
- package/dist/security/security-monitor.d.ts.map +1 -1
- package/dist/security/security-monitor.js +1 -0
- package/dist/security/security-monitor.js.map +1 -1
- package/dist/wiki/obsidian-writer.d.ts +1 -1
- package/dist/wiki/obsidian-writer.d.ts.map +1 -1
- package/dist/wiki/obsidian-writer.js +67 -27
- package/dist/wiki/obsidian-writer.js.map +1 -1
- package/dist/wiki/path-safety.d.ts +2 -0
- package/dist/wiki/path-safety.d.ts.map +1 -0
- package/dist/wiki/path-safety.js +40 -0
- package/dist/wiki/path-safety.js.map +1 -0
- package/dist/wiki/types.d.ts +4 -2
- package/dist/wiki/types.d.ts.map +1 -1
- package/dist/wiki/types.js +1 -1
- package/dist/wiki/types.js.map +1 -1
- package/dist/wiki-artifacts/normalization.d.ts +8 -0
- package/dist/wiki-artifacts/normalization.d.ts.map +1 -0
- package/dist/wiki-artifacts/normalization.js +41 -0
- package/dist/wiki-artifacts/normalization.js.map +1 -0
- package/dist/wiki-artifacts/types.d.ts +52 -0
- package/dist/wiki-artifacts/types.d.ts.map +1 -0
- package/dist/wiki-artifacts/types.js +3 -0
- package/dist/wiki-artifacts/types.js.map +1 -0
- package/dist/wiki-artifacts/wiki-publish-adapter.d.ts +14 -0
- package/dist/wiki-artifacts/wiki-publish-adapter.d.ts.map +1 -0
- package/dist/wiki-artifacts/wiki-publish-adapter.js +71 -0
- package/dist/wiki-artifacts/wiki-publish-adapter.js.map +1 -0
- package/package.json +5 -3
- package/public/ui/assets/index-CKOJQYXA.css +1 -0
- package/public/ui/assets/index-OSgiwL24.js +62 -0
- package/public/ui/index.html +14 -0
- package/public/ui/theme-init.js +20 -0
- package/public/viewer/js/utils/api.js +2 -2
- package/public/viewer/src/utils/api.ts +9 -2
- package/public/viewer/sw.js +1 -1
- package/public/viewer/viewer.html +17 -27
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OperatorActionVerifier (M8 Phase 2) - verifies that a reconcile run actually
|
|
3
|
+
* performed its obligated action. Ports Kagemusha's ContractActionVerifier
|
|
4
|
+
* snapshot-diff mechanism, strengthened per plan review: signals must be BOUND
|
|
5
|
+
* to the run, not to unrelated board activity.
|
|
6
|
+
*
|
|
7
|
+
* Verified iff, after the run:
|
|
8
|
+
* (a) a NEW gateway tool-call trace row exists (rowid past the snapshot)
|
|
9
|
+
* whose normalized tool name is one of the obligated tools, or
|
|
10
|
+
* (b) a NEW no-update note exists with EXACTLY this run's scope.
|
|
11
|
+
* Slot/ledger hash deltas are recorded as evidence detail only -- another
|
|
12
|
+
* writer may have moved them (the board-writer queue makes in-queue runs
|
|
13
|
+
* non-concurrent, which closes the remaining race).
|
|
14
|
+
*
|
|
15
|
+
* Observe, never block: the caller records the outcome and emits a notice;
|
|
16
|
+
* an unverified run is a loud signal, not a rejection.
|
|
17
|
+
*/
|
|
18
|
+
export declare const OBLIGATED_TOOLS: readonly ["report_publish", "task_create", "task_update", "contract_no_update"];
|
|
19
|
+
export interface VerifierDeps {
|
|
20
|
+
/** Current report slots (id -> html). */
|
|
21
|
+
getSlots: () => Array<{
|
|
22
|
+
slotId: string;
|
|
23
|
+
html: string;
|
|
24
|
+
}>;
|
|
25
|
+
/** Stable hash of the task ledger payload. */
|
|
26
|
+
getLedgerHash: () => string;
|
|
27
|
+
/** Max no-update note id for a scope (0 when none). */
|
|
28
|
+
getScopedNoteMaxId: (scope: string) => number;
|
|
29
|
+
/**
|
|
30
|
+
* Count of gateway tool-call trace rows past a rowid whose normalized tool
|
|
31
|
+
* name is in OBLIGATED_TOOLS (bound to the reconcile agent).
|
|
32
|
+
*/
|
|
33
|
+
countObligatedTraceRowsSince: (maxId: number) => number;
|
|
34
|
+
/** Max gateway trace rowid right now (0 when none). */
|
|
35
|
+
getTraceMaxId: () => number;
|
|
36
|
+
}
|
|
37
|
+
export interface ActionSnapshot {
|
|
38
|
+
slotHashes: Record<string, string>;
|
|
39
|
+
ledgerHash: string;
|
|
40
|
+
scopedNoteMaxId: number;
|
|
41
|
+
traceMaxId: number;
|
|
42
|
+
}
|
|
43
|
+
export interface VerifyResult {
|
|
44
|
+
verified: boolean;
|
|
45
|
+
/** Human-readable evidence lines for the activity record. */
|
|
46
|
+
effects: string[];
|
|
47
|
+
}
|
|
48
|
+
export declare function captureSnapshot(deps: VerifierDeps, scope: string): ActionSnapshot;
|
|
49
|
+
export declare function verifyAfterRun(deps: VerifierDeps, before: ActionSnapshot, scope: string): VerifyResult;
|
|
50
|
+
//# sourceMappingURL=action-verifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-verifier.d.ts","sourceRoot":"","sources":["../../src/operator/action-verifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,eAAO,MAAM,eAAe,iFAKlB,CAAC;AAEX,MAAM,WAAW,YAAY;IAC3B,yCAAyC;IACzC,QAAQ,EAAE,MAAM,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACxD,8CAA8C;IAC9C,aAAa,EAAE,MAAM,MAAM,CAAC;IAC5B,uDAAuD;IACvD,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9C;;;OAGG;IACH,4BAA4B,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACxD,uDAAuD;IACvD,aAAa,EAAE,MAAM,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,6DAA6D;IAC7D,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,cAAc,CAWjF;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,MAAM,GACZ,YAAY,CA+Bd"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* OperatorActionVerifier (M8 Phase 2) - verifies that a reconcile run actually
|
|
4
|
+
* performed its obligated action. Ports Kagemusha's ContractActionVerifier
|
|
5
|
+
* snapshot-diff mechanism, strengthened per plan review: signals must be BOUND
|
|
6
|
+
* to the run, not to unrelated board activity.
|
|
7
|
+
*
|
|
8
|
+
* Verified iff, after the run:
|
|
9
|
+
* (a) a NEW gateway tool-call trace row exists (rowid past the snapshot)
|
|
10
|
+
* whose normalized tool name is one of the obligated tools, or
|
|
11
|
+
* (b) a NEW no-update note exists with EXACTLY this run's scope.
|
|
12
|
+
* Slot/ledger hash deltas are recorded as evidence detail only -- another
|
|
13
|
+
* writer may have moved them (the board-writer queue makes in-queue runs
|
|
14
|
+
* non-concurrent, which closes the remaining race).
|
|
15
|
+
*
|
|
16
|
+
* Observe, never block: the caller records the outcome and emits a notice;
|
|
17
|
+
* an unverified run is a loud signal, not a rejection.
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.OBLIGATED_TOOLS = void 0;
|
|
21
|
+
exports.captureSnapshot = captureSnapshot;
|
|
22
|
+
exports.verifyAfterRun = verifyAfterRun;
|
|
23
|
+
const node_crypto_1 = require("node:crypto");
|
|
24
|
+
exports.OBLIGATED_TOOLS = [
|
|
25
|
+
'report_publish',
|
|
26
|
+
'task_create',
|
|
27
|
+
'task_update',
|
|
28
|
+
'contract_no_update',
|
|
29
|
+
];
|
|
30
|
+
function captureSnapshot(deps, scope) {
|
|
31
|
+
const slotHashes = {};
|
|
32
|
+
for (const slot of deps.getSlots()) {
|
|
33
|
+
slotHashes[slot.slotId] = (0, node_crypto_1.createHash)('sha256').update(slot.html).digest('hex');
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
slotHashes,
|
|
37
|
+
ledgerHash: deps.getLedgerHash(),
|
|
38
|
+
scopedNoteMaxId: deps.getScopedNoteMaxId(scope),
|
|
39
|
+
traceMaxId: deps.getTraceMaxId(),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function verifyAfterRun(deps, before, scope) {
|
|
43
|
+
const effects = [];
|
|
44
|
+
let verified = false;
|
|
45
|
+
// (a) run-bound signal: obligated gateway tool traces past the snapshot.
|
|
46
|
+
const obligatedTraces = deps.countObligatedTraceRowsSince(before.traceMaxId);
|
|
47
|
+
if (obligatedTraces > 0) {
|
|
48
|
+
verified = true;
|
|
49
|
+
effects.push(`obligated tool traces: ${obligatedTraces}`);
|
|
50
|
+
}
|
|
51
|
+
// (b) run-bound signal: a new no-update note with EXACTLY this scope.
|
|
52
|
+
const noteMaxNow = deps.getScopedNoteMaxId(scope);
|
|
53
|
+
if (noteMaxNow > before.scopedNoteMaxId) {
|
|
54
|
+
verified = true;
|
|
55
|
+
effects.push(`no-update note recorded (scope=${scope})`);
|
|
56
|
+
}
|
|
57
|
+
// Evidence detail only (NOT sufficient alone -- see module doc).
|
|
58
|
+
const after = captureSnapshot(deps, scope);
|
|
59
|
+
const changedSlots = Object.keys({ ...before.slotHashes, ...after.slotHashes }).filter((id) => before.slotHashes[id] !== after.slotHashes[id]);
|
|
60
|
+
if (changedSlots.length > 0) {
|
|
61
|
+
effects.push(`slots changed: ${changedSlots.join(', ')}`);
|
|
62
|
+
}
|
|
63
|
+
if (after.ledgerHash !== before.ledgerHash) {
|
|
64
|
+
effects.push('task ledger changed');
|
|
65
|
+
}
|
|
66
|
+
return { verified, effects };
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=action-verifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-verifier.js","sourceRoot":"","sources":["../../src/operator/action-verifier.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAwCH,0CAW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CAAC;IAC3D,CAAC;IAED,iEAAiE;IACjE,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC3C,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,UAAU,EAAE,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,MAAM,CACpF,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CACvD,CAAC;IACF,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,OAAO,CAAC,IAAI,CAAC,kBAAkB,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5D,CAAC;IACD,IAAI,KAAK,CAAC,UAAU,KAAK,MAAM,CAAC,UAAU,EAAE,CAAC;QAC3C,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* board-reconcile - the delta -> taskboard reconcile contract (M8 Phase 1).
|
|
3
|
+
*
|
|
4
|
+
* Ports Kagemusha's taskboard reconcile mechanism (agent-awareness.ts
|
|
5
|
+
* buildTaskboardReconcilePrompt / runTaskboardReconcile): when a channel delta
|
|
6
|
+
* arrives, the AGENT judges which board slots are affected and MUST either act
|
|
7
|
+
* (partial report_publish / task_create / task_update) or record a
|
|
8
|
+
* contract_no_update note. The system only debounces, budgets, and serializes;
|
|
9
|
+
* every judgment is the agent's (agent-first).
|
|
10
|
+
*
|
|
11
|
+
* Freshness-layer semantics: the 30-minute dashboard cron remains the
|
|
12
|
+
* repair/catch-up pass. Over-budget work is DEFERRED (channel stays dirty with
|
|
13
|
+
* its pending lines), never silently dropped; a crash loses at most one
|
|
14
|
+
* debounce window, which the next cron repairs.
|
|
15
|
+
*/
|
|
16
|
+
export interface ReconcilePromptInput {
|
|
17
|
+
/** "<connector>:<channelId>" - connector-qualified, collision-free. */
|
|
18
|
+
channelKey: string;
|
|
19
|
+
channelLabel?: string;
|
|
20
|
+
deltaLines: string[];
|
|
21
|
+
todayIso: string;
|
|
22
|
+
/** Also read kagemusha_tasks as judgment CONTEXT (never the projection source). */
|
|
23
|
+
kagemushaContext?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** The prompt MUST begin with this token so the persona's RECONCILE RUN mode engages. */
|
|
26
|
+
export declare const RECONCILE_RUN_TOKEN = "RECONCILE RUN";
|
|
27
|
+
export declare function buildReconcilePrompt(input: ReconcilePromptInput): string;
|
|
28
|
+
export interface ReconcileSchedulerOptions {
|
|
29
|
+
/** Trailing-edge debounce per channel. */
|
|
30
|
+
debounceMs?: number;
|
|
31
|
+
/** A continuously-busy channel still fires by this bound (anti-starvation). */
|
|
32
|
+
maxWaitMs?: number;
|
|
33
|
+
/** GLOBAL budget across all channels (sliding hour). Over-budget defers, never drops. */
|
|
34
|
+
globalMaxPerHour?: number;
|
|
35
|
+
/** Bounded pending lines kept per channel while deferred. */
|
|
36
|
+
maxPendingLines?: number;
|
|
37
|
+
run: (channelKey: string, deltaLines: string[]) => Promise<void>;
|
|
38
|
+
log: (line: string) => void;
|
|
39
|
+
now?: () => number;
|
|
40
|
+
}
|
|
41
|
+
export declare class ReconcileScheduler {
|
|
42
|
+
private readonly debounceMs;
|
|
43
|
+
private readonly maxWaitMs;
|
|
44
|
+
private readonly globalMaxPerHour;
|
|
45
|
+
private readonly maxPendingLines;
|
|
46
|
+
private readonly run;
|
|
47
|
+
private readonly log;
|
|
48
|
+
private readonly now;
|
|
49
|
+
private channels;
|
|
50
|
+
private runTimestamps;
|
|
51
|
+
private retryTimer;
|
|
52
|
+
private stopped;
|
|
53
|
+
constructor(opts: ReconcileSchedulerOptions);
|
|
54
|
+
enqueue(channelKey: string, lines: string[]): void;
|
|
55
|
+
/** Channels currently holding deferred/pending work (for observability). */
|
|
56
|
+
dirtyChannels(): string[];
|
|
57
|
+
stop(): void;
|
|
58
|
+
private budgetAvailable;
|
|
59
|
+
private scheduleRetry;
|
|
60
|
+
private fire;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=board-reconcile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"board-reconcile.d.ts","sourceRoot":"","sources":["../../src/operator/board-reconcile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,oBAAoB;IACnC,uEAAuE;IACvE,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,mFAAmF;IACnF,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,yFAAyF;AACzF,eAAO,MAAM,mBAAmB,kBAAkB,CAAC;AAEnD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,CAwBxE;AAED,MAAM,WAAW,yBAAyB;IACxC,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yFAAyF;IACzF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,6DAA6D;IAC7D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAQD,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAmC;IACvD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAmC;IACvD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IAEnC,OAAO,CAAC,QAAQ,CAAmC;IACnD,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,UAAU,CAA8C;IAChE,OAAO,CAAC,OAAO,CAAS;gBAEZ,IAAI,EAAE,yBAAyB;IAU3C,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI;IAwBlD,4EAA4E;IAC5E,aAAa,IAAI,MAAM,EAAE;IAMzB,IAAI,IAAI,IAAI;IAUZ,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,aAAa;YAcP,IAAI;CA+BnB"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* board-reconcile - the delta -> taskboard reconcile contract (M8 Phase 1).
|
|
4
|
+
*
|
|
5
|
+
* Ports Kagemusha's taskboard reconcile mechanism (agent-awareness.ts
|
|
6
|
+
* buildTaskboardReconcilePrompt / runTaskboardReconcile): when a channel delta
|
|
7
|
+
* arrives, the AGENT judges which board slots are affected and MUST either act
|
|
8
|
+
* (partial report_publish / task_create / task_update) or record a
|
|
9
|
+
* contract_no_update note. The system only debounces, budgets, and serializes;
|
|
10
|
+
* every judgment is the agent's (agent-first).
|
|
11
|
+
*
|
|
12
|
+
* Freshness-layer semantics: the 30-minute dashboard cron remains the
|
|
13
|
+
* repair/catch-up pass. Over-budget work is DEFERRED (channel stays dirty with
|
|
14
|
+
* its pending lines), never silently dropped; a crash loses at most one
|
|
15
|
+
* debounce window, which the next cron repairs.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ReconcileScheduler = exports.RECONCILE_RUN_TOKEN = void 0;
|
|
19
|
+
exports.buildReconcilePrompt = buildReconcilePrompt;
|
|
20
|
+
/** The prompt MUST begin with this token so the persona's RECONCILE RUN mode engages. */
|
|
21
|
+
exports.RECONCILE_RUN_TOKEN = 'RECONCILE RUN';
|
|
22
|
+
function buildReconcilePrompt(input) {
|
|
23
|
+
const label = input.channelLabel ?? input.channelKey;
|
|
24
|
+
const scope = `reconcile:${input.channelKey}`;
|
|
25
|
+
return [
|
|
26
|
+
`${exports.RECONCILE_RUN_TOKEN} for channel ${label} (${input.channelKey}). Today is ${input.todayIso}.`,
|
|
27
|
+
'New messages arrived in this channel. Reconcile the operator board and the task ledger',
|
|
28
|
+
'against them. Plan (execute in order):',
|
|
29
|
+
'1. Read the delta lines below.',
|
|
30
|
+
`2. task_list() for existing work items${input.kagemushaContext ? ' and kagemusha_tasks() as extra CONTEXT (the native ledger stays the projection source)' : ''}.`,
|
|
31
|
+
'3. Judge which slots are affected (briefing / action_required / decisions / pipeline).',
|
|
32
|
+
'4. You MUST call at least ONE of: report_publish with ONLY the affected slots,',
|
|
33
|
+
' task_create, or task_update -- when the delta concerns work that ALREADY has a',
|
|
34
|
+
' task row (match by title or source in step 2), task_update that row instead of',
|
|
35
|
+
' creating a near-duplicate, and pass source_channel plus source_event_id from the',
|
|
36
|
+
' delta header so retries upsert. If NOTHING on the board or ledger is affected,',
|
|
37
|
+
` you MUST call contract_no_update({reason, scope: "${scope}"}) instead.`,
|
|
38
|
+
'5. Finish with exactly one line: RECONCILED <comma-separated slots or none>.',
|
|
39
|
+
'',
|
|
40
|
+
'Constraints: do not rewrite unaffected slots; no mama_save; no follow-up questions.',
|
|
41
|
+
'',
|
|
42
|
+
`<latest-delta channel="${input.channelKey}">`,
|
|
43
|
+
...input.deltaLines,
|
|
44
|
+
'</latest-delta>',
|
|
45
|
+
].join('\n');
|
|
46
|
+
}
|
|
47
|
+
class ReconcileScheduler {
|
|
48
|
+
debounceMs;
|
|
49
|
+
maxWaitMs;
|
|
50
|
+
globalMaxPerHour;
|
|
51
|
+
maxPendingLines;
|
|
52
|
+
run;
|
|
53
|
+
log;
|
|
54
|
+
now;
|
|
55
|
+
channels = new Map();
|
|
56
|
+
runTimestamps = [];
|
|
57
|
+
retryTimer = null;
|
|
58
|
+
stopped = false;
|
|
59
|
+
constructor(opts) {
|
|
60
|
+
this.debounceMs = opts.debounceMs ?? 180_000;
|
|
61
|
+
this.maxWaitMs = opts.maxWaitMs ?? 600_000;
|
|
62
|
+
this.globalMaxPerHour = opts.globalMaxPerHour ?? 12;
|
|
63
|
+
this.maxPendingLines = opts.maxPendingLines ?? 30;
|
|
64
|
+
this.run = opts.run;
|
|
65
|
+
this.log = opts.log;
|
|
66
|
+
this.now = opts.now ?? Date.now;
|
|
67
|
+
}
|
|
68
|
+
enqueue(channelKey, lines) {
|
|
69
|
+
if (this.stopped)
|
|
70
|
+
return;
|
|
71
|
+
const state = this.channels.get(channelKey) ?? {
|
|
72
|
+
pendingLines: [],
|
|
73
|
+
debounceTimer: null,
|
|
74
|
+
firstEnqueuedAt: null,
|
|
75
|
+
};
|
|
76
|
+
state.pendingLines = [...state.pendingLines, ...lines].slice(-this.maxPendingLines);
|
|
77
|
+
if (state.firstEnqueuedAt === null)
|
|
78
|
+
state.firstEnqueuedAt = this.now();
|
|
79
|
+
this.channels.set(channelKey, state);
|
|
80
|
+
if (state.debounceTimer)
|
|
81
|
+
clearTimeout(state.debounceTimer);
|
|
82
|
+
// Trailing debounce with a max-wait bound: continuous traffic cannot
|
|
83
|
+
// starve the channel past maxWaitMs since its first pending event.
|
|
84
|
+
const sinceFirst = this.now() - state.firstEnqueuedAt;
|
|
85
|
+
const delay = Math.max(0, Math.min(this.debounceMs, this.maxWaitMs - sinceFirst));
|
|
86
|
+
const timer = setTimeout(() => {
|
|
87
|
+
state.debounceTimer = null;
|
|
88
|
+
void this.fire(channelKey);
|
|
89
|
+
}, delay);
|
|
90
|
+
timer.unref?.();
|
|
91
|
+
state.debounceTimer = timer;
|
|
92
|
+
}
|
|
93
|
+
/** Channels currently holding deferred/pending work (for observability). */
|
|
94
|
+
dirtyChannels() {
|
|
95
|
+
return [...this.channels.entries()]
|
|
96
|
+
.filter(([, s]) => s.pendingLines.length > 0)
|
|
97
|
+
.map(([k]) => k);
|
|
98
|
+
}
|
|
99
|
+
stop() {
|
|
100
|
+
this.stopped = true;
|
|
101
|
+
for (const state of this.channels.values()) {
|
|
102
|
+
if (state.debounceTimer)
|
|
103
|
+
clearTimeout(state.debounceTimer);
|
|
104
|
+
state.debounceTimer = null;
|
|
105
|
+
}
|
|
106
|
+
if (this.retryTimer)
|
|
107
|
+
clearTimeout(this.retryTimer);
|
|
108
|
+
this.retryTimer = null;
|
|
109
|
+
}
|
|
110
|
+
budgetAvailable() {
|
|
111
|
+
const cutoff = this.now() - 3_600_000;
|
|
112
|
+
this.runTimestamps = this.runTimestamps.filter((t) => t > cutoff);
|
|
113
|
+
return this.runTimestamps.length < this.globalMaxPerHour;
|
|
114
|
+
}
|
|
115
|
+
scheduleRetry() {
|
|
116
|
+
if (this.retryTimer || this.stopped)
|
|
117
|
+
return;
|
|
118
|
+
const timer = setTimeout(() => {
|
|
119
|
+
this.retryTimer = null;
|
|
120
|
+
const dirty = this.dirtyChannels();
|
|
121
|
+
for (const key of dirty) {
|
|
122
|
+
const state = this.channels.get(key);
|
|
123
|
+
if (state && !state.debounceTimer)
|
|
124
|
+
void this.fire(key);
|
|
125
|
+
}
|
|
126
|
+
}, 60_000);
|
|
127
|
+
timer.unref?.();
|
|
128
|
+
this.retryTimer = timer;
|
|
129
|
+
}
|
|
130
|
+
async fire(channelKey) {
|
|
131
|
+
if (this.stopped)
|
|
132
|
+
return;
|
|
133
|
+
const state = this.channels.get(channelKey);
|
|
134
|
+
if (!state || state.pendingLines.length === 0)
|
|
135
|
+
return;
|
|
136
|
+
if (!this.budgetAvailable()) {
|
|
137
|
+
// DEFER, never drop: the channel stays dirty and retries when budget frees.
|
|
138
|
+
this.log(`[reconcile] global budget exhausted (${this.globalMaxPerHour}/h); deferring ${channelKey} (${state.pendingLines.length} lines kept)`);
|
|
139
|
+
this.scheduleRetry();
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const lines = state.pendingLines;
|
|
143
|
+
state.pendingLines = [];
|
|
144
|
+
state.firstEnqueuedAt = null;
|
|
145
|
+
this.runTimestamps.push(this.now());
|
|
146
|
+
try {
|
|
147
|
+
await this.run(channelKey, lines);
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
// Run failure keeps the channel dirty for retry; the scheduler survives.
|
|
151
|
+
state.pendingLines = [...lines, ...state.pendingLines].slice(-this.maxPendingLines);
|
|
152
|
+
if (state.firstEnqueuedAt === null)
|
|
153
|
+
state.firstEnqueuedAt = this.now();
|
|
154
|
+
this.log(`[reconcile] run failed for ${channelKey}: ${err instanceof Error ? err.message : String(err)}; kept dirty for retry`);
|
|
155
|
+
this.scheduleRetry();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
exports.ReconcileScheduler = ReconcileScheduler;
|
|
160
|
+
//# sourceMappingURL=board-reconcile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"board-reconcile.js","sourceRoot":"","sources":["../../src/operator/board-reconcile.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAeH,oDAwBC;AA3BD,yFAAyF;AAC5E,QAAA,mBAAmB,GAAG,eAAe,CAAC;AAEnD,SAAgB,oBAAoB,CAAC,KAA2B;IAC9D,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,IAAI,KAAK,CAAC,UAAU,CAAC;IACrD,MAAM,KAAK,GAAG,aAAa,KAAK,CAAC,UAAU,EAAE,CAAC;IAC9C,OAAO;QACL,GAAG,2BAAmB,gBA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AY,GAAG,CAAC,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACpF,IAAI,KAAK,CAAC,eAAe,KAAK,IAAI;gBAAE,KAAK,CAAC,eAAe,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YACvE,IAAI,CAAC,GAAG,CACN,8BAA8B,UAAU,KAAK,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,wBAAwB,CACtH,CAAC;YACF,IAAI,CAAC,aAAa,EAAE,CAAC;QACvB,CAAC;IACH,CAAC;CACF;AApHD,gDAoHC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared board-authoring vocabulary (Kagemusha mechanism port).
|
|
3
|
+
*
|
|
4
|
+
* Every report producer (dashboard agent persona, its scheduled prompt, the
|
|
5
|
+
* trigger loop's scheduled full report) injects THESE lines so the operator
|
|
6
|
+
* board at /ui receives the same 4-slot, card-based HTML regardless of which
|
|
7
|
+
* agent wrote it. The classes are styled by ui/src/styles/global.css --
|
|
8
|
+
* agents write structure, the board owns look.
|
|
9
|
+
*
|
|
10
|
+
* Generic mechanism only: no personal strings, English source; the agent is
|
|
11
|
+
* told to write CONTENT in the owner's language.
|
|
12
|
+
*/
|
|
13
|
+
export declare const BOARD_SLOT_ORDER: readonly ["briefing", "action_required", "decisions", "pipeline"];
|
|
14
|
+
/** The exact HTML shapes the board stylesheet understands. */
|
|
15
|
+
export declare function buildBoardHtmlVocabulary(): string[];
|
|
16
|
+
/**
|
|
17
|
+
* Pipeline slot = item tracker projection (M8 Phase 3). Injected into EVERY
|
|
18
|
+
* board writer (dashboard persona, cron prompt, the trigger loop's full
|
|
19
|
+
* report) so both writers project the same tracker. D-day arithmetic uses the
|
|
20
|
+
* "Today is <date>" line each RUN PROMPT carries -- personas are static files
|
|
21
|
+
* and must never bake in a date.
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildPipelineTrackerInstructions(): string[];
|
|
24
|
+
/** Instruction block that makes a report run also publish the board slots. */
|
|
25
|
+
export declare function buildBoardPublishLines(): string[];
|
|
26
|
+
//# sourceMappingURL=board-slot-instructions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"board-slot-instructions.d.ts","sourceRoot":"","sources":["../../src/operator/board-slot-instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,gBAAgB,mEAAoE,CAAC;AAElG,8DAA8D;AAC9D,wBAAgB,wBAAwB,IAAI,MAAM,EAAE,CAenD;AAED;;;;;;GAMG;AACH,wBAAgB,gCAAgC,IAAI,MAAM,EAAE,CAe3D;AAED,8EAA8E;AAC9E,wBAAgB,sBAAsB,IAAI,MAAM,EAAE,CAcjD"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared board-authoring vocabulary (Kagemusha mechanism port).
|
|
4
|
+
*
|
|
5
|
+
* Every report producer (dashboard agent persona, its scheduled prompt, the
|
|
6
|
+
* trigger loop's scheduled full report) injects THESE lines so the operator
|
|
7
|
+
* board at /ui receives the same 4-slot, card-based HTML regardless of which
|
|
8
|
+
* agent wrote it. The classes are styled by ui/src/styles/global.css --
|
|
9
|
+
* agents write structure, the board owns look.
|
|
10
|
+
*
|
|
11
|
+
* Generic mechanism only: no personal strings, English source; the agent is
|
|
12
|
+
* told to write CONTENT in the owner's language.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.BOARD_SLOT_ORDER = void 0;
|
|
16
|
+
exports.buildBoardHtmlVocabulary = buildBoardHtmlVocabulary;
|
|
17
|
+
exports.buildPipelineTrackerInstructions = buildPipelineTrackerInstructions;
|
|
18
|
+
exports.buildBoardPublishLines = buildBoardPublishLines;
|
|
19
|
+
exports.BOARD_SLOT_ORDER = ['briefing', 'action_required', 'decisions', 'pipeline'];
|
|
20
|
+
/** The exact HTML shapes the board stylesheet understands. */
|
|
21
|
+
function buildBoardHtmlVocabulary() {
|
|
22
|
+
return [
|
|
23
|
+
'Slot HTML must use ONLY this class vocabulary (the board styles it; inline styles are unnecessary):',
|
|
24
|
+
'- Summary header: <div class="report-summary"><div class="summary-title">TITLE</div>',
|
|
25
|
+
' <div class="summary-stats">label <span class="stat-highlight">N</span> / label <span class="stat-highlight">N</span></div></div>',
|
|
26
|
+
'- Section heading: <div class="report-section-title">HEADING</div>',
|
|
27
|
+
'- Item card: <div class="report-card"><div class="card-header"><div class="card-title">TITLE</div>',
|
|
28
|
+
' <span class="card-badge badge-warning">STATE</span></div>',
|
|
29
|
+
' <div class="card-tags"><span class="tag tag-channel">CHANNEL</span></div>',
|
|
30
|
+
' <div class="card-action">CONCRETE NEXT ACTION</div></div>',
|
|
31
|
+
'- Badge classes by state: badge-danger (blocked/overdue), badge-warning (waiting/needs confirmation),',
|
|
32
|
+
' badge-info (in progress), badge-success (done/quiet).',
|
|
33
|
+
'- Pipeline table: <table class="report-table"><thead><tr><th>...</th></tr></thead><tbody>rows</tbody></table>',
|
|
34
|
+
'No <script>, <iframe>, or event handlers: the board sanitizes them out and the CSP blocks them.',
|
|
35
|
+
];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Pipeline slot = item tracker projection (M8 Phase 3). Injected into EVERY
|
|
39
|
+
* board writer (dashboard persona, cron prompt, the trigger loop's full
|
|
40
|
+
* report) so both writers project the same tracker. D-day arithmetic uses the
|
|
41
|
+
* "Today is <date>" line each RUN PROMPT carries -- personas are static files
|
|
42
|
+
* and must never bake in a date.
|
|
43
|
+
*/
|
|
44
|
+
function buildPipelineTrackerInstructions() {
|
|
45
|
+
return [
|
|
46
|
+
'The pipeline slot is an ITEM TRACKER, not a summary. Build it from',
|
|
47
|
+
'task_list({order: "deadline_priority", limit: 12}) -- the native task ledger is the',
|
|
48
|
+
'projection source. Render one report-table with a row per open item:',
|
|
49
|
+
' #id | title | status badge | assignee (or "unassigned") | D-day | source | latest event',
|
|
50
|
+
'- D-day: compute from the item\'s deadline against the run prompt\'s "Today is" date',
|
|
51
|
+
' (D-3 = due in 3 days, D+2 = 2 days overdue). No deadline -> "-".',
|
|
52
|
+
'- Overdue -> badge-danger. Unassigned AND due within 7 days -> badge-warning with the',
|
|
53
|
+
' literal word "unassigned" visible.',
|
|
54
|
+
'- Items with auto_created true and confirmed false render "(unconfirmed)" after the title',
|
|
55
|
+
' so model-created items are visually distinct from owner-confirmed ones.',
|
|
56
|
+
'- done/cancelled items never appear.',
|
|
57
|
+
'When a briefing/action_required/decisions card refers to a tracked item, cite its #id.',
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
/** Instruction block that makes a report run also publish the board slots. */
|
|
61
|
+
function buildBoardPublishLines() {
|
|
62
|
+
return [
|
|
63
|
+
'BEFORE writing your text report, update the operator board: call the report_publish',
|
|
64
|
+
'gateway tool EXACTLY once with ALL four slots:',
|
|
65
|
+
' report_publish({ slots: { briefing: "<html>", action_required: "<html>", decisions: "<html>", pipeline: "<html>" } })',
|
|
66
|
+
'- briefing: one report-summary block (title + stat highlights), then up to 4 item cards for the key situations.',
|
|
67
|
+
'- action_required: a report-section-title, then up to 5 cards; every card-action states the concrete next step.',
|
|
68
|
+
'- decisions: cards for items waiting on an owner decision or confirmation; omit filler when none exist,',
|
|
69
|
+
' but still publish the slot with a one-line quiet note.',
|
|
70
|
+
...buildPipelineTrackerInstructions(),
|
|
71
|
+
...buildBoardHtmlVocabulary(),
|
|
72
|
+
"Write all slot CONTENT in the owner's language (match the channels); keep each slot under 6KB.",
|
|
73
|
+
'The plain-text report you write afterwards is a separate output: no HTML in it.',
|
|
74
|
+
];
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=board-slot-instructions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"board-slot-instructions.js","sourceRoot":"","sources":["../../src/operator/board-slot-instructions.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAKH,4DAeC;AASD,4EAeC;AAGD,wDAcC;AA3DY,QAAA,gBAAgB,GAAG,CAAC,UAAU,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,CAAU,CAAC;AAElG,8DAA8D;AAC9D,SAAgB,wBAAwB;IACtC,OAAO;QACL,qGAAqG;QACrG,sFAAsF;QACtF,oIAAoI;QACpI,oEAAoE;QACpE,oGAAoG;QACpG,6DAA6D;QAC7D,6EAA6E;QAC7E,6DAA6D;QAC7D,uGAAuG;QACvG,yDAAyD;QACzD,+GAA+G;QAC/G,iGAAiG;KAClG,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,gCAAgC;IAC9C,OAAO;QACL,oEAAoE;QACpE,qFAAqF;QACrF,sEAAsE;QACtE,2FAA2F;QAC3F,sFAAsF;QACtF,oEAAoE;QACpE,uFAAuF;QACvF,sCAAsC;QACtC,2FAA2F;QAC3F,2EAA2E;QAC3E,sCAAsC;QACtC,wFAAwF;KACzF,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,SAAgB,sBAAsB;IACpC,OAAO;QACL,qFAAqF;QACrF,gDAAgD;QAChD,yHAAyH;QACzH,iHAAiH;QACjH,iHAAiH;QACjH,yGAAyG;QACzG,0DAA0D;QAC1D,GAAG,gCAAgC,EAAE;QACrC,GAAG,wBAAwB,EAAE;QAC7B,gGAAgG;QAChG,iFAAiF;KAClF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConnectorDeltaRepo - the real delta source for the trigger loop (M1-T1).
|
|
3
|
+
*
|
|
4
|
+
* Reads connector_event_index (mama-core main DB; migration 030:523-543): content, author,
|
|
5
|
+
* channel are INLINE columns - no source_id/raw-store join. Ordering uses operator_ingest_seq,
|
|
6
|
+
* which is PER-(source_connector, COALESCE(channel,'')) (migration 039), so this repo keeps a
|
|
7
|
+
* per-partition read-cursor map persisted as JSON under ~/.mama - deliberately DISJOINT from
|
|
8
|
+
* both the DB's own insert-assignment cursor table (connector_event_index_operator_seq_cursors)
|
|
9
|
+
* and vNext's vnext_operator_cursors. At-least-once: drainNew() re-delivers until commit().
|
|
10
|
+
*
|
|
11
|
+
* OperatorChannelEvent.id = SQLite rowid (global integer, satisfies the interface);
|
|
12
|
+
* eventIndexId carries the stable TEXT PK for provenance.
|
|
13
|
+
*/
|
|
14
|
+
import type { OperatorChannelEvent } from './operator-interfaces.js';
|
|
15
|
+
/** Minimal structural DB interface - satisfied by both the standalone sqlite wrapper and the mama-core adapter. */
|
|
16
|
+
export interface DeltaDbLike {
|
|
17
|
+
prepare(sql: string): {
|
|
18
|
+
all: (...params: unknown[]) => unknown[];
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export declare class ConnectorDeltaRepo {
|
|
22
|
+
private db;
|
|
23
|
+
private cursorPath;
|
|
24
|
+
private cursors;
|
|
25
|
+
/** rowid -> partition/seq of events handed out by drainNew, awaiting commit. */
|
|
26
|
+
private pending;
|
|
27
|
+
constructor(db: DeltaDbLike, cursorPath: string);
|
|
28
|
+
/** Drain up to `limitPerPartition` new events from EACH (connector, channel) partition. */
|
|
29
|
+
drainNew(limitPerPartition: number): OperatorChannelEvent[];
|
|
30
|
+
/** Advance per-partition cursors past the given (processed) events and persist. */
|
|
31
|
+
commit(events: OperatorChannelEvent[]): void;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=connector-delta-repo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connector-delta-repo.d.ts","sourceRoot":"","sources":["../../src/operator/connector-delta-repo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAErE,mHAAmH;AACnH,MAAM,WAA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,YAAY,OAAO,CAAC,GAAG,MAAM,CAAC,CAAC;IAC/D,IAAA,uBAAa,EAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC;IACpD,IAAA,oBAAU,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,iBAAiB;AAC1C,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* createMamaMemoryPort - the real OperatorMemoryPort binding (M1-T0).
|
|
3
|
+
*
|
|
4
|
+
* recall -> mama-core recallMemory (memory/api.ts:1118), mapping RecallBundle.memories
|
|
5
|
+
* (MemoryRecord: topic + summary) into the port's {topic, content} shape.
|
|
6
|
+
* save -> mama-core saveMemory (operator-authored notes; decision kind, global scope).
|
|
7
|
+
*
|
|
8
|
+
* Pure adapter: no judgment, no filtering beyond the mechanical mapping. The agent's
|
|
9
|
+
* memoryQuery decides what is recalled (trigger-fire.ts).
|
|
10
|
+
*/
|
|
11
|
+
import type { OperatorMemoryPort } from './operator-interfaces.js';
|
|
12
|
+
export declare function createMamaMemoryPort(): OperatorMemoryPort;
|
|
13
|
+
//# sourceMappingURL=mama-memory-port.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mama-memory-port.d.ts","sourceRoot":"","sources":["../../src/operator/mama-memory-port.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,wBAAgB,oBAAoB,IAAI,kBAAkB,CAoBzD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* createMamaMemoryPort - the real OperatorMemoryPort binding (M1-T0).
|
|
4
|
+
*
|
|
5
|
+
* recall -> mama-core recallMemory (memory/api.ts:1118), mapping RecallBundle.memories
|
|
6
|
+
* (MemoryRecord: topic + summary) into the port's {topic, content} shape.
|
|
7
|
+
* save -> mama-core saveMemory (operator-authored notes; decision kind, global scope).
|
|
8
|
+
*
|
|
9
|
+
* Pure adapter: no judgment, no filtering beyond the mechanical mapping. The agent's
|
|
10
|
+
* memoryQuery decides what is recalled (trigger-fire.ts).
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.createMamaMemoryPort = createMamaMemoryPort;
|
|
14
|
+
const mama_core_1 = require("@jungjaehoon/mama-core");
|
|
15
|
+
function createMamaMemoryPort() {
|
|
16
|
+
return {
|
|
17
|
+
async recall(query, opts) {
|
|
18
|
+
const bundle = await (0, mama_core_1.recallMemory)(query, { limit: opts?.limit ?? 5 });
|
|
19
|
+
return bundle.memories.map((m) => ({ topic: m.topic, content: m.summary }));
|
|
20
|
+
},
|
|
21
|
+
async save(input) {
|
|
22
|
+
await (0, mama_core_1.saveMemory)({
|
|
23
|
+
topic: input.topic,
|
|
24
|
+
kind: 'decision',
|
|
25
|
+
summary: input.content,
|
|
26
|
+
details: input.content,
|
|
27
|
+
scopes: input.scopes ?? [
|
|
28
|
+
{ kind: 'global', id: 'global' },
|
|
29
|
+
],
|
|
30
|
+
source: { package: 'standalone', source_type: 'operator-trigger-loop' },
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=mama-memory-port.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mama-memory-port.js","sourceRoot":"","sources":["../../src/operator/mama-memory-port.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAKH,oDAoBC;AAvBD,sDAAkE;AAGlE,SAAgB,oBAAoB;IAClC,OAAO;QACL,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI;YACtB,MAAM,MAAM,GAAG,MAAM,IAAA,wBAAY,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC,CAAC;YACtE,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC9E,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,KAAK;YACd,MAAM,IAAA,sBAAU,EAAC;gBACf,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,MAAM,EAAG,KAAK,CAAC,MAAwF,IAAI;oBACzG,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE;iBACjC;gBACD,MAAM,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,uBAAuB,EAAE;aACxE,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|