maka-agent 0.2.0-dev.53.20260927 → 0.2.0-dev.62.20260928

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 (55) hide show
  1. package/LICENSE +6 -5
  2. package/dist/workspace-root.js +2 -2
  3. package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
  4. package/node_modules/@maka/acp-executor-plugin/dist/index.js +333 -28
  5. package/node_modules/@maka/acp-executor-plugin/dist/plugin.mjs +283 -27
  6. package/node_modules/@maka/core/dist/executor-catalog.js +10 -1
  7. package/node_modules/@maka/core/dist/message-queue-order.js +47 -0
  8. package/node_modules/@maka/core/dist/model-metadata.js +2 -1
  9. package/node_modules/@maka/core/dist/redaction.js +42 -3
  10. package/node_modules/@maka/core/dist/relative-time-policy.js +71 -0
  11. package/node_modules/@maka/core/dist/relative-time.js +3 -54
  12. package/node_modules/@maka/core/package.json +1 -0
  13. package/node_modules/@maka/eval/dist/egress-audit.js +127 -0
  14. package/node_modules/@maka/eval/dist/harness-executor.js +16 -96
  15. package/node_modules/@maka/eval/harbor/egress-proxy/entrypoint.sh +4 -4
  16. package/node_modules/@maka/eval/harbor/egress_filter.py +153 -104
  17. package/node_modules/@maka/eval/harbor/eval_framework.py +37 -14
  18. package/node_modules/@maka/eval/harbor/relay_agent.py +4 -6
  19. package/node_modules/@maka/eval/harbor/run_trial.py +11 -4
  20. package/node_modules/@maka/runtime/dist/agent-graph-supervisor-wake.js +33 -6
  21. package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +1 -1
  22. package/node_modules/@maka/runtime/dist/plugin-executor-backend.js +26 -5
  23. package/node_modules/@maka/runtime/dist/plugin-executor-service.js +36 -0
  24. package/node_modules/@maka/runtime/dist/provider-error-classification.js +8 -73
  25. package/node_modules/@maka/runtime/dist/provider-error-signals.js +31 -0
  26. package/node_modules/@maka/runtime/dist/provider-retry-policy.js +79 -0
  27. package/node_modules/@maka/runtime/dist/session-manager.js +6 -4
  28. package/node_modules/@maka/runtime/dist/session-projection-helpers.js +2 -0
  29. package/node_modules/@maka/runtime/dist/shell-run-manager.js +8 -8
  30. package/node_modules/@maka/runtime/dist/terminal-run-commit.js +7 -1
  31. package/node_modules/@maka/runtime/dist/tool-runtime.js +5 -4
  32. package/node_modules/@maka/runtime-host/dist/adapter/provider-retry-projector.js +63 -0
  33. package/node_modules/@maka/runtime-host/dist/adapter/session-projector.js +7 -51
  34. package/node_modules/@maka/runtime-host/dist/protocol/index.js +9 -3
  35. package/node_modules/@maka/runtime-host/dist/protocol/message-queue-limits.js +21 -0
  36. package/node_modules/@maka/runtime-host/dist/protocol/message.js +6 -104
  37. package/node_modules/@maka/runtime-host/dist/protocol/queue-mutation.js +136 -0
  38. package/node_modules/@maka/runtime-host/dist/protocol/turn-provider-retry.js +69 -0
  39. package/node_modules/@maka/runtime-host/dist/protocol/turn.js +2 -43
  40. package/node_modules/@maka/runtime-host/dist/server/goal-coordinator.js +42 -5
  41. package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +105 -233
  42. package/node_modules/@maka/runtime-host/dist/server/message-queue-state.js +69 -0
  43. package/node_modules/@maka/runtime-host/dist/server/provider-retry-projection.js +71 -0
  44. package/node_modules/@maka/runtime-host/dist/server/queued-mutation-executor.js +94 -0
  45. package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +1 -1
  46. package/node_modules/@maka/runtime-host/dist/server/session-continuity-coordinator.js +9 -58
  47. package/node_modules/@maka/storage/dist/agent-run-store-contract.js +0 -3
  48. package/node_modules/@maka/storage/dist/agent-run-store.js +15 -6
  49. package/node_modules/@maka/storage/dist/execution-persistence-provider.js +1 -0
  50. package/node_modules/@maka/storage/dist/execution-stores.js +1 -0
  51. package/node_modules/@maka/storage/dist/project-catalog.js +41 -42
  52. package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +102 -31
  53. package/node_modules/@maka/storage/dist/sqlite-session-metadata-schema.js +52 -1
  54. package/node_modules/@maka/storage/dist/sqlite-session-metadata-store.js +34 -2
  55. package/package.json +1 -1
@@ -16,7 +16,7 @@
16
16
  * specific language governing permissions and limitations
17
17
  * under the License.
18
18
  */
19
- export const SQLITE_SESSION_METADATA_SCHEMA_VERSION = 39;
19
+ export const SQLITE_SESSION_METADATA_SCHEMA_VERSION = 40;
20
20
  export const SQLITE_SESSION_MESSAGE_CHUNK_BYTES = 64 * 1024;
21
21
  export const SQLITE_SESSION_MESSAGE_CHUNK_MARKER = '{"$maka":"session-message-chunks-v1"}';
22
22
  export const SQLITE_AGENT_GRAPH_CONTROL_TABLES = [
@@ -32,6 +32,57 @@ export const SQLITE_AGENT_GRAPH_CONTROL_TABLES = [
32
32
  'agent_graph_supervisor_wake_attempts',
33
33
  ];
34
34
  const MIGRATIONS = new Map([
35
+ [
36
+ 40,
37
+ `
38
+ DROP INDEX agent_graph_supervisor_wakes_by_status;
39
+ CREATE TABLE agent_graph_supervisor_wakes_v40 (
40
+ graph_id TEXT NOT NULL,
41
+ wake_id TEXT NOT NULL,
42
+ schema_version INTEGER NOT NULL CHECK (schema_version = 1),
43
+ snapshot_version TEXT NOT NULL,
44
+ root_session_id TEXT NOT NULL,
45
+ status TEXT NOT NULL CHECK (status IN (
46
+ 'pending', 'running', 'waiting_permission', 'delivered',
47
+ 'superseded', 'retryable_failed', 'exhausted'
48
+ )),
49
+ attempt_count INTEGER NOT NULL DEFAULT 0 CHECK (attempt_count >= 0),
50
+ current_attempt_id TEXT,
51
+ current_turn_id TEXT,
52
+ failure_reason TEXT,
53
+ created_at INTEGER NOT NULL CHECK (created_at >= 0),
54
+ updated_at INTEGER NOT NULL CHECK (updated_at >= 0),
55
+ PRIMARY KEY(graph_id, wake_id)
56
+ );
57
+ INSERT INTO agent_graph_supervisor_wakes_v40 SELECT * FROM agent_graph_supervisor_wakes;
58
+ CREATE TABLE agent_graph_supervisor_wake_attempts_v40 (
59
+ graph_id TEXT NOT NULL,
60
+ wake_id TEXT NOT NULL,
61
+ attempt_id TEXT NOT NULL UNIQUE,
62
+ turn_id TEXT NOT NULL,
63
+ status TEXT NOT NULL CHECK (status IN (
64
+ 'running', 'waiting_permission', 'delivered',
65
+ 'superseded', 'retryable_failed'
66
+ )),
67
+ failure_reason TEXT,
68
+ started_at INTEGER NOT NULL CHECK (started_at >= 0),
69
+ completed_at INTEGER,
70
+ PRIMARY KEY(graph_id, wake_id, attempt_id),
71
+ FOREIGN KEY(graph_id, wake_id)
72
+ REFERENCES agent_graph_supervisor_wakes_v40(graph_id, wake_id)
73
+ ON DELETE CASCADE
74
+ );
75
+ INSERT INTO agent_graph_supervisor_wake_attempts_v40
76
+ SELECT * FROM agent_graph_supervisor_wake_attempts;
77
+ DROP TABLE agent_graph_supervisor_wake_attempts;
78
+ DROP TABLE agent_graph_supervisor_wakes;
79
+ ALTER TABLE agent_graph_supervisor_wakes_v40 RENAME TO agent_graph_supervisor_wakes;
80
+ ALTER TABLE agent_graph_supervisor_wake_attempts_v40
81
+ RENAME TO agent_graph_supervisor_wake_attempts;
82
+ CREATE INDEX agent_graph_supervisor_wakes_by_status
83
+ ON agent_graph_supervisor_wakes(status, updated_at, graph_id, wake_id);
84
+ `,
85
+ ],
35
86
  [
36
87
  39,
37
88
  `
@@ -2453,11 +2453,17 @@ export class SqliteSessionMetadataStore {
2453
2453
  async beginAgentGraphSupervisorWakeAttempt(request) {
2454
2454
  this.assertOpen();
2455
2455
  assertAgentGraphSupervisorWakeAttempt(request);
2456
+ if (request.maxAttempts !== undefined &&
2457
+ (!Number.isSafeInteger(request.maxAttempts) || request.maxAttempts < 1)) {
2458
+ throw new Error('Agent graph supervisor wake max attempts must be positive');
2459
+ }
2456
2460
  return this.transaction(() => {
2457
2461
  const wake = this.requireAgentGraphSupervisorWakeSync(request.graphId, request.wakeId);
2458
2462
  if (wake.status === 'delivered' ||
2459
2463
  wake.status === 'running' ||
2460
- wake.status === 'waiting_permission') {
2464
+ wake.status === 'waiting_permission' ||
2465
+ wake.status === 'exhausted' ||
2466
+ (request.maxAttempts !== undefined && wake.attemptCount >= request.maxAttempts)) {
2461
2467
  return { wake, acquired: false };
2462
2468
  }
2463
2469
  const now = this.now();
@@ -2473,8 +2479,9 @@ export class SqliteSessionMetadataStore {
2473
2479
  WHERE graph_id = ?
2474
2480
  AND wake_id = ?
2475
2481
  AND status IN ('pending', 'retryable_failed')
2482
+ AND (? IS NULL OR attempt_count < ?)
2476
2483
  `)
2477
- .run(request.attemptId, request.turnId, now, request.graphId, request.wakeId);
2484
+ .run(request.attemptId, request.turnId, now, request.graphId, request.wakeId, request.maxAttempts ?? null, request.maxAttempts ?? null);
2478
2485
  if (updated.changes !== 1) {
2479
2486
  return {
2480
2487
  wake: this.requireAgentGraphSupervisorWakeSync(request.graphId, request.wakeId),
@@ -2541,6 +2548,30 @@ export class SqliteSessionMetadataStore {
2541
2548
  return this.requireAgentGraphSupervisorWakeSync(request.graphId, request.wakeId);
2542
2549
  });
2543
2550
  }
2551
+ async exhaustAgentGraphSupervisorWake(graphId, wakeId, reason) {
2552
+ this.assertOpen();
2553
+ assertGraphLookupIdentity(graphId, 'graph id');
2554
+ assertGraphLookupIdentity(wakeId, 'supervisor wake id');
2555
+ if (!reason.trim() || reason.length > 4_000) {
2556
+ throw new Error('Agent graph supervisor wake exhaustion reason must be non-empty and bounded');
2557
+ }
2558
+ return this.transaction(() => {
2559
+ const wake = this.requireAgentGraphSupervisorWakeSync(graphId, wakeId);
2560
+ if (wake.status === 'exhausted')
2561
+ return wake;
2562
+ if (wake.status !== 'retryable_failed') {
2563
+ throw new SessionMetadataConflictError('Agent graph supervisor wake is not retryable');
2564
+ }
2565
+ this.db
2566
+ .prepare(`
2567
+ UPDATE agent_graph_supervisor_wakes
2568
+ SET status = 'exhausted', failure_reason = ?, updated_at = ?
2569
+ WHERE graph_id = ? AND wake_id = ? AND status = 'retryable_failed'
2570
+ `)
2571
+ .run(reason, this.now(), graphId, wakeId);
2572
+ return this.requireAgentGraphSupervisorWakeSync(graphId, wakeId);
2573
+ });
2574
+ }
2544
2575
  async supersedeAgentGraphSupervisorWakes(request) {
2545
2576
  this.assertOpen();
2546
2577
  const sessionIds = [...new Set(request.rootSessionIds)];
@@ -4378,6 +4409,7 @@ function decodeAgentGraphSupervisorWakeRow(row) {
4378
4409
  'waiting_permission',
4379
4410
  'delivered',
4380
4411
  'superseded',
4412
+ 'exhausted',
4381
4413
  'retryable_failed',
4382
4414
  ].includes(row.status) ||
4383
4415
  !Number.isSafeInteger(row.attemptCount) ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maka-agent",
3
- "version": "0.2.0-dev.53.20260927",
3
+ "version": "0.2.0-dev.62.20260928",
4
4
  "description": "Apache Maka (Incubating) developer snapshot; not an Apache release.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",