@jungjaehoon/mama-os 0.48.4 → 0.49.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/dist/agent/agent-loop.d.ts +6 -7
- package/dist/agent/agent-loop.d.ts.map +1 -1
- package/dist/agent/agent-loop.js +93 -79
- 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 +0 -8
- package/dist/agent/code-act/host-bridge.js.map +1 -1
- package/dist/agent/codex-home.d.ts.map +1 -1
- package/dist/agent/codex-home.js +3 -1
- package/dist/agent/codex-home.js.map +1 -1
- package/dist/agent/gateway-tool-executor.d.ts +0 -16
- package/dist/agent/gateway-tool-executor.d.ts.map +1 -1
- package/dist/agent/gateway-tool-executor.js +0 -51
- package/dist/agent/gateway-tool-executor.js.map +1 -1
- package/dist/agent/gateway-tools.md +0 -1
- package/dist/agent/os-agent-capabilities.md +14 -34
- package/dist/agent/role-manager.d.ts.map +1 -1
- package/dist/agent/role-manager.js +6 -3
- package/dist/agent/role-manager.js.map +1 -1
- package/dist/agent/tool-registry.d.ts.map +1 -1
- package/dist/agent/tool-registry.js +0 -6
- package/dist/agent/tool-registry.js.map +1 -1
- package/dist/agent/types.d.ts +18 -6
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/api/graph-api-types.d.ts +0 -18
- package/dist/api/graph-api-types.d.ts.map +1 -1
- package/dist/api/graph-api.d.ts.map +1 -1
- package/dist/api/graph-api.js +9 -81
- package/dist/api/graph-api.js.map +1 -1
- package/dist/cli/commands/start.d.ts +7 -16
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +181 -188
- 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 +11 -4
- 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 +28 -11
- package/dist/cli/runtime/agent-loop-init.js.map +1 -1
- package/dist/cli/runtime/api-routes-init.d.ts +0 -2
- package/dist/cli/runtime/api-routes-init.d.ts.map +1 -1
- package/dist/cli/runtime/api-routes-init.js +9 -95
- package/dist/cli/runtime/api-routes-init.js.map +1 -1
- package/dist/cli/runtime/api-server-init.d.ts +2 -2
- package/dist/cli/runtime/api-server-init.d.ts.map +1 -1
- package/dist/cli/runtime/api-server-init.js +2 -2
- package/dist/cli/runtime/api-server-init.js.map +1 -1
- package/dist/cli/runtime/scheduler-init.d.ts +3 -4
- package/dist/cli/runtime/scheduler-init.d.ts.map +1 -1
- package/dist/cli/runtime/scheduler-init.js +6 -16
- package/dist/cli/runtime/scheduler-init.js.map +1 -1
- package/dist/cli/runtime/shutdown.d.ts +0 -1
- package/dist/cli/runtime/shutdown.d.ts.map +1 -1
- package/dist/cli/runtime/shutdown.js +1 -1
- package/dist/cli/runtime/shutdown.js.map +1 -1
- package/dist/cli/runtime/types.d.ts +0 -5
- package/dist/cli/runtime/types.d.ts.map +1 -1
- package/dist/concurrency/lane-manager.d.ts +1 -1
- package/dist/concurrency/lane-manager.d.ts.map +1 -1
- package/dist/concurrency/lane-manager.js +4 -2
- package/dist/concurrency/lane-manager.js.map +1 -1
- package/dist/concurrency/types.d.ts +4 -0
- package/dist/concurrency/types.d.ts.map +1 -1
- package/dist/concurrency/types.js.map +1 -1
- package/dist/envelope/types.d.ts +1 -1
- package/dist/envelope/types.d.ts.map +1 -1
- package/dist/envelope/types.js.map +1 -1
- package/dist/gateways/message-router.d.ts +13 -71
- package/dist/gateways/message-router.d.ts.map +1 -1
- package/dist/gateways/message-router.js +99 -489
- package/dist/gateways/message-router.js.map +1 -1
- package/dist/gateways/session-store.d.ts +3 -23
- package/dist/gateways/session-store.d.ts.map +1 -1
- package/dist/gateways/session-store.js +2 -64
- package/dist/gateways/session-store.js.map +1 -1
- package/dist/gateways/telegram-report-context-store.d.ts +4 -66
- package/dist/gateways/telegram-report-context-store.d.ts.map +1 -1
- package/dist/gateways/telegram-report-context-store.js +11 -235
- package/dist/gateways/telegram-report-context-store.js.map +1 -1
- package/dist/gateways/turn-contract.d.ts +7 -3
- package/dist/gateways/turn-contract.d.ts.map +1 -1
- package/dist/operator/operator-trigger-loop.d.ts +1 -12
- package/dist/operator/operator-trigger-loop.d.ts.map +1 -1
- package/dist/operator/operator-trigger-loop.js +6 -40
- package/dist/operator/operator-trigger-loop.js.map +1 -1
- package/dist/operator/owner-event-loop.d.ts +8 -7
- package/dist/operator/owner-event-loop.d.ts.map +1 -1
- package/dist/operator/owner-event-loop.js +7 -20
- package/dist/operator/owner-event-loop.js.map +1 -1
- package/dist/operator/owner-event-policy.d.ts.map +1 -1
- package/dist/operator/owner-event-policy.js +0 -2
- package/dist/operator/owner-event-policy.js.map +1 -1
- package/dist/operator/owner-event-prompt.d.ts +0 -2
- package/dist/operator/owner-event-prompt.d.ts.map +1 -1
- package/dist/operator/owner-event-prompt.js +1 -8
- package/dist/operator/owner-event-prompt.js.map +1 -1
- package/dist/operator/owner-runtime-journal.d.ts +21 -0
- package/dist/operator/owner-runtime-journal.d.ts.map +1 -0
- package/dist/operator/owner-runtime-journal.js +131 -0
- package/dist/operator/owner-runtime-journal.js.map +1 -0
- package/dist/operator/owner-runtime.d.ts +32 -0
- package/dist/operator/owner-runtime.d.ts.map +1 -0
- package/dist/operator/owner-runtime.js +31 -0
- package/dist/operator/owner-runtime.js.map +1 -0
- package/dist/operator/pending-report-store.d.ts +2 -2
- package/dist/operator/pending-report-store.d.ts.map +1 -1
- package/dist/operator/pending-report-store.js +4 -1
- package/dist/operator/pending-report-store.js.map +1 -1
- package/dist/operator/report-run.d.ts +7 -10
- package/dist/operator/report-run.d.ts.map +1 -1
- package/dist/operator/report-run.js +5 -26
- package/dist/operator/report-run.js.map +1 -1
- package/dist/operator/situation-report.d.ts +25 -6
- package/dist/operator/situation-report.d.ts.map +1 -1
- package/dist/operator/situation-report.js +25 -37
- package/dist/operator/situation-report.js.map +1 -1
- package/dist/operator/trigger-author.d.ts +0 -45
- package/dist/operator/trigger-author.d.ts.map +1 -1
- package/dist/operator/trigger-author.js +0 -122
- package/dist/operator/trigger-author.js.map +1 -1
- package/dist/operator/worker-run.d.ts +9 -23
- package/dist/operator/worker-run.d.ts.map +1 -1
- package/dist/operator/worker-run.js +18 -74
- package/dist/operator/worker-run.js.map +1 -1
- package/dist/operator/workorder-consumer.d.ts.map +1 -1
- package/dist/operator/workorder-consumer.js +7 -0
- package/dist/operator/workorder-consumer.js.map +1 -1
- package/dist/scheduler/cron-worker.d.ts +0 -3
- package/dist/scheduler/cron-worker.d.ts.map +1 -1
- package/dist/scheduler/cron-worker.js +2 -13
- package/dist/scheduler/cron-worker.js.map +1 -1
- package/dist/scheduler/heartbeat.d.ts +3 -1
- package/dist/scheduler/heartbeat.d.ts.map +1 -1
- package/dist/scheduler/heartbeat.js +13 -4
- package/dist/scheduler/heartbeat.js.map +1 -1
- package/dist/validation/types.d.ts +1 -1
- package/dist/validation/types.js +1 -1
- package/package.json +1 -1
- package/dist/cli/runtime/memory-agent-init.d.ts +0 -37
- package/dist/cli/runtime/memory-agent-init.d.ts.map +0 -1
- package/dist/cli/runtime/memory-agent-init.js +0 -202
- package/dist/cli/runtime/memory-agent-init.js.map +0 -1
- package/dist/gateways/owner-report-inbox.d.ts +0 -40
- package/dist/gateways/owner-report-inbox.d.ts.map +0 -1
- package/dist/gateways/owner-report-inbox.js +0 -128
- package/dist/gateways/owner-report-inbox.js.map +0 -1
- package/dist/multi-agent/memory-agent-persona.d.ts +0 -11
- package/dist/multi-agent/memory-agent-persona.d.ts.map +0 -1
- package/dist/multi-agent/memory-agent-persona.js +0 -175
- package/dist/multi-agent/memory-agent-persona.js.map +0 -1
- package/dist/operator/report-context.d.ts +0 -184
- package/dist/operator/report-context.d.ts.map +0 -1
- package/dist/operator/report-context.js +0 -1052
- package/dist/operator/report-context.js.map +0 -1
|
@@ -47,10 +47,12 @@ export declare class AgentLoop {
|
|
|
47
47
|
*
|
|
48
48
|
* Claude's persistent CLI cannot narrow native or MCP tools per turn, so a
|
|
49
49
|
* public lane may run only when both surfaces were disabled at construction.
|
|
50
|
-
* Codex
|
|
51
|
-
*
|
|
50
|
+
* Codex native multi-agent and Claude built-ins are construction-wide, so
|
|
51
|
+
* public lanes must use another tool-free runtime. Cline can gate spawn per role.
|
|
52
52
|
*/
|
|
53
53
|
readonly childRuntimeToolCapable: boolean;
|
|
54
|
+
readonly probesDurableSession: boolean;
|
|
55
|
+
readonly ownerRecoveryJournalEnabled: boolean;
|
|
54
56
|
private readonly agent;
|
|
55
57
|
private readonly persistentCLI;
|
|
56
58
|
private readonly mcpExecutor;
|
|
@@ -80,6 +82,7 @@ export declare class AgentLoop {
|
|
|
80
82
|
private readonly clineNativePolicyConfigured;
|
|
81
83
|
private readonly clineAllowSpawnAgent;
|
|
82
84
|
private readonly clineAllowAgentTeams;
|
|
85
|
+
private readonly ownerRuntimeJournal;
|
|
83
86
|
constructor(_oauthManager: OAuthManager | null, options?: AgentLoopOptions, _clientOptions?: ClaudeClientOptions, executorOptions?: GatewayToolExecutorOptions);
|
|
84
87
|
setContextCompileService(service: GatewayToolExecutorOptions['contextCompileService']): void;
|
|
85
88
|
/**
|
|
@@ -119,7 +122,7 @@ export declare class AgentLoop {
|
|
|
119
122
|
*/
|
|
120
123
|
setSessionsDb(db: import('../sqlite.js').default): void;
|
|
121
124
|
/**
|
|
122
|
-
* Set validation service for
|
|
125
|
+
* Set validation service for agent validation flows.
|
|
123
126
|
*/
|
|
124
127
|
setValidationService(svc: import('../validation/session-service.js').ValidationSessionService): void;
|
|
125
128
|
/**
|
|
@@ -142,10 +145,6 @@ export declare class AgentLoop {
|
|
|
142
145
|
compiledAt: string;
|
|
143
146
|
confidence: string;
|
|
144
147
|
}>) => void): void;
|
|
145
|
-
/**
|
|
146
|
-
* Set AgentProcessManager for delegate tool (multi-agent delegation)
|
|
147
|
-
*/
|
|
148
|
-
setAgentProcessManager(pm: import('../multi-agent/agent-process-manager.js').AgentProcessManager): void;
|
|
149
148
|
/**
|
|
150
149
|
* Set AgentEventBus for agent_notices tool
|
|
151
150
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-loop.d.ts","sourceRoot":"","sources":["../../src/agent/agent-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAqBH,OAAO,EAAE,mBAAmB,EAA+B,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"agent-loop.d.ts","sourceRoot":"","sources":["../../src/agent/agent-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAqBH,OAAO,EAAE,mBAAmB,EAA+B,MAAM,4BAA4B,CAAC;AAmB9F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIrD,OAAO,KAAK,EAEV,YAAY,EAIZ,cAAc,EACd,gBAAgB,EAChB,eAAe,EAKf,mBAAmB,EACnB,0BAA0B,EAG1B,YAAY,EAGZ,2BAA2B,EAM5B,MAAM,YAAY,CAAC;AA+DpB,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAKtD,CAAC;AAmFF;;;;;;;;;;;;;GAaG;AACH;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAyEnE;AAED,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,UAAQ,GAAG,MAAM,CAwB7E;AAED,wBAAgB,wBAAwB,CAAC,OAAO,UAAQ,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM,CA+CxF;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAO5E;AAgKD,MAAM,MAAM,yBAAyB,GAAG,2BAA2B,CAAC;AAEpE,wB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IAAI;IAIP;;OAEG;IACH,gBAAgB,CAAC,QAAQ,EAAE,OAAO,mCAAmC,EAAE,aAAa,GAAG,IAAI;IAI3F;;;;;;;;;;;;OAYG;IACG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;IAwB/E;;;;;;;;;OASG;IACG,cAAc,CAClB,OAAO,EAAE,YAAY,EAAE,EACvB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,eAAe,CAAC;IAkB3B;;OAEG;YACW,sBAAsB;IA0wCpC,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,0BAA0B;YAapB,oBAAoB;IAMlC,OAAO,CAAC,kBAAkB;IA+B1B;;OAEG;YACW,YAAY;IA8J1B;;;;;;OAMG;YACW,sBAAsB;IAiDpC;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IA0B9B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAoB1B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAQ5B,OAAO,CAAC,sBAAsB;IAO9B;;OAEG;IACH;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,mBAAmB;IAuB3B;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAgF7B;;OAEG;IACH,MAAM,CAAC,kBAAkB,IAAI,cAAc,EAAE;IAI7C;;OAEG;IACH,MAAM,CAAC,sBAAsB,IAAI,MAAM;IAIvC;;OAEG;IACH,OAAO,CAAC,OAAO,CAAS;IAElB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAsB5B"}
|
package/dist/agent/agent-loop.js
CHANGED
|
@@ -67,6 +67,7 @@ const index_js_1 = require("./code-act/index.js");
|
|
|
67
67
|
const index_js_2 = require("../concurrency/index.js");
|
|
68
68
|
const session_pool_js_1 = require("./session-pool.js");
|
|
69
69
|
const principal_js_1 = require("../gateways/principal.js");
|
|
70
|
+
const owner_runtime_js_1 = require("../operator/owner-runtime.js");
|
|
70
71
|
const os_1 = require("os");
|
|
71
72
|
const path_1 = require("path");
|
|
72
73
|
const crypto_1 = require("crypto");
|
|
@@ -104,16 +105,13 @@ const DEFAULT_PRIVATE_CONNECTOR_POLICY = (0, private_connector_policy_js_1.resol
|
|
|
104
105
|
config: {},
|
|
105
106
|
enabledNames: [],
|
|
106
107
|
});
|
|
107
|
-
// Sources without an entry stay on their per-session lane.
|
|
108
|
-
//
|
|
109
|
-
//
|
|
108
|
+
// Sources without an entry stay on their per-session lane. Every owner stimulus
|
|
109
|
+
// uses owner:runtime, so its session lane serializes chat, events, reports,
|
|
110
|
+
// maintenance, and heartbeat before any global-lane choice is considered.
|
|
110
111
|
exports.SOURCE_GLOBAL_LANES = {
|
|
111
112
|
viewer: 'viewer',
|
|
112
113
|
system: 'system',
|
|
113
|
-
//
|
|
114
|
-
// itself but must not block owner chat on 'main': a 260s full report was
|
|
115
|
-
// measurably blocking chat replies before this lane existed. Safe only
|
|
116
|
-
// because per-run state is scoped (RunScope), not instance state.
|
|
114
|
+
// Non-owner trigger authoring/review still uses the operator global lane.
|
|
117
115
|
operator: 'operator',
|
|
118
116
|
};
|
|
119
117
|
function applyTemporalCodeActBreakerState(runScope, state) {
|
|
@@ -314,11 +312,6 @@ function loadComposedSystemPrompt(verbose = false, context) {
|
|
|
314
312
|
if (context) {
|
|
315
313
|
layers.push((0, context_prompt_builder_js_1.buildMinimalContext)(context));
|
|
316
314
|
}
|
|
317
|
-
// Load backend-specific AGENTS.md (e.g., AGENTS.claude.md, AGENTS.codex.md)
|
|
318
|
-
const backendAgentsMd = loadBackendAgentsMd(context?.backend, verbose);
|
|
319
|
-
if (backendAgentsMd) {
|
|
320
|
-
layers.push(backendAgentsMd);
|
|
321
|
-
}
|
|
322
315
|
// Load CLAUDE.md (base instructions)
|
|
323
316
|
const claudeMd = loadSystemPrompt(verbose);
|
|
324
317
|
layers.push(claudeMd);
|
|
@@ -425,6 +418,18 @@ function combineCodeActSessionPolicyFingerprint(callerFingerprint, policy) {
|
|
|
425
418
|
codeActPolicy: policy.fingerprintPayload,
|
|
426
419
|
});
|
|
427
420
|
}
|
|
421
|
+
function ownerRuntimeSessionPolicyFingerprint(role, model) {
|
|
422
|
+
return JSON.stringify({
|
|
423
|
+
version: 1,
|
|
424
|
+
subject: owner_runtime_js_1.OWNER_RUNTIME_SESSION_KEY,
|
|
425
|
+
model: model ?? null,
|
|
426
|
+
allowedTools: [...(role?.allowedTools ?? [])].sort(),
|
|
427
|
+
blockedTools: [...(role?.blockedTools ?? [])].sort(),
|
|
428
|
+
allowedPaths: [...(role?.allowedPaths ?? [])].sort(),
|
|
429
|
+
systemControl: role?.systemControl === true,
|
|
430
|
+
sensitiveAccess: role?.sensitiveAccess === true,
|
|
431
|
+
});
|
|
432
|
+
}
|
|
428
433
|
function roleAllowsOuterCodeAct(role, disallowedTools) {
|
|
429
434
|
if (!role) {
|
|
430
435
|
return false;
|
|
@@ -510,10 +515,12 @@ class AgentLoop {
|
|
|
510
515
|
*
|
|
511
516
|
* Claude's persistent CLI cannot narrow native or MCP tools per turn, so a
|
|
512
517
|
* public lane may run only when both surfaces were disabled at construction.
|
|
513
|
-
* Codex
|
|
514
|
-
*
|
|
518
|
+
* Codex native multi-agent and Claude built-ins are construction-wide, so
|
|
519
|
+
* public lanes must use another tool-free runtime. Cline can gate spawn per role.
|
|
515
520
|
*/
|
|
516
521
|
childRuntimeToolCapable;
|
|
522
|
+
probesDurableSession;
|
|
523
|
+
ownerRecoveryJournalEnabled;
|
|
517
524
|
agent;
|
|
518
525
|
persistentCLI = null;
|
|
519
526
|
mcpExecutor;
|
|
@@ -548,6 +555,7 @@ class AgentLoop {
|
|
|
548
555
|
clineNativePolicyConfigured;
|
|
549
556
|
clineAllowSpawnAgent;
|
|
550
557
|
clineAllowAgentTeams;
|
|
558
|
+
ownerRuntimeJournal;
|
|
551
559
|
constructor(_oauthManager, options = {}, _clientOptions, executorOptions) {
|
|
552
560
|
// Initialize tools config (hybrid Gateway/MCP routing)
|
|
553
561
|
this.toolsConfig = {
|
|
@@ -586,6 +594,8 @@ class AgentLoop {
|
|
|
586
594
|
options.clineNativeDisallowedTools !== undefined;
|
|
587
595
|
this.clineAllowSpawnAgent = options.clineAllowSpawnAgent ?? false;
|
|
588
596
|
this.clineAllowAgentTeams = options.clineAllowAgentTeams ?? false;
|
|
597
|
+
this.ownerRuntimeJournal = options.ownerRuntimeJournal;
|
|
598
|
+
this.ownerRecoveryJournalEnabled = this.ownerRuntimeJournal !== undefined;
|
|
589
599
|
if (useGatewayMode && useMCPMode) {
|
|
590
600
|
logger.debug('🔀 Hybrid mode: Gateway + MCP tools enabled');
|
|
591
601
|
}
|
|
@@ -646,6 +656,7 @@ class AgentLoop {
|
|
|
646
656
|
];
|
|
647
657
|
}
|
|
648
658
|
const backend = options.backend ?? 'claude';
|
|
659
|
+
this.probesDurableSession = backend === 'codex';
|
|
649
660
|
if (this.useCodeAct && options.systemPrompt) {
|
|
650
661
|
promptLayers = [
|
|
651
662
|
{
|
|
@@ -655,11 +666,6 @@ class AgentLoop {
|
|
|
655
666
|
},
|
|
656
667
|
];
|
|
657
668
|
}
|
|
658
|
-
// Load backend-specific AGENTS.md (e.g., AGENTS.claude.md, AGENTS.codex.md)
|
|
659
|
-
const backendAgentsMd = loadBackendAgentsMd(backend);
|
|
660
|
-
if (backendAgentsMd) {
|
|
661
|
-
promptLayers.push({ name: 'backendAgents', content: backendAgentsMd, priority: 2 });
|
|
662
|
-
}
|
|
663
669
|
if (this.isGatewayMode) {
|
|
664
670
|
if (this.useCodeAct &&
|
|
665
671
|
roleAllowsOuterCodeAct(options.agentContext?.role, this.disallowedTools)) {
|
|
@@ -717,7 +723,7 @@ class AgentLoop {
|
|
|
717
723
|
// Choose backend (default: claude)
|
|
718
724
|
this.backend = backend;
|
|
719
725
|
this.childRuntimeToolCapable =
|
|
720
|
-
backend === 'claude' && (useMCPMode || options.builtinTools !== '');
|
|
726
|
+
backend === 'codex' || (backend === 'claude' && (useMCPMode || options.builtinTools !== ''));
|
|
721
727
|
if (this.backend === 'codex') {
|
|
722
728
|
// Codex app-server mode
|
|
723
729
|
const workspaceDir = options.codexCwd ?? (0, path_1.join)((0, os_1.homedir)(), '.mama', 'workspace');
|
|
@@ -911,7 +917,7 @@ class AgentLoop {
|
|
|
911
917
|
this.mcpExecutor.setSessionsDb(db);
|
|
912
918
|
}
|
|
913
919
|
/**
|
|
914
|
-
* Set validation service for
|
|
920
|
+
* Set validation service for agent validation flows.
|
|
915
921
|
*/
|
|
916
922
|
setValidationService(svc) {
|
|
917
923
|
this.mcpExecutor.setValidationService(svc);
|
|
@@ -934,13 +940,6 @@ class AgentLoop {
|
|
|
934
940
|
setWikiPublisher(fn) {
|
|
935
941
|
this.mcpExecutor.setWikiPublisher(fn);
|
|
936
942
|
}
|
|
937
|
-
/**
|
|
938
|
-
* Set AgentProcessManager for delegate tool (multi-agent delegation)
|
|
939
|
-
*/
|
|
940
|
-
setAgentProcessManager(pm) {
|
|
941
|
-
pm.setGatewayToolExecutor(this.mcpExecutor);
|
|
942
|
-
this.mcpExecutor.setAgentProcessManager(pm);
|
|
943
|
-
}
|
|
944
943
|
/**
|
|
945
944
|
* Set AgentEventBus for agent_notices tool
|
|
946
945
|
*/
|
|
@@ -970,7 +969,7 @@ class AgentLoop {
|
|
|
970
969
|
// Use lane-based queueing if enabled
|
|
971
970
|
if (this.useLanes) {
|
|
972
971
|
const globalLane = this.resolveGlobalLaneForSession(sessionKey);
|
|
973
|
-
return this.laneManager.enqueueWithSession(sessionKey, () => this.runWithContentInternal(content, options), globalLane);
|
|
972
|
+
return this.laneManager.enqueueWithSession(sessionKey, () => this.runWithContentInternal(content, options), globalLane, { priority: options?.lanePriority ?? 0 });
|
|
974
973
|
}
|
|
975
974
|
// Direct execution for backward compatibility
|
|
976
975
|
return this.runWithContentInternal(content, options);
|
|
@@ -990,7 +989,7 @@ class AgentLoop {
|
|
|
990
989
|
// Use lane-based queueing if enabled
|
|
991
990
|
if (this.useLanes) {
|
|
992
991
|
const globalLane = this.resolveGlobalLaneForSession(sessionKey);
|
|
993
|
-
return this.laneManager.enqueueWithSession(sessionKey, () => this.runWithContentInternal(content, options), globalLane);
|
|
992
|
+
return this.laneManager.enqueueWithSession(sessionKey, () => this.runWithContentInternal(content, options), globalLane, { priority: options?.lanePriority ?? 0 });
|
|
994
993
|
}
|
|
995
994
|
// Direct execution for backward compatibility
|
|
996
995
|
return this.runWithContentInternal(content, options);
|
|
@@ -1016,6 +1015,8 @@ class AgentLoop {
|
|
|
1016
1015
|
...(0, temporal_code_act_breaker_js_1.createTemporalCodeActBreakerState)(),
|
|
1017
1016
|
};
|
|
1018
1017
|
const history = [];
|
|
1018
|
+
const ownerJournalPrompt = options?.ownerJournalPrompt ??
|
|
1019
|
+
content.map((block) => (block.type === 'text' ? block.text : `[${block.type}]`)).join('\n');
|
|
1019
1020
|
const totalUsage = { input_tokens: 0, output_tokens: 0 };
|
|
1020
1021
|
// Budget accounting is separate from totalUsage (a published field): it includes cache
|
|
1021
1022
|
// creation and cache reads, which are the bulk of a re-sent context and the cost being
|
|
@@ -1080,24 +1081,36 @@ class AgentLoop {
|
|
|
1080
1081
|
...cline_native_tool_policy_js_1.CLINE_NATIVE_GUARD_BYPASS,
|
|
1081
1082
|
]),
|
|
1082
1083
|
];
|
|
1083
|
-
const
|
|
1084
|
-
|
|
1085
|
-
const
|
|
1084
|
+
const clineDelegationGranted = clineRole?.allowedTools.some((pattern) => pattern === '*' || pattern === 'native_subagent') ??
|
|
1085
|
+
false;
|
|
1086
|
+
const clineDelegationBlocked = clineRole?.blockedTools?.some((pattern) => pattern === '*' || pattern === 'native_subagent') ?? false;
|
|
1087
|
+
const clineAllowSpawnAgent = this.clineAllowSpawnAgent && clineDelegationGranted && !clineDelegationBlocked;
|
|
1088
|
+
const clineAllowAgentTeams = this.clineAllowAgentTeams && clineDelegationGranted && !clineDelegationBlocked;
|
|
1089
|
+
const ownerRuntime = channelKey === owner_runtime_js_1.OWNER_RUNTIME_SESSION_KEY;
|
|
1090
|
+
const sessionPolicyRole = ownerRuntime
|
|
1091
|
+
? (options?.sessionPolicyRole ?? options?.agentContext?.role)
|
|
1092
|
+
: options?.agentContext?.role;
|
|
1086
1093
|
const codeActPolicy = this.useCodeAct
|
|
1087
1094
|
? (0, index_js_1.projectCodeActToolPolicy)({
|
|
1088
|
-
tier: runScope.tier,
|
|
1089
|
-
roleName: options?.agentContext?.roleName,
|
|
1090
|
-
role:
|
|
1095
|
+
tier: ownerRuntime ? 1 : runScope.tier,
|
|
1096
|
+
roleName: ownerRuntime ? 'owner_console' : options?.agentContext?.roleName,
|
|
1097
|
+
role: sessionPolicyRole,
|
|
1091
1098
|
disallowedTools: this.disallowedTools,
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1099
|
+
...(ownerRuntime
|
|
1100
|
+
? {}
|
|
1101
|
+
: {
|
|
1102
|
+
envelopeDestinationKinds: options?.envelope?.scope.allowed_destinations.map((destination) => destination.kind) ?? [],
|
|
1103
|
+
envelopeRawConnectors: options?.envelope?.scope.raw_connectors ?? [],
|
|
1104
|
+
}),
|
|
1095
1105
|
})
|
|
1096
1106
|
: undefined;
|
|
1097
1107
|
const outerCodeActAllowed = this.useCodeAct && roleAllowsOuterCodeAct(options?.agentContext?.role, this.disallowedTools);
|
|
1108
|
+
const ownerPolicyFingerprint = ownerRuntime
|
|
1109
|
+
? ownerRuntimeSessionPolicyFingerprint(sessionPolicyRole, options?.model)
|
|
1110
|
+
: undefined;
|
|
1098
1111
|
const effectiveSessionPolicyFingerprint = isDurableRuntime && codeActPolicy
|
|
1099
|
-
? combineCodeActSessionPolicyFingerprint(options?.sessionPolicyFingerprint, codeActPolicy)
|
|
1100
|
-
: options?.sessionPolicyFingerprint;
|
|
1112
|
+
? combineCodeActSessionPolicyFingerprint(ownerPolicyFingerprint ?? options?.sessionPolicyFingerprint, codeActPolicy)
|
|
1113
|
+
: (ownerPolicyFingerprint ?? options?.sessionPolicyFingerprint);
|
|
1101
1114
|
let resolvedCliSessionId = options?.cliSessionId ?? null;
|
|
1102
1115
|
const sessionLabel = (isNew) => {
|
|
1103
1116
|
if (isDurableRuntime) {
|
|
@@ -1240,7 +1253,7 @@ class AgentLoop {
|
|
|
1240
1253
|
},
|
|
1241
1254
|
}
|
|
1242
1255
|
: undefined;
|
|
1243
|
-
const prepareSystemPrompt = (requestedSystemPrompt, isResumingSession,
|
|
1256
|
+
const prepareSystemPrompt = (requestedSystemPrompt, isResumingSession, includeOwnerRecovery = false) => {
|
|
1244
1257
|
let baseSystemPrompt = requestedSystemPrompt ?? this.defaultSystemPrompt;
|
|
1245
1258
|
let gatewayToolsPrompt = '';
|
|
1246
1259
|
if (this.isGatewayMode && this.useCodeAct) {
|
|
@@ -1273,25 +1286,15 @@ class AgentLoop {
|
|
|
1273
1286
|
}
|
|
1274
1287
|
}
|
|
1275
1288
|
}
|
|
1276
|
-
const
|
|
1277
|
-
?
|
|
1278
|
-
:
|
|
1279
|
-
const
|
|
1280
|
-
|
|
1281
|
-
: baseWithOwnerReportHistory;
|
|
1289
|
+
const ownerRecovery = includeOwnerRecovery && ownerRuntime && this.ownerRuntimeJournal
|
|
1290
|
+
? this.ownerRuntimeJournal.recoveryBlock()
|
|
1291
|
+
: '';
|
|
1292
|
+
const joinLayers = (base, tools, recovery) => [base, tools, recovery].filter(Boolean).join('\n\n---\n\n');
|
|
1293
|
+
const fullPrompt = joinLayers(baseSystemPrompt, gatewayToolsPrompt, ownerRecovery);
|
|
1282
1294
|
// Monitor and enforce prompt size
|
|
1283
1295
|
const monitor = new prompt_size_monitor_js_1.PromptSizeMonitor();
|
|
1284
1296
|
const runLayers = [
|
|
1285
1297
|
{ name: 'systemPrompt', content: baseSystemPrompt, priority: 1 },
|
|
1286
|
-
...(ownerReportHistoryPrompt
|
|
1287
|
-
? [
|
|
1288
|
-
{
|
|
1289
|
-
name: 'ownerReportHistory',
|
|
1290
|
-
content: ownerReportHistoryPrompt,
|
|
1291
|
-
priority: 3,
|
|
1292
|
-
},
|
|
1293
|
-
]
|
|
1294
|
-
: []),
|
|
1295
1298
|
...(gatewayToolsPrompt
|
|
1296
1299
|
? [
|
|
1297
1300
|
{
|
|
@@ -1307,6 +1310,9 @@ class AgentLoop {
|
|
|
1307
1310
|
},
|
|
1308
1311
|
]
|
|
1309
1312
|
: []),
|
|
1313
|
+
...(ownerRecovery
|
|
1314
|
+
? [{ name: 'ownerRecovery', content: ownerRecovery, priority: 3 }]
|
|
1315
|
+
: []),
|
|
1310
1316
|
];
|
|
1311
1317
|
const checkResult = monitor.check(runLayers);
|
|
1312
1318
|
if (checkResult.warning) {
|
|
@@ -1314,33 +1320,22 @@ class AgentLoop {
|
|
|
1314
1320
|
}
|
|
1315
1321
|
let effectivePrompt = fullPrompt;
|
|
1316
1322
|
if (!checkResult.withinBudget) {
|
|
1317
|
-
const
|
|
1318
|
-
|
|
1319
|
-
: runLayers;
|
|
1320
|
-
const { layers: trimmed, result: enforceResult } = monitor.enforce(boundedLayers);
|
|
1321
|
-
const truncatedLayers = [
|
|
1322
|
-
...(ownerReportHistoryPrompt ? ['ownerReportHistory'] : []),
|
|
1323
|
-
...enforceResult.truncatedLayers,
|
|
1324
|
-
];
|
|
1323
|
+
const { layers: trimmed, result: enforceResult } = monitor.enforce(runLayers);
|
|
1324
|
+
const truncatedLayers = enforceResult.truncatedLayers;
|
|
1325
1325
|
if (truncatedLayers.length > 0) {
|
|
1326
1326
|
console.warn(`[AgentLoop] Truncated layers: ${truncatedLayers.join(', ')}`);
|
|
1327
1327
|
}
|
|
1328
1328
|
const tBase = trimmed.find((l) => l.name === 'systemPrompt')?.content || baseSystemPrompt;
|
|
1329
|
-
const tOwnerReportHistory = trimmed.find((l) => l.name === 'ownerReportHistory')?.content || '';
|
|
1330
1329
|
const tTools = trimmed.find((l) => l.name === 'gatewayTools')?.content || '';
|
|
1331
|
-
const
|
|
1332
|
-
|
|
1333
|
-
: tBase;
|
|
1334
|
-
effectivePrompt = tTools
|
|
1335
|
-
? `${tBaseWithOwnerReportHistory}\n\n---\n\n${tTools}`
|
|
1336
|
-
: tBaseWithOwnerReportHistory;
|
|
1330
|
+
const tRecovery = trimmed.find((l) => l.name === 'ownerRecovery')?.content || '';
|
|
1331
|
+
effectivePrompt = joinLayers(tBase, tTools, tRecovery);
|
|
1337
1332
|
logger.debug(`[AgentLoop] System prompt truncated: ${fullPrompt.length} → ${effectivePrompt.length} chars`);
|
|
1338
1333
|
}
|
|
1339
1334
|
logger.debug(`[AgentLoop] Prepared systemPrompt for this call: ${effectivePrompt.length} chars ` +
|
|
1340
|
-
`(base: ${baseSystemPrompt.length},
|
|
1341
|
-
`tools: ${gatewayToolsPrompt.length})`);
|
|
1335
|
+
`(base: ${baseSystemPrompt.length}, tools: ${gatewayToolsPrompt.length}, recovery: ${ownerRecovery.length})`);
|
|
1342
1336
|
return effectivePrompt;
|
|
1343
1337
|
};
|
|
1338
|
+
const includeInitialOwnerRecovery = ownerRuntime && sessionIsNew && options?.resumeSession !== true;
|
|
1344
1339
|
let perCallSystemPrompt;
|
|
1345
1340
|
if (isCline && this.isGatewayMode && this.useCodeAct && !sessionIsNew) {
|
|
1346
1341
|
// TG-05: a compatible Cline Hub session ignores the per-call system prompt.
|
|
@@ -1349,10 +1344,12 @@ class AgentLoop {
|
|
|
1349
1344
|
perCallSystemPrompt = options?.systemPrompt ?? this.defaultSystemPrompt;
|
|
1350
1345
|
}
|
|
1351
1346
|
else if (options?.systemPrompt ||
|
|
1352
|
-
options?.ownerReportHistoryPrompt ||
|
|
1353
1347
|
options?.gatewayToolsPrompt !== undefined ||
|
|
1354
1348
|
(this.isGatewayMode && this.useCodeAct)) {
|
|
1355
|
-
perCallSystemPrompt = prepareSystemPrompt(options?.systemPrompt, options?.resumeSession === true,
|
|
1349
|
+
perCallSystemPrompt = prepareSystemPrompt(options?.systemPrompt, options?.resumeSession === true, includeInitialOwnerRecovery);
|
|
1350
|
+
}
|
|
1351
|
+
else if (includeInitialOwnerRecovery) {
|
|
1352
|
+
perCallSystemPrompt = prepareSystemPrompt(undefined, false, true);
|
|
1356
1353
|
}
|
|
1357
1354
|
else {
|
|
1358
1355
|
perCallSystemPrompt = this.defaultSystemPrompt;
|
|
@@ -1367,7 +1364,7 @@ class AgentLoop {
|
|
|
1367
1364
|
// invokes only inside the resume branch; a live thread never pays for it.
|
|
1368
1365
|
const freshSystemPromptBuilder = options?.freshSessionSystemPrompt;
|
|
1369
1366
|
const resumeInstructions = isDurableRuntime && freshSystemPromptBuilder
|
|
1370
|
-
? async () => prepareSystemPrompt(await freshSystemPromptBuilder(), false,
|
|
1367
|
+
? async () => prepareSystemPrompt(await freshSystemPromptBuilder(), false, true)
|
|
1371
1368
|
: undefined;
|
|
1372
1369
|
// Reset StopContinuation state for this channel to prevent leaking
|
|
1373
1370
|
// retry counts from previous invocations
|
|
@@ -1523,7 +1520,7 @@ class AgentLoop {
|
|
|
1523
1520
|
provisionalDurableSessionId = newSessionId;
|
|
1524
1521
|
try {
|
|
1525
1522
|
if (options?.freshSessionSystemPrompt) {
|
|
1526
|
-
requestSystemPrompt = prepareSystemPrompt(await options.freshSessionSystemPrompt(), false,
|
|
1523
|
+
requestSystemPrompt = prepareSystemPrompt(await options.freshSessionSystemPrompt(), false, true);
|
|
1527
1524
|
}
|
|
1528
1525
|
}
|
|
1529
1526
|
catch (rebuildError) {
|
|
@@ -1667,7 +1664,7 @@ class AgentLoop {
|
|
|
1667
1664
|
// its own final error, never the mismatch that triggered it.
|
|
1668
1665
|
attemptReportedError = undefined;
|
|
1669
1666
|
if (options?.freshSessionSystemPrompt) {
|
|
1670
|
-
resetSystemPrompt = prepareSystemPrompt(await options.freshSessionSystemPrompt(), false,
|
|
1667
|
+
resetSystemPrompt = prepareSystemPrompt(await options.freshSessionSystemPrompt(), false, true);
|
|
1671
1668
|
}
|
|
1672
1669
|
piResult = await this.agent.prompt(promptText, callbacks, {
|
|
1673
1670
|
model: options?.model,
|
|
@@ -2002,6 +1999,23 @@ class AgentLoop {
|
|
|
2002
1999
|
result.modelRunProvenance = 'commit_failed';
|
|
2003
2000
|
logger.error(`Model run ${ownedModelRunId} may remain uncommitted; provenance reported as commit_failed`);
|
|
2004
2001
|
}
|
|
2002
|
+
if (ownerRuntime && this.ownerRuntimeJournal && finalResponse.trim()) {
|
|
2003
|
+
try {
|
|
2004
|
+
this.ownerRuntimeJournal.append({
|
|
2005
|
+
trust: options?.ownerJournalTrust ?? 'untrusted',
|
|
2006
|
+
source: options?.source ?? 'owner',
|
|
2007
|
+
channelId: options?.channelId ?? owner_runtime_js_1.OWNER_RUNTIME_SESSION_KEY,
|
|
2008
|
+
prompt: ownerJournalPrompt,
|
|
2009
|
+
response: finalResponse,
|
|
2010
|
+
...(options?.sourceMessageRef ? { sourceMessageRef: options.sourceMessageRef } : {}),
|
|
2011
|
+
committedAt: new Date().toISOString(),
|
|
2012
|
+
});
|
|
2013
|
+
}
|
|
2014
|
+
catch (journalError) {
|
|
2015
|
+
result.ownerJournalProvenance = 'commit_failed';
|
|
2016
|
+
logger.warn(`Owner runtime journal append failed: ${journalError instanceof Error ? journalError.message : String(journalError)}`);
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2005
2019
|
return result;
|
|
2006
2020
|
}
|
|
2007
2021
|
catch (error) {
|