@jungjaehoon/mama-os 0.32.0 → 0.32.2
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 +8 -0
- package/README.md +15 -13
- package/dist/agent/agent-loop.d.ts +10 -1
- package/dist/agent/agent-loop.d.ts.map +1 -1
- package/dist/agent/agent-loop.js +221 -103
- package/dist/agent/agent-loop.js.map +1 -1
- package/dist/agent/backend-model-policy.d.ts +9 -0
- package/dist/agent/backend-model-policy.d.ts.map +1 -0
- package/dist/agent/backend-model-policy.js +21 -0
- package/dist/agent/backend-model-policy.js.map +1 -0
- package/dist/agent/backend-model-runner-factory.d.ts +27 -0
- package/dist/agent/backend-model-runner-factory.d.ts.map +1 -0
- package/dist/agent/backend-model-runner-factory.js +85 -0
- package/dist/agent/backend-model-runner-factory.js.map +1 -0
- package/dist/agent/cline-cli-adapter.d.ts +124 -0
- package/dist/agent/cline-cli-adapter.d.ts.map +1 -0
- package/dist/agent/cline-cli-adapter.js +1040 -0
- package/dist/agent/cline-cli-adapter.js.map +1 -0
- package/dist/agent/cline-native-tool-policy.d.ts +3 -0
- package/dist/agent/cline-native-tool-policy.d.ts.map +1 -0
- package/dist/agent/cline-native-tool-policy.js +50 -0
- package/dist/agent/cline-native-tool-policy.js.map +1 -0
- package/dist/agent/code-act/constants.d.ts +1 -1
- package/dist/agent/code-act/constants.d.ts.map +1 -1
- package/dist/agent/code-act/constants.js +13 -1
- package/dist/agent/code-act/constants.js.map +1 -1
- package/dist/agent/code-act/host-bridge.d.ts.map +1 -1
- package/dist/agent/code-act/host-bridge.js +35 -74
- package/dist/agent/code-act/host-bridge.js.map +1 -1
- package/dist/agent/codex-app-server-process.d.ts +5 -0
- package/dist/agent/codex-app-server-process.d.ts.map +1 -1
- package/dist/agent/codex-app-server-process.js +30 -0
- package/dist/agent/codex-app-server-process.js.map +1 -1
- package/dist/agent/codex-auxiliary-tools.d.ts +17 -0
- package/dist/agent/codex-auxiliary-tools.d.ts.map +1 -0
- package/dist/agent/codex-auxiliary-tools.js +267 -0
- package/dist/agent/codex-auxiliary-tools.js.map +1 -0
- package/dist/agent/codex-home.d.ts.map +1 -1
- package/dist/agent/codex-home.js +1 -0
- package/dist/agent/codex-home.js.map +1 -1
- package/dist/agent/gateway-tool-catalog.d.ts +14 -0
- package/dist/agent/gateway-tool-catalog.d.ts.map +1 -0
- package/dist/agent/gateway-tool-catalog.js +41 -0
- package/dist/agent/gateway-tool-catalog.js.map +1 -0
- package/dist/agent/gateway-tool-executor.d.ts +12 -1
- package/dist/agent/gateway-tool-executor.d.ts.map +1 -1
- package/dist/agent/gateway-tool-executor.js +149 -15
- package/dist/agent/gateway-tool-executor.js.map +1 -1
- package/dist/agent/gateway-tools.md +5 -7
- package/dist/agent/managed-agent-runtime-sync.d.ts.map +1 -1
- package/dist/agent/managed-agent-runtime-sync.js +17 -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 +11 -1
- package/dist/agent/model-runner.d.ts.map +1 -1
- package/dist/agent/model-runner.js +12 -1
- package/dist/agent/model-runner.js.map +1 -1
- package/dist/agent/session-pool.d.ts +10 -9
- package/dist/agent/session-pool.d.ts.map +1 -1
- package/dist/agent/session-pool.js +12 -47
- package/dist/agent/session-pool.js.map +1 -1
- package/dist/agent/tool-registry.d.ts +6 -4
- package/dist/agent/tool-registry.d.ts.map +1 -1
- package/dist/agent/tool-registry.js +62 -30
- package/dist/agent/tool-registry.js.map +1 -1
- package/dist/agent/types.d.ts +36 -4
- 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 +15 -5
- package/dist/api/graph-api.js.map +1 -1
- package/dist/api/index.d.ts +10 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +7 -16
- package/dist/api/index.js.map +1 -1
- package/dist/cli/commands/connector.d.ts +6 -1
- package/dist/cli/commands/connector.d.ts.map +1 -1
- package/dist/cli/commands/connector.js +61 -45
- package/dist/cli/commands/connector.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 +43 -10
- 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 +12 -0
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/setup.d.ts +22 -0
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +79 -28
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/cli/commands/start.d.ts +13 -9
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +190 -97
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +4 -0
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/config/config-manager.d.ts.map +1 -1
- package/dist/cli/config/config-manager.js +63 -14
- package/dist/cli/config/config-manager.js.map +1 -1
- package/dist/cli/config/types.d.ts +12 -5
- package/dist/cli/config/types.d.ts.map +1 -1
- package/dist/cli/config/types.js +3 -4
- package/dist/cli/config/types.js.map +1 -1
- package/dist/cli/index.js +6 -4
- 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 +8 -3
- package/dist/cli/runtime/agent-loop-init.js.map +1 -1
- package/dist/cli/runtime/api-routes-init.d.ts +38 -1
- package/dist/cli/runtime/api-routes-init.d.ts.map +1 -1
- package/dist/cli/runtime/api-routes-init.js +150 -30
- package/dist/cli/runtime/api-routes-init.js.map +1 -1
- package/dist/cli/runtime/api-server-init.d.ts +4 -0
- package/dist/cli/runtime/api-server-init.d.ts.map +1 -1
- package/dist/cli/runtime/api-server-init.js +3 -1
- package/dist/cli/runtime/api-server-init.js.map +1 -1
- package/dist/cli/runtime/connector-bootstrap.d.ts +8 -0
- package/dist/cli/runtime/connector-bootstrap.d.ts.map +1 -0
- package/dist/cli/runtime/connector-bootstrap.js +14 -0
- package/dist/cli/runtime/connector-bootstrap.js.map +1 -0
- package/dist/cli/runtime/connector-init.d.ts +4 -1
- package/dist/cli/runtime/connector-init.d.ts.map +1 -1
- package/dist/cli/runtime/connector-init.js +2 -8
- package/dist/cli/runtime/connector-init.js.map +1 -1
- package/dist/cli/runtime/envelope-bootstrap.d.ts +2 -1
- package/dist/cli/runtime/envelope-bootstrap.d.ts.map +1 -1
- package/dist/cli/runtime/envelope-bootstrap.js +7 -15
- 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.map +1 -1
- package/dist/cli/runtime/mama-core-init.d.ts +10 -2
- package/dist/cli/runtime/mama-core-init.d.ts.map +1 -1
- package/dist/cli/runtime/mama-core-init.js +52 -68
- package/dist/cli/runtime/mama-core-init.js.map +1 -1
- package/dist/cli/runtime/memory-agent-init.d.ts.map +1 -1
- package/dist/cli/runtime/memory-agent-init.js +18 -5
- package/dist/cli/runtime/memory-agent-init.js.map +1 -1
- package/dist/cli/runtime/scheduler-init.d.ts +4 -0
- package/dist/cli/runtime/scheduler-init.d.ts.map +1 -1
- package/dist/cli/runtime/scheduler-init.js +24 -3
- package/dist/cli/runtime/scheduler-init.js.map +1 -1
- package/dist/cli/runtime/shutdown.d.ts +4 -0
- package/dist/cli/runtime/shutdown.d.ts.map +1 -1
- package/dist/cli/runtime/shutdown.js +30 -6
- package/dist/cli/runtime/shutdown.js.map +1 -1
- package/dist/cli/runtime/utilities.d.ts +2 -0
- package/dist/cli/runtime/utilities.d.ts.map +1 -1
- package/dist/cli/runtime/utilities.js +33 -0
- package/dist/cli/runtime/utilities.js.map +1 -1
- package/dist/connectors/index.d.ts +4 -1
- package/dist/connectors/index.d.ts.map +1 -1
- package/dist/connectors/index.js +3 -2
- package/dist/connectors/index.js.map +1 -1
- package/dist/connectors/private-connector-policy.d.ts +150 -0
- package/dist/connectors/private-connector-policy.d.ts.map +1 -0
- package/dist/connectors/private-connector-policy.js +289 -0
- package/dist/connectors/private-connector-policy.js.map +1 -0
- package/dist/connectors/private-prompt-overlay.d.ts +17 -0
- package/dist/connectors/private-prompt-overlay.d.ts.map +1 -0
- package/dist/connectors/private-prompt-overlay.js +156 -0
- package/dist/connectors/private-prompt-overlay.js.map +1 -0
- package/dist/db/migrations/operator-task-external-lifecycle.d.ts +8 -0
- package/dist/db/migrations/operator-task-external-lifecycle.d.ts.map +1 -0
- package/dist/db/migrations/operator-task-external-lifecycle.js +169 -0
- package/dist/db/migrations/operator-task-external-lifecycle.js.map +1 -0
- package/dist/envelope/enforcer.js +8 -7
- package/dist/envelope/enforcer.js.map +1 -1
- package/dist/envelope/reactive-config.d.ts.map +1 -1
- package/dist/envelope/reactive-config.js +2 -1
- package/dist/envelope/reactive-config.js.map +1 -1
- package/dist/envelope/tool-connector-scope.d.ts.map +1 -1
- package/dist/envelope/tool-connector-scope.js +4 -0
- package/dist/envelope/tool-connector-scope.js.map +1 -1
- package/dist/gateways/discord.d.ts.map +1 -1
- package/dist/gateways/discord.js +11 -6
- package/dist/gateways/discord.js.map +1 -1
- package/dist/gateways/image-analyzer.d.ts +5 -0
- package/dist/gateways/image-analyzer.d.ts.map +1 -1
- package/dist/gateways/image-analyzer.js +8 -0
- package/dist/gateways/image-analyzer.js.map +1 -1
- package/dist/gateways/message-router.d.ts +11 -1
- package/dist/gateways/message-router.d.ts.map +1 -1
- package/dist/gateways/message-router.js +146 -52
- package/dist/gateways/message-router.js.map +1 -1
- package/dist/gateways/slack.d.ts.map +1 -1
- package/dist/gateways/slack.js +6 -2
- package/dist/gateways/slack.js.map +1 -1
- package/dist/gateways/telegram-message-ledger.d.ts +8 -1
- package/dist/gateways/telegram-message-ledger.d.ts.map +1 -1
- package/dist/gateways/telegram-message-ledger.js +141 -24
- package/dist/gateways/telegram-message-ledger.js.map +1 -1
- package/dist/gateways/telegram.d.ts +2 -0
- package/dist/gateways/telegram.d.ts.map +1 -1
- package/dist/gateways/telegram.js +19 -12
- package/dist/gateways/telegram.js.map +1 -1
- package/dist/gateways/types.d.ts +1 -1
- package/dist/gateways/types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/multi-agent/agent-process-manager.d.ts +14 -4
- package/dist/multi-agent/agent-process-manager.d.ts.map +1 -1
- package/dist/multi-agent/agent-process-manager.js +144 -47
- package/dist/multi-agent/agent-process-manager.js.map +1 -1
- package/dist/multi-agent/dashboard-agent-persona.d.ts +3 -3
- package/dist/multi-agent/dashboard-agent-persona.d.ts.map +1 -1
- package/dist/multi-agent/dashboard-agent-persona.js +10 -13
- 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 +1 -1
- package/dist/multi-agent/runtime-process.d.ts +3 -0
- package/dist/multi-agent/runtime-process.d.ts.map +1 -1
- package/dist/multi-agent/runtime-process.js +10 -2
- package/dist/multi-agent/runtime-process.js.map +1 -1
- package/dist/multi-agent/types.d.ts +12 -2
- package/dist/multi-agent/types.d.ts.map +1 -1
- package/dist/multi-agent/types.js.map +1 -1
- package/dist/multi-agent/wiki-agent-persona.d.ts +2 -2
- package/dist/multi-agent/wiki-agent-persona.js +2 -2
- package/dist/multi-agent/workflow-types.d.ts +1 -1
- package/dist/multi-agent/workflow-types.d.ts.map +1 -1
- package/dist/onboarding/complete-autonomous-prompt.d.ts +1 -1
- package/dist/onboarding/complete-autonomous-prompt.d.ts.map +1 -1
- package/dist/onboarding/complete-autonomous-prompt.js +9 -9
- package/dist/operator/board-slot-instructions.d.ts +1 -1
- package/dist/operator/board-slot-instructions.js +2 -2
- package/dist/operator/board-slot-instructions.js.map +1 -1
- package/dist/operator/briefs.d.ts +3 -0
- package/dist/operator/briefs.d.ts.map +1 -1
- package/dist/operator/briefs.js +64 -3
- package/dist/operator/briefs.js.map +1 -1
- package/dist/operator/console-brief.d.ts +6 -3
- package/dist/operator/console-brief.d.ts.map +1 -1
- package/dist/operator/console-brief.js +39 -9
- package/dist/operator/console-brief.js.map +1 -1
- package/dist/operator/external-lifecycle-candidates.d.ts +56 -0
- package/dist/operator/external-lifecycle-candidates.d.ts.map +1 -0
- package/dist/operator/external-lifecycle-candidates.js +415 -0
- package/dist/operator/external-lifecycle-candidates.js.map +1 -0
- package/dist/operator/external-lifecycle.d.ts +82 -0
- package/dist/operator/external-lifecycle.d.ts.map +1 -0
- package/dist/operator/external-lifecycle.js +27 -0
- package/dist/operator/external-lifecycle.js.map +1 -0
- package/dist/operator/file-coordination.d.ts +7 -0
- package/dist/operator/file-coordination.d.ts.map +1 -0
- package/dist/operator/file-coordination.js +84 -0
- package/dist/operator/file-coordination.js.map +1 -0
- package/dist/operator/operator-trigger-loop.d.ts +19 -4
- package/dist/operator/operator-trigger-loop.d.ts.map +1 -1
- package/dist/operator/operator-trigger-loop.js +151 -23
- package/dist/operator/operator-trigger-loop.js.map +1 -1
- package/dist/operator/pending-report-store.d.ts +62 -3
- package/dist/operator/pending-report-store.d.ts.map +1 -1
- package/dist/operator/pending-report-store.js +297 -40
- package/dist/operator/pending-report-store.js.map +1 -1
- package/dist/operator/report-carry-delivery.d.ts +35 -0
- package/dist/operator/report-carry-delivery.d.ts.map +1 -0
- package/dist/operator/report-carry-delivery.js +55 -0
- package/dist/operator/report-carry-delivery.js.map +1 -0
- package/dist/operator/report-carry.d.ts +50 -30
- package/dist/operator/report-carry.d.ts.map +1 -1
- package/dist/operator/report-carry.js +323 -71
- package/dist/operator/report-carry.js.map +1 -1
- package/dist/operator/situation-report.d.ts +30 -11
- package/dist/operator/situation-report.d.ts.map +1 -1
- package/dist/operator/situation-report.js +79 -35
- package/dist/operator/situation-report.js.map +1 -1
- package/dist/operator/task-ledger.d.ts +101 -0
- package/dist/operator/task-ledger.d.ts.map +1 -1
- package/dist/operator/task-ledger.js +599 -124
- package/dist/operator/task-ledger.js.map +1 -1
- package/dist/operator/temporal-runtime.d.ts.map +1 -1
- package/dist/operator/temporal-runtime.js +3 -1
- package/dist/operator/temporal-runtime.js.map +1 -1
- package/dist/operator/temporal-worker.js +1 -1
- package/dist/operator/trigger-author.d.ts +13 -1
- package/dist/operator/trigger-author.d.ts.map +1 -1
- package/dist/operator/trigger-author.js +35 -0
- package/dist/operator/trigger-author.js.map +1 -1
- package/dist/operator/worker-run.d.ts +1 -1
- package/dist/operator/worker-run.d.ts.map +1 -1
- package/dist/operator/worker-run.js +27 -9
- package/dist/operator/worker-run.js.map +1 -1
- package/dist/operator/workorder-consumer.d.ts +12 -1
- package/dist/operator/workorder-consumer.d.ts.map +1 -1
- package/dist/operator/workorder-consumer.js +125 -6
- package/dist/operator/workorder-consumer.js.map +1 -1
- package/dist/operator/workorder-hooks.d.ts +7 -2
- package/dist/operator/workorder-hooks.d.ts.map +1 -1
- package/dist/operator/workorder-hooks.js +22 -0
- package/dist/operator/workorder-hooks.js.map +1 -1
- package/dist/operator/workorder-publishers.d.ts +9 -2
- package/dist/operator/workorder-publishers.d.ts.map +1 -1
- package/dist/operator/workorder-publishers.js +167 -5
- package/dist/operator/workorder-publishers.js.map +1 -1
- package/dist/scheduler/cron-worker.d.ts +8 -4
- package/dist/scheduler/cron-worker.d.ts.map +1 -1
- package/dist/scheduler/cron-worker.js +56 -39
- package/dist/scheduler/cron-worker.js.map +1 -1
- package/dist/setup/setup-actions.d.ts +26 -0
- package/dist/setup/setup-actions.d.ts.map +1 -0
- package/dist/setup/setup-actions.js +371 -0
- package/dist/setup/setup-actions.js.map +1 -0
- 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 +28 -33
- package/dist/setup/setup-prompt.js.map +1 -1
- package/dist/setup/setup-server.d.ts +6 -1
- package/dist/setup/setup-server.d.ts.map +1 -1
- package/dist/setup/setup-server.js +55 -9
- package/dist/setup/setup-server.js.map +1 -1
- package/dist/setup/setup-websocket.d.ts +14 -2
- package/dist/setup/setup-websocket.d.ts.map +1 -1
- package/dist/setup/setup-websocket.js +121 -37
- package/dist/setup/setup-websocket.js.map +1 -1
- package/package.json +2 -2
- package/public/setup.html +9 -6
- package/public/viewer/js/modules/agents.js +5 -4
- package/public/viewer/js/modules/settings.js +34 -10
- package/public/viewer/src/modules/agents.ts +5 -4
- package/public/viewer/src/modules/settings.ts +49 -11
- package/public/viewer/src/utils/api.ts +3 -2
- package/scripts/generate-gateway-tools.ts +13 -3
|
@@ -63,7 +63,8 @@ const session_pool_js_1 = require("../agent/session-pool.js");
|
|
|
63
63
|
const agent_loop_js_1 = require("../agent/agent-loop.js");
|
|
64
64
|
const console_brief_js_1 = require("../operator/console-brief.js");
|
|
65
65
|
const role_manager_js_1 = require("../agent/role-manager.js");
|
|
66
|
-
const
|
|
66
|
+
const gateway_tool_catalog_js_1 = require("../agent/gateway-tool-catalog.js");
|
|
67
|
+
const private_prompt_overlay_js_1 = require("../connectors/private-prompt-overlay.js");
|
|
67
68
|
const context_prompt_builder_js_1 = require("../agent/context-prompt-builder.js");
|
|
68
69
|
const prompt_enhancer_js_1 = require("../agent/prompt-enhancer.js");
|
|
69
70
|
const debugLogger = __importStar(require("@jungjaehoon/mama-core/debug-logger"));
|
|
@@ -74,11 +75,16 @@ const recall_bundle_formatter_js_1 = require("../memory/recall-bundle-formatter.
|
|
|
74
75
|
const save_candidate_extractor_js_1 = require("../memory/save-candidate-extractor.js");
|
|
75
76
|
const untrusted_content_js_1 = require("../utils/untrusted-content.js");
|
|
76
77
|
const security_monitor_js_1 = require("../security/security-monitor.js");
|
|
77
|
-
const report_carry_js_1 = require("../operator/report-carry.js");
|
|
78
78
|
const agent_store_js_1 = require("../db/agent-store.js");
|
|
79
79
|
const reactive_config_js_1 = require("../envelope/reactive-config.js");
|
|
80
|
+
const private_connector_policy_js_1 = require("../connectors/private-connector-policy.js");
|
|
80
81
|
const { DebugLogger } = debugLogger;
|
|
81
82
|
const logger = new DebugLogger('MessageRouter');
|
|
83
|
+
const DEFAULT_PRIVATE_CONNECTOR_POLICY = (0, private_connector_policy_js_1.resolvePrivateConnectorPolicy)({
|
|
84
|
+
ok: true,
|
|
85
|
+
config: {},
|
|
86
|
+
enabledNames: [],
|
|
87
|
+
});
|
|
82
88
|
/**
|
|
83
89
|
* The owner's message, as the cause of whatever the turn it started changes.
|
|
84
90
|
*
|
|
@@ -158,7 +164,7 @@ function hashSessionPolicyFingerprint({ baseInstructions, agentsContent, rulesCo
|
|
|
158
164
|
}
|
|
159
165
|
return hash.digest('hex');
|
|
160
166
|
}
|
|
161
|
-
function buildStableRolePolicyInstructions(agentContext, roleManager, trelloAvailable, options = {}) {
|
|
167
|
+
function buildStableRolePolicyInstructions(agentContext, roleManager, trelloAvailable, privateConnectorPolicy, options = {}) {
|
|
162
168
|
if (agentContext.roleName !== 'owner_console') {
|
|
163
169
|
return '';
|
|
164
170
|
}
|
|
@@ -166,9 +172,12 @@ function buildStableRolePolicyInstructions(agentContext, roleManager, trelloAvai
|
|
|
166
172
|
const trelloBoundary = trelloAvailable && roleManager.isToolAllowed(agentContext.role, 'context_compile')
|
|
167
173
|
? `
|
|
168
174
|
- ${untrusted_content_js_1.UNTRUSTED_EXTERNAL_EVIDENCE_INSTRUCTION}
|
|
169
|
-
- Trello is separate external connector evidence and is available only through context_compile. When intentionally isolating Trello evidence, use context_compile({ task: "...", connectors: ['trello'] }); never claim that
|
|
175
|
+
- Trello is separate external connector evidence and is available only through context_compile. When intentionally isolating Trello evidence, use context_compile({ task: "...", connectors: ['trello'] }); never claim that one store is another or substitute lifecycle state across stores.`
|
|
176
|
+
: '';
|
|
177
|
+
const privateStoreBoundary = privateConnectorPolicy.enabledPrivateConnectors.length > 0
|
|
178
|
+
? '\n- Private connector task tools are read-only evidence. Keep their lifecycle state separate from the native task board.'
|
|
170
179
|
: '';
|
|
171
|
-
const evidencePolicy = `- Task-store canonicity:
|
|
180
|
+
const evidencePolicy = `- Task-store canonicity: the task board (task_list/task_create/task_update) is the tracker YOU maintain for the owner. Every external store remains separate evidence; never copy or infer lifecycle state across stores.${privateStoreBoundary}${trelloBoundary}
|
|
172
181
|
- Answer status questions from artifacts first (board_read, workorder_status, audit_findings_read), then live queries; memory recall is the LAST resort and may be stale - cite which source answered.`;
|
|
173
182
|
return includeOperatingDiscipline
|
|
174
183
|
? `${evidencePolicy}\n\n${OWNER_CONSOLE_OPERATING_DISCIPLINE}`
|
|
@@ -219,7 +228,7 @@ const KOREAN_TARGETS = new Set(['korean', '한국어']);
|
|
|
219
228
|
const VIEWER_CONTEXT_AGENT_LIST_LIMIT = 5;
|
|
220
229
|
const VIEWER_CONTEXT_ALERT_LIMIT = 3;
|
|
221
230
|
const REACTIVE_ENVELOPE_EXPIRY_MULTIPLIER = 4;
|
|
222
|
-
function buildReactiveEnvelopeInput(message, config) {
|
|
231
|
+
function buildReactiveEnvelopeInput(message, config, surface, privateConnectorPolicy) {
|
|
223
232
|
const policy = (0, reactive_config_js_1.getReactiveRoutePolicy)(message, config);
|
|
224
233
|
return {
|
|
225
234
|
agent_id: 'worker',
|
|
@@ -229,7 +238,9 @@ function buildReactiveEnvelopeInput(message, config) {
|
|
|
229
238
|
trigger_context: { user_text: message.text },
|
|
230
239
|
scope: {
|
|
231
240
|
project_refs: policy.projectRefs,
|
|
232
|
-
raw_connectors:
|
|
241
|
+
raw_connectors: [
|
|
242
|
+
...privateConnectorPolicy.projectRawConnectors(surface, policy.rawConnectors),
|
|
243
|
+
],
|
|
233
244
|
// Identity scopes only - the grant mirror is an enforcement-layer READ
|
|
234
245
|
// allowance, never issued into the envelope (PR #217 review: issuing it
|
|
235
246
|
// here widened this chat's raw narrowing back to every sibling channel
|
|
@@ -308,6 +319,8 @@ class MessageRouter {
|
|
|
308
319
|
config;
|
|
309
320
|
envelopeConfig;
|
|
310
321
|
envelopeAuthority;
|
|
322
|
+
privateConnectorPolicy;
|
|
323
|
+
reportCarry;
|
|
311
324
|
roleManager;
|
|
312
325
|
promptEnhancer;
|
|
313
326
|
gatewayRegistry = null;
|
|
@@ -493,12 +506,15 @@ class MessageRouter {
|
|
|
493
506
|
};
|
|
494
507
|
return this.memoryAuditQueue.enqueue(auditJob);
|
|
495
508
|
}
|
|
496
|
-
constructor(sessionStore, agentLoop, mamaApi, config = {}, envelopeConfig, envelopeAuthority) {
|
|
509
|
+
constructor(sessionStore, agentLoop, mamaApi, config = {}, envelopeConfig, envelopeAuthority, dependencies = {}) {
|
|
497
510
|
this.sessionStore = sessionStore;
|
|
498
511
|
this.agentLoop = agentLoop;
|
|
499
512
|
this.mamaApi = mamaApi;
|
|
500
513
|
this.envelopeConfig = envelopeConfig;
|
|
501
514
|
this.envelopeAuthority = envelopeAuthority;
|
|
515
|
+
this.privateConnectorPolicy =
|
|
516
|
+
dependencies.privateConnectorPolicy ?? DEFAULT_PRIVATE_CONNECTOR_POLICY;
|
|
517
|
+
this.reportCarry = dependencies.reportCarry;
|
|
502
518
|
if (this.envelopeConfig && !this.envelopeAuthority) {
|
|
503
519
|
throw new Error('[envelope] ReactiveEnvelopeConfig provided without EnvelopeAuthority');
|
|
504
520
|
}
|
|
@@ -522,13 +538,14 @@ class MessageRouter {
|
|
|
522
538
|
maxDecisions: this.config.maxDecisions,
|
|
523
539
|
});
|
|
524
540
|
}
|
|
525
|
-
buildReactiveEnvelope(message) {
|
|
541
|
+
buildReactiveEnvelope(message, agentContext) {
|
|
526
542
|
const config = this.envelopeConfig;
|
|
527
543
|
const authority = this.envelopeAuthority;
|
|
528
544
|
if (!config || !authority) {
|
|
529
545
|
return undefined;
|
|
530
546
|
}
|
|
531
|
-
|
|
547
|
+
const surface = (0, private_connector_policy_js_1.resolvePrivatePrincipalSurface)({ agentContext });
|
|
548
|
+
return authority.buildAndPersist(buildReactiveEnvelopeInput(message, config, surface, this.privateConnectorPolicy));
|
|
532
549
|
}
|
|
533
550
|
/**
|
|
534
551
|
* Create AgentContext for a message
|
|
@@ -541,9 +558,15 @@ class MessageRouter {
|
|
|
541
558
|
channelId: message.channelId,
|
|
542
559
|
chatType: typeof message.metadata?.chatType === 'string' ? message.metadata.chatType : undefined,
|
|
543
560
|
});
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
|
|
561
|
+
const surface = roleName === 'owner_console'
|
|
562
|
+
? 'owner_console'
|
|
563
|
+
: roleName === 'os_agent'
|
|
564
|
+
? 'os_agent'
|
|
565
|
+
: 'multi-agent-generic';
|
|
566
|
+
const projectedRole = this.privateConnectorPolicy.projectRole(surface, role);
|
|
567
|
+
const capabilities = this.roleManager.getCapabilities(projectedRole);
|
|
568
|
+
const limitations = this.roleManager.getLimitations(projectedRole);
|
|
569
|
+
const ctx = (0, context_prompt_builder_js_1.createAgentContext)(message.source, roleName, projectedRole, {
|
|
547
570
|
sessionId,
|
|
548
571
|
channelId: message.channelId,
|
|
549
572
|
userId: message.userId,
|
|
@@ -726,6 +749,15 @@ This protects your credentials from being exposed in chat logs.`;
|
|
|
726
749
|
};
|
|
727
750
|
try {
|
|
728
751
|
const agentContext = this.createAgentContext(message, session.id);
|
|
752
|
+
const reportCarryTarget = agentContext.roleName === 'owner_console' && message.source === 'telegram'
|
|
753
|
+
? { source: message.source, channelId: message.channelId }
|
|
754
|
+
: null;
|
|
755
|
+
const reportCarryChannelKey = reportCarryTarget
|
|
756
|
+
? (0, session_pool_js_1.buildChannelKey)(reportCarryTarget.source, reportCarryTarget.channelId)
|
|
757
|
+
: null;
|
|
758
|
+
const reportCarryPeek = reportCarryTarget
|
|
759
|
+
? (this.reportCarry?.peek(reportCarryTarget) ?? null)
|
|
760
|
+
: null;
|
|
729
761
|
const mediaInstructions = buildUploadedMediaInstructions(message, agentContext.role.allowedTools, agentContext.roleName === 'owner_console');
|
|
730
762
|
// Save user message immediately for crash/refresh resilience
|
|
731
763
|
this.sessionStore.appendMessage(session.id, {
|
|
@@ -751,22 +783,26 @@ This protects your credentials from being exposed in chat logs.`;
|
|
|
751
783
|
? { agentId: agentContext.roleName, channelId: message.channelId }
|
|
752
784
|
: undefined;
|
|
753
785
|
const enhanced = await this.promptEnhancer.enhance(message.text, workspacePath, ruleContext);
|
|
754
|
-
//
|
|
786
|
+
// TG-05: every main backend keeps its live conversation in a durable
|
|
787
|
+
// runtime session. Only a genuinely new/replacement session rebuilds
|
|
788
|
+
// bounded MAMA context.
|
|
789
|
+
const needsFullContext = isNewCliSession;
|
|
790
|
+
// Persistent backends skip repeated retrieval after the first turn.
|
|
755
791
|
context =
|
|
756
|
-
|
|
792
|
+
needsFullContext && this.config.implicitLegacyContextSearch
|
|
757
793
|
? await this.contextInjector.getRelevantContext(message.text)
|
|
758
794
|
: { prompt: '', decisions: [], hasContext: false };
|
|
759
|
-
if (!
|
|
795
|
+
if (!needsFullContext) {
|
|
760
796
|
systemPrompt = '';
|
|
761
797
|
logger.info('CONTINUE turn: skipping context injection');
|
|
762
798
|
}
|
|
763
799
|
else {
|
|
764
|
-
//
|
|
800
|
+
// New persistent session: full prompt build.
|
|
765
801
|
const sessionStartupContext = await this.contextInjector.getSessionStartupContext({
|
|
766
802
|
source: message.source,
|
|
767
803
|
channelId: message.channelId,
|
|
768
804
|
});
|
|
769
|
-
systemPrompt = this.buildSystemPrompt(session, context.prompt, historyContext, sessionStartupContext, agentContext, enhanced,
|
|
805
|
+
systemPrompt = this.buildSystemPrompt(session, context.prompt, historyContext, sessionStartupContext, agentContext, enhanced, true, trelloAvailable);
|
|
770
806
|
}
|
|
771
807
|
// 7. Run agent loop (with session info for lane-based concurrency)
|
|
772
808
|
const roleModel = agentContext.role.model;
|
|
@@ -779,6 +815,9 @@ This protects your credentials from being exposed in chat logs.`;
|
|
|
779
815
|
' Codex: codex login → roles.definitions.' +
|
|
780
816
|
agentContext.roleName +
|
|
781
817
|
'.model: gpt-5.4\n\n' +
|
|
818
|
+
' Cline: cline auth cline → roles.definitions.' +
|
|
819
|
+
agentContext.roleName +
|
|
820
|
+
'.model: deepseek/deepseek-v4-flash\n\n' +
|
|
782
821
|
'Or run: mama init --reconfigure');
|
|
783
822
|
}
|
|
784
823
|
const roleMaxTurns = agentContext.role.maxTurns;
|
|
@@ -833,7 +872,7 @@ This protects your credentials from being exposed in chat logs.`;
|
|
|
833
872
|
let pendingNotices = false;
|
|
834
873
|
let pendingChannelNoticeCount = 0;
|
|
835
874
|
let pendingBroadcastNoticeCount = 0;
|
|
836
|
-
const envelope = this.buildReactiveEnvelope(message);
|
|
875
|
+
const envelope = this.buildReactiveEnvelope(message, agentContext);
|
|
837
876
|
const options = {
|
|
838
877
|
systemPrompt: effectivePrompt,
|
|
839
878
|
sessionPolicyFingerprint,
|
|
@@ -866,7 +905,7 @@ This protects your credentials from being exposed in chat logs.`;
|
|
|
866
905
|
// citation this ledger exists to refuse.
|
|
867
906
|
...(causeFromOwnerMessage(sourceTurnId, sourceMessageRef) ?? {}),
|
|
868
907
|
};
|
|
869
|
-
if (this.config.backend === 'codex' && shouldResume) {
|
|
908
|
+
if ((this.config.backend === 'codex' || this.config.backend === 'cline') && shouldResume) {
|
|
870
909
|
options.freshSessionSystemPrompt = async () => {
|
|
871
910
|
const freshContext = this.config.implicitLegacyContextSearch
|
|
872
911
|
? await this.contextInjector.getRelevantContext(message.text)
|
|
@@ -884,11 +923,9 @@ This protects your credentials from being exposed in chat logs.`;
|
|
|
884
923
|
else {
|
|
885
924
|
logger.info(`New CLI session (full: ${systemPrompt.length} chars)`);
|
|
886
925
|
}
|
|
887
|
-
//
|
|
888
|
-
//
|
|
889
|
-
|
|
890
|
-
// prompts never reach a pooled CLI process).
|
|
891
|
-
const carryPrefix = agentContext?.roleName === 'owner_console' ? (0, report_carry_js_1.buildReportCarryPrefix)() : '';
|
|
926
|
+
// TG-05/TG-06: carry is captured once before the model call and travels
|
|
927
|
+
// only in this turn's user message, never in a rebuilt system prompt.
|
|
928
|
+
const carryPrefix = reportCarryPeek?.prefix ?? '';
|
|
892
929
|
try {
|
|
893
930
|
if (shouldResume) {
|
|
894
931
|
// Per-channel notices PLUS the operator broadcast key: host-code
|
|
@@ -968,8 +1005,10 @@ This protects your credentials from being exposed in chat logs.`;
|
|
|
968
1005
|
if (effectiveMessageText) {
|
|
969
1006
|
contentBlocks.push({ type: 'text', text: effectiveMessageText });
|
|
970
1007
|
}
|
|
971
|
-
//
|
|
972
|
-
|
|
1008
|
+
// Claude uses its direct vision client. Durable Codex/Cline runtimes
|
|
1009
|
+
// receive the original image block and inspect the private workspace
|
|
1010
|
+
// media through their own native path, avoiding hidden Claude auth.
|
|
1011
|
+
if (hasImages && this.config.backend === 'claude') {
|
|
973
1012
|
const { getImageAnalyzer } = await import('./image-analyzer.js');
|
|
974
1013
|
const analysisText = protectImageAnalysis(message, await getImageAnalyzer().processContentBlocks(message.contentBlocks));
|
|
975
1014
|
contentBlocks.length = 0;
|
|
@@ -983,6 +1022,9 @@ This protects your credentials from being exposed in chat logs.`;
|
|
|
983
1022
|
if (block.type === 'text' && block.text) {
|
|
984
1023
|
contentBlocks.push(block);
|
|
985
1024
|
}
|
|
1025
|
+
else if (block.type === 'image') {
|
|
1026
|
+
contentBlocks.push(block);
|
|
1027
|
+
}
|
|
986
1028
|
}
|
|
987
1029
|
if (mediaInstructions) {
|
|
988
1030
|
contentBlocks.push({
|
|
@@ -1052,9 +1094,11 @@ This protects your credentials from being exposed in chat logs.`;
|
|
|
1052
1094
|
this.logAgentActivity(this.resolveFrontdoorAgentId(message), 'task_error', message.text?.slice(0, 200), undefined, durationMs, error instanceof Error ? error.message : String(error));
|
|
1053
1095
|
// CLI timeout or resume failure - invalidate session to force fresh start next time
|
|
1054
1096
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
1055
|
-
const
|
|
1056
|
-
|
|
1057
|
-
|
|
1097
|
+
const normalizedErrorMsg = errorMsg.toLowerCase();
|
|
1098
|
+
const isCriticalError = normalizedErrorMsg.includes('timeout') ||
|
|
1099
|
+
normalizedErrorMsg.includes('timed out') ||
|
|
1100
|
+
normalizedErrorMsg.includes('resume') ||
|
|
1101
|
+
normalizedErrorMsg.includes('exited with code');
|
|
1058
1102
|
if (isCriticalError) {
|
|
1059
1103
|
logger.warn(`CLI error detected, invalidating session: ${errorMsg}`);
|
|
1060
1104
|
sessionPool.invalidateSession(channelKey, cliSessionId);
|
|
@@ -1105,13 +1149,27 @@ This protects your credentials from being exposed in chat logs.`;
|
|
|
1105
1149
|
// 6. Update session context — finalize assistant response
|
|
1106
1150
|
// Use flushStreamingResponse first (updates existing turn from periodic flush),
|
|
1107
1151
|
// fall back to appendMessage if no turn exists yet (non-streaming path)
|
|
1108
|
-
const
|
|
1109
|
-
if (!flushed) {
|
|
1152
|
+
const persisted = this.sessionStore.flushStreamingResponse(session.id, response) ||
|
|
1110
1153
|
this.sessionStore.appendMessage(session.id, {
|
|
1111
1154
|
role: 'assistant',
|
|
1112
1155
|
content: response,
|
|
1113
1156
|
timestamp: Date.now(),
|
|
1114
1157
|
});
|
|
1158
|
+
if (!persisted) {
|
|
1159
|
+
throw new Error('Unable to persist final assistant response');
|
|
1160
|
+
}
|
|
1161
|
+
if (reportCarryPeek && reportCarryTarget && reportCarryChannelKey) {
|
|
1162
|
+
try {
|
|
1163
|
+
this.reportCarry?.acknowledge({
|
|
1164
|
+
deliveryId: reportCarryPeek.deliveryId,
|
|
1165
|
+
target: reportCarryTarget,
|
|
1166
|
+
consumingChannelKey: reportCarryChannelKey,
|
|
1167
|
+
consumedAtIso: new Date().toISOString(),
|
|
1168
|
+
});
|
|
1169
|
+
}
|
|
1170
|
+
catch (error) {
|
|
1171
|
+
logger.warn(`[report-carry] acknowledgement failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
1172
|
+
}
|
|
1115
1173
|
}
|
|
1116
1174
|
// Release session lock AFTER final persistence to prevent out-of-order turns
|
|
1117
1175
|
releaseCliSessionLock();
|
|
@@ -1149,19 +1207,42 @@ This protects your credentials from being exposed in chat logs.`;
|
|
|
1149
1207
|
const isOnboarding = !(0, node_fs_1.existsSync)(soulPath);
|
|
1150
1208
|
// Hoist session history — reuse across onboarding check and prompt build
|
|
1151
1209
|
const sessionHistory = this.sessionStore.formatContextForPrompt(session.id);
|
|
1210
|
+
const surface = agentContext
|
|
1211
|
+
? (0, private_connector_policy_js_1.resolvePrivatePrincipalSurface)({ agentContext })
|
|
1212
|
+
: 'multi-agent-generic';
|
|
1213
|
+
const gatewayCatalog = agentContext
|
|
1214
|
+
? (0, gateway_tool_catalog_js_1.buildGatewayToolCatalog)({
|
|
1215
|
+
surface,
|
|
1216
|
+
allowedTools: agentContext.role.allowedTools,
|
|
1217
|
+
blockedTools: agentContext.role.blockedTools,
|
|
1218
|
+
privateConnectorPolicy: this.privateConnectorPolicy,
|
|
1219
|
+
})
|
|
1220
|
+
: null;
|
|
1221
|
+
const durableNativeBackend = this.config.backend === 'codex' || this.config.backend === 'cline';
|
|
1222
|
+
const privatePolicyPrompt = durableNativeBackend && surface === 'owner_console'
|
|
1223
|
+
? (0, console_brief_js_1.projectConsoleBriefForPrompt)('', this.privateConnectorPolicy).trim()
|
|
1224
|
+
: '';
|
|
1152
1225
|
const stableRolePolicy = agentContext
|
|
1153
|
-
?
|
|
1226
|
+
? [
|
|
1227
|
+
buildStableRolePolicyInstructions(agentContext, this.roleManager, trelloAvailable, this.privateConnectorPolicy),
|
|
1228
|
+
privatePolicyPrompt,
|
|
1229
|
+
]
|
|
1230
|
+
.filter(Boolean)
|
|
1231
|
+
.join('\n\n')
|
|
1154
1232
|
: '';
|
|
1155
1233
|
// Onboarding is guided first contact, not operator duty. The awakening persona asks the
|
|
1156
1234
|
// user's name and runs a personality quiz; ordering it to gather via gateway tools and
|
|
1157
1235
|
// execute multi-step work would fight that flow and aim it at connectors that do not
|
|
1158
1236
|
// exist yet. Evidence policy still travels; the operating posture does not.
|
|
1159
1237
|
const onboardingRolePolicy = agentContext
|
|
1160
|
-
?
|
|
1161
|
-
includeOperatingDiscipline: false,
|
|
1162
|
-
|
|
1238
|
+
? [
|
|
1239
|
+
buildStableRolePolicyInstructions(agentContext, this.roleManager, trelloAvailable, this.privateConnectorPolicy, { includeOperatingDiscipline: false }),
|
|
1240
|
+
privatePolicyPrompt,
|
|
1241
|
+
]
|
|
1242
|
+
.filter(Boolean)
|
|
1243
|
+
.join('\n\n')
|
|
1163
1244
|
: '';
|
|
1164
|
-
const appendOnboardingRolePolicy = (basePrompt) => onboardingRolePolicy ? `${basePrompt}\n\n${onboardingRolePolicy}\n` : basePrompt;
|
|
1245
|
+
const appendOnboardingRolePolicy = (basePrompt) => this.projectPrivatePromptText(onboardingRolePolicy ? `${basePrompt}\n\n${onboardingRolePolicy}\n` : basePrompt);
|
|
1165
1246
|
if (isOnboarding) {
|
|
1166
1247
|
// Check if we have existing conversation
|
|
1167
1248
|
const hasHistory = sessionHistory && sessionHistory !== 'New conversation';
|
|
@@ -1284,7 +1365,10 @@ ${historyContext}
|
|
|
1284
1365
|
if (agentContext.roleName === 'owner_console') {
|
|
1285
1366
|
const consoleBrief = (0, console_brief_js_1.loadConsoleBrief)();
|
|
1286
1367
|
if (consoleBrief.trim()) {
|
|
1287
|
-
|
|
1368
|
+
const projectedBrief = (0, console_brief_js_1.projectConsoleBriefForPrompt)(consoleBrief, this.privateConnectorPolicy);
|
|
1369
|
+
prompt += `\n\n${((gatewayCatalog && !durableNativeBackend) || privatePolicyPrompt
|
|
1370
|
+
? (0, private_prompt_overlay_js_1.stripMarkedPrivatePromptOverlays)(projectedBrief)
|
|
1371
|
+
: projectedBrief).trim()}\n`;
|
|
1288
1372
|
}
|
|
1289
1373
|
}
|
|
1290
1374
|
}
|
|
@@ -1297,38 +1381,48 @@ ${historyContext}
|
|
|
1297
1381
|
// See process() method for user-message injection.
|
|
1298
1382
|
// Include gateway tools directly in system prompt (priority 1 protection)
|
|
1299
1383
|
// so they don't get truncated by PromptSizeMonitor as a separate layer.
|
|
1300
|
-
// Prompt-permission coherence:
|
|
1301
|
-
//
|
|
1302
|
-
//
|
|
1303
|
-
|
|
1304
|
-
// per-bullet filter preserves the '## Gateway Tools' marker - AgentLoop
|
|
1305
|
-
// must keep seeing that marker or it double-injects an UNFILTERED catalog
|
|
1306
|
-
// (agent-loop alreadyHasTools check).
|
|
1307
|
-
const disallowedForRole = agentContext
|
|
1308
|
-
? tool_registry_js_1.ToolRegistry.getValidToolNames().filter((name) => !this.roleManager.isToolAllowed(agentContext.role, name))
|
|
1309
|
-
: undefined;
|
|
1310
|
-
const gatewayToolsPrompt = this.config.backend === 'codex' ? '' : (0, agent_loop_js_1.getGatewayToolsPrompt)(disallowedForRole) || '';
|
|
1384
|
+
// Prompt-permission coherence: the policy-keyed catalog is generated from
|
|
1385
|
+
// the final exact role projection, so cached private text cannot cross a
|
|
1386
|
+
// connector-policy or principal boundary.
|
|
1387
|
+
const gatewayToolsPrompt = durableNativeBackend ? '' : (gatewayCatalog?.prompt ?? '');
|
|
1311
1388
|
if (gatewayToolsPrompt) {
|
|
1312
1389
|
prompt += `\n---\n\n${gatewayToolsPrompt}\n`;
|
|
1313
1390
|
}
|
|
1314
|
-
return prompt;
|
|
1391
|
+
return this.projectPrivatePromptText(prompt);
|
|
1315
1392
|
}
|
|
1316
1393
|
buildSessionPolicyFingerprint(agentContext, enhanced, model, trelloAvailable) {
|
|
1317
1394
|
const soulPath = (0, node_path_1.join)((0, node_os_1.homedir)(), '.mama', 'SOUL.md');
|
|
1318
1395
|
const baseInstructions = (0, node_fs_1.existsSync)(soulPath)
|
|
1319
1396
|
? (0, agent_loop_js_1.loadComposedSystemPrompt)(false, agentContext)
|
|
1320
1397
|
: complete_autonomous_prompt_js_1.COMPLETE_AUTONOMOUS_PROMPT;
|
|
1398
|
+
const surface = (0, private_connector_policy_js_1.resolvePrivatePrincipalSurface)({ agentContext });
|
|
1399
|
+
const gatewayCatalog = (0, gateway_tool_catalog_js_1.buildGatewayToolCatalog)({
|
|
1400
|
+
surface,
|
|
1401
|
+
allowedTools: agentContext.role.allowedTools,
|
|
1402
|
+
blockedTools: agentContext.role.blockedTools,
|
|
1403
|
+
privateConnectorPolicy: this.privateConnectorPolicy,
|
|
1404
|
+
});
|
|
1321
1405
|
return hashSessionPolicyFingerprint({
|
|
1322
1406
|
baseInstructions,
|
|
1323
1407
|
agentsContent: enhanced.agentsContent,
|
|
1324
1408
|
rulesContent: enhanced.rulesContent,
|
|
1325
1409
|
model,
|
|
1326
|
-
stableRolePolicy: buildStableRolePolicyInstructions(agentContext, this.roleManager, trelloAvailable) +
|
|
1410
|
+
stableRolePolicy: buildStableRolePolicyInstructions(agentContext, this.roleManager, trelloAvailable, this.privateConnectorPolicy) +
|
|
1327
1411
|
// Brief edits must rotate the durable-session policy (re-anchor carries
|
|
1328
1412
|
// the new manual); non-owner roles contribute an empty string.
|
|
1329
|
-
(agentContext.roleName === 'owner_console'
|
|
1413
|
+
(agentContext.roleName === 'owner_console'
|
|
1414
|
+
? `\n${(0, console_brief_js_1.projectConsoleBriefForPrompt)((0, console_brief_js_1.loadConsoleBrief)(), this.privateConnectorPolicy)}`
|
|
1415
|
+
: '') +
|
|
1416
|
+
`\n${gatewayCatalog.cacheKey}`,
|
|
1330
1417
|
});
|
|
1331
1418
|
}
|
|
1419
|
+
/** Remove only a complete, structurally valid host-generated private overlay. */
|
|
1420
|
+
projectPrivatePromptText(prompt) {
|
|
1421
|
+
if (this.privateConnectorPolicy.enabledPrivateConnectors.length > 0) {
|
|
1422
|
+
return prompt;
|
|
1423
|
+
}
|
|
1424
|
+
return (0, private_prompt_overlay_js_1.stripMarkedPrivatePromptOverlays)(prompt);
|
|
1425
|
+
}
|
|
1332
1426
|
/**
|
|
1333
1427
|
* Build minimal prompt for resumed CLI sessions.
|
|
1334
1428
|
* CLI already has full system prompt from initial request.
|