maka-agent 0.2.0-dev.47.20260922 → 0.2.0-dev.49.20260924

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 (155) hide show
  1. package/dist/acp/session-event-mapper.js +1 -4
  2. package/dist/onboarding-catalog.js +20 -4
  3. package/dist/pi-transcript.js +0 -8
  4. package/dist/pi-tui-pickers.js +1 -1
  5. package/dist/pi-tui-runner.js +6 -4
  6. package/dist/runtime-host-capability-provider-command.js +25 -6
  7. package/dist/runtime-host-onboarding.js +5 -3
  8. package/dist/runtime-host-session-channel.js +9 -3
  9. package/dist/tui-mcp-control.js +37 -24
  10. package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
  11. package/node_modules/@maka/acp-executor-plugin/dist/acp-errors.js +26 -0
  12. package/node_modules/@maka/acp-executor-plugin/dist/acp-filesystem.js +103 -0
  13. package/node_modules/@maka/acp-executor-plugin/dist/acp-process.js +119 -0
  14. package/node_modules/@maka/acp-executor-plugin/dist/acp-projection.js +146 -0
  15. package/node_modules/@maka/acp-executor-plugin/dist/index.js +653 -0
  16. package/node_modules/@maka/acp-executor-plugin/dist/plugin.mjs +24446 -0
  17. package/node_modules/@maka/acp-executor-plugin/package.json +15 -0
  18. package/node_modules/@maka/antigravity-acp-plugin/dist/index.js +88 -0
  19. package/node_modules/@maka/antigravity-acp-plugin/dist/model-presentation.js +53 -0
  20. package/node_modules/@maka/antigravity-acp-plugin/dist/plugin.mjs +115 -0
  21. package/node_modules/@maka/antigravity-acp-plugin/package.json +15 -0
  22. package/node_modules/@maka/core/dist/events.js +13 -0
  23. package/node_modules/@maka/core/dist/executor-catalog.js +106 -0
  24. package/node_modules/@maka/core/dist/llm-connections.js +2 -5
  25. package/node_modules/@maka/core/dist/mcp.js +4 -1
  26. package/node_modules/@maka/core/dist/model-facts.js +2 -4
  27. package/node_modules/@maka/core/dist/model-metadata.generated.js +345 -248
  28. package/node_modules/@maka/core/dist/model-metadata.js +28 -1
  29. package/node_modules/@maka/core/dist/model-thinking.js +17 -17
  30. package/node_modules/@maka/core/dist/model-web-search.js +7 -9
  31. package/node_modules/@maka/core/dist/models-dev-projection.js +1 -1
  32. package/node_modules/@maka/core/dist/onboarding.js +1 -4
  33. package/node_modules/@maka/core/dist/provider-registry.js +60 -86
  34. package/node_modules/@maka/core/dist/runtime-event-store.js +25 -0
  35. package/node_modules/@maka/core/dist/runtime-event.js +2 -2
  36. package/node_modules/@maka/core/dist/runtime-invocation.js +5 -0
  37. package/node_modules/@maka/core/dist/runtime-policy/connection-catalog-codec.js +28 -16
  38. package/node_modules/@maka/core/dist/runtime-policy/credential-vault-codec.js +6 -0
  39. package/node_modules/@maka/core/dist/runtime-policy/policy-codec.js +21 -0
  40. package/node_modules/@maka/core/dist/runtime-policy.js +1 -1
  41. package/node_modules/@maka/core/dist/session.js +25 -9
  42. package/node_modules/@maka/core/dist/settings.js +1 -0
  43. package/node_modules/@maka/core/dist/tool-ledger-scanner.js +365 -104
  44. package/node_modules/@maka/core/dist/transcript-search.js +1 -0
  45. package/node_modules/@maka/core/dist/turn-origin.js +14 -0
  46. package/node_modules/@maka/core/dist/usage-stats/types.js +1 -0
  47. package/node_modules/@maka/core/package.json +2 -0
  48. package/node_modules/@maka/eval/dist/harbor-maka-subject.js +3 -0
  49. package/node_modules/@maka/eval/dist/maka-subject.js +8 -1
  50. package/node_modules/@maka/mcp/dist/credential-coordinator.js +6 -1
  51. package/node_modules/@maka/mcp/dist/index.js +31 -5
  52. package/node_modules/@maka/mcp/dist/oauth.js +54 -6
  53. package/node_modules/@maka/runtime/dist/agent-run-inspect.js +1 -1
  54. package/node_modules/@maka/runtime/dist/ai-sdk-backend.js +1 -11
  55. package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +2 -12
  56. package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +3 -71
  57. package/node_modules/@maka/runtime/dist/conversation-copy.js +58 -3
  58. package/node_modules/@maka/runtime/dist/local-web-fetch.js +23 -11
  59. package/node_modules/@maka/runtime/dist/mcp-tools.js +9 -2
  60. package/node_modules/@maka/runtime/dist/model-adapter.js +10 -5
  61. package/node_modules/@maka/runtime/dist/model-factory.js +33 -30
  62. package/node_modules/@maka/runtime/dist/model-fetcher.js +4 -1
  63. package/node_modules/@maka/runtime/dist/model-runtime.js +3 -9
  64. package/node_modules/@maka/runtime/dist/plugin-executor-backend.js +116 -3
  65. package/node_modules/@maka/runtime/dist/plugin-executor-service.js +212 -16
  66. package/node_modules/@maka/runtime/dist/read-page.js +11 -8
  67. package/node_modules/@maka/runtime/dist/recovery-resolver.js +47 -20
  68. package/node_modules/@maka/runtime/dist/runtime-event-backfill.js +1 -0
  69. package/node_modules/@maka/runtime/dist/runtime-ledger-repair.js +2 -2
  70. package/node_modules/@maka/runtime/dist/scheduled-task-tools.js +39 -8
  71. package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +3 -0
  72. package/node_modules/@maka/runtime/dist/session-manager.js +182 -127
  73. package/node_modules/@maka/runtime/dist/shell-run-manager.js +3 -0
  74. package/node_modules/@maka/runtime/dist/stream-graph-coordinator.js +29 -4
  75. package/node_modules/@maka/runtime/dist/telemetry/model-pricing.generated.js +141 -134
  76. package/node_modules/@maka/runtime/dist/tool-result-archive-transition.js +3 -3
  77. package/node_modules/@maka/runtime/dist/workers/filesystem-worker.js +7 -6
  78. package/node_modules/@maka/runtime-host/dist/adapter/session-projector.js +28 -62
  79. package/node_modules/@maka/runtime-host/dist/candidate-entry.js +8 -5
  80. package/node_modules/@maka/runtime-host/dist/client/hosted-execution-target.js +7 -1
  81. package/node_modules/@maka/runtime-host/dist/client/index.js +1 -1
  82. package/node_modules/@maka/runtime-host/dist/client/reconnect-lifecycle.js +8 -1
  83. package/node_modules/@maka/runtime-host/dist/client/session-catalog-summary.js +6 -1
  84. package/node_modules/@maka/runtime-host/dist/client/session-subscription.js +3 -0
  85. package/node_modules/@maka/runtime-host/dist/composition-identity.js +19 -0
  86. package/node_modules/@maka/runtime-host/dist/protocol/connection-effects.js +6 -3
  87. package/node_modules/@maka/runtime-host/dist/protocol/index.js +14 -2
  88. package/node_modules/@maka/runtime-host/dist/protocol/operations.js +4 -1
  89. package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +34 -0
  90. package/node_modules/@maka/runtime-host/dist/protocol/prompt-suggestions.js +61 -0
  91. package/node_modules/@maka/runtime-host/dist/protocol/runtime-policy.js +4 -1
  92. package/node_modules/@maka/runtime-host/dist/protocol/session-catalog.js +40 -2
  93. package/node_modules/@maka/runtime-host/dist/protocol/session-continuity.js +2 -1
  94. package/node_modules/@maka/runtime-host/dist/server/builtin-external-agent-plugins.js +188 -0
  95. package/node_modules/@maka/runtime-host/dist/server/candidate.js +12 -7
  96. package/node_modules/@maka/runtime-host/dist/server/client-capability-recovery.js +44 -46
  97. package/node_modules/@maka/runtime-host/dist/server/connection-effect-coordinator.js +3 -0
  98. package/node_modules/@maka/runtime-host/dist/server/context-coordinator.js +2 -0
  99. package/node_modules/@maka/runtime-host/dist/server/execution-composition-factory.js +1 -1
  100. package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +212 -24
  101. package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +41 -2
  102. package/node_modules/@maka/runtime-host/dist/server/extension-bundle.js +4 -0
  103. package/node_modules/@maka/runtime-host/dist/server/generated-text.js +39 -0
  104. package/node_modules/@maka/runtime-host/dist/server/host-composition-source.js +47 -0
  105. package/node_modules/@maka/runtime-host/dist/server/host-composition.js +1 -29
  106. package/node_modules/@maka/runtime-host/dist/server/host-kernel.js +2 -9
  107. package/node_modules/@maka/runtime-host/dist/server/hosted-execution-recovery.js +75 -9
  108. package/node_modules/@maka/runtime-host/dist/server/hosted-execution-tool-profile.js +12 -0
  109. package/node_modules/@maka/runtime-host/dist/server/interaction-coordinator.js +45 -0
  110. package/node_modules/@maka/runtime-host/dist/server/jev-routing-model.js +157 -0
  111. package/node_modules/@maka/runtime-host/dist/server/listener-set.js +2 -2
  112. package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +4 -0
  113. package/node_modules/@maka/runtime-host/dist/server/plugin-platform-coordinator.js +11 -1
  114. package/node_modules/@maka/runtime-host/dist/server/process-lifecycle.js +1 -1
  115. package/node_modules/@maka/runtime-host/dist/server/process-termination-error.js +27 -0
  116. package/node_modules/@maka/runtime-host/dist/server/prompt-suggestion.js +179 -0
  117. package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +93 -14
  118. package/node_modules/@maka/runtime-host/dist/server/runtime-policy-coordinator.js +2 -0
  119. package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +99 -12
  120. package/node_modules/@maka/runtime-host/dist/server/session-continuity-coordinator.js +48 -16
  121. package/node_modules/@maka/runtime-host/dist/server/session-effect-coordinator.js +12 -6
  122. package/node_modules/@maka/runtime-host/dist/server/session-title.js +3 -16
  123. package/node_modules/@maka/runtime-host/dist/server/session-transcript-reader.js +71 -3
  124. package/node_modules/@maka/runtime-host/dist/server/shared-session-transcript.js +3 -0
  125. package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-action-gate.js +6 -13
  126. package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +39 -11
  127. package/node_modules/@maka/runtime-host/dist/server/workhub-result-coordinator.js +173 -0
  128. package/node_modules/@maka/runtime-host/dist/server/workhub-result-runtime.js +293 -0
  129. package/node_modules/@maka/runtime-host/package.json +2 -0
  130. package/node_modules/@maka/storage/dist/agent-run-store-contract.js +8 -0
  131. package/node_modules/@maka/storage/dist/config-transfer.js +14 -8
  132. package/node_modules/@maka/storage/dist/execution-stores.js +19 -6
  133. package/node_modules/@maka/storage/dist/interaction-store.js +13 -0
  134. package/node_modules/@maka/storage/dist/mcp-config-store.js +91 -2
  135. package/node_modules/@maka/storage/dist/operational-state-store.js +15 -1
  136. package/node_modules/@maka/storage/dist/plan-authority.js +2 -0
  137. package/node_modules/@maka/storage/dist/plan-store.js +30 -0
  138. package/node_modules/@maka/storage/dist/runtime-event-persistence.js +1 -0
  139. package/node_modules/@maka/storage/dist/runtime-policy/connection-catalog-document.js +28 -17
  140. package/node_modules/@maka/storage/dist/runtime-policy/coordinator.js +9 -3
  141. package/node_modules/@maka/storage/dist/runtime-policy/credential-vault-document.js +4 -1
  142. package/node_modules/@maka/storage/dist/runtime-policy/legacy-custom-connection.js +65 -0
  143. package/node_modules/@maka/storage/dist/runtime-policy/onboarding-transaction.js +10 -5
  144. package/node_modules/@maka/storage/dist/runtime-policy/policy-document.js +2 -0
  145. package/node_modules/@maka/storage/dist/session-bundle-policy.js +11 -0
  146. package/node_modules/@maka/storage/dist/session-store-values.js +16 -4
  147. package/node_modules/@maka/storage/dist/session-store.js +29 -6
  148. package/node_modules/@maka/storage/dist/shell-run-authority.js +1 -0
  149. package/node_modules/@maka/storage/dist/shell-run-store.js +15 -0
  150. package/node_modules/@maka/storage/dist/sqlite-core-execution-schema.js +3 -0
  151. package/node_modules/@maka/storage/dist/sqlite-runtime-schema.js +74 -1
  152. package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +849 -91
  153. package/node_modules/@maka/storage/dist/sqlite-session-metadata-store.js +21 -3
  154. package/node_modules/@maka/storage/dist/usage-screen.js +138 -108
  155. package/package.json +1 -1
@@ -0,0 +1,146 @@
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 MAX_EVENT_TEXT = 8_192;
20
+ const MAX_TOOL_RESULT_DIFF = 1024 * 1024;
21
+ export function promptText(request) {
22
+ const sections = [request.text];
23
+ if (request.instructions)
24
+ sections.push(`Agent instructions:\n${request.instructions}`);
25
+ for (const quote of request.quotes ?? [])
26
+ sections.push(`Quoted context:\n${quote.text}`);
27
+ for (const reference of request.directoryReferences ?? [])
28
+ sections.push(`Project directory reference: ${reference.path}`);
29
+ return sections.filter(Boolean).join('\n\n');
30
+ }
31
+ export function emitText(context, type, text) {
32
+ const safeText = text.replaceAll('\r', '');
33
+ for (let offset = 0; offset < safeText.length; offset += MAX_EVENT_TEXT) {
34
+ const chunk = safeText.slice(offset, offset + MAX_EVENT_TEXT);
35
+ context.emit({ type, text: chunk });
36
+ }
37
+ }
38
+ export function emitToolOutput(context, toolCallId, text) {
39
+ const safeText = text.replaceAll('\r', '');
40
+ for (let offset = 0; offset < safeText.length; offset += MAX_EVENT_TEXT) {
41
+ context.emit({
42
+ type: 'tool_output_delta',
43
+ toolCallId,
44
+ text: safeText.slice(offset, offset + MAX_EVENT_TEXT),
45
+ });
46
+ }
47
+ }
48
+ export function projectToolResult(content, rawOutput) {
49
+ const diffs = content.flatMap((item) => item.type === 'diff'
50
+ ? [
51
+ {
52
+ path: item.path,
53
+ diff: createWholeFileDiff(item.path, item.oldText ?? '', item.newText ?? ''),
54
+ },
55
+ ]
56
+ : []);
57
+ const combinedDiff = diffs.map(({ diff }) => diff).join('');
58
+ if (diffs.length && diffs.length <= 64 && combinedDiff.length <= MAX_TOOL_RESULT_DIFF)
59
+ return {
60
+ kind: 'file_diff',
61
+ paths: diffs.map(({ path }) => path),
62
+ diff: combinedDiff,
63
+ };
64
+ if (diffs.length)
65
+ return {
66
+ kind: 'text',
67
+ text: boundedText(`${diffs.map(({ path }) => `Updated ${path}`).join('\n')}\nDiff omitted because it exceeds the executor event limit.`),
68
+ };
69
+ return { kind: 'text', text: boundedText(summarizeToolResult(content, rawOutput)) };
70
+ }
71
+ function createWholeFileDiff(path, oldText, newText) {
72
+ const oldFile = diffLines(oldText);
73
+ const newFile = diffLines(newText);
74
+ const oldLines = oldFile.lines;
75
+ const newLines = newFile.lines;
76
+ return ([
77
+ `--- a/${path}`,
78
+ `+++ b/${path}`,
79
+ `@@ -${oldLines.length ? 1 : 0},${oldLines.length} +${newLines.length ? 1 : 0},${newLines.length} @@`,
80
+ ...diffSide(oldLines, '-', oldFile.endsWithNewline),
81
+ ...diffSide(newLines, '+', newFile.endsWithNewline),
82
+ ].join('\n') + '\n');
83
+ }
84
+ function diffLines(text) {
85
+ const normalized = text.replaceAll('\r', '');
86
+ if (!normalized)
87
+ return { lines: [], endsWithNewline: true };
88
+ const endsWithNewline = normalized.endsWith('\n');
89
+ const lines = normalized.split('\n');
90
+ if (endsWithNewline)
91
+ lines.pop();
92
+ return { lines, endsWithNewline };
93
+ }
94
+ function diffSide(lines, prefix, endsWithNewline) {
95
+ return lines.flatMap((line, index) => [
96
+ `${prefix}${line}`,
97
+ ...(index === lines.length - 1 && !endsWithNewline ? ['\'] : []),
98
+ ]);
99
+ }
100
+ export function summarizeToolContent(content) {
101
+ return content
102
+ .map((item) => {
103
+ if (item.type === 'diff')
104
+ return `Updated ${item.path}`;
105
+ if (item.type === 'terminal')
106
+ return item.terminalId ? `Terminal ${item.terminalId}` : '';
107
+ return item.content.type === 'text' ? item.content.text : '';
108
+ })
109
+ .filter(Boolean)
110
+ .join('\n');
111
+ }
112
+ function summarizeToolResult(content, rawOutput) {
113
+ const summary = summarizeToolContent(content);
114
+ if (summary)
115
+ return summary;
116
+ if (rawOutput === undefined)
117
+ return '';
118
+ try {
119
+ return JSON.stringify(rawOutput);
120
+ }
121
+ catch {
122
+ return 'External tool completed';
123
+ }
124
+ }
125
+ export function boundedText(value) {
126
+ const safe = value.replace(/[\0\r]/gu, '');
127
+ return safe.length <= MAX_EVENT_TEXT ? safe : `${safe.slice(0, MAX_EVENT_TEXT - 1)}…`;
128
+ }
129
+ export function toolName(value) {
130
+ return value.replace(/[\0\r\n]/gu, '').slice(0, 256) || 'external_tool';
131
+ }
132
+ export function activityKind(kind) {
133
+ if (kind === 'read')
134
+ return 'read';
135
+ if (kind === 'edit' || kind === 'delete' || kind === 'move')
136
+ return 'edit';
137
+ if (kind === 'search')
138
+ return 'search';
139
+ if (kind === 'fetch')
140
+ return 'webfetch';
141
+ if (kind === 'execute')
142
+ return 'command';
143
+ if (kind === 'think')
144
+ return 'explore';
145
+ return 'tool';
146
+ }