maka-agent 0.2.0-dev.67.20261002 → 0.2.0-dev.69.20261004
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/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-catalog.js +132 -0
- package/node_modules/@maka/acp-executor-plugin/dist/index.js +251 -113
- package/node_modules/@maka/acp-executor-plugin/dist/plugin.mjs +431 -108
- package/node_modules/@maka/core/dist/executor-catalog.js +25 -3
- package/node_modules/@maka/core/dist/recall.js +13 -14
- package/node_modules/@maka/runtime/dist/admission-limiter.js +3 -2
- package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +0 -3
- package/node_modules/@maka/runtime/dist/model-history.js +4 -14
- package/node_modules/@maka/runtime/dist/plugin-data-services.js +7 -0
- package/node_modules/@maka/runtime/dist/plugin-executor-service.js +19 -3
- package/node_modules/@maka/runtime/dist/runtime-read-model.js +23 -4
- package/node_modules/@maka/runtime/dist/session-manager.js +1 -0
- package/node_modules/@maka/runtime/package.json +1 -0
- package/node_modules/@maka/runtime-host/dist/antigravity-program.js +49 -0
- package/node_modules/@maka/runtime-host/dist/protocol/index.js +3 -1
- package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +8 -2
- package/node_modules/@maka/runtime-host/dist/server/acp/antigravity.js +5 -19
- package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +14 -3
- package/node_modules/@maka/runtime-host/dist/server/external-agent-setup-coordinator.js +3 -0
- package/node_modules/@maka/runtime-host/dist/server/plugin-data-runtime.js +6 -0
- package/node_modules/@maka/runtime-host/dist/server/plugin-scratch-directory.js +55 -0
- package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +40 -6
- package/node_modules/@maka/runtime-host/package.json +1 -0
- package/node_modules/@maka/storage/dist/execution-stores.js +10 -0
- package/node_modules/@maka/storage/dist/runtime-event-persistence.js +1 -0
- package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +74 -5
- package/package.json +1 -1
|
Binary file
|
|
@@ -0,0 +1,132 @@
|
|
|
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
|
+
const CATALOG_TTL_MS = 60_000;
|
|
20
|
+
const PROBE_TIMEOUT_MS = 30_000;
|
|
21
|
+
/** Instance-scoped candidates. Only a retained task Session owns workspace configuration. */
|
|
22
|
+
export class AcpCatalog {
|
|
23
|
+
admission;
|
|
24
|
+
probe;
|
|
25
|
+
unavailable;
|
|
26
|
+
#cached;
|
|
27
|
+
#pending;
|
|
28
|
+
#tail;
|
|
29
|
+
#operations = new Set();
|
|
30
|
+
#revision = 0;
|
|
31
|
+
#disposed = false;
|
|
32
|
+
constructor(admission, probe, unavailable) {
|
|
33
|
+
this.admission = admission;
|
|
34
|
+
this.probe = probe;
|
|
35
|
+
this.unavailable = unavailable;
|
|
36
|
+
}
|
|
37
|
+
async get(signal, refresh = false) {
|
|
38
|
+
signal.throwIfAborted();
|
|
39
|
+
if (this.#disposed)
|
|
40
|
+
return this.unavailable();
|
|
41
|
+
if (refresh)
|
|
42
|
+
this.invalidate();
|
|
43
|
+
while (true) {
|
|
44
|
+
signal.throwIfAborted();
|
|
45
|
+
if (this.#disposed)
|
|
46
|
+
return this.unavailable();
|
|
47
|
+
const cached = this.#cached;
|
|
48
|
+
if (cached && cached.expires > Date.now())
|
|
49
|
+
return cached.entry;
|
|
50
|
+
const pending = this.#ensureProbe();
|
|
51
|
+
const result = await waitForSignal(pending.promise, signal);
|
|
52
|
+
signal.throwIfAborted();
|
|
53
|
+
if (this.#disposed)
|
|
54
|
+
return this.unavailable();
|
|
55
|
+
// An invalidation need not have another caller to start its replacement.
|
|
56
|
+
// Only superseded revisions retry; genuine failures remain terminal.
|
|
57
|
+
if (pending.revision !== this.#revision)
|
|
58
|
+
continue;
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
#ensureProbe() {
|
|
63
|
+
if (!this.#pending) {
|
|
64
|
+
const revision = this.#revision;
|
|
65
|
+
const controller = new AbortController();
|
|
66
|
+
const startup = AbortSignal.any([controller.signal, AbortSignal.timeout(PROBE_TIMEOUT_MS)]);
|
|
67
|
+
const previous = this.#tail;
|
|
68
|
+
const run = async () => {
|
|
69
|
+
try {
|
|
70
|
+
// A refresh must drain the superseded process before starting its replacement.
|
|
71
|
+
await previous;
|
|
72
|
+
startup.throwIfAborted();
|
|
73
|
+
const permit = await this.admission.acquire(startup);
|
|
74
|
+
let entry;
|
|
75
|
+
try {
|
|
76
|
+
startup.throwIfAborted();
|
|
77
|
+
// probe settles only after its process and temporary directory have been disposed.
|
|
78
|
+
entry = await this.probe(startup);
|
|
79
|
+
}
|
|
80
|
+
finally {
|
|
81
|
+
permit.release();
|
|
82
|
+
}
|
|
83
|
+
if (startup.aborted || revision !== this.#revision || this.#disposed)
|
|
84
|
+
return this.unavailable();
|
|
85
|
+
if (entry.readiness === 'ready')
|
|
86
|
+
this.#cached = { entry, expires: Date.now() + CATALOG_TTL_MS };
|
|
87
|
+
return entry;
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return this.unavailable();
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const promise = run().finally(() => {
|
|
94
|
+
this.#operations.delete(promise);
|
|
95
|
+
if (this.#pending?.promise === promise)
|
|
96
|
+
this.#pending = undefined;
|
|
97
|
+
if (this.#tail === promise)
|
|
98
|
+
this.#tail = undefined;
|
|
99
|
+
});
|
|
100
|
+
this.#pending = { revision, controller, promise };
|
|
101
|
+
this.#tail = promise;
|
|
102
|
+
this.#operations.add(promise);
|
|
103
|
+
}
|
|
104
|
+
return this.#pending;
|
|
105
|
+
}
|
|
106
|
+
invalidate() {
|
|
107
|
+
this.#revision++;
|
|
108
|
+
this.#cached = undefined;
|
|
109
|
+
this.#pending?.controller.abort(new Error('ACP catalog invalidated'));
|
|
110
|
+
this.#pending = undefined;
|
|
111
|
+
}
|
|
112
|
+
async dispose() {
|
|
113
|
+
this.#disposed = true;
|
|
114
|
+
this.invalidate();
|
|
115
|
+
await Promise.allSettled(this.#operations);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/** A caller can stop waiting without cancelling a probe shared by other drafts. */
|
|
119
|
+
async function waitForSignal(promise, signal) {
|
|
120
|
+
signal.throwIfAborted();
|
|
121
|
+
return await new Promise((resolve, reject) => {
|
|
122
|
+
const aborted = () => reject(signal.reason);
|
|
123
|
+
signal.addEventListener('abort', aborted, { once: true });
|
|
124
|
+
void promise.then((value) => {
|
|
125
|
+
signal.removeEventListener('abort', aborted);
|
|
126
|
+
resolve(value);
|
|
127
|
+
}, (error) => {
|
|
128
|
+
signal.removeEventListener('abort', aborted);
|
|
129
|
+
reject(error);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
}
|