maka-agent 0.2.0-dev.23.20260906 → 0.2.0-dev.24.20260907
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/dist/acp/maka-acp-agent.js +2 -1
- package/dist/acp/session-configuration.js +143 -0
- package/dist/acp/session-registry.js +90 -4
- package/dist/cli-core.js +2 -0
- package/dist/pi-transcript.js +5 -12
- package/dist/pi-tui-runner.js +74 -4
- package/dist/runtime-host-cli-context.js +167 -78
- package/dist/runtime-host-cli-installation.js +8 -2
- package/dist/runtime-host-cli.js +31 -1
- package/dist/runtime-host-handoff-surface.js +81 -0
- package/dist/runtime-host-installed-update-bootstrap.js +13 -0
- package/dist/runtime-host-installed-update-coordinator.js +33 -0
- package/dist/runtime-host-lifecycle-transaction.js +9 -1
- package/dist/runtime-host-local-handoff.js +37 -4
- package/dist/runtime-host-local-managed-activation.js +84 -0
- package/dist/runtime-host-local-source-retirement.js +18 -2
- package/dist/runtime-host-managed-lifecycle-manager.js +1 -0
- package/dist/runtime-host-operator-retirement.js +50 -0
- package/dist/runtime-host-service-manager.js +3 -0
- package/dist/runtime-host-session-driver.js +4 -25
- package/dist/runtime-host-session-update.js +62 -0
- package/dist/runtime-host-tui-command.js +38 -73
- package/dist/runtime-host-tui-context.js +1 -0
- package/dist/runtime-host-tui-owner.js +226 -0
- package/dist/tui-copy-catalog.js +140 -3
- package/dist/tui-host-owner-copy.js +24 -0
- package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
- package/node_modules/@maka/core/dist/canonical-runtime-event.js +3 -1
- package/node_modules/@maka/core/dist/model-failure.js +40 -0
- package/node_modules/@maka/core/dist/model-metadata.generated.js +4 -4
- package/node_modules/@maka/core/dist/model-metadata.js +3 -3
- package/node_modules/@maka/core/dist/model-web-search.js +5 -4
- package/node_modules/@maka/core/dist/provider-registry.js +45 -4
- package/node_modules/@maka/core/dist/record-schema.js +9 -2
- package/node_modules/@maka/core/dist/runtime-boundary.js +31 -11
- package/node_modules/@maka/core/dist/runtime-event.js +37 -6
- package/node_modules/@maka/core/dist/runtime-handoff.js +98 -0
- package/node_modules/@maka/core/dist/runtime-invocation.js +1 -1
- package/node_modules/@maka/core/dist/runtime-logical-execution.js +112 -0
- package/node_modules/@maka/core/dist/session.js +54 -52
- package/node_modules/@maka/core/dist/slash-command-catalog.js +2 -0
- package/node_modules/@maka/core/dist/tool-result-archive-evidence.js +20 -0
- package/node_modules/@maka/core/dist/usage-record-schema.js +26 -35
- package/node_modules/@maka/core/package.json +4 -0
- package/node_modules/@maka/mcp/dist/index.js +131 -1
- package/node_modules/@maka/runtime/dist/agent-run.js +272 -105
- package/node_modules/@maka/runtime/dist/ai-sdk-backend.js +13 -5
- package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +109 -34
- package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +127 -133
- package/node_modules/@maka/runtime/dist/context-budget.js +14 -9
- package/node_modules/@maka/runtime/dist/conversation-copy.js +5 -4
- package/node_modules/@maka/runtime/dist/goal-continuation.js +36 -4
- package/node_modules/@maka/runtime/dist/history-compact-checkpoint.js +18 -9
- package/node_modules/@maka/runtime/dist/history-compact-summarizer.js +30 -22
- package/node_modules/@maka/runtime/dist/history-compaction.js +29 -4
- package/node_modules/@maka/runtime/dist/ledger-tool-result-archive-reader.js +106 -0
- package/node_modules/@maka/runtime/dist/message-authority.js +9 -0
- package/node_modules/@maka/runtime/dist/model-adapter.js +19 -98
- package/node_modules/@maka/runtime/dist/model-factory.js +19 -81
- package/node_modules/@maka/runtime/dist/model-fetcher.js +7 -0
- package/node_modules/@maka/runtime/dist/model-runtime.js +85 -111
- package/node_modules/@maka/runtime/dist/native-web-search-tool.js +2 -1
- package/node_modules/@maka/runtime/dist/openai-codex-history-compactor.js +2 -2
- package/node_modules/@maka/runtime/dist/opencode-session-header.js +4 -2
- package/node_modules/@maka/runtime/dist/provider-error-classification.js +84 -123
- package/node_modules/@maka/runtime/dist/provider-request-telemetry.js +68 -108
- package/node_modules/@maka/runtime/dist/run-handoff-gate.js +97 -0
- package/node_modules/@maka/runtime/dist/runtime-event-backfill.js +82 -54
- package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +117 -159
- package/node_modules/@maka/runtime/dist/runtime-kernel.js +150 -112
- package/node_modules/@maka/runtime/dist/runtime-ledger-repair.js +160 -79
- package/node_modules/@maka/runtime/dist/runtime-read-model.js +30 -89
- package/node_modules/@maka/runtime/dist/runtime-resume.js +80 -4
- package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +5 -0
- package/node_modules/@maka/runtime/dist/session-manager.js +171 -288
- package/node_modules/@maka/runtime/dist/session-projection-helpers.js +0 -27
- package/node_modules/@maka/runtime/dist/subscription-model-fetch.js +3 -4
- package/node_modules/@maka/runtime/dist/test-connection.js +16 -16
- package/node_modules/@maka/runtime/dist/tool-result-archive-encoding.js +38 -0
- package/node_modules/@maka/runtime/dist/tool-runtime.js +3 -61
- package/node_modules/@maka/runtime/package.json +1 -0
- package/node_modules/@maka/runtime-host/dist/adapter/session-projector.js +35 -0
- package/node_modules/@maka/runtime-host/dist/client/connect-or-spawn.js +9 -1
- package/node_modules/@maka/runtime-host/dist/client/connection.js +3 -0
- package/node_modules/@maka/runtime-host/dist/client/host-handoff-copy.js +156 -0
- package/node_modules/@maka/runtime-host/dist/client/host-handoff.js +273 -0
- package/node_modules/@maka/runtime-host/dist/client/host-retirement.js +26 -5
- package/node_modules/@maka/runtime-host/dist/client/index.js +2 -0
- package/node_modules/@maka/runtime-host/dist/client/launcher.js +3 -0
- package/node_modules/@maka/runtime-host/dist/client/remote-compatibility-error.js +2 -0
- package/node_modules/@maka/runtime-host/dist/client/session-subscription.js +27 -5
- package/node_modules/@maka/runtime-host/dist/operator/index.js +2 -1
- package/node_modules/@maka/runtime-host/dist/operator/retirement-cancellation.js +20 -0
- package/node_modules/@maka/runtime-host/dist/protocol/host-status.js +21 -12
- package/node_modules/@maka/runtime-host/dist/protocol/index.js +25 -1
- package/node_modules/@maka/runtime-host/dist/protocol/operations.js +1 -0
- package/node_modules/@maka/runtime-host/dist/protocol/session-continuity.js +40 -20
- package/node_modules/@maka/runtime-host/dist/protocol/session-transcript.js +0 -5
- package/node_modules/@maka/runtime-host/dist/protocol/session-turns.js +29 -58
- package/node_modules/@maka/runtime-host/dist/protocol/turn.js +11 -1
- package/node_modules/@maka/runtime-host/dist/server/access-credential-store.js +1 -0
- package/node_modules/@maka/runtime-host/dist/server/canonical-turn-snapshot.js +19 -4
- package/node_modules/@maka/runtime-host/dist/server/connection-session.js +7 -6
- package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +100 -24
- package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +5 -5
- package/node_modules/@maka/runtime-host/dist/server/execution-model-composition.js +3 -2
- package/node_modules/@maka/runtime-host/dist/server/goal-coordinator.js +40 -1
- package/node_modules/@maka/runtime-host/dist/server/host-kernel.js +96 -17
- package/node_modules/@maka/runtime-host/dist/server/host-residency-registry.js +13 -7
- package/node_modules/@maka/runtime-host/dist/server/hosted-execution-admission-registry.js +3 -1
- package/node_modules/@maka/runtime-host/dist/server/hosted-execution-recovery.js +124 -62
- package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +76 -6
- package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +325 -73
- package/node_modules/@maka/runtime-host/dist/server/scheduled-task-coordinator.js +37 -2
- package/node_modules/@maka/runtime-host/dist/server/serial-outbound-writer.js +45 -3
- package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +50 -7
- package/node_modules/@maka/runtime-host/dist/server/session-continuity-coordinator.js +87 -25
- package/node_modules/@maka/runtime-host/dist/server/session-revision-coordinator.js +8 -55
- package/node_modules/@maka/runtime-host/dist/server/session-sidecar-purge.js +1 -16
- package/node_modules/@maka/runtime-host/dist/server/session-transcript-pager.js +0 -1
- package/node_modules/@maka/runtime-host/dist/server/session-transcript-reader.js +460 -70
- package/node_modules/@maka/runtime-host/dist/server/shared-session-transcript.js +1 -1
- package/node_modules/@maka/runtime-host/dist/server/storage-maintenance.js +109 -0
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +0 -1
- package/node_modules/@maka/storage/dist/artifact-store.js +21 -10
- package/node_modules/@maka/storage/dist/artifact-stores.js +1 -1
- package/node_modules/@maka/storage/dist/claude-code-session-adapter.js +0 -4
- package/node_modules/@maka/storage/dist/codex-session-adapter.js +0 -2
- package/node_modules/@maka/storage/dist/context-offload-snapshot.js +325 -0
- package/node_modules/@maka/storage/dist/execution-stores.js +9 -7
- package/node_modules/@maka/storage/dist/file-session-repository.js +1012 -0
- package/node_modules/@maka/storage/dist/opencode-session-adapter.js +0 -4
- package/node_modules/@maka/storage/dist/operational-state-backup.js +9 -5
- package/node_modules/@maka/storage/dist/runtime-event-persistence.js +1 -0
- package/node_modules/@maka/storage/dist/runtime-transcript-query.js +308 -0
- package/node_modules/@maka/storage/dist/session-bundle-policy.js +24 -4
- package/node_modules/@maka/storage/dist/session-message-projection.js +15 -0
- package/node_modules/@maka/storage/dist/session-repository.js +767 -0
- package/node_modules/@maka/storage/dist/session-store.js +25 -99
- package/node_modules/@maka/storage/dist/sqlite-artifact-metadata.js +10 -3
- package/node_modules/@maka/storage/dist/sqlite-context-offload-store.js +24 -8
- package/node_modules/@maka/storage/dist/sqlite-core-execution-schema.js +7 -1
- package/node_modules/@maka/storage/dist/sqlite-runtime-schema.js +44 -1
- package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +129 -25
- package/node_modules/@maka/storage/dist/sqlite-session-metadata-store.js +109 -892
- package/node_modules/@maka/storage/dist/tool-result-archive-evidence.js +111 -0
- package/node_modules/@maka/storage/package.json +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,111 @@
|
|
|
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 { TOOL_RESULT_ARCHIVE_EVIDENCE_MAX_BYTES as MAX_BYTES, TOOL_RESULT_ARCHIVE_EVIDENCE_MAX_TRANSITIONS as MAX_TRANSITIONS, } from '@maka/core/tool-result-archive-evidence';
|
|
20
|
+
import { assertStorageRootLease, runWithStorageRootLease, } from './root-authority.js';
|
|
21
|
+
import { decodeRuntimeEvent } from '@maka/core/runtime-event';
|
|
22
|
+
import { decodeAgentRunEvent } from '@maka/core/agent-run';
|
|
23
|
+
import { MODEL_PROJECTION_TARGET_SQL as TARGET } from './sqlite-core-execution-schema.js';
|
|
24
|
+
const TRANSITIONS = 'core_agent_run_events INDEXED BY core_model_projection_target';
|
|
25
|
+
const KIND = "event_type = 'model_projection_transition_recorded'";
|
|
26
|
+
/** Reader-first foundation; no archive writer or fallback is activated by opening it. */
|
|
27
|
+
export async function openToolResultArchiveEvidenceReader(lease) {
|
|
28
|
+
await assertStorageRootLease(lease, 'interactive', lease.access);
|
|
29
|
+
const { acquireOperationalStateDatabase } = await import('./operational-state-store.js');
|
|
30
|
+
await assertStorageRootLease(lease, 'interactive', lease.access);
|
|
31
|
+
const database = acquireOperationalStateDatabase(lease.canonicalPath, {
|
|
32
|
+
schemaMigration: lease.access === 'read' ? 'require_current' : 'migrate',
|
|
33
|
+
});
|
|
34
|
+
let closed = false;
|
|
35
|
+
return {
|
|
36
|
+
close() {
|
|
37
|
+
if (!closed) {
|
|
38
|
+
closed = true;
|
|
39
|
+
database.close();
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
async read(input) {
|
|
43
|
+
const accepted = { ...input };
|
|
44
|
+
if (closed)
|
|
45
|
+
return { ok: false, reason: 'unavailable' };
|
|
46
|
+
try {
|
|
47
|
+
return await runWithStorageRootLease(lease, 'interactive', lease.access, async () => {
|
|
48
|
+
if (closed)
|
|
49
|
+
return { ok: false, reason: 'unavailable' };
|
|
50
|
+
return database.transaction('read', () => {
|
|
51
|
+
const db = database.database;
|
|
52
|
+
const { sessionId, runtimeEventId } = accepted;
|
|
53
|
+
const eventSize = db
|
|
54
|
+
.prepare('SELECT length(CAST(payload_json AS BLOB)) AS bytes FROM runtime_events WHERE event_id = ? AND session_id = ?')
|
|
55
|
+
.get(runtimeEventId, sessionId);
|
|
56
|
+
if (!eventSize)
|
|
57
|
+
return { ok: false, reason: 'not_found' };
|
|
58
|
+
// An unscoped unreadable transition prevents proving completeness.
|
|
59
|
+
if (db
|
|
60
|
+
.prepare(`SELECT 1 FROM ${TRANSITIONS} WHERE ${KIND} AND session_id = ? AND ${TARGET} IS NULL LIMIT 1`)
|
|
61
|
+
.get(sessionId))
|
|
62
|
+
return { ok: false, reason: 'corrupt' };
|
|
63
|
+
const sizes = db
|
|
64
|
+
.prepare(`SELECT run_id, sequence, length(CAST(record_json AS BLOB)) AS bytes FROM ${TRANSITIONS}
|
|
65
|
+
WHERE ${KIND} AND session_id = ? AND ${TARGET} = ? LIMIT ?`)
|
|
66
|
+
.all(sessionId, runtimeEventId, MAX_TRANSITIONS + 1);
|
|
67
|
+
if (sizes.length > MAX_TRANSITIONS)
|
|
68
|
+
return { ok: false, reason: 'too_large' };
|
|
69
|
+
let bytes = Number(eventSize.bytes);
|
|
70
|
+
for (const row of sizes)
|
|
71
|
+
bytes += Number(row.bytes);
|
|
72
|
+
if (!Number.isSafeInteger(bytes) || bytes < 0 || bytes > MAX_BYTES)
|
|
73
|
+
return { ok: false, reason: 'too_large' };
|
|
74
|
+
const raw = db
|
|
75
|
+
.prepare('SELECT payload_json FROM runtime_events WHERE event_id = ? AND session_id = ?')
|
|
76
|
+
.get(runtimeEventId, sessionId);
|
|
77
|
+
let event;
|
|
78
|
+
try {
|
|
79
|
+
event = decodeRuntimeEvent(JSON.parse(String(raw?.payload_json)));
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return { ok: false, reason: 'corrupt' };
|
|
83
|
+
}
|
|
84
|
+
if (event.sessionId !== sessionId || event.id !== runtimeEventId)
|
|
85
|
+
return { ok: false, reason: 'corrupt' };
|
|
86
|
+
const read = db.prepare('SELECT record_json FROM core_agent_run_events WHERE session_id = ? AND run_id = ? AND sequence = ?');
|
|
87
|
+
const transitions = [];
|
|
88
|
+
for (const row of sizes) {
|
|
89
|
+
const stored = read.get(sessionId, row.run_id, row.sequence);
|
|
90
|
+
let transition;
|
|
91
|
+
try {
|
|
92
|
+
transition = decodeAgentRunEvent(JSON.parse(String(stored?.record_json)));
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return { ok: false, reason: 'corrupt' };
|
|
96
|
+
}
|
|
97
|
+
if (transition.sessionId !== sessionId)
|
|
98
|
+
return { ok: false, reason: 'corrupt' };
|
|
99
|
+
transitions.push(transition);
|
|
100
|
+
}
|
|
101
|
+
return { ok: true, event, transitions };
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
// Failure to acquire/read the store is not evidence that its records are invalid.
|
|
107
|
+
return { ok: false, reason: 'unavailable' };
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"./artifact-stores": "./dist/artifact-stores.js",
|
|
11
11
|
"./config-transfer": "./dist/config-transfer.js",
|
|
12
12
|
"./context-offload-store": "./dist/context-offload-store.js",
|
|
13
|
+
"./tool-result-archive-evidence": "./dist/tool-result-archive-evidence.js",
|
|
13
14
|
"./credential-store": "./dist/credential-store.js",
|
|
14
15
|
"./daily-review-authority": "./dist/daily-review-authority.js",
|
|
15
16
|
"./deep-research-authority": "./dist/deep-research-authority.js",
|
|
@@ -45,6 +46,7 @@
|
|
|
45
46
|
"./session-bundle-policy": "./dist/session-bundle-policy.js",
|
|
46
47
|
"./session-copy-cleanup": "./dist/session-copy-cleanup.js",
|
|
47
48
|
"./session-todo-authority": "./dist/session-todo-authority.js",
|
|
49
|
+
"./session-message-projection": "./dist/session-message-projection.js",
|
|
48
50
|
"./session-store": "./dist/session-store.js",
|
|
49
51
|
"./settings-store": "./dist/settings-store.js",
|
|
50
52
|
"./shell-run-authority": "./dist/shell-run-authority.js",
|