@0xmaxma/claude-gateway 2.1.1 → 2.1.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/README.md +1 -1
- package/config.template.json +1 -1
- package/dist/agent/dreaming/index.d.ts +6 -0
- package/dist/agent/dreaming/index.d.ts.map +1 -1
- package/dist/agent/dreaming/index.js +3 -3
- package/dist/agent/dreaming/index.js.map +1 -1
- package/dist/agent/runner.d.ts +1 -1
- package/dist/agent/runner.d.ts.map +1 -1
- package/dist/agent/runner.js +9 -4
- package/dist/agent/runner.js.map +1 -1
- package/dist/agent/workspace-loader.d.ts +12 -0
- package/dist/agent/workspace-loader.d.ts.map +1 -1
- package/dist/agent/workspace-loader.js +34 -4
- package/dist/agent/workspace-loader.js.map +1 -1
- package/dist/api/cron-router.d.ts.map +1 -1
- package/dist/api/cron-router.js +3 -2
- package/dist/api/cron-router.js.map +1 -1
- package/dist/api/gateway-router.d.ts.map +1 -1
- package/dist/api/gateway-router.js +1 -1
- package/dist/api/gateway-router.js.map +1 -1
- package/dist/api/router.d.ts.map +1 -1
- package/dist/api/router.js +40 -5
- package/dist/api/router.js.map +1 -1
- package/dist/api/share-router.d.ts +1 -1
- package/dist/api/share-router.d.ts.map +1 -1
- package/dist/api/share-router.js +14 -5
- package/dist/api/share-router.js.map +1 -1
- package/dist/api/voice-call-router.d.ts.map +1 -1
- package/dist/api/voice-call-router.js +8 -5
- package/dist/api/voice-call-router.js.map +1 -1
- package/dist/api/voice-router.js +1 -1
- package/dist/api/voice-router.js.map +1 -1
- package/dist/api/voice-settings-router.d.ts.map +1 -1
- package/dist/api/voice-settings-router.js +15 -0
- package/dist/api/voice-settings-router.js.map +1 -1
- package/dist/apps/agent-manager.d.ts +2 -2
- package/dist/apps/agent-manager.d.ts.map +1 -1
- package/dist/apps/agent-manager.js +12 -3
- package/dist/apps/agent-manager.js.map +1 -1
- package/dist/apps/compose-generator.d.ts +4 -0
- package/dist/apps/compose-generator.d.ts.map +1 -1
- package/dist/apps/compose-generator.js +6 -3
- package/dist/apps/compose-generator.js.map +1 -1
- package/dist/apps/conversation-sandbox.d.ts +78 -0
- package/dist/apps/conversation-sandbox.d.ts.map +1 -0
- package/dist/apps/conversation-sandbox.js +357 -0
- package/dist/apps/conversation-sandbox.js.map +1 -0
- package/dist/apps/installer.d.ts +1 -0
- package/dist/apps/installer.d.ts.map +1 -1
- package/dist/apps/installer.js +5 -0
- package/dist/apps/installer.js.map +1 -1
- package/dist/apps/registry.d.ts +1 -0
- package/dist/apps/registry.d.ts.map +1 -1
- package/dist/build-provenance.json +4 -4
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +3 -0
- package/dist/config/loader.js.map +1 -1
- package/dist/config/migrator.d.ts +2 -0
- package/dist/config/migrator.d.ts.map +1 -1
- package/dist/config/migrator.js +37 -1
- package/dist/config/migrator.js.map +1 -1
- package/dist/config/reload-policy.d.ts.map +1 -1
- package/dist/config/reload-policy.js +2 -0
- package/dist/config/reload-policy.js.map +1 -1
- package/dist/cron/manager.d.ts +15 -0
- package/dist/cron/manager.d.ts.map +1 -1
- package/dist/cron/manager.js +53 -1
- package/dist/cron/manager.js.map +1 -1
- package/dist/index.js +21 -9
- package/dist/index.js.map +1 -1
- package/dist/orchestration/bridge.d.ts +4 -0
- package/dist/orchestration/bridge.d.ts.map +1 -1
- package/dist/orchestration/bridge.js +25 -6
- package/dist/orchestration/bridge.js.map +1 -1
- package/dist/orchestration/capabilities.d.ts.map +1 -1
- package/dist/orchestration/capabilities.js +1 -0
- package/dist/orchestration/capabilities.js.map +1 -1
- package/dist/orchestration/config.js +1 -1
- package/dist/orchestration/config.js.map +1 -1
- package/dist/orchestration/container.d.ts.map +1 -1
- package/dist/orchestration/container.js +48 -1
- package/dist/orchestration/container.js.map +1 -1
- package/dist/orchestration/context-footprint.d.ts.map +1 -1
- package/dist/orchestration/context-footprint.js +1 -1
- package/dist/orchestration/context-footprint.js.map +1 -1
- package/dist/orchestration/recovery.d.ts.map +1 -1
- package/dist/orchestration/recovery.js +27 -0
- package/dist/orchestration/recovery.js.map +1 -1
- package/dist/orchestration/report-promise.d.ts +9 -0
- package/dist/orchestration/report-promise.d.ts.map +1 -0
- package/dist/orchestration/report-promise.js +39 -0
- package/dist/orchestration/report-promise.js.map +1 -0
- package/dist/orchestration/restart-resume.d.ts +7 -1
- package/dist/orchestration/restart-resume.d.ts.map +1 -1
- package/dist/orchestration/restart-resume.js +22 -1
- package/dist/orchestration/restart-resume.js.map +1 -1
- package/dist/orchestration/runtime.d.ts +3 -0
- package/dist/orchestration/runtime.d.ts.map +1 -1
- package/dist/orchestration/runtime.js +32 -7
- package/dist/orchestration/runtime.js.map +1 -1
- package/dist/orchestration/tasks/driver.d.ts +1 -0
- package/dist/orchestration/tasks/driver.d.ts.map +1 -1
- package/dist/orchestration/tasks/driver.js +23 -3
- package/dist/orchestration/tasks/driver.js.map +1 -1
- package/dist/orchestration/tasks/service.d.ts +1 -3
- package/dist/orchestration/tasks/service.d.ts.map +1 -1
- package/dist/orchestration/tasks/service.js +5 -17
- package/dist/orchestration/tasks/service.js.map +1 -1
- package/dist/session/process.d.ts +15 -1
- package/dist/session/process.d.ts.map +1 -1
- package/dist/session/process.js +101 -15
- package/dist/session/process.js.map +1 -1
- package/dist/share/share-store.d.ts +10 -1
- package/dist/share/share-store.d.ts.map +1 -1
- package/dist/share/share-store.js +42 -1
- package/dist/share/share-store.js.map +1 -1
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/ui/voice-call-client.d.ts +27 -14
- package/dist/ui/voice-call-client.d.ts.map +1 -1
- package/dist/ui/voice-call-client.js +80 -24
- package/dist/ui/voice-call-client.js.map +1 -1
- package/dist/ui/voice-call-ui.d.ts +4 -1
- package/dist/ui/voice-call-ui.d.ts.map +1 -1
- package/dist/ui/voice-call-ui.js +65 -21
- package/dist/ui/voice-call-ui.js.map +1 -1
- package/dist/voice/errors.js +1 -1
- package/dist/voice/errors.js.map +1 -1
- package/dist/voice/notes.d.ts +4 -3
- package/dist/voice/notes.d.ts.map +1 -1
- package/dist/voice/notes.js +14 -11
- package/dist/voice/notes.js.map +1 -1
- package/dist/voice/telegram-avatar.d.ts +6 -2
- package/dist/voice/telegram-avatar.d.ts.map +1 -1
- package/dist/voice/telegram-avatar.js +23 -10
- package/dist/voice/telegram-avatar.js.map +1 -1
- package/dist/voice/turn-manager.d.ts.map +1 -1
- package/dist/voice/turn-manager.js +1 -1
- package/dist/voice/turn-manager.js.map +1 -1
- package/dist/voice/types.d.ts +3 -0
- package/dist/voice/types.d.ts.map +1 -1
- package/dist/voice/types.js +4 -0
- package/dist/voice/types.js.map +1 -1
- package/mcp/modules.ts +13 -1
- package/mcp/tools/api/module.ts +9 -1
- package/mcp/tools/discord/module.ts +44 -11
- package/mcp/tools/line/module.ts +11 -0
- package/mcp/tools/memory/disable-archive.test.ts +47 -0
- package/mcp/tools/memory/module.ts +2 -1
- package/mcp/tools/shared/isolate.ts +77 -0
- package/mcp/tools/shared/share-client.ts +15 -1
- package/mcp/tools/slack/module.ts +12 -5
- package/mcp/tools/telegram/attachment-log.ts +39 -0
- package/mcp/tools/telegram/module.ts +27 -11
- package/mcp/tools/telegram/receiver-server.ts +8 -0
- package/mcp/tools/wechat/module.ts +2 -0
- package/mcp/tools/whatsapp/module.ts +8 -1
- package/mcp/tools/whatsapp-cloud/module.ts +14 -7
- package/package.json +1 -1
|
@@ -53,6 +53,7 @@ const telegram_voices_1 = require("./telegram-voices");
|
|
|
53
53
|
const stop_controls_1 = require("./stop-controls");
|
|
54
54
|
const config_1 = require("../agent/dreaming/config");
|
|
55
55
|
const container_1 = require("./container");
|
|
56
|
+
const conversation_sandbox_1 = require("../apps/conversation-sandbox");
|
|
56
57
|
const conversation_intake_1 = require("./conversation-intake");
|
|
57
58
|
const agent_cli_session_1 = require("./agent-cli-session");
|
|
58
59
|
const claude_settings_1 = require("../config/claude-settings");
|
|
@@ -89,6 +90,7 @@ const types_2 = require("./types");
|
|
|
89
90
|
const automation_session_1 = require("./tasks/automation-session");
|
|
90
91
|
const recovery_1 = require("./recovery");
|
|
91
92
|
const restart_resume_1 = require("./restart-resume");
|
|
93
|
+
const report_promise_1 = require("./report-promise");
|
|
92
94
|
const instance_lock_1 = require("./instance-lock");
|
|
93
95
|
const delivery_1 = require("./delivery");
|
|
94
96
|
const knowledge_1 = require("../agent/knowledge");
|
|
@@ -265,7 +267,7 @@ class AgentOrchestrationRuntime {
|
|
|
265
267
|
};
|
|
266
268
|
gatewayAdapters.set('browser', new browser_1.BrowserTaskAdapter({ agentId: agent.id, root: (0, path_1.join)(root, 'browser-requests'),
|
|
267
269
|
stepMode: () => gateway.gateway.jev?.features?.browserSteps?.enabled === true, settled: () => gatewayTick.run(), userSteps,
|
|
268
|
-
allowed: () => (0, jev_gateway_1.jevAllowed)(gateway, agent) && gateway.gateway.jev?.features?.browserTasks?.enabled === true,
|
|
270
|
+
allowed: () => !agent.isolateMemory && (0, jev_gateway_1.jevAllowed)(gateway, agent) && gateway.gateway.jev?.features?.browserTasks?.enabled === true,
|
|
269
271
|
bindings: browserBindings,
|
|
270
272
|
refreshBindings: async (context, signal) => { store.assertMember(context.conversationId, context.principalId); await automaticBrowsers.refresh(context.principalId, context.conversationId, context.execute, () => { try {
|
|
271
273
|
store.assertMember(context.conversationId, context.principalId);
|
|
@@ -321,7 +323,9 @@ class AgentOrchestrationRuntime {
|
|
|
321
323
|
return false;
|
|
322
324
|
} }
|
|
323
325
|
}) }));
|
|
324
|
-
|
|
326
|
+
// Isolate mode (#609) is default-deny: one browser profile and one computer serve
|
|
327
|
+
// every conversation, so neither is offered to an isolated agent.
|
|
328
|
+
const computerAllowed = () => !agent.isolateMemory && (0, jev_gateway_1.computerDecisions)(gateway, agent) !== undefined;
|
|
325
329
|
gatewayAdapters.set('computer', new computer_1.ComputerTaskAdapter({ agentId: agent.id, root: (0, path_1.join)(root, 'computer-requests'), connectors: new computer_connector_1.ComputerConnectors(gateway, agent), allowed: computerAllowed,
|
|
326
330
|
stepMode: () => gateway.gateway.jev?.features?.computerSteps?.enabled === true, settled: () => gatewayTick.run(),
|
|
327
331
|
userSteps,
|
|
@@ -364,7 +368,7 @@ class AgentOrchestrationRuntime {
|
|
|
364
368
|
bridge.computerEnabled = computerAllowed;
|
|
365
369
|
bridge.models = () => (0, model_registry_1.selectableModels)(gateway.gateway.models);
|
|
366
370
|
bridge.jevEnabled = () => (0, jev_gateway_1.jevAllowed)(gateway, agent);
|
|
367
|
-
bridge.browserEnabled = () => Boolean(gateway.gateway.jev?.browser) && (0, jev_gateway_1.jevAllowed)(gateway, agent) && gateway.gateway.jev?.features?.browserTasks?.enabled === true;
|
|
371
|
+
bridge.browserEnabled = () => !agent.isolateMemory && Boolean(gateway.gateway.jev?.browser) && (0, jev_gateway_1.jevAllowed)(gateway, agent) && gateway.gateway.jev?.features?.browserTasks?.enabled === true;
|
|
368
372
|
bridge.jevCall = async (scope, args, actionId, signal) => {
|
|
369
373
|
const current = scope.role === 'worker' ? files.scope(scope.attemptId, scope.generation) : undefined;
|
|
370
374
|
const conversation = scope.role === 'agent' ? store.assertMember(scope.context.conversationId, scope.context.principalId) : current.conversation;
|
|
@@ -393,6 +397,7 @@ class AgentOrchestrationRuntime {
|
|
|
393
397
|
const sharedRetention = (0, knowledge_1.resolveSharedConfig)(agent.knowledge?.shared, gateway.gateway.knowledge?.shared).staleness;
|
|
394
398
|
bridge.recordRetrievals = (personalRetention.enabled && personalRetention.recordRetrievals) || (sharedRetention.enabled && sharedRetention.recordRetrievals);
|
|
395
399
|
bridge.isolateMemory = files.isolateMemory = () => Boolean(agent.isolateMemory);
|
|
400
|
+
bridge.disableArchive = () => Boolean(agent.disableArchive);
|
|
396
401
|
let admissionStore;
|
|
397
402
|
try {
|
|
398
403
|
(0, recovery_1.recoverOrchestration)(store);
|
|
@@ -677,6 +682,11 @@ class AgentOrchestrationRuntime {
|
|
|
677
682
|
this.store.appendEvent(String(conversation.id), 'session.context_reset', { sessionId, historyLimit: 50 });
|
|
678
683
|
});
|
|
679
684
|
}
|
|
685
|
+
/** The container a conversation's Claude Code transcript lives in: its own sandbox
|
|
686
|
+
* for an isolated app agent (#609), whose HOME no other conversation shares. */
|
|
687
|
+
executionAgent(source, chatId, sessionId) {
|
|
688
|
+
return (0, conversation_sandbox_1.usesConversationSandbox)(this.agent) ? (0, conversation_sandbox_1.sandboxedAgent)(this.agent, { source, chatId, sessionId }) : Promise.resolve(this.agent);
|
|
689
|
+
}
|
|
680
690
|
/** An exclusive maintenance operation on the existing CLI transcript, not a chat summary. */
|
|
681
691
|
compactSession(sessionId, model) {
|
|
682
692
|
if (this.closing || this.draining)
|
|
@@ -694,7 +704,7 @@ class AgentOrchestrationRuntime {
|
|
|
694
704
|
let revoke;
|
|
695
705
|
try {
|
|
696
706
|
const cli = this.agent.type === 'app-agent'
|
|
697
|
-
? await this.cliSessions.resolveContainer(sessionId, this.
|
|
707
|
+
? await this.cliSessions.resolveContainer(sessionId, await this.executionAgent(String(conversation.source), String(conversation.chat_id), sessionId), true)
|
|
698
708
|
: this.cliSessions.resolve(sessionId, this.agent.workspace, true);
|
|
699
709
|
if (!cli.resume || cli.id !== stored.cli_session_id)
|
|
700
710
|
throw new types_2.OrchestrationError('NO_CLI_SESSION', 'The previous Claude Code transcript is unavailable. Chat history was not changed.');
|
|
@@ -1392,6 +1402,9 @@ class AgentOrchestrationRuntime {
|
|
|
1392
1402
|
// Retries and an incomplete credit check that still let the note through are traceable by reference.
|
|
1393
1403
|
this.voiceLog('info', 'Voice note diagnostic', { ...trace, ...event });
|
|
1394
1404
|
} });
|
|
1405
|
+
// Whatever transcribed it, a note without words is never sent to the agent as the user's message.
|
|
1406
|
+
if (!(0, types_1.hasSpokenWords)(text))
|
|
1407
|
+
throw new types_2.OrchestrationError('VOICE_NOTE_NO_TRANSCRIPT');
|
|
1395
1408
|
this.store.run("UPDATE voice_note_transcripts SET state='completed',text=? WHERE input_id=?", text, receipt.inputId);
|
|
1396
1409
|
}
|
|
1397
1410
|
catch (error) {
|
|
@@ -1435,7 +1448,7 @@ class AgentOrchestrationRuntime {
|
|
|
1435
1448
|
if (preparedRefs.length)
|
|
1436
1449
|
input = { ...input, attachmentIds: [...new Set([...(input.attachmentIds ?? []), ...preparedRefs])] };
|
|
1437
1450
|
const cliSession = this.agent.type === 'app-agent'
|
|
1438
|
-
? await this.cliSessions.resolveContainer(sessionId, this.
|
|
1451
|
+
? await this.cliSessions.resolveContainer(sessionId, await this.executionAgent(input.scope.source, input.scope.chatId, sessionId))
|
|
1439
1452
|
: this.cliSessions.resolve(sessionId, this.agent.workspace);
|
|
1440
1453
|
const contextPlan = this.contextDelivery.begin({ conversationId: receipt.conversationId,
|
|
1441
1454
|
principalId: input.scope.principalId, bindingId: String(admitted.binding_id),
|
|
@@ -1721,7 +1734,7 @@ class AgentOrchestrationRuntime {
|
|
|
1721
1734
|
if (cliSession.resume && this.agent.type !== 'app-agent')
|
|
1722
1735
|
transcriptCheckpoint = await (0, transcript_checkpoint_1.checkpointTranscript)((0, claude_settings_1.transcriptPath)(this.agent.workspace, cliSession.id));
|
|
1723
1736
|
if (cliSession.resume && this.agent.type === 'app-agent')
|
|
1724
|
-
restoreContainerTranscript = await (0, agent_cli_session_1.containerTranscriptCheckpoint)(this.
|
|
1737
|
+
restoreContainerTranscript = await (0, agent_cli_session_1.containerTranscriptCheckpoint)((await this.executionAgent(input.scope.source, input.scope.chatId, sessionId)).container, cliSession.id);
|
|
1725
1738
|
if (cliSession.fallback) {
|
|
1726
1739
|
// No silent failure: a session we had already started could not be continued, so this
|
|
1727
1740
|
// turn re-seeds history and pays a cache write. Record why before it happens.
|
|
@@ -1733,7 +1746,10 @@ class AgentOrchestrationRuntime {
|
|
|
1733
1746
|
}
|
|
1734
1747
|
ticket.profile.excludedHistoryOperationIds = this.store.all(`SELECT r.id FROM assistant_responses r
|
|
1735
1748
|
JOIN conversation_decisions d ON d.id=r.decision_id WHERE d.session_id=? AND r.state='failed'`, sessionId)
|
|
1736
|
-
.map(row => `response:${row.id}`)
|
|
1749
|
+
.map(row => `response:${row.id}`)
|
|
1750
|
+
// This turn's own inputs are already persisted, and the prompt delivers them as the current
|
|
1751
|
+
// message; seeding them too would end the history on an unanswered user turn.
|
|
1752
|
+
.concat(decision.inputIds.map(id => `input:${id}`));
|
|
1737
1753
|
ticket.profile.responseId = decision.responseId;
|
|
1738
1754
|
agentSession = await this.host.createAgentSession(sessionId, ticket.profile, options.model, input.scope);
|
|
1739
1755
|
options.onMark?.('process_spawned');
|
|
@@ -2041,6 +2057,15 @@ class AgentOrchestrationRuntime {
|
|
|
2041
2057
|
surfaces.spoken = '';
|
|
2042
2058
|
this.store.transaction(() => this.store.appendEvent(receipt.conversationId, 'response.dispatch_unresolved', { responseId: decision.responseId, inputId: receipt.inputId }));
|
|
2043
2059
|
}
|
|
2060
|
+
// A report turn cannot start or re-run work (#605). A reply that says it will, with nothing
|
|
2061
|
+
// committed or queued to do it, would leave the user waiting for work that never runs.
|
|
2062
|
+
if (active.notification && !capabilities.execute && !review && !controlSilent && !response.interrupted &&
|
|
2063
|
+
!dispatchCommitted && (0, report_promise_1.promisesWork)(surfaces.display) && !(0, report_promise_1.workPending)(this.store, receipt.conversationId)) {
|
|
2064
|
+
surfaces.display = `${surfaces.display}\n\n${(0, report_promise_1.unbackedPromiseNote)(surfaces.display)}`;
|
|
2065
|
+
if (surfaces.spoken)
|
|
2066
|
+
surfaces.spoken = `${surfaces.spoken} ${(0, report_promise_1.unbackedPromiseNote)(surfaces.spoken)}`;
|
|
2067
|
+
this.store.transaction(() => this.store.appendEvent(receipt.conversationId, 'response.unbacked_promise', { responseId: decision.responseId }));
|
|
2068
|
+
}
|
|
2044
2069
|
const intakeSilent = !recoveryFailed && semantic && !uncommittedDispatch && (intakeChoice?.mode === 'wait' || intakeDeferred || (acknowledgementId && unresolved?.deferredDispatch && !dispatchCommitted) || (acknowledgementId && this.store.get("SELECT action_id FROM task_commands WHERE decision_id=? AND command_type IN ('spawn','update','answer') LIMIT 1", decision.decisionId)));
|
|
2045
2070
|
if (intakeSilent) {
|
|
2046
2071
|
// A receipt/preparation turn has not reported older task results. Keep
|