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.
- package/DISCLAIMER-WIP +6 -1
- package/README.md +6 -1
- package/dist/acp/maka-acp-agent.js +1 -1
- package/dist/acp/session-mcp.js +212 -0
- package/dist/acp/session-registry.js +52 -8
- package/dist/acp/stdio-server.js +3 -0
- package/dist/cli-core.js +1 -1
- package/dist/mcp-capability-provider.js +6 -1
- package/dist/mcp-capability-publication.js +139 -0
- package/dist/pi-tui-layout.js +46 -17
- package/dist/pi-tui-pickers.js +25 -14
- package/dist/pi-tui-runner.js +24 -15
- package/dist/runtime-host-capability-provider-command.js +25 -6
- package/dist/runtime-host-service-manager.js +26 -2
- package/dist/tui-context-refresh.js +15 -26
- package/dist/tui-mcp-control.js +66 -112
- package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
- package/node_modules/@maka/acp-executor-plugin/dist/acp-errors.js +26 -0
- package/node_modules/@maka/acp-executor-plugin/dist/acp-filesystem.js +103 -0
- package/node_modules/@maka/acp-executor-plugin/dist/acp-process.js +119 -0
- package/node_modules/@maka/acp-executor-plugin/dist/acp-projection.js +146 -0
- package/node_modules/@maka/acp-executor-plugin/dist/index.js +653 -0
- package/node_modules/@maka/acp-executor-plugin/dist/plugin.mjs +24446 -0
- package/node_modules/@maka/acp-executor-plugin/package.json +15 -0
- package/node_modules/@maka/antigravity-acp-plugin/dist/index.js +88 -0
- package/node_modules/@maka/antigravity-acp-plugin/dist/model-presentation.js +53 -0
- package/node_modules/@maka/antigravity-acp-plugin/dist/plugin.mjs +115 -0
- package/node_modules/@maka/antigravity-acp-plugin/package.json +15 -0
- package/node_modules/@maka/core/dist/client-capability-grant.js +2 -2
- package/node_modules/@maka/core/dist/executor-catalog.js +106 -0
- package/node_modules/@maka/core/dist/mcp.js +4 -1
- package/node_modules/@maka/core/dist/model-metadata.js +28 -1
- package/node_modules/@maka/core/dist/model-thinking.js +36 -1
- package/node_modules/@maka/core/dist/provider-registry.js +0 -1
- package/node_modules/@maka/core/dist/refresh-read-coordinator.js +62 -0
- package/node_modules/@maka/core/dist/runtime-event-store.js +25 -0
- package/node_modules/@maka/core/dist/runtime-invocation.js +5 -0
- package/node_modules/@maka/core/dist/runtime-policy/connection-catalog-codec.js +4 -0
- package/node_modules/@maka/core/dist/runtime-policy/credential-vault-codec.js +6 -0
- package/node_modules/@maka/core/dist/runtime-policy/policy-codec.js +21 -0
- package/node_modules/@maka/core/dist/session.js +19 -1
- package/node_modules/@maka/core/dist/settings.js +3 -0
- package/node_modules/@maka/core/dist/tool-ledger-scanner.js +365 -104
- package/node_modules/@maka/core/dist/turn-origin.js +14 -0
- package/node_modules/@maka/core/package.json +3 -0
- package/node_modules/@maka/mcp/dist/credential-coordinator.js +6 -1
- package/node_modules/@maka/mcp/dist/index.js +31 -5
- package/node_modules/@maka/mcp/dist/oauth.js +54 -6
- package/node_modules/@maka/runtime/dist/agent-run-inspect.js +1 -1
- package/node_modules/@maka/runtime/dist/ai-sdk-message-projection.js +15 -60
- package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +18 -0
- package/node_modules/@maka/runtime/dist/apply-patch-profile.js +64 -14
- package/node_modules/@maka/runtime/dist/builtin-tools.js +3 -2
- package/node_modules/@maka/runtime/dist/codex-v4a-patch.js +18 -0
- package/node_modules/@maka/runtime/dist/conversation-copy.js +56 -1
- package/node_modules/@maka/runtime/dist/mcp-tools.js +9 -2
- package/node_modules/@maka/runtime/dist/model-adapter.js +80 -3
- package/node_modules/@maka/runtime/dist/model-runtime.js +6 -0
- package/node_modules/@maka/runtime/dist/openai-apply-patch.js +5 -0
- package/node_modules/@maka/runtime/dist/plugin-executor-backend.js +122 -3
- package/node_modules/@maka/runtime/dist/plugin-executor-service.js +212 -16
- package/node_modules/@maka/runtime/dist/runtime-ledger-repair.js +2 -2
- package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +3 -0
- package/node_modules/@maka/runtime/dist/session-manager.js +184 -126
- package/node_modules/@maka/runtime/dist/shell-run-manager.js +3 -0
- package/node_modules/@maka/runtime/dist/stream-graph-coordinator.js +29 -4
- package/node_modules/@maka/runtime-host/dist/candidate-entry.js +8 -5
- package/node_modules/@maka/runtime-host/dist/client/capability-provider-service.js +2 -0
- package/node_modules/@maka/runtime-host/dist/client/client-capability-channel.js +59 -20
- package/node_modules/@maka/runtime-host/dist/client/connection.js +6 -4
- package/node_modules/@maka/runtime-host/dist/client/index.js +1 -1
- package/node_modules/@maka/runtime-host/dist/client/reconnect-lifecycle.js +8 -1
- package/node_modules/@maka/runtime-host/dist/client/reconnecting-connection.js +4 -4
- package/node_modules/@maka/runtime-host/dist/client/session-catalog-summary.js +6 -1
- package/node_modules/@maka/runtime-host/dist/composition-identity.js +19 -0
- package/node_modules/@maka/runtime-host/dist/protocol/client-capability.js +20 -3
- package/node_modules/@maka/runtime-host/dist/protocol/external-session.js +8 -5
- package/node_modules/@maka/runtime-host/dist/protocol/index.js +20 -2
- package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +34 -0
- package/node_modules/@maka/runtime-host/dist/protocol/session-catalog.js +75 -5
- package/node_modules/@maka/runtime-host/dist/protocol/workhub-coordination.js +1 -5
- package/node_modules/@maka/runtime-host/dist/server/builtin-external-agent-plugins.js +188 -0
- package/node_modules/@maka/runtime-host/dist/server/candidate.js +12 -7
- package/node_modules/@maka/runtime-host/dist/server/client-capability-coordinator.js +234 -70
- package/node_modules/@maka/runtime-host/dist/server/client-capability-invocation-broker.js +14 -8
- package/node_modules/@maka/runtime-host/dist/server/client-capability-recovery.js +44 -46
- package/node_modules/@maka/runtime-host/dist/server/context-coordinator.js +2 -0
- package/node_modules/@maka/runtime-host/dist/server/execution-composition-factory.js +1 -1
- package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +188 -21
- package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +6 -0
- package/node_modules/@maka/runtime-host/dist/server/extension-bundle.js +4 -0
- package/node_modules/@maka/runtime-host/dist/server/external-session-coordinator.js +29 -7
- package/node_modules/@maka/runtime-host/dist/server/host-composition-source.js +47 -0
- package/node_modules/@maka/runtime-host/dist/server/host-composition.js +1 -29
- package/node_modules/@maka/runtime-host/dist/server/host-kernel.js +2 -9
- package/node_modules/@maka/runtime-host/dist/server/hosted-execution-recovery.js +75 -9
- package/node_modules/@maka/runtime-host/dist/server/hosted-execution-tool-profile.js +5 -1
- package/node_modules/@maka/runtime-host/dist/server/interaction-coordinator.js +45 -0
- package/node_modules/@maka/runtime-host/dist/server/jev-routing-model.js +157 -0
- package/node_modules/@maka/runtime-host/dist/server/listener-set.js +2 -2
- package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +4 -0
- package/node_modules/@maka/runtime-host/dist/server/plugin-platform-coordinator.js +11 -1
- package/node_modules/@maka/runtime-host/dist/server/process-lifecycle.js +1 -1
- package/node_modules/@maka/runtime-host/dist/server/process-termination-error.js +27 -0
- package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +91 -12
- package/node_modules/@maka/runtime-host/dist/server/runtime-policy-coordinator.js +2 -0
- package/node_modules/@maka/runtime-host/dist/server/session-bundle-coordinator.js +4 -1
- package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +128 -13
- package/node_modules/@maka/runtime-host/dist/server/session-effect-coordinator.js +12 -6
- package/node_modules/@maka/runtime-host/dist/server/session-retirement-coordinator.js +2 -2
- package/node_modules/@maka/runtime-host/dist/server/session-transcript-reader.js +33 -0
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +4 -0
- package/node_modules/@maka/runtime-host/dist/server/workhub-result-coordinator.js +173 -0
- package/node_modules/@maka/runtime-host/dist/server/workhub-result-runtime.js +293 -0
- package/node_modules/@maka/runtime-host/package.json +2 -0
- package/node_modules/@maka/storage/dist/agent-run-store-contract.js +8 -0
- package/node_modules/@maka/storage/dist/execution-stores.js +15 -3
- package/node_modules/@maka/storage/dist/mcp-config-store.js +91 -2
- package/node_modules/@maka/storage/dist/operational-state-store.js +15 -1
- package/node_modules/@maka/storage/dist/plan-authority.js +2 -0
- package/node_modules/@maka/storage/dist/plan-store.js +30 -0
- package/node_modules/@maka/storage/dist/runtime-event-persistence.js +1 -0
- package/node_modules/@maka/storage/dist/runtime-policy/credential-vault-document.js +4 -1
- package/node_modules/@maka/storage/dist/runtime-policy/policy-document.js +2 -0
- package/node_modules/@maka/storage/dist/session-store-values.js +16 -4
- package/node_modules/@maka/storage/dist/shell-run-authority.js +1 -0
- package/node_modules/@maka/storage/dist/shell-run-store.js +15 -0
- package/node_modules/@maka/storage/dist/sqlite-runtime-schema.js +74 -1
- package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +724 -84
- package/node_modules/@maka/storage/dist/sqlite-session-metadata-store.js +16 -0
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maka/acp-executor-plugin",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Shared ACP runtime service for Maka executor adapter plugins.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./dist/index.js",
|
|
10
|
+
"./plugin": "./dist/plugin.mjs"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@agentclientprotocol/sdk": "1.4.0"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
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 { describeAntigravityModels } from './model-presentation.js';
|
|
20
|
+
import { dirname, isAbsolute, resolve } from 'node:path';
|
|
21
|
+
export const ANTIGRAVITY_ACP_EXECUTOR_ID = 'antigravity-acp';
|
|
22
|
+
/** Antigravity-specific launch and environment policy; ACP mechanics live in the parent service. */
|
|
23
|
+
export const antigravityAcpAdapter = Object.freeze({
|
|
24
|
+
id: ANTIGRAVITY_ACP_EXECUTOR_ID,
|
|
25
|
+
displayName: 'Antigravity',
|
|
26
|
+
clientName: 'maka-antigravity-acp-plugin',
|
|
27
|
+
describeModels: describeAntigravityModels,
|
|
28
|
+
// Verified with official 1.1.1: structured questions use interaction_ ids and choice options.
|
|
29
|
+
permissionKind: (request) => request.toolCall.toolCallId.startsWith('interaction_') && request.toolCall.kind == null
|
|
30
|
+
? 'question'
|
|
31
|
+
: 'permission',
|
|
32
|
+
executionFailed: (text) => text.trimStart().startsWith('Agent execution error:'),
|
|
33
|
+
configure(value) {
|
|
34
|
+
const config = validateConfig(value);
|
|
35
|
+
const helper = config.helper ?? resolve(dirname(config.executable), 'localharness_external');
|
|
36
|
+
return Object.freeze({
|
|
37
|
+
launch: Object.freeze({
|
|
38
|
+
executable: config.executable,
|
|
39
|
+
requiredExecutables: Object.freeze([helper]),
|
|
40
|
+
cwd: dirname(config.executable),
|
|
41
|
+
env: antigravityEnvironment(process.env, helper),
|
|
42
|
+
...(config.model ? { initialConfig: Object.freeze({ model: config.model }) } : {}),
|
|
43
|
+
}),
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
export function validateConfig(value) {
|
|
48
|
+
if (!value || typeof value !== 'object')
|
|
49
|
+
throw new TypeError('ACP Plugin config is required');
|
|
50
|
+
const executable = absolutePath(value.executable, 'executable');
|
|
51
|
+
const helper = value.helper === undefined ? undefined : absolutePath(value.helper, 'helper');
|
|
52
|
+
const model = value.model?.trim();
|
|
53
|
+
if (value.model !== undefined && !model)
|
|
54
|
+
throw new TypeError('ACP Plugin model is invalid');
|
|
55
|
+
return Object.freeze({ executable, ...(helper ? { helper } : {}), ...(model ? { model } : {}) });
|
|
56
|
+
}
|
|
57
|
+
function absolutePath(value, label) {
|
|
58
|
+
if (typeof value !== 'string' || !isAbsolute(value) || /[\0\r\n]/u.test(value))
|
|
59
|
+
throw new TypeError(`ACP Plugin ${label} must be an absolute path`);
|
|
60
|
+
return resolve(value);
|
|
61
|
+
}
|
|
62
|
+
export function antigravityEnvironment(base, helper) {
|
|
63
|
+
const env = {
|
|
64
|
+
...base,
|
|
65
|
+
BROWSER: '/usr/bin/true',
|
|
66
|
+
PYTHONUNBUFFERED: '1',
|
|
67
|
+
ANTIGRAVITY_HARNESS_PATH: helper,
|
|
68
|
+
};
|
|
69
|
+
const bypass = [env.NO_PROXY, env.no_proxy, 'localhost', '127.0.0.1', '::1']
|
|
70
|
+
.flatMap((entry) => entry?.split(',') ?? [])
|
|
71
|
+
.map((entry) => entry.trim())
|
|
72
|
+
.filter((entry, index, entries) => entry.length > 0 && entries.indexOf(entry) === index)
|
|
73
|
+
.join(',');
|
|
74
|
+
env.NO_PROXY = bypass;
|
|
75
|
+
env.no_proxy = bypass;
|
|
76
|
+
return env;
|
|
77
|
+
}
|
|
78
|
+
const host = Object.freeze({
|
|
79
|
+
inject: ['acp'],
|
|
80
|
+
apply(ctx, config) {
|
|
81
|
+
ctx.acp.register(ctx, antigravityAcpAdapter, config);
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
export default Object.freeze({
|
|
85
|
+
packageId: 'antigravity-acp',
|
|
86
|
+
contributions: Object.freeze([{ id: ANTIGRAVITY_ACP_EXECUTOR_ID, kind: 'executor' }]),
|
|
87
|
+
host,
|
|
88
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
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 { THINKING_LEVELS } from '@maka/core/model-thinking';
|
|
20
|
+
/** Official ACP 1.1.1 labels encode intensity; IDs are opaque (e.g. gemini-pro-agent). */
|
|
21
|
+
export function describeAntigravityModels(models) {
|
|
22
|
+
const families = new Map();
|
|
23
|
+
const unrecognized = new Set();
|
|
24
|
+
for (const model of models) {
|
|
25
|
+
const match = /^(Gemini \d+(?:\.\d+)? (?:Flash|Pro)) \((High|Medium|Low)\)$/.exec(model.name);
|
|
26
|
+
if (!match) {
|
|
27
|
+
// A bare or unfamiliar variant of the same family makes grouping ambiguous.
|
|
28
|
+
const family = /^(Gemini \d+(?:\.\d+)? (?:Flash|Pro))(?:$|[ (])/.exec(model.name)?.[1];
|
|
29
|
+
if (family)
|
|
30
|
+
unrecognized.add(family);
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
const variants = families.get(match[1]) ?? [];
|
|
34
|
+
variants.push({ modelId: model.id, level: match[2].toLowerCase() });
|
|
35
|
+
families.set(match[1], variants);
|
|
36
|
+
}
|
|
37
|
+
const modelGroups = [];
|
|
38
|
+
for (const [name, variants] of families) {
|
|
39
|
+
if (unrecognized.has(name) ||
|
|
40
|
+
variants.length < 2 ||
|
|
41
|
+
new Set(variants.map((v) => v.level)).size !== variants.length)
|
|
42
|
+
continue;
|
|
43
|
+
modelGroups.push({
|
|
44
|
+
id: name,
|
|
45
|
+
name,
|
|
46
|
+
variants: [...variants].sort((a, b) => THINKING_LEVELS.indexOf(a.level) - THINKING_LEVELS.indexOf(b.level)),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
models: models.map((model) => /^Gemini(?: |$)/.test(model.name) ? { ...model, providerType: 'google' } : model),
|
|
51
|
+
modelGroups,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// ../core/dist/model-thinking.js
|
|
2
|
+
var THINKING_LEVELS = [
|
|
3
|
+
"off",
|
|
4
|
+
"minimal",
|
|
5
|
+
"low",
|
|
6
|
+
"medium",
|
|
7
|
+
"high",
|
|
8
|
+
"xhigh",
|
|
9
|
+
"max"
|
|
10
|
+
];
|
|
11
|
+
var DECLARABLE_RELAY_THINKING_LEVELS = THINKING_LEVELS.filter((level) => level !== "off");
|
|
12
|
+
|
|
13
|
+
// src/model-presentation.ts
|
|
14
|
+
function describeAntigravityModels(models) {
|
|
15
|
+
const families = /* @__PURE__ */ new Map();
|
|
16
|
+
const unrecognized = /* @__PURE__ */ new Set();
|
|
17
|
+
for (const model of models) {
|
|
18
|
+
const match = /^(Gemini \d+(?:\.\d+)? (?:Flash|Pro)) \((High|Medium|Low)\)$/.exec(model.name);
|
|
19
|
+
if (!match) {
|
|
20
|
+
const family = /^(Gemini \d+(?:\.\d+)? (?:Flash|Pro))(?:$|[ (])/.exec(model.name)?.[1];
|
|
21
|
+
if (family) unrecognized.add(family);
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
const variants = families.get(match[1]) ?? [];
|
|
25
|
+
variants.push({ modelId: model.id, level: match[2].toLowerCase() });
|
|
26
|
+
families.set(match[1], variants);
|
|
27
|
+
}
|
|
28
|
+
const modelGroups = [];
|
|
29
|
+
for (const [name, variants] of families) {
|
|
30
|
+
if (unrecognized.has(name) || variants.length < 2 || new Set(variants.map((v) => v.level)).size !== variants.length)
|
|
31
|
+
continue;
|
|
32
|
+
modelGroups.push({
|
|
33
|
+
id: name,
|
|
34
|
+
name,
|
|
35
|
+
variants: [...variants].sort(
|
|
36
|
+
(a, b) => THINKING_LEVELS.indexOf(a.level) - THINKING_LEVELS.indexOf(b.level)
|
|
37
|
+
)
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
models: models.map(
|
|
42
|
+
(model) => /^Gemini(?: |$)/.test(model.name) ? { ...model, providerType: "google" } : model
|
|
43
|
+
),
|
|
44
|
+
modelGroups
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// src/index.ts
|
|
49
|
+
import { dirname, isAbsolute, resolve } from "node:path";
|
|
50
|
+
var ANTIGRAVITY_ACP_EXECUTOR_ID = "antigravity-acp";
|
|
51
|
+
var antigravityAcpAdapter = Object.freeze({
|
|
52
|
+
id: ANTIGRAVITY_ACP_EXECUTOR_ID,
|
|
53
|
+
displayName: "Antigravity",
|
|
54
|
+
clientName: "maka-antigravity-acp-plugin",
|
|
55
|
+
describeModels: describeAntigravityModels,
|
|
56
|
+
// Verified with official 1.1.1: structured questions use interaction_ ids and choice options.
|
|
57
|
+
permissionKind: (request) => request.toolCall.toolCallId.startsWith("interaction_") && request.toolCall.kind == null ? "question" : "permission",
|
|
58
|
+
executionFailed: (text) => text.trimStart().startsWith("Agent execution error:"),
|
|
59
|
+
configure(value) {
|
|
60
|
+
const config = validateConfig(value);
|
|
61
|
+
const helper = config.helper ?? resolve(dirname(config.executable), "localharness_external");
|
|
62
|
+
return Object.freeze({
|
|
63
|
+
launch: Object.freeze({
|
|
64
|
+
executable: config.executable,
|
|
65
|
+
requiredExecutables: Object.freeze([helper]),
|
|
66
|
+
cwd: dirname(config.executable),
|
|
67
|
+
env: antigravityEnvironment(process.env, helper),
|
|
68
|
+
...config.model ? { initialConfig: Object.freeze({ model: config.model }) } : {}
|
|
69
|
+
})
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
function validateConfig(value) {
|
|
74
|
+
if (!value || typeof value !== "object") throw new TypeError("ACP Plugin config is required");
|
|
75
|
+
const executable = absolutePath(value.executable, "executable");
|
|
76
|
+
const helper = value.helper === void 0 ? void 0 : absolutePath(value.helper, "helper");
|
|
77
|
+
const model = value.model?.trim();
|
|
78
|
+
if (value.model !== void 0 && !model) throw new TypeError("ACP Plugin model is invalid");
|
|
79
|
+
return Object.freeze({ executable, ...helper ? { helper } : {}, ...model ? { model } : {} });
|
|
80
|
+
}
|
|
81
|
+
function absolutePath(value, label) {
|
|
82
|
+
if (typeof value !== "string" || !isAbsolute(value) || /[\0\r\n]/u.test(value))
|
|
83
|
+
throw new TypeError(`ACP Plugin ${label} must be an absolute path`);
|
|
84
|
+
return resolve(value);
|
|
85
|
+
}
|
|
86
|
+
function antigravityEnvironment(base, helper) {
|
|
87
|
+
const env = {
|
|
88
|
+
...base,
|
|
89
|
+
BROWSER: "/usr/bin/true",
|
|
90
|
+
PYTHONUNBUFFERED: "1",
|
|
91
|
+
ANTIGRAVITY_HARNESS_PATH: helper
|
|
92
|
+
};
|
|
93
|
+
const bypass = [env.NO_PROXY, env.no_proxy, "localhost", "127.0.0.1", "::1"].flatMap((entry) => entry?.split(",") ?? []).map((entry) => entry.trim()).filter((entry, index, entries) => entry.length > 0 && entries.indexOf(entry) === index).join(",");
|
|
94
|
+
env.NO_PROXY = bypass;
|
|
95
|
+
env.no_proxy = bypass;
|
|
96
|
+
return env;
|
|
97
|
+
}
|
|
98
|
+
var host = Object.freeze({
|
|
99
|
+
inject: ["acp"],
|
|
100
|
+
apply(ctx, config) {
|
|
101
|
+
ctx.acp.register(ctx, antigravityAcpAdapter, config);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
var index_default = Object.freeze({
|
|
105
|
+
packageId: "antigravity-acp",
|
|
106
|
+
contributions: Object.freeze([{ id: ANTIGRAVITY_ACP_EXECUTOR_ID, kind: "executor" }]),
|
|
107
|
+
host
|
|
108
|
+
});
|
|
109
|
+
export {
|
|
110
|
+
ANTIGRAVITY_ACP_EXECUTOR_ID,
|
|
111
|
+
antigravityAcpAdapter,
|
|
112
|
+
antigravityEnvironment,
|
|
113
|
+
index_default as default,
|
|
114
|
+
validateConfig
|
|
115
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maka/antigravity-acp-plugin",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Antigravity ACP Session executor packaged for Maka's Host Plugin Platform.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./dist/index.js",
|
|
10
|
+
"./plugin": "./dist/plugin.mjs"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@maka/acp-executor-plugin": "0.1.0"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -41,11 +41,11 @@ export function decodeClientCapabilitySessionGrantKey(value) {
|
|
|
41
41
|
}
|
|
42
42
|
export function decodeClientCapabilityGrantTarget(value) {
|
|
43
43
|
const record = plainRecord(value, 'Client Capability Grant target');
|
|
44
|
-
const capability = oneOf(record.capability, ['browser', 'computer_use', 'desktop_mcp'], 'capability');
|
|
44
|
+
const capability = oneOf(record.capability, ['browser', 'computer_use', 'desktop_mcp', 'mcp'], 'capability');
|
|
45
45
|
const scope = decodeClientCapabilityGrantScope(record.scope);
|
|
46
46
|
if ((capability === 'browser' && scope.kind !== 'browser_origin') ||
|
|
47
47
|
(capability === 'computer_use' && scope.kind !== 'capability') ||
|
|
48
|
-
(capability === 'desktop_mcp' && scope.kind !== 'mcp_tool')) {
|
|
48
|
+
((capability === 'desktop_mcp' || capability === 'mcp') && scope.kind !== 'mcp_tool')) {
|
|
49
49
|
throw new Error('Client Capability Session Grant scope does not match capability');
|
|
50
50
|
}
|
|
51
51
|
return deepFreeze({
|
|
@@ -0,0 +1,106 @@
|
|
|
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 { isExecutorId } from './executor-id.js';
|
|
20
|
+
import { CATALOG_PROVIDER_TYPES } from './provider-registry.js';
|
|
21
|
+
import { isThinkingLevel } from './model-thinking.js';
|
|
22
|
+
export function isExecutorConfiguration(value) {
|
|
23
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
24
|
+
return false;
|
|
25
|
+
const record = value;
|
|
26
|
+
return (Object.keys(record).every((key) => key === 'model') &&
|
|
27
|
+
(record.model === undefined ||
|
|
28
|
+
(typeof record.model === 'string' &&
|
|
29
|
+
record.model.length > 0 &&
|
|
30
|
+
record.model.length <= 1024 &&
|
|
31
|
+
!/[\0\r\n]/u.test(record.model))));
|
|
32
|
+
}
|
|
33
|
+
export function normalizeCatalogEntry(value, id) {
|
|
34
|
+
if (!value ||
|
|
35
|
+
!isExecutorId(id) ||
|
|
36
|
+
value.id !== id ||
|
|
37
|
+
!isCatalogText(value.displayName) ||
|
|
38
|
+
!['ready', 'unavailable', 'authentication_required', 'history_only'].includes(value.readiness) ||
|
|
39
|
+
!Array.isArray(value.models) ||
|
|
40
|
+
value.models.length > 256 ||
|
|
41
|
+
!Array.from(value.models).every((model) => model &&
|
|
42
|
+
isExecutorConfiguration({ model: model.id }) &&
|
|
43
|
+
typeof model.id === 'string' &&
|
|
44
|
+
isCatalogText(model.name) &&
|
|
45
|
+
(model.providerType === undefined || CATALOG_PROVIDER_TYPES.includes(model.providerType))) ||
|
|
46
|
+
new Set(value.models.map((model) => model.id)).size !== value.models.length ||
|
|
47
|
+
!isExecutorConfiguration({ model: value.currentModel }) ||
|
|
48
|
+
typeof value.supportsAttachments !== 'boolean' ||
|
|
49
|
+
typeof value.supportsModelChange !== 'boolean')
|
|
50
|
+
throw new TypeError('Executor catalog is invalid');
|
|
51
|
+
const usedModels = new Set();
|
|
52
|
+
const groupIds = new Set();
|
|
53
|
+
if (value.modelGroups !== undefined &&
|
|
54
|
+
(!Array.isArray(value.modelGroups) ||
|
|
55
|
+
value.modelGroups.length > value.models.length ||
|
|
56
|
+
!value.modelGroups.every((group) => {
|
|
57
|
+
if (!group ||
|
|
58
|
+
!isExecutorConfiguration({ model: group.id }) ||
|
|
59
|
+
typeof group.id !== 'string' ||
|
|
60
|
+
!isCatalogText(group.name) ||
|
|
61
|
+
groupIds.has(group.id) ||
|
|
62
|
+
!Array.isArray(group.variants) ||
|
|
63
|
+
group.variants.length < 2 ||
|
|
64
|
+
group.variants.length > 7)
|
|
65
|
+
return false;
|
|
66
|
+
groupIds.add(group.id);
|
|
67
|
+
const levels = new Set();
|
|
68
|
+
return group.variants.every((variant) => {
|
|
69
|
+
if (!variant ||
|
|
70
|
+
!isThinkingLevel(variant.level) ||
|
|
71
|
+
levels.has(variant.level) ||
|
|
72
|
+
usedModels.has(variant.modelId) ||
|
|
73
|
+
!value.models.some((model) => model.id === variant.modelId))
|
|
74
|
+
return false;
|
|
75
|
+
levels.add(variant.level);
|
|
76
|
+
usedModels.add(variant.modelId);
|
|
77
|
+
return true;
|
|
78
|
+
});
|
|
79
|
+
})))
|
|
80
|
+
throw new TypeError('Executor model groups are invalid');
|
|
81
|
+
return Object.freeze({
|
|
82
|
+
id,
|
|
83
|
+
displayName: value.displayName,
|
|
84
|
+
readiness: value.readiness,
|
|
85
|
+
models: Object.freeze(value.models.map(({ id, name, providerType }) => Object.freeze({
|
|
86
|
+
id,
|
|
87
|
+
name,
|
|
88
|
+
...(providerType !== undefined ? { providerType } : {}),
|
|
89
|
+
}))),
|
|
90
|
+
...(value.modelGroups !== undefined
|
|
91
|
+
? {
|
|
92
|
+
modelGroups: Object.freeze(value.modelGroups.map((group) => Object.freeze({
|
|
93
|
+
id: group.id,
|
|
94
|
+
name: group.name,
|
|
95
|
+
variants: Object.freeze(group.variants.map(({ modelId, level }) => Object.freeze({ modelId, level }))),
|
|
96
|
+
}))),
|
|
97
|
+
}
|
|
98
|
+
: {}),
|
|
99
|
+
...(value.currentModel !== undefined ? { currentModel: value.currentModel } : {}),
|
|
100
|
+
supportsAttachments: value.supportsAttachments,
|
|
101
|
+
supportsModelChange: value.supportsModelChange,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
function isCatalogText(value) {
|
|
105
|
+
return typeof value === 'string' && value.length <= 8_192 && !/[\0\r]/u.test(value);
|
|
106
|
+
}
|
|
@@ -213,7 +213,10 @@ export function mcpConfigChangeRetiresCredentials(previous, next) {
|
|
|
213
213
|
const nextStdio = isMcpStdioConfig(next);
|
|
214
214
|
if (previousStdio || nextStdio)
|
|
215
215
|
return previousStdio !== nextStdio;
|
|
216
|
-
return previous.url !== next.url
|
|
216
|
+
return (previous.url !== next.url ||
|
|
217
|
+
previous.oauth?.issuer !== next.oauth?.issuer ||
|
|
218
|
+
previous.oauth?.clientId !== next.oauth?.clientId ||
|
|
219
|
+
previous.oauth?.clientSecret !== next.oauth?.clientSecret);
|
|
217
220
|
}
|
|
218
221
|
export function resolveMcpProtocolPreference(config) {
|
|
219
222
|
return config.protocol ?? 'legacy';
|
|
@@ -140,7 +140,7 @@ export function openAiAdapterApiProtocol(modelId, providerType) {
|
|
|
140
140
|
(providerType === 'opencode-go' && id === 'muse-spark-1.2-contributor') ||
|
|
141
141
|
((providerType === 'alibaba-token-plan-cn' || providerType === 'alibaba-token-plan') &&
|
|
142
142
|
id === 'qwen3.8-max') ||
|
|
143
|
-
/^gpt-
|
|
143
|
+
/^gpt-[56]/i.test(id) ||
|
|
144
144
|
((providerType === 'xai' || providerType === 'xai-oauth') && id === 'grok-4.5')
|
|
145
145
|
? 'openai-responses'
|
|
146
146
|
: 'openai-chat';
|
|
@@ -205,6 +205,24 @@ const GOOGLE_MODEL_OVERRIDES = {
|
|
|
205
205
|
thinkingOptions: { toggle: true, offBehavior: 'google-thinking-budget-zero' },
|
|
206
206
|
},
|
|
207
207
|
};
|
|
208
|
+
// These models are in the live models.dev OpenAI catalog but not yet in the
|
|
209
|
+
// bundled snapshot. The OpenAI Responses SDK accepts only these five GPT-6
|
|
210
|
+
// efforts on both API and Codex OAuth paths. It discards `none` and the Codex
|
|
211
|
+
// model list's `ultra` for Sol, so do not offer them until the request path
|
|
212
|
+
// can send and handle them.
|
|
213
|
+
const OPENAI_GPT6_THINKING_OPTIONS = {
|
|
214
|
+
efforts: ['low', 'medium', 'high', 'xhigh', 'max'],
|
|
215
|
+
};
|
|
216
|
+
const OPENAI_GPT6_MODEL_OVERRIDES = {
|
|
217
|
+
'gpt-6-sol': {
|
|
218
|
+
displayName: 'GPT-6 Sol',
|
|
219
|
+
thinkingOptions: OPENAI_GPT6_THINKING_OPTIONS,
|
|
220
|
+
},
|
|
221
|
+
'gpt-6-luna': {
|
|
222
|
+
displayName: 'GPT-6 Luna',
|
|
223
|
+
thinkingOptions: OPENAI_GPT6_THINKING_OPTIONS,
|
|
224
|
+
},
|
|
225
|
+
};
|
|
208
226
|
// The OAuth path pins its own context windows over whatever the public
|
|
209
227
|
// catalog says. Base facts come from the active table, falling back to the
|
|
210
228
|
// shipped snapshot so a model upstream stops listing keeps a display name.
|
|
@@ -221,6 +239,14 @@ function withoutInputLimit(metadata) {
|
|
|
221
239
|
}
|
|
222
240
|
function openAiOAuthModelMetadata(active) {
|
|
223
241
|
return {
|
|
242
|
+
'gpt-6-sol': {
|
|
243
|
+
...openAiOAuthBase(active, 'gpt-6-sol'),
|
|
244
|
+
...OPENAI_GPT6_MODEL_OVERRIDES['gpt-6-sol'],
|
|
245
|
+
},
|
|
246
|
+
'gpt-6-luna': {
|
|
247
|
+
...openAiOAuthBase(active, 'gpt-6-luna'),
|
|
248
|
+
...OPENAI_GPT6_MODEL_OVERRIDES['gpt-6-luna'],
|
|
249
|
+
},
|
|
224
250
|
'gpt-5.6-sol': {
|
|
225
251
|
...openAiOAuthBase(active, 'gpt-5.6-sol'),
|
|
226
252
|
contextWindow: 372_000,
|
|
@@ -412,6 +438,7 @@ const COMMAND_CODE_MODEL_METADATA = {
|
|
|
412
438
|
function buildStaticModelMetadata(active) {
|
|
413
439
|
return {
|
|
414
440
|
anthropic: ANTHROPIC_MODEL_OVERRIDES,
|
|
441
|
+
openai: OPENAI_GPT6_MODEL_OVERRIDES,
|
|
415
442
|
'claude-subscription': claudeSubscriptionModelMetadata(active),
|
|
416
443
|
// The Command Code Provider-API plan rides the same effort table.
|
|
417
444
|
commandcode: COMMAND_CODE_MODEL_METADATA,
|
|
@@ -65,6 +65,39 @@ function deriveThinkingChoices(options) {
|
|
|
65
65
|
}
|
|
66
66
|
return THINKING_LEVELS.filter((level) => choices.has(level));
|
|
67
67
|
}
|
|
68
|
+
/** Known patch-capable models. Unknown models stay off until explicitly enabled. */
|
|
69
|
+
const APPLY_PATCH_MODELS = new Set([
|
|
70
|
+
'gpt-5-codex',
|
|
71
|
+
'gpt-5.1',
|
|
72
|
+
'gpt-5.1-codex',
|
|
73
|
+
'gpt-5.1-codex-mini',
|
|
74
|
+
'gpt-5.1-codex-max',
|
|
75
|
+
'gpt-5.2',
|
|
76
|
+
'gpt-5.2-codex',
|
|
77
|
+
'gpt-5.3-codex',
|
|
78
|
+
'gpt-5.3-codex-spark',
|
|
79
|
+
'gpt-5.4',
|
|
80
|
+
'gpt-5.4-mini',
|
|
81
|
+
'gpt-5.4-nano',
|
|
82
|
+
'gpt-5.4-pro',
|
|
83
|
+
'gpt-5.5',
|
|
84
|
+
'gpt-5.6',
|
|
85
|
+
'gpt-5.6-sol',
|
|
86
|
+
'gpt-5.6-terra',
|
|
87
|
+
'gpt-5.6-luna',
|
|
88
|
+
'gpt-6-astra',
|
|
89
|
+
'deepseek-v4-flash',
|
|
90
|
+
'deepseek-v4-flash-vision-exp',
|
|
91
|
+
'deepseek-v4-pro',
|
|
92
|
+
]);
|
|
93
|
+
/** Shared by model settings and tool routing so the displayed switch matches execution. */
|
|
94
|
+
export function modelApplyPatchEnabled(modelId, override) {
|
|
95
|
+
return (override?.applyPatch ??
|
|
96
|
+
APPLY_PATCH_MODELS.has(modelId
|
|
97
|
+
.trim()
|
|
98
|
+
.toLowerCase()
|
|
99
|
+
.replace(/-\d{4}-\d{2}-\d{2}$/, '')));
|
|
100
|
+
}
|
|
68
101
|
function isRecord(value) {
|
|
69
102
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
70
103
|
}
|
|
@@ -90,6 +123,8 @@ function normalizeModelOverride(entry) {
|
|
|
90
123
|
}
|
|
91
124
|
if (typeof entry.vision === 'boolean')
|
|
92
125
|
declared.vision = entry.vision;
|
|
126
|
+
if (typeof entry.applyPatch === 'boolean')
|
|
127
|
+
declared.applyPatch = entry.applyPatch;
|
|
93
128
|
for (const field of [
|
|
94
129
|
'contextWindow',
|
|
95
130
|
'compactionThreshold',
|
|
@@ -240,7 +275,7 @@ export function thinkingVariantsForModel(providerType, modelId) {
|
|
|
240
275
|
export function applyModelOverride(model, override) {
|
|
241
276
|
if (!override)
|
|
242
277
|
return model;
|
|
243
|
-
const { thinkingLevels: _thinking, defaultThinkingLevel: _defaultThinking, serviceTier: _tier, compactionThreshold: _threshold, maxOutputTokens: _outputBudget, vision, capabilities, ...facts } = override;
|
|
278
|
+
const { thinkingLevels: _thinking, defaultThinkingLevel: _defaultThinking, serviceTier: _tier, compactionThreshold: _threshold, maxOutputTokens: _outputBudget, applyPatch: _applyPatch, vision, capabilities, ...facts } = override;
|
|
244
279
|
return {
|
|
245
280
|
...model,
|
|
246
281
|
...facts,
|
|
@@ -614,7 +614,6 @@ const providerRegistry = {
|
|
|
614
614
|
runtimeAdapter: {
|
|
615
615
|
kind: 'openai-compatible',
|
|
616
616
|
name: 'provider',
|
|
617
|
-
applyPatchProtocol: 'codex-v4a-freeform',
|
|
618
617
|
responses: { adapter: 'open-responses', reasoningReplay: 'plaintext-content' },
|
|
619
618
|
},
|
|
620
619
|
modelDiscovery: { kind: 'protocol' },
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
/**
|
|
20
|
+
* Coordinates a debounced read of an authority-owned projection.
|
|
21
|
+
*
|
|
22
|
+
* The freshness invariant is intentionally stronger than "only the latest
|
|
23
|
+
* query may apply": an authority event also invalidates a read that is
|
|
24
|
+
* already in flight. That read may have captured the projection before the
|
|
25
|
+
* event and can otherwise resolve after the newer state has reached the
|
|
26
|
+
* caller. Callers decide which events are relevant; this module owns the
|
|
27
|
+
* ordering and cancellation rule behind that small interface.
|
|
28
|
+
*/
|
|
29
|
+
export function createRefreshReadCoordinator(input) {
|
|
30
|
+
let cancelScheduled;
|
|
31
|
+
let revision = 0;
|
|
32
|
+
const dropScheduled = () => {
|
|
33
|
+
cancelScheduled?.();
|
|
34
|
+
cancelScheduled = undefined;
|
|
35
|
+
};
|
|
36
|
+
const run = () => {
|
|
37
|
+
cancelScheduled = undefined;
|
|
38
|
+
const readRevision = ++revision;
|
|
39
|
+
void input.read().then((result) => {
|
|
40
|
+
if (readRevision !== revision)
|
|
41
|
+
return;
|
|
42
|
+
input.apply(result);
|
|
43
|
+
}, () => { });
|
|
44
|
+
};
|
|
45
|
+
return {
|
|
46
|
+
observe() {
|
|
47
|
+
// Invalidate before scheduling. The previous read can resolve during the
|
|
48
|
+
// debounce window, before the replacement read is issued.
|
|
49
|
+
revision += 1;
|
|
50
|
+
dropScheduled();
|
|
51
|
+
cancelScheduled = input.schedule(run, input.delayMs);
|
|
52
|
+
},
|
|
53
|
+
refresh() {
|
|
54
|
+
dropScheduled();
|
|
55
|
+
run();
|
|
56
|
+
},
|
|
57
|
+
cancel() {
|
|
58
|
+
dropScheduled();
|
|
59
|
+
revision += 1;
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
@@ -16,8 +16,33 @@
|
|
|
16
16
|
* specific language governing permissions and limitations
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
|
+
import { runtimeHandoffPause } from './runtime-handoff.js';
|
|
20
|
+
import { mayBeTranscriptLedgerInvocationId, } from './runtime-invocation.js';
|
|
19
21
|
export const TOOL_RECOVERY_BUNDLE_CAPABILITY_V1 = 'tool_recovery_bundle_v1';
|
|
20
22
|
export const RUNTIME_CONTINUATION_AUTHORITY_V1 = 'runtime_continuation_authority_v1';
|
|
23
|
+
export function runtimeInvocationRecoveryInventoryFromInvocations(invocations) {
|
|
24
|
+
return invocations.map((invocation) => {
|
|
25
|
+
const base = {
|
|
26
|
+
sessionId: invocation.sessionId,
|
|
27
|
+
invocationId: invocation.invocationId,
|
|
28
|
+
};
|
|
29
|
+
if (!invocation.terminalEvent || runtimeHandoffPause(invocation.terminalEvent)) {
|
|
30
|
+
return { ...base, candidate: invocation };
|
|
31
|
+
}
|
|
32
|
+
return mayBeTranscriptLedgerInvocationId(invocation.invocationId)
|
|
33
|
+
? {
|
|
34
|
+
...base,
|
|
35
|
+
identity: {
|
|
36
|
+
sessionId: invocation.sessionId,
|
|
37
|
+
invocationId: invocation.invocationId,
|
|
38
|
+
runId: invocation.runId,
|
|
39
|
+
turnId: invocation.turnId,
|
|
40
|
+
openedAt: invocation.openedAt,
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
: base;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
21
46
|
/**
|
|
22
47
|
* An append arrived after the run's terminal fact was already written. The
|
|
23
48
|
* refusal is the store doing its job: once a run has said it ended, a late
|
|
@@ -17,6 +17,11 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
import { isTerminalRuntimeEvent } from './runtime-event.js';
|
|
20
|
+
/** Persisted namespace used only by deterministic legacy-transcript conversion runs. */
|
|
21
|
+
export const TRANSCRIPT_LEDGER_INVOCATION_ID_PREFIX = 'transcript-';
|
|
22
|
+
export function mayBeTranscriptLedgerInvocationId(invocationId) {
|
|
23
|
+
return invocationId.startsWith(TRANSCRIPT_LEDGER_INVOCATION_ID_PREFIX);
|
|
24
|
+
}
|
|
20
25
|
/**
|
|
21
26
|
* Rebuild a Session's invocation inventory from its events alone.
|
|
22
27
|
*
|