maka-agent 0.2.0-dev.47.20260922 → 0.2.0-dev.48.20260923

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.
Files changed (92) hide show
  1. package/dist/runtime-host-capability-provider-command.js +25 -6
  2. package/dist/tui-mcp-control.js +37 -24
  3. package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
  4. package/node_modules/@maka/acp-executor-plugin/dist/acp-errors.js +26 -0
  5. package/node_modules/@maka/acp-executor-plugin/dist/acp-filesystem.js +103 -0
  6. package/node_modules/@maka/acp-executor-plugin/dist/acp-process.js +119 -0
  7. package/node_modules/@maka/acp-executor-plugin/dist/acp-projection.js +146 -0
  8. package/node_modules/@maka/acp-executor-plugin/dist/index.js +653 -0
  9. package/node_modules/@maka/acp-executor-plugin/dist/plugin.mjs +24446 -0
  10. package/node_modules/@maka/acp-executor-plugin/package.json +15 -0
  11. package/node_modules/@maka/antigravity-acp-plugin/dist/index.js +88 -0
  12. package/node_modules/@maka/antigravity-acp-plugin/dist/model-presentation.js +53 -0
  13. package/node_modules/@maka/antigravity-acp-plugin/dist/plugin.mjs +115 -0
  14. package/node_modules/@maka/antigravity-acp-plugin/package.json +15 -0
  15. package/node_modules/@maka/core/dist/executor-catalog.js +106 -0
  16. package/node_modules/@maka/core/dist/mcp.js +4 -1
  17. package/node_modules/@maka/core/dist/model-metadata.js +28 -1
  18. package/node_modules/@maka/core/dist/runtime-event-store.js +25 -0
  19. package/node_modules/@maka/core/dist/runtime-invocation.js +5 -0
  20. package/node_modules/@maka/core/dist/runtime-policy/credential-vault-codec.js +6 -0
  21. package/node_modules/@maka/core/dist/runtime-policy/policy-codec.js +21 -0
  22. package/node_modules/@maka/core/dist/session.js +2 -0
  23. package/node_modules/@maka/core/dist/settings.js +1 -0
  24. package/node_modules/@maka/core/dist/tool-ledger-scanner.js +365 -104
  25. package/node_modules/@maka/core/dist/turn-origin.js +14 -0
  26. package/node_modules/@maka/core/package.json +2 -0
  27. package/node_modules/@maka/mcp/dist/credential-coordinator.js +6 -1
  28. package/node_modules/@maka/mcp/dist/index.js +31 -5
  29. package/node_modules/@maka/mcp/dist/oauth.js +54 -6
  30. package/node_modules/@maka/runtime/dist/agent-run-inspect.js +1 -1
  31. package/node_modules/@maka/runtime/dist/conversation-copy.js +56 -1
  32. package/node_modules/@maka/runtime/dist/mcp-tools.js +9 -2
  33. package/node_modules/@maka/runtime/dist/plugin-executor-backend.js +116 -3
  34. package/node_modules/@maka/runtime/dist/plugin-executor-service.js +212 -16
  35. package/node_modules/@maka/runtime/dist/runtime-ledger-repair.js +2 -2
  36. package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +3 -0
  37. package/node_modules/@maka/runtime/dist/session-manager.js +170 -125
  38. package/node_modules/@maka/runtime/dist/shell-run-manager.js +3 -0
  39. package/node_modules/@maka/runtime/dist/stream-graph-coordinator.js +29 -4
  40. package/node_modules/@maka/runtime-host/dist/candidate-entry.js +8 -5
  41. package/node_modules/@maka/runtime-host/dist/client/index.js +1 -1
  42. package/node_modules/@maka/runtime-host/dist/client/reconnect-lifecycle.js +8 -1
  43. package/node_modules/@maka/runtime-host/dist/client/session-catalog-summary.js +6 -1
  44. package/node_modules/@maka/runtime-host/dist/composition-identity.js +19 -0
  45. package/node_modules/@maka/runtime-host/dist/protocol/index.js +10 -2
  46. package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +34 -0
  47. package/node_modules/@maka/runtime-host/dist/protocol/session-catalog.js +40 -2
  48. package/node_modules/@maka/runtime-host/dist/server/builtin-external-agent-plugins.js +188 -0
  49. package/node_modules/@maka/runtime-host/dist/server/candidate.js +12 -7
  50. package/node_modules/@maka/runtime-host/dist/server/client-capability-recovery.js +44 -46
  51. package/node_modules/@maka/runtime-host/dist/server/context-coordinator.js +2 -0
  52. package/node_modules/@maka/runtime-host/dist/server/execution-composition-factory.js +1 -1
  53. package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +159 -19
  54. package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +3 -0
  55. package/node_modules/@maka/runtime-host/dist/server/extension-bundle.js +4 -0
  56. package/node_modules/@maka/runtime-host/dist/server/host-composition-source.js +47 -0
  57. package/node_modules/@maka/runtime-host/dist/server/host-composition.js +1 -29
  58. package/node_modules/@maka/runtime-host/dist/server/host-kernel.js +2 -9
  59. package/node_modules/@maka/runtime-host/dist/server/hosted-execution-recovery.js +75 -9
  60. package/node_modules/@maka/runtime-host/dist/server/hosted-execution-tool-profile.js +4 -0
  61. package/node_modules/@maka/runtime-host/dist/server/interaction-coordinator.js +45 -0
  62. package/node_modules/@maka/runtime-host/dist/server/jev-routing-model.js +157 -0
  63. package/node_modules/@maka/runtime-host/dist/server/listener-set.js +2 -2
  64. package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +4 -0
  65. package/node_modules/@maka/runtime-host/dist/server/plugin-platform-coordinator.js +11 -1
  66. package/node_modules/@maka/runtime-host/dist/server/process-lifecycle.js +1 -1
  67. package/node_modules/@maka/runtime-host/dist/server/process-termination-error.js +27 -0
  68. package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +91 -12
  69. package/node_modules/@maka/runtime-host/dist/server/runtime-policy-coordinator.js +2 -0
  70. package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +99 -12
  71. package/node_modules/@maka/runtime-host/dist/server/session-effect-coordinator.js +12 -6
  72. package/node_modules/@maka/runtime-host/dist/server/session-transcript-reader.js +33 -0
  73. package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +4 -0
  74. package/node_modules/@maka/runtime-host/dist/server/workhub-result-coordinator.js +173 -0
  75. package/node_modules/@maka/runtime-host/dist/server/workhub-result-runtime.js +293 -0
  76. package/node_modules/@maka/runtime-host/package.json +2 -0
  77. package/node_modules/@maka/storage/dist/agent-run-store-contract.js +8 -0
  78. package/node_modules/@maka/storage/dist/execution-stores.js +15 -3
  79. package/node_modules/@maka/storage/dist/mcp-config-store.js +91 -2
  80. package/node_modules/@maka/storage/dist/operational-state-store.js +15 -1
  81. package/node_modules/@maka/storage/dist/plan-authority.js +2 -0
  82. package/node_modules/@maka/storage/dist/plan-store.js +30 -0
  83. package/node_modules/@maka/storage/dist/runtime-event-persistence.js +1 -0
  84. package/node_modules/@maka/storage/dist/runtime-policy/credential-vault-document.js +4 -1
  85. package/node_modules/@maka/storage/dist/runtime-policy/policy-document.js +2 -0
  86. package/node_modules/@maka/storage/dist/session-store-values.js +16 -4
  87. package/node_modules/@maka/storage/dist/shell-run-authority.js +1 -0
  88. package/node_modules/@maka/storage/dist/shell-run-store.js +15 -0
  89. package/node_modules/@maka/storage/dist/sqlite-runtime-schema.js +74 -1
  90. package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +724 -84
  91. package/node_modules/@maka/storage/dist/sqlite-session-metadata-store.js +16 -0
  92. package/package.json +1 -1
@@ -16,6 +16,7 @@
16
16
  * specific language governing permissions and limitations
17
17
  * under the License.
18
18
  */
19
+ import { normalizeCatalogEntry } from '@maka/core/executor-catalog';
19
20
  import { validateCompositionEntry, validatePluginRootId, } from '@maka/runtime/plugin-runtime';
20
21
  import { requireCount, requireEncodedByteLimit, requireExactRecord, requireId, requireRecord, requireShapedRecord, requireString, } from './codec.js';
21
22
  import { invalidProtocolFrame } from './errors.js';
@@ -85,6 +86,39 @@ export const PLUGIN_PLATFORM_OPERATION_SPECS = {
85
86
  decodeInput: decodePluginClientRemoteStreamCursorInput,
86
87
  decodeOutput: decodePluginClientRemoteStreamCloseResult,
87
88
  }),
89
+ 'plugin.executor.query': defineOperation({
90
+ mode: 'query',
91
+ availability: 'ready',
92
+ errors: QUERY_ERRORS,
93
+ decodeInput: (value) => {
94
+ const record = requireRecord(value, 'Executor query');
95
+ if (record.kind === 'catalog') {
96
+ const input = requireExactRecord(record, 'Executor catalog', ['kind', 'cwd']);
97
+ return { kind: 'catalog', cwd: requireString(input.cwd, 'cwd', 4096) };
98
+ }
99
+ const input = requireExactRecord(record, 'Executor conversation', ['kind', 'sessionId']);
100
+ if (input.kind !== 'conversation')
101
+ throw invalidProtocolFrame('Invalid executor query');
102
+ return { kind: 'conversation', sessionId: requireId(input.sessionId, 'sessionId') };
103
+ },
104
+ decodeOutput: (value) => {
105
+ requireEncodedByteLimit(value, 'Executor catalog', MAX_FRAME_BYTES);
106
+ const output = requireExactRecord(value, 'Executor catalog result', ['items']);
107
+ if (!Array.isArray(output.items) || output.items.length > 256)
108
+ throw invalidProtocolFrame('Invalid executor catalog');
109
+ return {
110
+ items: output.items.map((entry) => {
111
+ const record = requireRecord(entry, 'Executor catalog entry');
112
+ try {
113
+ return normalizeCatalogEntry(record, requireString(record.id, 'executor id', 256));
114
+ }
115
+ catch {
116
+ throw invalidProtocolFrame('Invalid executor catalog entry');
117
+ }
118
+ }),
119
+ };
120
+ },
121
+ }),
88
122
  'plugin.platform.query': defineOperation({
89
123
  mode: 'query',
90
124
  availability: 'ready',
@@ -16,6 +16,7 @@
16
16
  * specific language governing permissions and limitations
17
17
  * under the License.
18
18
  */
19
+ import { isExecutorConfiguration } from '@maka/core/executor-catalog';
19
20
  import { isCollaborationMode } from '@maka/core/collaboration';
20
21
  import { isOrchestrationMode } from '@maka/core/orchestration';
21
22
  import { isPermissionMode } from '@maka/core/permission';
@@ -94,6 +95,7 @@ const PROJECTION_FIELDS = [
94
95
  'revisionIndex',
95
96
  'revisionState',
96
97
  'executorId',
98
+ 'executorConfig',
97
99
  'thinkingLevel',
98
100
  'lastReadMessageId',
99
101
  'liveRunState',
@@ -252,6 +254,7 @@ export function decodeSessionCreateInput(value) {
252
254
  'modelTarget',
253
255
  'executorId',
254
256
  'executorModel',
257
+ 'executorConfig',
255
258
  'thinkingLevel',
256
259
  'toolProfile',
257
260
  'permissionMode',
@@ -261,6 +264,9 @@ export function decodeSessionCreateInput(value) {
261
264
  const executorId = Object.hasOwn(input, 'executorId')
262
265
  ? executorIdValue(input.executorId)
263
266
  : undefined;
267
+ if (input.executorConfig !== undefined &&
268
+ (!executorId || !isExecutorConfiguration(input.executorConfig)))
269
+ throw invalidProtocolFrame('Invalid executor configuration');
264
270
  const target = Object.hasOwn(input, 'modelTarget') ? modelTarget(input.modelTarget) : undefined;
265
271
  const executorModel = Object.hasOwn(input, 'executorModel')
266
272
  ? requireUtf8String(input.executorModel, 'Executor model', SESSION_CATALOG_MODEL_MAX_BYTES)
@@ -268,6 +274,11 @@ export function decodeSessionCreateInput(value) {
268
274
  if ((executorId === undefined) === (target === undefined)) {
269
275
  throw invalidProtocolFrame('Session creation requires exactly one model target or executor id');
270
276
  }
277
+ if (executorModel !== undefined &&
278
+ input.executorConfig?.model !== undefined &&
279
+ executorModel !== input.executorConfig.model) {
280
+ throw invalidProtocolFrame('Conflicting executor models');
281
+ }
271
282
  if (executorModel !== undefined && executorId === undefined) {
272
283
  throw invalidProtocolFrame('Executor model requires an executor id');
273
284
  }
@@ -280,6 +291,14 @@ export function decodeSessionCreateInput(value) {
280
291
  ...(target ? { modelTarget: target } : {}),
281
292
  ...(executorId ? { executorId } : {}),
282
293
  ...(executorModel ? { executorModel } : {}),
294
+ ...(executorId
295
+ ? {
296
+ executorId,
297
+ ...(input.executorConfig
298
+ ? { executorConfig: input.executorConfig }
299
+ : {}),
300
+ }
301
+ : {}),
283
302
  ...(Object.hasOwn(input, 'thinkingLevel')
284
303
  ? { thinkingLevel: input.thinkingLevel === null ? null : thinkingLevel(input.thinkingLevel) }
285
304
  : {}),
@@ -336,6 +355,7 @@ export function decodeSessionConfigurationUpdateInput(value) {
336
355
  'patch',
337
356
  ]);
338
357
  const patch = requireShapedRecord(input.patch, 'Session configuration patch', [], [
358
+ 'executorConfig',
339
359
  'modelTarget',
340
360
  'executorTarget',
341
361
  'thinkingLevel',
@@ -343,6 +363,11 @@ export function decodeSessionConfigurationUpdateInput(value) {
343
363
  'collaborationMode',
344
364
  'orchestrationMode',
345
365
  ]);
366
+ if (patch.executorConfig !== undefined &&
367
+ (!isExecutorConfiguration(patch.executorConfig) ||
368
+ patch.modelTarget !== undefined ||
369
+ patch.executorTarget !== undefined))
370
+ throw invalidProtocolFrame('Invalid executor configuration');
346
371
  if (Object.keys(patch).length === 0) {
347
372
  throw invalidProtocolFrame('Session configuration patch is empty');
348
373
  }
@@ -353,6 +378,9 @@ export function decodeSessionConfigurationUpdateInput(value) {
353
378
  sessionId: requireEntityId(input.sessionId, 'sessionId'),
354
379
  expectedRevision: positiveRevision(input.expectedRevision, 'expected Session revision'),
355
380
  patch: {
381
+ ...(patch.executorConfig
382
+ ? { executorConfig: patch.executorConfig }
383
+ : {}),
356
384
  ...(Object.hasOwn(patch, 'modelTarget')
357
385
  ? { modelTarget: explicitModelTarget(patch.modelTarget) }
358
386
  : {}),
@@ -692,9 +720,19 @@ function executorTarget(value) {
692
720
  };
693
721
  }
694
722
  function optionalExecutorId(record) {
695
- if (record.executorId === undefined)
723
+ if (record.executorId === undefined) {
724
+ if (record.executorConfig !== undefined)
725
+ throw invalidProtocolFrame('Executor configuration requires an executor');
696
726
  return {};
697
- return { executorId: executorIdValue(record.executorId) };
727
+ }
728
+ if (record.executorConfig !== undefined && !isExecutorConfiguration(record.executorConfig))
729
+ throw invalidProtocolFrame('Invalid executor configuration');
730
+ return {
731
+ executorId: executorIdValue(record.executorId),
732
+ ...(record.executorConfig
733
+ ? { executorConfig: record.executorConfig }
734
+ : {}),
735
+ };
698
736
  }
699
737
  function thinkingLevel(value) {
700
738
  if (!isThinkingLevel(value))
@@ -0,0 +1,188 @@
1
+ /*
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+ import { copyFile, mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises';
20
+ import { join } from 'node:path';
21
+ import { fileURLToPath } from 'node:url';
22
+ import { extensionPackageDirectoryContentDigest } from './extension-bundle.js';
23
+ const ACP_RUNTIME_PACKAGE_ID = 'acp-executor';
24
+ const ACP_RUNTIME_ENTRY_ID = 'acp-runtime';
25
+ const ANTIGRAVITY_PACKAGE_ID = 'antigravity-acp';
26
+ const ANTIGRAVITY_ENTRY_ID = 'antigravity-acp';
27
+ const STAGING_DIRECTORY = 'builtin-plugin-staging-v1';
28
+ const RUNTIME_ENTRY = 'plugin.mjs';
29
+ const COMPOSITION_PATCH = 'maka.composition.json';
30
+ // Built-in setup entries remain discoverable before their Plugin is installed.
31
+ // Registered Plugins replace these placeholders with their live catalogs.
32
+ const BUILTIN_EXTERNAL_AGENT_CATALOG = Object.freeze([
33
+ Object.freeze({
34
+ id: ANTIGRAVITY_ENTRY_ID,
35
+ displayName: 'Antigravity',
36
+ readiness: 'unavailable',
37
+ models: Object.freeze([]),
38
+ supportsAttachments: false,
39
+ supportsModelChange: false,
40
+ }),
41
+ ]);
42
+ export function withBuiltinExternalAgentCatalog(catalog) {
43
+ const registered = new Set(catalog.map((entry) => entry.id));
44
+ return [
45
+ ...catalog,
46
+ ...BUILTIN_EXTERNAL_AGENT_CATALOG.filter((entry) => !registered.has(entry.id)),
47
+ ];
48
+ }
49
+ /**
50
+ * Projects durable product settings into reserved Plugin packages and Entries.
51
+ *
52
+ * RuntimePolicy remains the owner of setup facts. The generated package layer
53
+ * is replaceable derived state, so adapter code never reads RuntimePolicy and
54
+ * repeated reconciliation does not append unbounded user composition overlays.
55
+ */
56
+ export class HostBuiltinExternalAgentPluginCoordinator {
57
+ #platform;
58
+ #controlDirectory;
59
+ #readPolicy;
60
+ #entries;
61
+ #gate = Promise.resolve();
62
+ constructor(input) {
63
+ this.#platform = input.platform;
64
+ this.#controlDirectory = input.controlDirectory;
65
+ this.#readPolicy = input.readPolicy;
66
+ this.#entries = input.entries ?? resolveBuiltinExternalAgentPluginEntries();
67
+ }
68
+ async recover() {
69
+ await rm(join(this.#controlDirectory, STAGING_DIRECTORY), { recursive: true, force: true });
70
+ return await this.reconcile();
71
+ }
72
+ reconcile() {
73
+ const task = this.#gate.then(() => this.#reconcileNow());
74
+ this.#gate = task.catch(() => undefined);
75
+ return task;
76
+ }
77
+ async #reconcileNow() {
78
+ const executable = (await this.#readPolicy()).policy.externalAgents.antigravity.executable;
79
+ if (!executable) {
80
+ await this.#removeIfInstalled(ANTIGRAVITY_PACKAGE_ID);
81
+ await this.#removeIfInstalled(ACP_RUNTIME_PACKAGE_ID);
82
+ return;
83
+ }
84
+ await this.#ensurePackage(ACP_RUNTIME_PACKAGE_ID, this.#entries.acpRuntime, acpRuntimeManifest(), [
85
+ {
86
+ type: 'insert',
87
+ rootId: 'profile',
88
+ entry: {
89
+ id: ACP_RUNTIME_ENTRY_ID,
90
+ packageId: ACP_RUNTIME_PACKAGE_ID,
91
+ isolate: { acp: true },
92
+ },
93
+ },
94
+ ]);
95
+ await this.#ensurePackage(ANTIGRAVITY_PACKAGE_ID, this.#entries.antigravity, antigravityManifest(), [
96
+ {
97
+ type: 'insert',
98
+ parentId: ACP_RUNTIME_ENTRY_ID,
99
+ entry: {
100
+ id: ANTIGRAVITY_ENTRY_ID,
101
+ packageId: ANTIGRAVITY_PACKAGE_ID,
102
+ config: { executable },
103
+ },
104
+ },
105
+ ]);
106
+ }
107
+ async #ensurePackage(extensionId, runtimeEntry, manifest, operations) {
108
+ const staged = await stagePackage(this.#controlDirectory, runtimeEntry, manifest, operations);
109
+ try {
110
+ const installed = (await this.#platform.packageProjections()).find((candidate) => candidate.extensionId === extensionId);
111
+ if (installed?.contentDigest === staged.digest)
112
+ return;
113
+ await this.#platform.installPackage(staged.root);
114
+ }
115
+ finally {
116
+ await staged.dispose();
117
+ }
118
+ }
119
+ async #removeIfInstalled(extensionId) {
120
+ const installed = (await this.#platform.packageProjections()).some((candidate) => candidate.extensionId === extensionId);
121
+ if (installed)
122
+ await this.#platform.uninstallPackage(extensionId);
123
+ }
124
+ }
125
+ export function resolveBuiltinExternalAgentPluginEntries() {
126
+ return Object.freeze({
127
+ acpRuntime: fileURLToPath(import.meta.resolve('@maka/acp-executor-plugin/plugin')),
128
+ antigravity: fileURLToPath(import.meta.resolve('@maka/antigravity-acp-plugin/plugin')),
129
+ });
130
+ }
131
+ async function stagePackage(controlDirectory, runtimeEntry, manifest, operations) {
132
+ const stagingRoot = join(controlDirectory, STAGING_DIRECTORY);
133
+ await mkdir(stagingRoot, { recursive: true, mode: 0o700 });
134
+ const root = await mkdtemp(join(stagingRoot, '.package-'));
135
+ try {
136
+ await copyFile(runtimeEntry, join(root, RUNTIME_ENTRY));
137
+ await writeFile(join(root, 'maka.extension.json'), `${JSON.stringify(manifest, null, 2)}\n`, {
138
+ mode: 0o600,
139
+ });
140
+ await writeFile(join(root, COMPOSITION_PATCH), `${JSON.stringify(operations, null, 2)}\n`, {
141
+ mode: 0o600,
142
+ });
143
+ return Object.freeze({
144
+ root,
145
+ digest: await extensionPackageDirectoryContentDigest(root),
146
+ dispose: () => rm(root, { recursive: true, force: true }),
147
+ });
148
+ }
149
+ catch (error) {
150
+ await rm(root, { recursive: true, force: true }).catch(() => undefined);
151
+ throw error;
152
+ }
153
+ }
154
+ function acpRuntimeManifest() {
155
+ return Object.freeze({
156
+ schemaVersion: 1,
157
+ id: ACP_RUNTIME_PACKAGE_ID,
158
+ displayName: 'ACP Executor Runtime',
159
+ description: 'Shared ACP protocol and process runtime for external Agent adapter plugins.',
160
+ dependencies: Object.freeze([]),
161
+ configuration: Object.freeze({ properties: Object.freeze({}), required: Object.freeze([]) }),
162
+ runtime: Object.freeze({ entry: RUNTIME_ENTRY }),
163
+ composition: Object.freeze({
164
+ patch: COMPOSITION_PATCH,
165
+ structuralDependencies: Object.freeze([]),
166
+ }),
167
+ });
168
+ }
169
+ function antigravityManifest() {
170
+ return Object.freeze({
171
+ schemaVersion: 1,
172
+ id: ANTIGRAVITY_PACKAGE_ID,
173
+ displayName: 'Antigravity ACP',
174
+ description: 'Runs Google Antigravity as an external Agent through ACP.',
175
+ dependencies: Object.freeze([{ id: ACP_RUNTIME_PACKAGE_ID }]),
176
+ configuration: Object.freeze({
177
+ properties: Object.freeze({
178
+ executable: Object.freeze({ type: 'string', title: 'ACP executable' }),
179
+ }),
180
+ required: Object.freeze(['executable']),
181
+ }),
182
+ runtime: Object.freeze({ entry: RUNTIME_ENTRY }),
183
+ composition: Object.freeze({
184
+ patch: COMPOSITION_PATCH,
185
+ structuralDependencies: Object.freeze([ACP_RUNTIME_PACKAGE_ID]),
186
+ }),
187
+ });
188
+ }
@@ -18,10 +18,8 @@
18
18
  */
19
19
  import { resolveExistingStorageRoot } from '@maka/storage/root-authority';
20
20
  import { currentRuntimeHostProcessLaunch, tryAcquireRuntimeHostLaunch, } from '../operator/managed-deployment.js';
21
- import { RuntimeHostKernel } from './host-kernel.js';
22
- import { openRuntimeHostAccessAuthority } from './access-authority.js';
23
- import { startRuntimeHostAuthenticatedListenerSet } from './listener-set.js';
24
21
  export async function startInteractiveRuntimeHostCandidate(options, createComposition, dependencies = {}) {
22
+ const kernelModule = import('./host-kernel.js').then((module) => ({ kind: 'loaded', module }), (error) => ({ kind: 'failed', error }));
25
23
  const capability = await resolveExistingStorageRoot({
26
24
  path: options.rootPath,
27
25
  kind: 'interactive',
@@ -37,9 +35,13 @@ export async function startInteractiveRuntimeHostCandidate(options, createCompos
37
35
  const { owner, managedConfig } = ownership;
38
36
  try {
39
37
  const composition = await createComposition(managedConfig);
38
+ const loadedKernel = await kernelModule;
39
+ if (loadedKernel.kind === 'failed')
40
+ throw loadedKernel.error;
41
+ const { RuntimeHostKernel } = loadedKernel.module;
40
42
  const websocket = managedConfig?.listeners.websocket;
41
43
  const accessAuthority = websocket
42
- ? await openRuntimeHostAccessAuthority(owner.controlDirectory)
44
+ ? await import('./access-authority.js').then(({ openRuntimeHostAccessAuthority }) => openRuntimeHostAccessAuthority(owner.controlDirectory))
43
45
  : undefined;
44
46
  const host = await RuntimeHostKernel.start({
45
47
  owner,
@@ -55,9 +57,12 @@ export async function startInteractiveRuntimeHostCandidate(options, createCompos
55
57
  ...(accessAuthority ? { accessAuthority } : {}),
56
58
  ...(websocket && accessAuthority
57
59
  ? {
58
- listenerSetFactory: (input) => startRuntimeHostAuthenticatedListenerSet(input, {
59
- websocket: { ...websocket, accessAuthority },
60
- }),
60
+ listenerSetFactory: async (input) => {
61
+ const { startRuntimeHostAuthenticatedListenerSet } = await import('./listener-set.js');
62
+ return startRuntimeHostAuthenticatedListenerSet(input, {
63
+ websocket: { ...websocket, accessAuthority },
64
+ });
65
+ },
61
66
  }
62
67
  : {}),
63
68
  });
@@ -20,53 +20,51 @@ import { compatibilityToolResultProjection } from '@maka/runtime/durable-tool-re
20
20
  const OUTCOME_UNKNOWN_TEXT = 'outcome_unknown: the Host restarted after dispatching this Client Capability call. The client-side effect may have happened; do not retry it automatically.';
21
21
  export async function recoverClientCapabilityOutcomes(store, sessionIds, now = Date.now) {
22
22
  let recovered = 0;
23
- for (const sessionId of sessionIds) {
24
- const operations = await store.listUnsettledToolOperations(sessionId);
25
- for (const operation of operations) {
26
- if (operation.recoveryMode !== 'outcome_unknown')
27
- continue;
28
- const ts = now();
29
- const result = {
30
- kind: 'text',
31
- text: OUTCOME_UNKNOWN_TEXT,
32
- uncertainOutcome: {
33
- code: 'outcome_unknown',
34
- retrySafe: false,
35
- },
36
- };
37
- const responseContent = {
38
- kind: 'function_response',
39
- id: operation.providerToolCallId,
40
- name: operation.toolName,
41
- result,
42
- isError: true,
43
- };
44
- const modelProjection = compatibilityToolResultProjection(responseContent, sessionId);
45
- const runtimeEvent = {
46
- id: `${operation.operationId}_response`,
47
- invocationId: operation.invocationId,
48
- runId: operation.runId,
49
- sessionId,
50
- turnId: operation.turnId,
51
- ts,
52
- partial: false,
53
- role: 'tool',
54
- author: 'tool',
55
- content: { ...responseContent, ...(modelProjection ? { modelProjection } : {}) },
56
- refs: {
57
- operationId: operation.operationId,
58
- toolCallId: operation.providerToolCallId,
59
- },
60
- };
61
- const committed = await store.commitToolOutcome({
23
+ const operations = await store.listUnsettledToolOperations(sessionIds);
24
+ for (const operation of operations) {
25
+ if (operation.recoveryMode !== 'outcome_unknown')
26
+ continue;
27
+ const ts = now();
28
+ const result = {
29
+ kind: 'text',
30
+ text: OUTCOME_UNKNOWN_TEXT,
31
+ uncertainOutcome: {
32
+ code: 'outcome_unknown',
33
+ retrySafe: false,
34
+ },
35
+ };
36
+ const responseContent = {
37
+ kind: 'function_response',
38
+ id: operation.providerToolCallId,
39
+ name: operation.toolName,
40
+ result,
41
+ isError: true,
42
+ };
43
+ const modelProjection = compatibilityToolResultProjection(responseContent, operation.sessionId);
44
+ const runtimeEvent = {
45
+ id: `${operation.operationId}_response`,
46
+ invocationId: operation.invocationId,
47
+ runId: operation.runId,
48
+ sessionId: operation.sessionId,
49
+ turnId: operation.turnId,
50
+ ts,
51
+ partial: false,
52
+ role: 'tool',
53
+ author: 'tool',
54
+ content: { ...responseContent, ...(modelProjection ? { modelProjection } : {}) },
55
+ refs: {
62
56
  operationId: operation.operationId,
63
- journalEventId: `${operation.operationId}_outcome`,
64
- runtimeEvent,
65
- committedAt: ts,
66
- });
67
- if (committed.created)
68
- recovered += 1;
69
- }
57
+ toolCallId: operation.providerToolCallId,
58
+ },
59
+ };
60
+ const committed = await store.commitToolOutcome({
61
+ operationId: operation.operationId,
62
+ journalEventId: `${operation.operationId}_outcome`,
63
+ runtimeEvent,
64
+ committedAt: ts,
65
+ });
66
+ if (committed.created)
67
+ recovered += 1;
70
68
  }
71
69
  return recovered;
72
70
  }
@@ -150,6 +150,8 @@ export class HostContextCoordinator {
150
150
  return notFound('Session does not exist');
151
151
  throw error;
152
152
  }
153
+ if (header.backend === 'plugin-executor')
154
+ return operationUnavailable('External executors own their context. Start a new task instead of compacting.');
153
155
  if (header.isArchived) {
154
156
  return sessionArchived('Cannot compact an archived Session');
155
157
  }
@@ -16,7 +16,7 @@
16
16
  * specific language governing permissions and limitations
17
17
  * under the License.
18
18
  */
19
- import { defineInteractiveRuntimeHostComposition, } from './host-composition.js';
19
+ import { defineInteractiveRuntimeHostComposition, } from './host-composition-source.js';
20
20
  export async function createExecutionRuntimeHostCompositionSource(options, dependencies = {}) {
21
21
  const compositionOptions = {
22
22
  ...(options.initialization ? { initialization: options.initialization } : {}),