@jungjaehoon/mama-os 0.22.1 → 0.24.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 +22 -0
- package/README.md +3 -1
- package/dist/agent/agent-loop.d.ts +3 -9
- package/dist/agent/agent-loop.d.ts.map +1 -1
- package/dist/agent/agent-loop.js +419 -216
- package/dist/agent/agent-loop.js.map +1 -1
- package/dist/agent/code-act/constants.d.ts +2 -2
- package/dist/agent/code-act/constants.d.ts.map +1 -1
- package/dist/agent/code-act/constants.js +16 -9
- package/dist/agent/code-act/constants.js.map +1 -1
- package/dist/agent/code-act/host-bridge.d.ts +12 -11
- package/dist/agent/code-act/host-bridge.d.ts.map +1 -1
- package/dist/agent/code-act/host-bridge.js +92 -15
- package/dist/agent/code-act/host-bridge.js.map +1 -1
- package/dist/agent/code-act/index.d.ts +2 -0
- package/dist/agent/code-act/index.d.ts.map +1 -1
- package/dist/agent/code-act/index.js +5 -1
- package/dist/agent/code-act/index.js.map +1 -1
- package/dist/agent/code-act/tool-policy.d.ts +42 -0
- package/dist/agent/code-act/tool-policy.d.ts.map +1 -0
- package/dist/agent/code-act/tool-policy.js +122 -0
- package/dist/agent/code-act/tool-policy.js.map +1 -0
- package/dist/agent/code-act/type-definition-generator.d.ts +4 -3
- package/dist/agent/code-act/type-definition-generator.d.ts.map +1 -1
- package/dist/agent/code-act/type-definition-generator.js +26 -48
- package/dist/agent/code-act/type-definition-generator.js.map +1 -1
- package/dist/agent/codex-app-server-process.d.ts +116 -0
- package/dist/agent/codex-app-server-process.d.ts.map +1 -0
- package/dist/agent/codex-app-server-process.js +1382 -0
- package/dist/agent/codex-app-server-process.js.map +1 -0
- package/dist/agent/codex-home.d.ts +9 -0
- package/dist/agent/codex-home.d.ts.map +1 -1
- package/dist/agent/codex-home.js +626 -4
- package/dist/agent/codex-home.js.map +1 -1
- package/dist/agent/codex-thread-registry.d.ts +63 -0
- package/dist/agent/codex-thread-registry.d.ts.map +1 -0
- package/dist/agent/codex-thread-registry.js +433 -0
- package/dist/agent/codex-thread-registry.js.map +1 -0
- package/dist/agent/gateway-tool-executor.d.ts +20 -7
- package/dist/agent/gateway-tool-executor.d.ts.map +1 -1
- package/dist/agent/gateway-tool-executor.js +254 -90
- package/dist/agent/gateway-tool-executor.js.map +1 -1
- package/dist/agent/gateway-tools.md +10 -5
- package/dist/agent/managed-agent-runtime-sync.d.ts.map +1 -1
- package/dist/agent/managed-agent-runtime-sync.js +0 -3
- package/dist/agent/managed-agent-runtime-sync.js.map +1 -1
- package/dist/agent/managed-agent-validation.js +1 -1
- package/dist/agent/managed-agent-validation.js.map +1 -1
- package/dist/agent/model-runner.d.ts +51 -3
- package/dist/agent/model-runner.d.ts.map +1 -1
- package/dist/agent/model-runner.js +1 -1
- package/dist/agent/model-runner.js.map +1 -1
- package/dist/agent/persistent-cli-adapter.d.ts +1 -0
- package/dist/agent/persistent-cli-adapter.d.ts.map +1 -1
- package/dist/agent/persistent-cli-adapter.js +3 -0
- package/dist/agent/persistent-cli-adapter.js.map +1 -1
- package/dist/agent/role-manager.d.ts +22 -1
- package/dist/agent/role-manager.d.ts.map +1 -1
- package/dist/agent/role-manager.js +39 -2
- package/dist/agent/role-manager.js.map +1 -1
- package/dist/agent/session-pool.d.ts +2 -2
- package/dist/agent/session-pool.d.ts.map +1 -1
- package/dist/agent/session-pool.js +6 -6
- package/dist/agent/session-pool.js.map +1 -1
- package/dist/agent/tool-registry.d.ts +14 -0
- package/dist/agent/tool-registry.d.ts.map +1 -1
- package/dist/agent/tool-registry.js +81 -12
- package/dist/agent/tool-registry.js.map +1 -1
- package/dist/agent/types.d.ts +49 -7
- 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 +62 -40
- package/dist/api/graph-api.js.map +1 -1
- package/dist/api/operator-tasks-handler.d.ts.map +1 -1
- package/dist/api/operator-tasks-handler.js +6 -2
- package/dist/api/operator-tasks-handler.js.map +1 -1
- package/dist/cli/commands/init.d.ts +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +22 -14
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/run.d.ts.map +1 -1
- package/dist/cli/commands/run.js +7 -4
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/start.d.ts +2 -0
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +259 -23
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/status.js +2 -2
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/config/config-manager.d.ts +0 -5
- package/dist/cli/config/config-manager.d.ts.map +1 -1
- package/dist/cli/config/config-manager.js +78 -6
- package/dist/cli/config/config-manager.js.map +1 -1
- package/dist/cli/config/types.d.ts +4 -4
- package/dist/cli/config/types.d.ts.map +1 -1
- package/dist/cli/config/types.js +36 -0
- package/dist/cli/config/types.js.map +1 -1
- package/dist/cli/index.js +2 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/runtime/agent-loop-init.d.ts +1 -1
- package/dist/cli/runtime/agent-loop-init.d.ts.map +1 -1
- package/dist/cli/runtime/agent-loop-init.js +106 -60
- package/dist/cli/runtime/agent-loop-init.js.map +1 -1
- package/dist/cli/runtime/api-routes-init.d.ts +3 -0
- package/dist/cli/runtime/api-routes-init.d.ts.map +1 -1
- package/dist/cli/runtime/api-routes-init.js +226 -51
- package/dist/cli/runtime/api-routes-init.js.map +1 -1
- package/dist/cli/runtime/connector-init.d.ts.map +1 -1
- package/dist/cli/runtime/connector-init.js +13 -17
- package/dist/cli/runtime/connector-init.js.map +1 -1
- package/dist/cli/runtime/envelope-bootstrap.d.ts.map +1 -1
- package/dist/cli/runtime/envelope-bootstrap.js +13 -1
- package/dist/cli/runtime/envelope-bootstrap.js.map +1 -1
- package/dist/cli/runtime/gateway-init.d.ts +1 -1
- package/dist/cli/runtime/gateway-init.d.ts.map +1 -1
- package/dist/cli/runtime/gateway-init.js +5 -0
- package/dist/cli/runtime/gateway-init.js.map +1 -1
- package/dist/cli/runtime/mama-core-init.d.ts +2 -2
- package/dist/cli/runtime/mama-core-init.d.ts.map +1 -1
- package/dist/cli/runtime/mama-core-init.js +17 -0
- package/dist/cli/runtime/mama-core-init.js.map +1 -1
- package/dist/cli/runtime/memory-agent-init.d.ts +1 -1
- package/dist/cli/runtime/memory-agent-init.d.ts.map +1 -1
- package/dist/cli/runtime/memory-agent-init.js +16 -6
- package/dist/cli/runtime/memory-agent-init.js.map +1 -1
- package/dist/cli/runtime/types.d.ts +4 -26
- package/dist/cli/runtime/types.d.ts.map +1 -1
- package/dist/cli/runtime/utilities.js +2 -2
- package/dist/cli/runtime/utilities.js.map +1 -1
- package/dist/connectors/config-loader.d.ts +24 -0
- package/dist/connectors/config-loader.d.ts.map +1 -0
- package/dist/connectors/config-loader.js +205 -0
- package/dist/connectors/config-loader.js.map +1 -0
- package/dist/connectors/framework/types.d.ts +2 -0
- package/dist/connectors/framework/types.d.ts.map +1 -1
- package/dist/connectors/kagemusha/query-tools.js +2 -2
- package/dist/connectors/kagemusha/query-tools.js.map +1 -1
- package/dist/envelope/reactive-config.d.ts +2 -2
- package/dist/envelope/reactive-config.d.ts.map +1 -1
- package/dist/envelope/reactive-config.js +36 -4
- package/dist/envelope/reactive-config.js.map +1 -1
- package/dist/gateways/context-injector.d.ts +2 -1
- package/dist/gateways/context-injector.d.ts.map +1 -1
- package/dist/gateways/context-injector.js.map +1 -1
- package/dist/gateways/message-router.d.ts +19 -1
- package/dist/gateways/message-router.d.ts.map +1 -1
- package/dist/gateways/message-router.js +179 -24
- package/dist/gateways/message-router.js.map +1 -1
- package/dist/gateways/telegram.d.ts.map +1 -1
- package/dist/gateways/telegram.js +13 -0
- package/dist/gateways/telegram.js.map +1 -1
- package/dist/gateways/types.d.ts +4 -1
- package/dist/gateways/types.d.ts.map +1 -1
- package/dist/memory/history-extractor.d.ts +0 -24
- package/dist/memory/history-extractor.d.ts.map +1 -1
- package/dist/memory/history-extractor.js +0 -132
- package/dist/memory/history-extractor.js.map +1 -1
- package/dist/memory/save-candidate-extractor.d.ts +3 -0
- package/dist/memory/save-candidate-extractor.d.ts.map +1 -1
- package/dist/memory/save-candidate-extractor.js +12 -1
- package/dist/memory/save-candidate-extractor.js.map +1 -1
- package/dist/memory/secret-filter.d.ts +22 -0
- package/dist/memory/secret-filter.d.ts.map +1 -0
- package/dist/memory/secret-filter.js +77 -0
- package/dist/memory/secret-filter.js.map +1 -0
- package/dist/multi-agent/agent-process-manager.d.ts +9 -1
- package/dist/multi-agent/agent-process-manager.d.ts.map +1 -1
- package/dist/multi-agent/agent-process-manager.js +197 -49
- package/dist/multi-agent/agent-process-manager.js.map +1 -1
- package/dist/multi-agent/multi-agent-base.d.ts.map +1 -1
- package/dist/multi-agent/multi-agent-base.js +2 -1
- package/dist/multi-agent/multi-agent-base.js.map +1 -1
- package/dist/multi-agent/runtime-process.d.ts +18 -15
- package/dist/multi-agent/runtime-process.d.ts.map +1 -1
- package/dist/multi-agent/runtime-process.js +63 -59
- package/dist/multi-agent/runtime-process.js.map +1 -1
- package/dist/multi-agent/types.d.ts +13 -7
- package/dist/multi-agent/types.d.ts.map +1 -1
- package/dist/multi-agent/types.js.map +1 -1
- package/dist/multi-agent/workflow-engine.js +3 -3
- package/dist/multi-agent/workflow-engine.js.map +1 -1
- package/dist/multi-agent/workflow-types.d.ts +2 -2
- package/dist/multi-agent/workflow-types.d.ts.map +1 -1
- package/dist/observability/code-audit.d.ts +4 -0
- package/dist/observability/code-audit.d.ts.map +1 -1
- package/dist/observability/code-audit.js +69 -0
- package/dist/observability/code-audit.js.map +1 -1
- package/dist/operator/briefs.d.ts +26 -0
- package/dist/operator/briefs.d.ts.map +1 -0
- package/dist/operator/briefs.js +128 -0
- package/dist/operator/briefs.js.map +1 -0
- package/dist/operator/operator-trigger-loop.d.ts +27 -0
- package/dist/operator/operator-trigger-loop.d.ts.map +1 -1
- package/dist/operator/operator-trigger-loop.js +72 -12
- package/dist/operator/operator-trigger-loop.js.map +1 -1
- package/dist/operator/report-carry.d.ts +29 -0
- package/dist/operator/report-carry.d.ts.map +1 -0
- package/dist/operator/report-carry.js +81 -0
- package/dist/operator/report-carry.js.map +1 -0
- package/dist/operator/report-run.d.ts +4 -4
- package/dist/operator/shadow-capture.d.ts +20 -0
- package/dist/operator/shadow-capture.d.ts.map +1 -0
- package/dist/operator/shadow-capture.js +34 -0
- package/dist/operator/shadow-capture.js.map +1 -0
- package/dist/operator/situation-report.d.ts +9 -0
- package/dist/operator/situation-report.d.ts.map +1 -1
- package/dist/operator/situation-report.js +56 -26
- package/dist/operator/situation-report.js.map +1 -1
- package/dist/operator/task-ledger.d.ts +90 -2
- package/dist/operator/task-ledger.d.ts.map +1 -1
- package/dist/operator/task-ledger.js +359 -23
- package/dist/operator/task-ledger.js.map +1 -1
- package/dist/operator/trigger-author.d.ts +35 -1
- package/dist/operator/trigger-author.d.ts.map +1 -1
- package/dist/operator/trigger-author.js +73 -10
- package/dist/operator/trigger-author.js.map +1 -1
- package/dist/operator/worker-run.d.ts +89 -0
- package/dist/operator/worker-run.d.ts.map +1 -0
- package/dist/operator/worker-run.js +127 -0
- package/dist/operator/worker-run.js.map +1 -0
- package/dist/operator/workorder-consumer.d.ts +121 -0
- package/dist/operator/workorder-consumer.d.ts.map +1 -0
- package/dist/operator/workorder-consumer.js +253 -0
- package/dist/operator/workorder-consumer.js.map +1 -0
- package/dist/operator/workorder-hooks.d.ts +30 -0
- package/dist/operator/workorder-hooks.d.ts.map +1 -0
- package/dist/operator/workorder-hooks.js +70 -0
- package/dist/operator/workorder-hooks.js.map +1 -0
- package/dist/operator/workorder-publishers.d.ts +68 -0
- package/dist/operator/workorder-publishers.d.ts.map +1 -0
- package/dist/operator/workorder-publishers.js +150 -0
- package/dist/operator/workorder-publishers.js.map +1 -0
- package/dist/security/security-monitor.d.ts +7 -0
- package/dist/security/security-monitor.d.ts.map +1 -1
- package/dist/security/security-monitor.js +17 -0
- package/dist/security/security-monitor.js.map +1 -1
- package/dist/setup/setup-prompt.d.ts +1 -1
- package/dist/setup/setup-prompt.d.ts.map +1 -1
- package/dist/setup/setup-prompt.js +4 -5
- package/dist/setup/setup-prompt.js.map +1 -1
- package/dist/utils/untrusted-content.d.ts +13 -0
- package/dist/utils/untrusted-content.d.ts.map +1 -1
- package/dist/utils/untrusted-content.js +43 -0
- package/dist/utils/untrusted-content.js.map +1 -1
- package/package.json +2 -2
- package/public/viewer/js/modules/agents.js +13 -9
- package/public/viewer/js/modules/settings.js +15 -10
- package/public/viewer/src/modules/agents.ts +12 -10
- package/public/viewer/src/modules/settings.ts +17 -12
- package/public/viewer/src/utils/api.ts +2 -2
- package/templates/AGENTS.codex.md +2 -23
- package/templates/personas/conductor.md +1 -1
- package/dist/agent/codex-mcp-process.d.ts +0 -105
- package/dist/agent/codex-mcp-process.d.ts.map +0 -1
- package/dist/agent/codex-mcp-process.js +0 -748
- package/dist/agent/codex-mcp-process.js.map +0 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Context carry for the owner console (plan v6 S1-T4).
|
|
4
|
+
*
|
|
5
|
+
* Kagemusha's continuity mechanism, minimal form: the chat persona can
|
|
6
|
+
* reference "the report you just received" because the last DELIVERED full
|
|
7
|
+
* report is persisted at delivery time and injected per turn. Carry is
|
|
8
|
+
* DERIVED state (storage-layer, never session accumulation - owner principle
|
|
9
|
+
* "session = cache").
|
|
10
|
+
*
|
|
11
|
+
* Injection rides the user-message prefix path - the only channel that flows
|
|
12
|
+
* on EVERY turn including CONTINUE (per-call system prompts never reach a
|
|
13
|
+
* pooled CLI process).
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.defaultCarryPath = defaultCarryPath;
|
|
17
|
+
exports.persistLastFullReport = persistLastFullReport;
|
|
18
|
+
exports.loadLastFullReport = loadLastFullReport;
|
|
19
|
+
exports.buildReportCarryPrefix = buildReportCarryPrefix;
|
|
20
|
+
const node_fs_1 = require("node:fs");
|
|
21
|
+
const untrusted_content_js_1 = require("../utils/untrusted-content.js");
|
|
22
|
+
const node_os_1 = require("node:os");
|
|
23
|
+
const node_path_1 = require("node:path");
|
|
24
|
+
const CARRY_SUMMARY_MAX_CHARS = 700;
|
|
25
|
+
function defaultCarryPath() {
|
|
26
|
+
return (0, node_path_1.join)((0, node_os_1.homedir)(), '.mama', 'operator', 'last-full-report.json');
|
|
27
|
+
}
|
|
28
|
+
/** Persist the delivered full report (atomic write, same pattern as the schedule store). */
|
|
29
|
+
function persistLastFullReport(deliveredAtIso, text, path = defaultCarryPath()) {
|
|
30
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(path), { recursive: true });
|
|
31
|
+
const tmp = (0, node_path_1.join)((0, node_path_1.dirname)(path), `.last-full-report.${process.pid}.tmp`);
|
|
32
|
+
// 0600: the carried report is owner operational data.
|
|
33
|
+
(0, node_fs_1.writeFileSync)(tmp, JSON.stringify({ deliveredAt: deliveredAtIso, text }), {
|
|
34
|
+
mode: 0o600,
|
|
35
|
+
});
|
|
36
|
+
(0, node_fs_1.renameSync)(tmp, path);
|
|
37
|
+
}
|
|
38
|
+
/** Load the last delivered full report; null when none exists or the file is unreadable. */
|
|
39
|
+
function loadLastFullReport(path = defaultCarryPath()) {
|
|
40
|
+
let raw;
|
|
41
|
+
try {
|
|
42
|
+
raw = (0, node_fs_1.readFileSync)(path, 'utf8');
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// Missing file is the normal no-report-yet state.
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
const parsed = JSON.parse(raw);
|
|
50
|
+
if (typeof parsed.deliveredAt !== 'string' || typeof parsed.text !== 'string') {
|
|
51
|
+
console.warn(`[report-carry] carry file has invalid shape, ignoring: ${path}`);
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return { deliveredAt: parsed.deliveredAt, text: parsed.text };
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
// Corrupt state must be LOUD (repo rule), then fall back to no-carry.
|
|
58
|
+
console.warn(`[report-carry] carry file corrupt, ignoring (${path}): ${error instanceof Error ? error.message : String(error)}`);
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Build the per-turn carry prefix for the owner console. Empty string when no
|
|
64
|
+
* report has been delivered yet (nothing to carry - the persona should use
|
|
65
|
+
* report_request/board_read instead).
|
|
66
|
+
*/
|
|
67
|
+
function buildReportCarryPrefix(path = defaultCarryPath()) {
|
|
68
|
+
const last = loadLastFullReport(path);
|
|
69
|
+
if (!last) {
|
|
70
|
+
return '';
|
|
71
|
+
}
|
|
72
|
+
const summary = last.text.length > CARRY_SUMMARY_MAX_CHARS
|
|
73
|
+
? `${last.text.slice(0, CARRY_SUMMARY_MAX_CHARS)}\n[... truncated - full text was delivered to the owner channel]`
|
|
74
|
+
: last.text;
|
|
75
|
+
// The report is agent-authored but SUMMARIZES third-party content; wrapping
|
|
76
|
+
// it keeps reproduced instructions inert across every future turn it rides.
|
|
77
|
+
return (`[Operator context] The last FULL situation report was delivered at ${last.deliveredAt}.\n` +
|
|
78
|
+
`If the owner asks for a report or current status, reference/refresh THIS instead of ` +
|
|
79
|
+
`reconstructing state from memory. Content:\n${(0, untrusted_content_js_1.wrapUntrustedContent)('operator-report-carry', summary)}\n---\n`);
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=report-carry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-carry.js","sourceRoot":"","sources":["../../src/operator/report-carry.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;AAcH,4CAEC;AAGD,sDAgBC;AAGD,gDAwBC;AAOD,wDAmBC;AAtFD,qCAA6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AAC,IAAI,CAAC,0DAA0D,IAAI,EAAE,CAAC,CAAC;YAC/E,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IAChE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,sEAAsE;QACtE,OAAO,CAAC,IAAI,CACV,gDAAgD,IAAI,MAClD,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CACvD,EAAE,CACH,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAgB,sBAAsB,CAAC,OAAe,gBAAgB,EAAE;IACtE,MAAM,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,OAAO,GACX,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,uBAAuB;QACxC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,uBAAuB,CAAC,kEAAkE;QAClH,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IAChB,4EAA4E;IAC5E,4EAA4E;IAC5E,OAAO,CACL,sEAAsE,IAAI,CAAC,WAAW,KAAK;QAC3F,sFAAsF;QACtF,+CAA+C,IAAA,2CAAoB,EACjE,uBAAuB,EACvB,OAAO,CACR,SAAS,CACX,CAAC;AACJ,CAAC"}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Operator report-run wiring + tool-use audit (M3 "Operator Hands").
|
|
3
3
|
*
|
|
4
4
|
* PURE half (this file, Task 1): classify the gateway tools the persona agent actually EXECUTED
|
|
5
|
-
* during a report.
|
|
6
|
-
* tool_use
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* during a report. Claude text-gateway calls and Codex native host calls are both recorded by
|
|
6
|
+
* AgentLoop as assistant tool_use followed by user tool_result history entries. We pair
|
|
7
|
+
* tool_use.id with its tool_result and count executions only - errored results and envelope
|
|
8
|
+
* denials ("success":false /
|
|
9
9
|
* envelope_missing, gateway-tool-executor.ts:1090-1142) do NOT count. History is read
|
|
10
10
|
* structurally (no agent-internal imports) so the audit is trivially unit-testable.
|
|
11
11
|
*
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shadow capture store (Stage-2 S2-T4) - TEMPORARY migration harness.
|
|
3
|
+
*
|
|
4
|
+
* At MAMA_STAGE2_WORKORDERS=shadow, board workorder runs get a capture
|
|
5
|
+
* publisher injected via reportPublisherOverride: their report_publish calls
|
|
6
|
+
* land HERE (JSONL under ~/.mama/operator/) instead of the live report store.
|
|
7
|
+
* The T6 equivalence gate compares these captures (brief-driven output)
|
|
8
|
+
* against the legacy live publishes (persona-driven output) by kagemusha-id
|
|
9
|
+
* overlap.
|
|
10
|
+
*
|
|
11
|
+
* KILL-LIST: this whole file is deleted at cutover (plan T6) - keep it
|
|
12
|
+
* self-contained.
|
|
13
|
+
*/
|
|
14
|
+
export declare function shadowCapturePath(homeDir?: string): string;
|
|
15
|
+
export interface ShadowCapture {
|
|
16
|
+
/** Drop-in report_publish target - appends, never touches the live store. */
|
|
17
|
+
publisher: (slots: Record<string, string>) => void;
|
|
18
|
+
}
|
|
19
|
+
export declare function createShadowCapture(homeDir?: string): ShadowCapture;
|
|
20
|
+
//# sourceMappingURL=shadow-capture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shadow-capture.d.ts","sourceRoot":"","sources":["../../src/operator/shadow-capture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,MAAkB,GAAG,MAAM,CAErE;AAED,MAAM,WAAW,aAAa;IAC5B,6EAA6E;IAC7E,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;CACpD;AAED,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,MAAkB,GAAG,aAAa,CAW9E"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shadow capture store (Stage-2 S2-T4) - TEMPORARY migration harness.
|
|
4
|
+
*
|
|
5
|
+
* At MAMA_STAGE2_WORKORDERS=shadow, board workorder runs get a capture
|
|
6
|
+
* publisher injected via reportPublisherOverride: their report_publish calls
|
|
7
|
+
* land HERE (JSONL under ~/.mama/operator/) instead of the live report store.
|
|
8
|
+
* The T6 equivalence gate compares these captures (brief-driven output)
|
|
9
|
+
* against the legacy live publishes (persona-driven output) by kagemusha-id
|
|
10
|
+
* overlap.
|
|
11
|
+
*
|
|
12
|
+
* KILL-LIST: this whole file is deleted at cutover (plan T6) - keep it
|
|
13
|
+
* self-contained.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.shadowCapturePath = shadowCapturePath;
|
|
17
|
+
exports.createShadowCapture = createShadowCapture;
|
|
18
|
+
const node_fs_1 = require("node:fs");
|
|
19
|
+
const node_os_1 = require("node:os");
|
|
20
|
+
const node_path_1 = require("node:path");
|
|
21
|
+
function shadowCapturePath(homeDir = (0, node_os_1.homedir)()) {
|
|
22
|
+
return (0, node_path_1.join)(homeDir, '.mama', 'operator', 'shadow-capture.jsonl');
|
|
23
|
+
}
|
|
24
|
+
function createShadowCapture(homeDir = (0, node_os_1.homedir)()) {
|
|
25
|
+
const path = shadowCapturePath(homeDir);
|
|
26
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(path), { recursive: true });
|
|
27
|
+
return {
|
|
28
|
+
publisher: (slots) => {
|
|
29
|
+
(0, node_fs_1.appendFileSync)(path, `${JSON.stringify({ ts: Date.now(), slots })}\n`, 'utf-8');
|
|
30
|
+
console.log(`[stage2] shadow capture: ${Object.keys(slots).length} slot(s) -> ${path} (live store untouched)`);
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=shadow-capture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shadow-capture.js","sourceRoot":"","sources":["../../src/operator/shadow-capture.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;AAMH,8CAEC;AAOD,kDAWC;AAxBD,qCAAoD;AACpD,qCAAkC;AAClC,yCAA0C;AAE1C,SAAgB,iBAAiB,CAAC,UAAkB,IAAA,iBAAO,GAAE;IAC3D,OAAO,IAAA,gBAAI,EAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,sBAAsB,CAAC,CAAC;AACpE,CAAC;AAOD,SAAgB,mBAAmB,CAAC,UAAkB,IAAA,iBAAO,GAAE;IAC7D,MAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACxC,IAAA,mBAAS,EAAC,IAAA,mBAAO,EAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,OAAO;QACL,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;YACnB,IAAA,wBAAc,EAAC,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAChF,OAAO,CAAC,GAAG,CACT,4BAA4B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,eAAe,IAAI,yBAAyB,CAClG,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import type { OperatorChannelEvent, OutputSink } from './operator-interfaces.js';
|
|
19
19
|
import type { AskAgent } from './trigger-author.js';
|
|
20
|
+
import type { BackendType } from '../agent/model-runner.js';
|
|
20
21
|
/**
|
|
21
22
|
* Machine frame tag prepended to the FULL report prompt so the report-run wiring can tell a full
|
|
22
23
|
* report from a digest for tool-use auditing (report-run.ts). Kagemusha frames its scheduled full
|
|
@@ -34,6 +35,8 @@ export interface FireActivity {
|
|
|
34
35
|
}
|
|
35
36
|
export type ReportMode = 'digest' | 'full';
|
|
36
37
|
export interface SituationReporterOptions {
|
|
38
|
+
/** Model provider controls only the tool-call syntax; report workflow/content stays shared. */
|
|
39
|
+
backend?: BackendType;
|
|
37
40
|
/**
|
|
38
41
|
* M2.3: tool-call instructions injected into the FULL report framing so the agent
|
|
39
42
|
* ACTIVELY gathers current context (channels, tasks, memory) before writing - the
|
|
@@ -62,6 +65,12 @@ export interface SituationReporterOptions {
|
|
|
62
65
|
* of being elimination-only. Uncited fires stay NEUTRAL - not failures.
|
|
63
66
|
*/
|
|
64
67
|
recordTriggerUse?: (triggerIds: string[]) => void;
|
|
68
|
+
/**
|
|
69
|
+
* Context carry (plan v6 S1-T4): called with (deliveredAtIso, reportText)
|
|
70
|
+
* after a FULL report is successfully delivered. Runtime wiring persists it
|
|
71
|
+
* so the owner console can reference the latest report per chat turn.
|
|
72
|
+
*/
|
|
73
|
+
persistLastFullReport?: (deliveredAtIso: string, text: string) => void;
|
|
65
74
|
}
|
|
66
75
|
export declare class SituationReporter {
|
|
67
76
|
private windowByChannel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"situation-report.d.ts","sourceRoot":"","sources":["../../src/operator/situation-report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"situation-report.d.ts","sourceRoot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AC,IAAI,CAA2B;gBAE3B,IAAI,GAAE,wBAA6B;IAI/C,0EAA0E;IAC1E,YAAY,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,IAAI;IAgBlD,2FAA2F;IAC3F,UAAU,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI;IAmBxC,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAInC,uFAAuF;IACvF,WAAW,IAAI,OAAO;IAItB;;;OAGG;IACG,MAAM,CACV,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,EAChC,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,OAAO,CAAC;IA2DnB,OAAO,CAAC,KAAK;IAQb,kGAAkG;IAClG,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM;CAyItC"}
|
|
@@ -106,6 +106,19 @@ class SituationReporter {
|
|
|
106
106
|
if (cited.length > 0) {
|
|
107
107
|
this.opts.recordTriggerUse?.(cited);
|
|
108
108
|
}
|
|
109
|
+
// Context carry (plan v6 S1-T4): persist the DELIVERED full report so the
|
|
110
|
+
// chat console can reference "the report you just got" instead of
|
|
111
|
+
// fabricating one. Same success condition as the delta anchor.
|
|
112
|
+
if (mode === 'full') {
|
|
113
|
+
try {
|
|
114
|
+
this.opts.persistLastFullReport?.(new Date().toISOString(), text);
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
// Carry is derived state - persistence failure must not fail the
|
|
118
|
+
// delivered report, but it must be loud.
|
|
119
|
+
console.warn(`[situation-report] failed to persist last full report for context carry: ${error instanceof Error ? error.message : String(error)}`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
109
122
|
this.reset();
|
|
110
123
|
return true;
|
|
111
124
|
}
|
|
@@ -137,6 +150,48 @@ class SituationReporter {
|
|
|
137
150
|
? this.opts.selfGatherLines()
|
|
138
151
|
: (this.opts.selfGatherLines ?? [])
|
|
139
152
|
: [];
|
|
153
|
+
const gatherInstructions = this.opts.backend === 'codex'
|
|
154
|
+
? [
|
|
155
|
+
'Before writing, ACTIVELY gather current context with your injected native host tools directly.',
|
|
156
|
+
'Call each tool through the native model tool interface and wait for its result before',
|
|
157
|
+
'the next call; never emit Markdown or JavaScript substitutes for tool calls.',
|
|
158
|
+
'Gather with these injected native host tools:',
|
|
159
|
+
...gatherLines.map((line) => `- ${line}`),
|
|
160
|
+
'These tool names are already injected for this run. Do not search for them, and do',
|
|
161
|
+
'not fall back to Bash or curl against any API.',
|
|
162
|
+
'Use ONLY these injected host tools to gather. Do NOT read log files, databases, or',
|
|
163
|
+
'the filesystem with Bash, Read, or other unrelated tools - those are not the task',
|
|
164
|
+
'board and will make the report wrong. Your tool findings are the primary source;',
|
|
165
|
+
'the window summary below is only a hint.',
|
|
166
|
+
'',
|
|
167
|
+
'After gathering, if the window contains a durable decision or lesson worth keeping,',
|
|
168
|
+
'persist exactly ONE by calling the injected native mama_save host tool (type',
|
|
169
|
+
'"decision", with topic, decision, reasoning). Only save when it is genuinely',
|
|
170
|
+
'durable; skip the save otherwise. This is your judgement, not a requirement.',
|
|
171
|
+
]
|
|
172
|
+
: [
|
|
173
|
+
'Before writing, ACTIVELY gather current context by CALLING your gateway tools.',
|
|
174
|
+
'Emit each call as a fenced tool_call JSON block and wait for the result before',
|
|
175
|
+
'the next call. The block format is exactly:',
|
|
176
|
+
'```tool_call',
|
|
177
|
+
'{"name": "kagemusha_tasks", "input": {"status": "in_progress"}}',
|
|
178
|
+
'```',
|
|
179
|
+
'Gather with these gateway tool calls:',
|
|
180
|
+
...gatherLines.map((line) => `- ${line}`),
|
|
181
|
+
'These gateway tools are NOT native or deferred CLI tools: ToolSearch cannot',
|
|
182
|
+
'load them and will find nothing. Invoke them ONLY as fenced tool_call JSON',
|
|
183
|
+
'blocks in your reply text - do not search for them, and do not fall back to',
|
|
184
|
+
'Bash or curl against any API.',
|
|
185
|
+
'Use ONLY these gateway tool_call blocks to gather. Do NOT read log files,',
|
|
186
|
+
'databases, or the filesystem with Bash, Read, or other native tools - those are',
|
|
187
|
+
'not the task board and will make the report wrong. Your gateway tool findings',
|
|
188
|
+
'are the primary source; the window summary below is only a hint.',
|
|
189
|
+
'',
|
|
190
|
+
'After gathering, if the window contains a durable decision or lesson worth',
|
|
191
|
+
'keeping, persist exactly ONE with a gateway tool_call to mama_save (type',
|
|
192
|
+
'"decision", with topic, decision, reasoning). Only save when it is genuinely',
|
|
193
|
+
'durable; skip the save otherwise. This is your judgement, not a requirement.',
|
|
194
|
+
];
|
|
140
195
|
// M2.1 posture: the full report is a DUTY report (always arrives - a quiet window is
|
|
141
196
|
// reported as quiet, the aliveness signal owners rely on); the digest defaults to briefing
|
|
142
197
|
// and keeps NOTHING only for pure noise.
|
|
@@ -151,32 +206,7 @@ class SituationReporter {
|
|
|
151
206
|
"Structure the report with these sections (render the headings in the owner's language;",
|
|
152
207
|
'omit a section only when it is truly empty):',
|
|
153
208
|
'1) Key situation 2) Action required 3) Decisions needed 4) Pipeline 5) Next actions',
|
|
154
|
-
...(gatherLines.length > 0
|
|
155
|
-
? [
|
|
156
|
-
'',
|
|
157
|
-
'Before writing, ACTIVELY gather current context by CALLING your gateway tools.',
|
|
158
|
-
'Emit each call as a fenced tool_call JSON block and wait for the result before',
|
|
159
|
-
'the next call. The block format is exactly:',
|
|
160
|
-
'```tool_call',
|
|
161
|
-
'{"name": "kagemusha_tasks", "input": {"status": "in_progress"}}',
|
|
162
|
-
'```',
|
|
163
|
-
'Gather with these gateway tool calls:',
|
|
164
|
-
...gatherLines.map((line) => `- ${line}`),
|
|
165
|
-
'These gateway tools are NOT native or deferred CLI tools: ToolSearch cannot',
|
|
166
|
-
'load them and will find nothing. Invoke them ONLY as fenced tool_call JSON',
|
|
167
|
-
'blocks in your reply text - do not search for them, and do not fall back to',
|
|
168
|
-
'Bash or curl against any API.',
|
|
169
|
-
'Use ONLY these gateway tool_call blocks to gather. Do NOT read log files,',
|
|
170
|
-
'databases, or the filesystem with Bash, Read, or other native tools - those are',
|
|
171
|
-
'not the task board and will make the report wrong. Your gateway tool findings',
|
|
172
|
-
'are the primary source; the window summary below is only a hint.',
|
|
173
|
-
'',
|
|
174
|
-
'After gathering, if the window contains a durable decision or lesson worth',
|
|
175
|
-
'keeping, persist exactly ONE with a gateway tool_call to mama_save (type',
|
|
176
|
-
'"decision", with topic, decision, reasoning). Only save when it is genuinely',
|
|
177
|
-
'durable; skip the save otherwise. This is your judgement, not a requirement.',
|
|
178
|
-
]
|
|
179
|
-
: []),
|
|
209
|
+
...(gatherLines.length > 0 ? ['', ...gatherInstructions] : []),
|
|
180
210
|
...(this.opts.boardPublishLines && this.opts.boardPublishLines.length > 0
|
|
181
211
|
? ['', ...this.opts.boardPublishLines]
|
|
182
212
|
: []),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"situation-report.js","sourceRoot":"","sources":["../../src/operator/situation-report.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"situation-report.js","sourceRoot":"","sources":["../../src/operator/situation-report.ts"],"names":[],"mappings":";;;AAoBA,wEAAqE;AAErE;;;;GAIG;AACU,QAAA,wBAAwB,GAAG,wBAAwB,CAAC;AAWjE,kGAAkG;AAClG,MAAM,wBAAwB,GAAG,CAAC,CAAC;AACnC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAC9B,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAClC,MAAM,YAAY,GAAG,EAAE,CAAC;AAsDxB,oFAAoF;AACpF,MAAM,qBAAqB,GAAG,iCAAiC,CAAC;AAEhE,MAAa,iBAAiB;IACpB,eAAe,GAAG,IAAI,GAAG,EAAyB,CAAC;IACnD,WAAW,GAAG,CAAC,CAAC;IAChB,OAAO,GAAG,IAAI,GAAG,EAAmB,CAAC;IACrC,QAAQ,GAAG,CAAC,CAAC;IACb,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC,CAAC,sCAAsC;IAC5E,IAAI,CAA2B;IAEvC,YAAY,OA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AC5C,GAAG,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;SACzD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;CACF;AA/QD,8CA+QC"}
|
|
@@ -20,14 +20,42 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import type { SQLiteDatabase } from '../sqlite.js';
|
|
22
22
|
import type { OperatorTask, TaskSource } from './operator-interfaces.js';
|
|
23
|
-
export declare const TASK_STATUSES: readonly ["pending", "in_progress", "review", "blocked", "done", "cancelled"];
|
|
23
|
+
export declare const TASK_STATUSES: readonly ["pending", "in_progress", "review", "blocked", "done", "cancelled", "failed"];
|
|
24
24
|
export type TaskStatus = (typeof TASK_STATUSES)[number];
|
|
25
25
|
export declare const TASK_PRIORITIES: readonly ["high", "normal", "low"];
|
|
26
26
|
export type TaskPriority = (typeof TASK_PRIORITIES)[number];
|
|
27
|
+
export declare const TASK_KINDS: readonly ["owner", "system"];
|
|
28
|
+
export type TaskKind = (typeof TASK_KINDS)[number];
|
|
29
|
+
export declare const WORKORDER_KINDS: readonly ["board", "wiki", "memory-curation"];
|
|
30
|
+
export type WorkOrderKind = (typeof WORKORDER_KINDS)[number];
|
|
31
|
+
/** source_channel namespace for workorder rows: 'workorder:<workKind>'. */
|
|
32
|
+
export declare const WORKORDER_CHANNEL_PREFIX = "workorder:";
|
|
33
|
+
export interface EnqueueWorkOrderInput {
|
|
34
|
+
workKind: WorkOrderKind;
|
|
35
|
+
/** Per-occurrence idempotency key (schedule slot / event batch / manual ts). */
|
|
36
|
+
idempotencyKey: string;
|
|
37
|
+
/** Kind-specific payload; `attempts` is managed by the ledger (starts at 1). */
|
|
38
|
+
input: Record<string, unknown>;
|
|
39
|
+
priority?: TaskPriority;
|
|
40
|
+
}
|
|
41
|
+
export interface WorkOrderRecord {
|
|
42
|
+
id: number;
|
|
43
|
+
workKind: WorkOrderKind;
|
|
44
|
+
status: TaskStatus;
|
|
45
|
+
priority: TaskPriority;
|
|
46
|
+
idempotencyKey: string;
|
|
47
|
+
/** Parsed payload; always carries `attempts` (>= 1). */
|
|
48
|
+
payload: Record<string, unknown> & {
|
|
49
|
+
attempts: number;
|
|
50
|
+
};
|
|
51
|
+
createdAt: number;
|
|
52
|
+
updatedAt: number;
|
|
53
|
+
}
|
|
27
54
|
/** Extended record: satisfies OperatorTask (numeric deadline) and carries the ISO original. */
|
|
28
55
|
export interface TaskRecord extends OperatorTask {
|
|
29
56
|
status: TaskStatus;
|
|
30
57
|
priority: TaskPriority;
|
|
58
|
+
kind: TaskKind;
|
|
31
59
|
/** ISO YYYY-MM-DD as stored; `deadline` (OperatorTask) is its UTC-midnight epoch ms. */
|
|
32
60
|
deadlineIso: string | null;
|
|
33
61
|
assignee: string | null;
|
|
@@ -72,11 +100,24 @@ export declare class TaskLedger implements TaskSource {
|
|
|
72
100
|
private db;
|
|
73
101
|
constructor(db: SQLiteDatabase);
|
|
74
102
|
private runMigration;
|
|
103
|
+
/** Full current column set - single source for CREATE and the rebuild copy. */
|
|
104
|
+
private static readonly TABLE_COLUMNS_SQL;
|
|
105
|
+
private static readonly INDEXES_SQL;
|
|
106
|
+
/**
|
|
107
|
+
* Stage-2 in-place upgrade for pre-existing tables. Guards are re-checked
|
|
108
|
+
* INSIDE `BEGIN IMMEDIATE`: two connections construct TaskLedger (boot +
|
|
109
|
+
* lazy API handler) and both run this - the loser must see the winner's
|
|
110
|
+
* finished work, not rebuild an already-migrated table.
|
|
111
|
+
*/
|
|
112
|
+
private upgradeSchema;
|
|
75
113
|
/** TaskSource conformance: open items in canonical board order. */
|
|
76
114
|
getTasks(): OperatorTask[];
|
|
77
115
|
countOpenUnconfirmed(): number;
|
|
78
116
|
list(filter?: ListTasksFilter): TaskRecord[];
|
|
117
|
+
/** Owner rows only - system workorder rows are invisible to external reads. */
|
|
79
118
|
getById(id: number): TaskRecord | null;
|
|
119
|
+
/** Internal fetch without the kind filter (guards and workorder paths). */
|
|
120
|
+
private getRowById;
|
|
80
121
|
/**
|
|
81
122
|
* Create a task. Idempotent under at-least-once delivery: a duplicate
|
|
82
123
|
* (source_channel, source_event_id) UPSERTS - the existing row gets the new
|
|
@@ -84,8 +125,55 @@ export declare class TaskLedger implements TaskSource {
|
|
|
84
125
|
*/
|
|
85
126
|
create(input: CreateTaskInput): TaskRecord;
|
|
86
127
|
update(id: number, patch: UpdateTaskInput): TaskRecord;
|
|
87
|
-
/**
|
|
128
|
+
/**
|
|
129
|
+
* Stable hash over ordered OWNER rows - the Phase-2 verifier's ledger
|
|
130
|
+
* snapshot. kind filter keeps concurrent system enqueues from shaking the
|
|
131
|
+
* hash mid-bracket (evidence-only signal, but noise is noise).
|
|
132
|
+
*/
|
|
88
133
|
payloadHash(): string;
|
|
134
|
+
/**
|
|
135
|
+
* Enqueue a workorder. Idempotent per occurrence key: an open (pending or
|
|
136
|
+
* in_progress) keyed row dedups; a terminal keyed row frees the slot (the
|
|
137
|
+
* unique index excludes terminal statuses) and a fresh row is inserted.
|
|
138
|
+
*/
|
|
139
|
+
enqueueWorkOrder(order: EnqueueWorkOrderInput): WorkOrderRecord;
|
|
140
|
+
/**
|
|
141
|
+
* Claim the next pending workorder: priority high>normal>low, then id ASC
|
|
142
|
+
* (plan D2/E2 - CASE mapping, never lexicographic on the TEXT enum).
|
|
143
|
+
* pending -> in_progress. Single serial consumer; transaction for atomicity.
|
|
144
|
+
*/
|
|
145
|
+
claimNextWorkOrder(): WorkOrderRecord | null;
|
|
146
|
+
/**
|
|
147
|
+
* Atomic fail-and-requeue (PR bot round): the failure mark and the
|
|
148
|
+
* replacement row commit together - a crash between the two would lose
|
|
149
|
+
* the retry (the old row terminal, the new one never inserted). The
|
|
150
|
+
* replacement can only be inserted AFTER the old row leaves the partial
|
|
151
|
+
* unique index, hence one transaction, not two calls.
|
|
152
|
+
*/
|
|
153
|
+
requeueWorkOrder(wo: WorkOrderRecord, reason: string): WorkOrderRecord;
|
|
154
|
+
completeWorkOrder(id: number): void;
|
|
155
|
+
failWorkOrder(id: number, reason: string): void;
|
|
156
|
+
countPendingWorkOrders(): number;
|
|
157
|
+
/** In-progress system rows at boot = crash artifacts (single serial consumer). */
|
|
158
|
+
listStaleClaims(): WorkOrderRecord[];
|
|
159
|
+
/**
|
|
160
|
+
* Boot cleanup (plan D3 + review N4): open system rows -> cancelled. A
|
|
161
|
+
* rollback is not a failure - excluded from failed counters/alarms; caller
|
|
162
|
+
* logs ONE summary line with the returned count. `onlyKinds` scopes the
|
|
163
|
+
* cancellation (shadow rollback cancels non-board orders only).
|
|
164
|
+
*/
|
|
165
|
+
cancelOpenWorkOrders(reason: string, onlyKinds?: WorkOrderKind[]): number;
|
|
166
|
+
/** Per-kind stats for the workorder_status surface. */
|
|
167
|
+
workOrderStats(): Array<{
|
|
168
|
+
workKind: WorkOrderKind;
|
|
169
|
+
lastRunAt: number | null;
|
|
170
|
+
lastStatus: TaskStatus | null;
|
|
171
|
+
failedCount: number;
|
|
172
|
+
lastFailureReason: string | null;
|
|
173
|
+
}>;
|
|
174
|
+
private getWorkOrderById;
|
|
175
|
+
private transitionWorkOrder;
|
|
176
|
+
private rowToWorkOrder;
|
|
89
177
|
/** contract_no_update: silence as a verifiable judgment, scoped to one reconcile run. */
|
|
90
178
|
recordNoUpdate(scope: string, reason: string): {
|
|
91
179
|
id: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-ledger.d.ts","sourceRoot":"","sources":["../../src/operator/task-ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEzE,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"task-ledger.d.ts","sourceRoot":"","sources":["../../src/operator/task-ledger.ts"],"names":[],"mapp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