maka-agent 0.2.0-dev.46.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 (131) hide show
  1. package/DISCLAIMER-WIP +6 -1
  2. package/README.md +6 -1
  3. package/dist/acp/maka-acp-agent.js +1 -1
  4. package/dist/acp/session-mcp.js +212 -0
  5. package/dist/acp/session-registry.js +52 -8
  6. package/dist/acp/stdio-server.js +3 -0
  7. package/dist/cli-core.js +1 -1
  8. package/dist/mcp-capability-provider.js +6 -1
  9. package/dist/mcp-capability-publication.js +139 -0
  10. package/dist/pi-tui-layout.js +46 -17
  11. package/dist/pi-tui-pickers.js +25 -14
  12. package/dist/pi-tui-runner.js +24 -15
  13. package/dist/runtime-host-capability-provider-command.js +25 -6
  14. package/dist/runtime-host-service-manager.js +26 -2
  15. package/dist/tui-context-refresh.js +15 -26
  16. package/dist/tui-mcp-control.js +66 -112
  17. package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
  18. package/node_modules/@maka/acp-executor-plugin/dist/acp-errors.js +26 -0
  19. package/node_modules/@maka/acp-executor-plugin/dist/acp-filesystem.js +103 -0
  20. package/node_modules/@maka/acp-executor-plugin/dist/acp-process.js +119 -0
  21. package/node_modules/@maka/acp-executor-plugin/dist/acp-projection.js +146 -0
  22. package/node_modules/@maka/acp-executor-plugin/dist/index.js +653 -0
  23. package/node_modules/@maka/acp-executor-plugin/dist/plugin.mjs +24446 -0
  24. package/node_modules/@maka/acp-executor-plugin/package.json +15 -0
  25. package/node_modules/@maka/antigravity-acp-plugin/dist/index.js +88 -0
  26. package/node_modules/@maka/antigravity-acp-plugin/dist/model-presentation.js +53 -0
  27. package/node_modules/@maka/antigravity-acp-plugin/dist/plugin.mjs +115 -0
  28. package/node_modules/@maka/antigravity-acp-plugin/package.json +15 -0
  29. package/node_modules/@maka/core/dist/client-capability-grant.js +2 -2
  30. package/node_modules/@maka/core/dist/executor-catalog.js +106 -0
  31. package/node_modules/@maka/core/dist/mcp.js +4 -1
  32. package/node_modules/@maka/core/dist/model-metadata.js +28 -1
  33. package/node_modules/@maka/core/dist/model-thinking.js +36 -1
  34. package/node_modules/@maka/core/dist/provider-registry.js +0 -1
  35. package/node_modules/@maka/core/dist/refresh-read-coordinator.js +62 -0
  36. package/node_modules/@maka/core/dist/runtime-event-store.js +25 -0
  37. package/node_modules/@maka/core/dist/runtime-invocation.js +5 -0
  38. package/node_modules/@maka/core/dist/runtime-policy/connection-catalog-codec.js +4 -0
  39. package/node_modules/@maka/core/dist/runtime-policy/credential-vault-codec.js +6 -0
  40. package/node_modules/@maka/core/dist/runtime-policy/policy-codec.js +21 -0
  41. package/node_modules/@maka/core/dist/session.js +19 -1
  42. package/node_modules/@maka/core/dist/settings.js +3 -0
  43. package/node_modules/@maka/core/dist/tool-ledger-scanner.js +365 -104
  44. package/node_modules/@maka/core/dist/turn-origin.js +14 -0
  45. package/node_modules/@maka/core/package.json +3 -0
  46. package/node_modules/@maka/mcp/dist/credential-coordinator.js +6 -1
  47. package/node_modules/@maka/mcp/dist/index.js +31 -5
  48. package/node_modules/@maka/mcp/dist/oauth.js +54 -6
  49. package/node_modules/@maka/runtime/dist/agent-run-inspect.js +1 -1
  50. package/node_modules/@maka/runtime/dist/ai-sdk-message-projection.js +15 -60
  51. package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +18 -0
  52. package/node_modules/@maka/runtime/dist/apply-patch-profile.js +64 -14
  53. package/node_modules/@maka/runtime/dist/builtin-tools.js +3 -2
  54. package/node_modules/@maka/runtime/dist/codex-v4a-patch.js +18 -0
  55. package/node_modules/@maka/runtime/dist/conversation-copy.js +56 -1
  56. package/node_modules/@maka/runtime/dist/mcp-tools.js +9 -2
  57. package/node_modules/@maka/runtime/dist/model-adapter.js +80 -3
  58. package/node_modules/@maka/runtime/dist/model-runtime.js +6 -0
  59. package/node_modules/@maka/runtime/dist/openai-apply-patch.js +5 -0
  60. package/node_modules/@maka/runtime/dist/plugin-executor-backend.js +122 -3
  61. package/node_modules/@maka/runtime/dist/plugin-executor-service.js +212 -16
  62. package/node_modules/@maka/runtime/dist/runtime-ledger-repair.js +2 -2
  63. package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +3 -0
  64. package/node_modules/@maka/runtime/dist/session-manager.js +184 -126
  65. package/node_modules/@maka/runtime/dist/shell-run-manager.js +3 -0
  66. package/node_modules/@maka/runtime/dist/stream-graph-coordinator.js +29 -4
  67. package/node_modules/@maka/runtime-host/dist/candidate-entry.js +8 -5
  68. package/node_modules/@maka/runtime-host/dist/client/capability-provider-service.js +2 -0
  69. package/node_modules/@maka/runtime-host/dist/client/client-capability-channel.js +59 -20
  70. package/node_modules/@maka/runtime-host/dist/client/connection.js +6 -4
  71. package/node_modules/@maka/runtime-host/dist/client/index.js +1 -1
  72. package/node_modules/@maka/runtime-host/dist/client/reconnect-lifecycle.js +8 -1
  73. package/node_modules/@maka/runtime-host/dist/client/reconnecting-connection.js +4 -4
  74. package/node_modules/@maka/runtime-host/dist/client/session-catalog-summary.js +6 -1
  75. package/node_modules/@maka/runtime-host/dist/composition-identity.js +19 -0
  76. package/node_modules/@maka/runtime-host/dist/protocol/client-capability.js +20 -3
  77. package/node_modules/@maka/runtime-host/dist/protocol/external-session.js +8 -5
  78. package/node_modules/@maka/runtime-host/dist/protocol/index.js +20 -2
  79. package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +34 -0
  80. package/node_modules/@maka/runtime-host/dist/protocol/session-catalog.js +75 -5
  81. package/node_modules/@maka/runtime-host/dist/protocol/workhub-coordination.js +1 -5
  82. package/node_modules/@maka/runtime-host/dist/server/builtin-external-agent-plugins.js +188 -0
  83. package/node_modules/@maka/runtime-host/dist/server/candidate.js +12 -7
  84. package/node_modules/@maka/runtime-host/dist/server/client-capability-coordinator.js +234 -70
  85. package/node_modules/@maka/runtime-host/dist/server/client-capability-invocation-broker.js +14 -8
  86. package/node_modules/@maka/runtime-host/dist/server/client-capability-recovery.js +44 -46
  87. package/node_modules/@maka/runtime-host/dist/server/context-coordinator.js +2 -0
  88. package/node_modules/@maka/runtime-host/dist/server/execution-composition-factory.js +1 -1
  89. package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +188 -21
  90. package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +6 -0
  91. package/node_modules/@maka/runtime-host/dist/server/extension-bundle.js +4 -0
  92. package/node_modules/@maka/runtime-host/dist/server/external-session-coordinator.js +29 -7
  93. package/node_modules/@maka/runtime-host/dist/server/host-composition-source.js +47 -0
  94. package/node_modules/@maka/runtime-host/dist/server/host-composition.js +1 -29
  95. package/node_modules/@maka/runtime-host/dist/server/host-kernel.js +2 -9
  96. package/node_modules/@maka/runtime-host/dist/server/hosted-execution-recovery.js +75 -9
  97. package/node_modules/@maka/runtime-host/dist/server/hosted-execution-tool-profile.js +5 -1
  98. package/node_modules/@maka/runtime-host/dist/server/interaction-coordinator.js +45 -0
  99. package/node_modules/@maka/runtime-host/dist/server/jev-routing-model.js +157 -0
  100. package/node_modules/@maka/runtime-host/dist/server/listener-set.js +2 -2
  101. package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +4 -0
  102. package/node_modules/@maka/runtime-host/dist/server/plugin-platform-coordinator.js +11 -1
  103. package/node_modules/@maka/runtime-host/dist/server/process-lifecycle.js +1 -1
  104. package/node_modules/@maka/runtime-host/dist/server/process-termination-error.js +27 -0
  105. package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +91 -12
  106. package/node_modules/@maka/runtime-host/dist/server/runtime-policy-coordinator.js +2 -0
  107. package/node_modules/@maka/runtime-host/dist/server/session-bundle-coordinator.js +4 -1
  108. package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +128 -13
  109. package/node_modules/@maka/runtime-host/dist/server/session-effect-coordinator.js +12 -6
  110. package/node_modules/@maka/runtime-host/dist/server/session-retirement-coordinator.js +2 -2
  111. package/node_modules/@maka/runtime-host/dist/server/session-transcript-reader.js +33 -0
  112. package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +4 -0
  113. package/node_modules/@maka/runtime-host/dist/server/workhub-result-coordinator.js +173 -0
  114. package/node_modules/@maka/runtime-host/dist/server/workhub-result-runtime.js +293 -0
  115. package/node_modules/@maka/runtime-host/package.json +2 -0
  116. package/node_modules/@maka/storage/dist/agent-run-store-contract.js +8 -0
  117. package/node_modules/@maka/storage/dist/execution-stores.js +15 -3
  118. package/node_modules/@maka/storage/dist/mcp-config-store.js +91 -2
  119. package/node_modules/@maka/storage/dist/operational-state-store.js +15 -1
  120. package/node_modules/@maka/storage/dist/plan-authority.js +2 -0
  121. package/node_modules/@maka/storage/dist/plan-store.js +30 -0
  122. package/node_modules/@maka/storage/dist/runtime-event-persistence.js +1 -0
  123. package/node_modules/@maka/storage/dist/runtime-policy/credential-vault-document.js +4 -1
  124. package/node_modules/@maka/storage/dist/runtime-policy/policy-document.js +2 -0
  125. package/node_modules/@maka/storage/dist/session-store-values.js +16 -4
  126. package/node_modules/@maka/storage/dist/shell-run-authority.js +1 -0
  127. package/node_modules/@maka/storage/dist/shell-run-store.js +15 -0
  128. package/node_modules/@maka/storage/dist/sqlite-runtime-schema.js +74 -1
  129. package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +724 -84
  130. package/node_modules/@maka/storage/dist/sqlite-session-metadata-store.js +16 -0
  131. package/package.json +1 -1
@@ -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
  });