maka-agent 0.2.0-dev.26.20260909 → 0.2.0-dev.28.20260911
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/LICENSE +106 -0
- package/dist/cli-core.js +28 -0
- package/dist/runtime-host-cli.js +43 -3
- package/dist/runtime-host-handoff-surface.js +10 -8
- package/dist/runtime-host-lifecycle-transaction.js +28 -3
- package/dist/runtime-host-local-source-retirement.js +1 -1
- package/dist/runtime-host-run-command.js +15 -7
- package/dist/runtime-host-setup-command.js +29 -6
- package/dist/runtime-host-update-command.js +49 -5
- package/dist/session-export-command.js +72 -0
- package/dist/session-import-command.js +69 -0
- package/native/runtime-host-peer/prebuilds/darwin-arm64/maka_runtime_host_peer.node +0 -0
- package/native/runtime-host-peer/prebuilds/linux-arm64/maka_runtime_host_peer.node +0 -0
- package/native/runtime-host-peer/prebuilds/linux-x64/maka_runtime_host_peer.node +0 -0
- package/native/runtime-host-peer/prebuilds/win32-x64/maka_runtime_host_peer.node +0 -0
- package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +9 -4
- package/node_modules/@maka/core/dist/diagnostic-log.js +18 -7
- package/node_modules/@maka/core/dist/text-sanitize.js +8 -2
- package/node_modules/@maka/core/dist/usage-stats/types.js +2 -0
- package/node_modules/@maka/core/dist/workhub-routing.js +126 -0
- package/node_modules/@maka/core/package.json +2 -1
- package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +15 -11
- package/node_modules/@maka/runtime/dist/archive-read-tool.js +3 -1
- package/node_modules/@maka/runtime/dist/bots/bot-test.js +2 -1
- package/node_modules/@maka/runtime/dist/bots/feishu-bridge.js +24 -20
- package/node_modules/@maka/runtime/dist/bots/slack-bridge.js +5 -3
- package/node_modules/@maka/runtime/dist/bots/wechat-bridge.js +87 -29
- package/node_modules/@maka/runtime/dist/bots/wecom-bridge.js +40 -36
- package/node_modules/@maka/runtime/dist/builtin-tools.js +21 -2
- package/node_modules/@maka/runtime/dist/computer-use-tools.js +4 -1
- package/node_modules/@maka/runtime/dist/deep-research-tools.js +11 -5
- package/node_modules/@maka/runtime/dist/edit-replace.js +2 -2
- package/node_modules/@maka/runtime/dist/filesystem-worker/operations.js +5 -6
- package/node_modules/@maka/runtime/dist/memory-extraction-evidence.js +7 -1
- package/node_modules/@maka/runtime/dist/memory-extraction.js +12 -7
- package/node_modules/@maka/runtime/dist/openai-responses-websocket.js +2 -5
- package/node_modules/@maka/runtime/dist/plugin-agent-service.js +131 -0
- package/node_modules/@maka/runtime/dist/plugin-approval-service.js +33 -0
- package/node_modules/@maka/runtime/dist/plugin-attachment-service.js +53 -0
- package/node_modules/@maka/runtime/dist/plugin-command-service.js +100 -0
- package/node_modules/@maka/runtime/dist/plugin-composition-loader.js +11 -2
- package/node_modules/@maka/runtime/dist/plugin-data-services.js +332 -0
- package/node_modules/@maka/runtime/dist/plugin-fs-service.js +62 -0
- package/node_modules/@maka/runtime/dist/plugin-goal-service.js +61 -0
- package/node_modules/@maka/runtime/dist/plugin-invocation-signal.js +24 -0
- package/node_modules/@maka/runtime/dist/plugin-llm-service.js +85 -0
- package/node_modules/@maka/runtime/dist/plugin-lsp-service.js +94 -0
- package/node_modules/@maka/runtime/dist/plugin-scope-registry.js +91 -0
- package/node_modules/@maka/runtime/dist/plugin-session-query-service.js +71 -0
- package/node_modules/@maka/runtime/dist/plugin-shell-env-service.js +87 -0
- package/node_modules/@maka/runtime/dist/plugin-shell-service.js +74 -0
- package/node_modules/@maka/runtime/dist/plugin-skill-service.js +93 -0
- package/node_modules/@maka/runtime/dist/plugin-system-prompt-service.js +346 -0
- package/node_modules/@maka/runtime/dist/plugin-tool-service.js +18 -52
- package/node_modules/@maka/runtime/dist/plugin-user-question-service.js +43 -0
- package/node_modules/@maka/runtime/dist/plugin-web-service.js +69 -0
- package/node_modules/@maka/runtime/dist/request-customization-fetch.js +14 -7
- package/node_modules/@maka/runtime/dist/session-export.js +178 -0
- package/node_modules/@maka/runtime/dist/session-import.js +100 -0
- package/node_modules/@maka/runtime/dist/session-manager.js +6 -1
- package/node_modules/@maka/runtime/dist/shell-run-manager.js +9 -6
- package/node_modules/@maka/runtime/dist/shell-run-tool-result.js +13 -6
- package/node_modules/@maka/runtime/dist/stream-graph-coordinator.js +43 -10
- package/node_modules/@maka/runtime/dist/stream-graph-handoff.js +6 -1
- package/node_modules/@maka/runtime/dist/subscription-model-fetch.js +1 -4
- package/node_modules/@maka/runtime/dist/system-prompt/workspace-instructions.js +11 -6
- package/node_modules/@maka/runtime/dist/tavily-search.js +8 -2
- package/node_modules/@maka/runtime/dist/text-line-window.js +49 -0
- package/node_modules/@maka/runtime/dist/tool-output.js +35 -12
- package/node_modules/@maka/runtime/dist/unified-diff.js +40 -10
- package/node_modules/@maka/runtime/dist/web-fetch-tool.js +4 -2
- package/node_modules/@maka/runtime/dist/workers/filesystem-worker.js +82 -33
- package/node_modules/@maka/runtime/dist/workspace-executor.js +2 -6
- package/node_modules/@maka/runtime/package.json +20 -1
- package/node_modules/@maka/runtime-host/dist/client/host-handoff-copy.js +73 -24
- package/node_modules/@maka/runtime-host/dist/client/host-handoff.js +46 -12
- package/node_modules/@maka/runtime-host/dist/operator/setup-frame.js +31 -21
- package/node_modules/@maka/runtime-host/dist/peer-mesh/node.js +7 -4
- package/node_modules/@maka/runtime-host/dist/protocol/artifact.js +2 -2
- package/node_modules/@maka/runtime-host/dist/protocol/index.js +10 -1
- package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +30 -5
- package/node_modules/@maka/runtime-host/dist/protocol/session-transcript.js +3 -2
- package/node_modules/@maka/runtime-host/dist/protocol/skill-catalog.js +2 -1
- package/node_modules/@maka/runtime-host/dist/protocol/workhub-coordination.js +25 -23
- package/node_modules/@maka/runtime-host/dist/server/artifact-coordinator.js +2 -0
- package/node_modules/@maka/runtime-host/dist/server/client-capability-coordinator.js +62 -4
- package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +481 -11
- package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +74 -0
- package/node_modules/@maka/runtime-host/dist/server/goal-coordinator.js +6 -1
- package/node_modules/@maka/runtime-host/dist/server/hosted-execution-recovery.js +2 -2
- package/node_modules/@maka/runtime-host/dist/server/hosted-execution-tool-profile.js +30 -0
- package/node_modules/@maka/runtime-host/dist/server/interactive-run-composer.js +114 -20
- package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +49 -12
- package/node_modules/@maka/runtime-host/dist/server/plugin-data-runtime.js +234 -0
- package/node_modules/@maka/runtime-host/dist/server/plugin-platform-coordinator.js +6 -0
- package/node_modules/@maka/runtime-host/dist/server/plugin-platform.js +12 -0
- package/node_modules/@maka/runtime-host/dist/server/root-admission-owner.js +17 -8
- package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +189 -92
- package/node_modules/@maka/runtime-host/dist/server/runtime-resource-projection.js +3 -9
- package/node_modules/@maka/runtime-host/dist/server/session-continuity-coordinator.js +20 -21
- package/node_modules/@maka/runtime-host/dist/server/session-transcript-pager.js +24 -2
- package/node_modules/@maka/runtime-host/dist/server/skill-catalog-coordinator.js +18 -2
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-action-gate.js +44 -35
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +92 -10
- package/node_modules/@maka/runtime-host/dist/transport/framed-byte-stream-transport.js +4 -1
- package/node_modules/@maka/runtime-host/dist/transport/local-ipc-framing.js +4 -2
- package/node_modules/@maka/runtime-host/dist/transport/peer-native.js +9 -8
- package/node_modules/@maka/runtime-host/dist/transport/resumable-peer-stream.js +14 -9
- package/node_modules/@maka/storage/dist/agent-run-store.js +54 -10
- package/node_modules/@maka/storage/dist/context-offload-snapshot.js +32 -10
- package/node_modules/@maka/storage/dist/context-value-mutation-gate.js +59 -0
- package/node_modules/@maka/storage/dist/execution-stores.js +1 -1
- package/node_modules/@maka/storage/dist/session-bundle-policy.js +909 -34
- package/node_modules/@maka/storage/dist/session-message-projection.js +8 -4
- package/node_modules/@maka/storage/dist/session-store.js +2 -2
- package/node_modules/@maka/storage/dist/sqlite-context-offload-store.js +18 -4
- package/node_modules/@maka/storage/dist/sqlite-session-metadata-store.js +12 -5
- package/node_modules/@maka/storage/dist/stable-storage.js +2 -1
- package/node_modules/@maka/storage/package.json +2 -0
- package/node_modules/@modelcontextprotocol/client/dist/src-D_zzAWoS.mjs +22 -5
- package/node_modules/@modelcontextprotocol/client/dist/src-NAgB4Mp8.cjs +22 -5
- package/node_modules/zod/v4/core/memoizer.cjs +12 -16
- package/node_modules/zod/v4/core/memoizer.js +12 -16
- package/package.json +1 -1
|
@@ -22,7 +22,7 @@ import { chmod, copyFile, lstat, mkdir, realpath } from 'node:fs/promises';
|
|
|
22
22
|
import { dirname, join, resolve } from 'node:path';
|
|
23
23
|
import { backup, DatabaseSync } from 'node:sqlite';
|
|
24
24
|
import { isCanonicalStorageRef } from '@maka/core/events';
|
|
25
|
-
import { discoverMarkedStorageRoot, runWithStorageRootLease, tryAcquireInteractiveRootOwner, } from './root-authority.js';
|
|
25
|
+
import { discoverMarkedStorageRoot, resolveStorageRoot, runWithStorageRootLease, tryAcquireInteractiveRootOwner, } from './root-authority.js';
|
|
26
26
|
import { migrateSqliteContextOffloadDatabase, SQLITE_CONTEXT_OFFLOAD_SCHEMA_VERSION, } from './sqlite-context-offload-schema.js';
|
|
27
27
|
import { CONTEXT_OFFLOAD_DATABASE_NAME, CONTEXT_OFFLOAD_VALUES_DIRECTORY_NAME, } from './sqlite-context-offload-store.js';
|
|
28
28
|
import { syncDirectoryChain, syncFile } from './stable-storage.js';
|
|
@@ -32,10 +32,25 @@ import { SQLITE_SESSION_MESSAGE_CHUNK_MARKER } from './sqlite-session-metadata-s
|
|
|
32
32
|
* snapshots require the root owner: a Session gate does not fence global GC.
|
|
33
33
|
* The callback must recheck absence before publishing an artifact-only snapshot.
|
|
34
34
|
*/
|
|
35
|
-
export async function withOfflineContextSnapshot(root, operation) {
|
|
36
|
-
if (
|
|
35
|
+
export async function withOfflineContextSnapshot(root, operation, options = {}) {
|
|
36
|
+
if (options.requireAuthority !== true &&
|
|
37
|
+
!(await exists(join(root, CONTEXT_OFFLOAD_DATABASE_NAME)))) {
|
|
37
38
|
return operation(false);
|
|
38
|
-
|
|
39
|
+
}
|
|
40
|
+
const lease = options.lease;
|
|
41
|
+
if (lease) {
|
|
42
|
+
if ((await realpath(root).catch(() => resolve(root))) !== lease.canonicalPath) {
|
|
43
|
+
throw new Error('Context snapshot lease does not name this Storage Root');
|
|
44
|
+
}
|
|
45
|
+
return runWithStorageRootLease(lease, 'interactive', 'write', () => operation(true));
|
|
46
|
+
}
|
|
47
|
+
// Discovery finds a marked root; it does not make one. A workspace that has
|
|
48
|
+
// never been opened is exactly the target an import writes to first, so when
|
|
49
|
+
// the caller says it is about to write, the root is resolved -- which
|
|
50
|
+
// initialises it -- rather than merely looked for.
|
|
51
|
+
const capability = options.requireAuthority === true
|
|
52
|
+
? await resolveStorageRoot({ path: root, kind: 'interactive' })
|
|
53
|
+
: await discoverMarkedStorageRoot({ path: root });
|
|
39
54
|
const owner = await tryAcquireInteractiveRootOwner(capability);
|
|
40
55
|
if (!owner)
|
|
41
56
|
throw new Error('Context snapshot requires an offline Storage Root; stop the Runtime Host first');
|
|
@@ -47,7 +62,7 @@ export async function withOfflineContextSnapshot(root, operation) {
|
|
|
47
62
|
}
|
|
48
63
|
}
|
|
49
64
|
/** Copies under the offline owner and the caller's Artifact lock; never mutates the source DB. */
|
|
50
|
-
export async function copyContextSnapshot(sourceRoot, targetRoot, contextLocked,
|
|
65
|
+
export async function copyContextSnapshot(sourceRoot, targetRoot, contextLocked, sessionIds) {
|
|
51
66
|
const sourcePath = join(sourceRoot, CONTEXT_OFFLOAD_DATABASE_NAME);
|
|
52
67
|
if (!(await exists(sourcePath)))
|
|
53
68
|
return false;
|
|
@@ -68,8 +83,14 @@ export async function copyContextSnapshot(sourceRoot, targetRoot, contextLocked,
|
|
|
68
83
|
target.exec('PRAGMA foreign_keys = ON');
|
|
69
84
|
migrateSqliteContextOffloadDatabase(target);
|
|
70
85
|
target.exec('BEGIN IMMEDIATE');
|
|
71
|
-
|
|
72
|
-
|
|
86
|
+
// A subagent child's context refs belong to the export as much as its
|
|
87
|
+
// parent's do: the parent's tool call is why the child ran at all.
|
|
88
|
+
if (sessionIds !== undefined) {
|
|
89
|
+
const keep = sessionIds.map(() => '?').join(', ');
|
|
90
|
+
target
|
|
91
|
+
.prepare(`DELETE FROM context_refs WHERE session_id NOT IN (${keep})`)
|
|
92
|
+
.run(...sessionIds);
|
|
93
|
+
}
|
|
73
94
|
target.exec(`
|
|
74
95
|
DELETE FROM context_gc_candidates;
|
|
75
96
|
DELETE FROM context_file_deletions;
|
|
@@ -110,7 +131,7 @@ export async function copyContextSnapshot(sourceRoot, targetRoot, contextLocked,
|
|
|
110
131
|
await syncDirectoryChain(targetRoot, targetRoot);
|
|
111
132
|
return true;
|
|
112
133
|
}
|
|
113
|
-
export async function planContextSnapshotFiles(root,
|
|
134
|
+
export async function planContextSnapshotFiles(root, sessionIds) {
|
|
114
135
|
const path = join(root, CONTEXT_OFFLOAD_DATABASE_NAME);
|
|
115
136
|
if (!(await exists(path)))
|
|
116
137
|
return [];
|
|
@@ -126,8 +147,9 @@ export async function planContextSnapshotFiles(root, sessionId) {
|
|
|
126
147
|
for (const row of database
|
|
127
148
|
.prepare(`SELECT DISTINCT b.blob_id, b.payload FROM context_refs r
|
|
128
149
|
JOIN context_blobs b ON b.blob_id = r.blob_id
|
|
129
|
-
WHERE r.session_id
|
|
130
|
-
|
|
150
|
+
WHERE r.session_id IN (${sessionIds.map(() => '?').join(', ')})
|
|
151
|
+
AND b.storage_kind = 'managed_file' ORDER BY b.blob_id`)
|
|
152
|
+
.iterate(...sessionIds)) {
|
|
131
153
|
const file = managedPath(row.blob_id, row.payload);
|
|
132
154
|
await assertRegularPath(root, file);
|
|
133
155
|
files.push(file);
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
* Serialises every mutation of a Storage Root's managed context values.
|
|
21
|
+
*
|
|
22
|
+
* The Context Store's own operations read database state, await, and then act
|
|
23
|
+
* on files -- garbage collection decides a payload is unreferenced, awaits, and
|
|
24
|
+
* unlinks it. A second writer that commits a reference to that payload inside
|
|
25
|
+
* the await leaves a reference pointing at a file that is about to disappear.
|
|
26
|
+
* The re-check garbage collection performs cannot see it, because the check and
|
|
27
|
+
* the unlink straddle the await.
|
|
28
|
+
*
|
|
29
|
+
* The Store used to serialise those operations against each other through a
|
|
30
|
+
* private promise tail, which fenced nothing outside the instance. This is the
|
|
31
|
+
* same queue, keyed by Storage Root, so that an importer publishing payloads
|
|
32
|
+
* into a live workspace takes its turn alongside the Store's own publication
|
|
33
|
+
* and collection rather than interleaving with them.
|
|
34
|
+
*
|
|
35
|
+
* In-process is the whole boundary: the interactive write authority is an
|
|
36
|
+
* exclusive election, so one process at a time can mutate a root's context.
|
|
37
|
+
*
|
|
38
|
+
* `root` must already be canonical -- the same string the Store derives with
|
|
39
|
+
* `realpath`. Two spellings of one directory would be two queues and fence
|
|
40
|
+
* nothing.
|
|
41
|
+
*/
|
|
42
|
+
const gates = new Map();
|
|
43
|
+
export async function runWithContextValueMutation(root, operation) {
|
|
44
|
+
const previous = gates.get(root);
|
|
45
|
+
let release;
|
|
46
|
+
const current = new Promise((resolve) => {
|
|
47
|
+
release = resolve;
|
|
48
|
+
});
|
|
49
|
+
gates.set(root, current);
|
|
50
|
+
await previous?.catch(() => { });
|
|
51
|
+
try {
|
|
52
|
+
return await operation();
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
release();
|
|
56
|
+
if (gates.get(root) === current)
|
|
57
|
+
gates.delete(root);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -172,7 +172,7 @@ async function createExecutionStoresForWrite(lease, kind, extension) {
|
|
|
172
172
|
listMessageAdmissions: (sessionId) => run(() => sessionStore.listMessageAdmissions(sessionId)),
|
|
173
173
|
markMessagesHandedOff: (input) => run(() => sessionStore.markMessagesHandedOff(input)),
|
|
174
174
|
updateMessageAdmission: (admission) => run(() => sessionStore.updateMessageAdmission(admission)),
|
|
175
|
-
reorderMessageAdmissions: (sessionId, messageIds) => run(() => sessionStore.reorderMessageAdmissions(sessionId, messageIds)),
|
|
175
|
+
reorderMessageAdmissions: (sessionId, messageIds, disposition) => run(() => sessionStore.reorderMessageAdmissions(sessionId, messageIds, disposition)),
|
|
176
176
|
cancelMessageAdmissions: (sessionId, messageIds) => run(() => sessionStore.cancelMessageAdmissions(sessionId, messageIds)),
|
|
177
177
|
subscribeTranscriptChanges: (listener) => sessionStore.subscribeTranscriptChanges(listener),
|
|
178
178
|
updateHeader: (sessionId, patch) => run(() => sessionStore.updateHeader(sessionId, patch)),
|