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.
- package/dist/acp/session-event-mapper.js +1 -4
- package/dist/onboarding-catalog.js +20 -4
- package/dist/pi-transcript.js +0 -8
- package/dist/pi-tui-pickers.js +1 -1
- package/dist/pi-tui-runner.js +6 -4
- package/dist/runtime-host-capability-provider-command.js +25 -6
- package/dist/runtime-host-onboarding.js +5 -3
- package/dist/runtime-host-session-channel.js +9 -3
- package/dist/tui-mcp-control.js +37 -24
- 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-errors.js +26 -0
- package/node_modules/@maka/acp-executor-plugin/dist/acp-filesystem.js +103 -0
- package/node_modules/@maka/acp-executor-plugin/dist/acp-process.js +119 -0
- package/node_modules/@maka/acp-executor-plugin/dist/acp-projection.js +146 -0
- package/node_modules/@maka/acp-executor-plugin/dist/index.js +653 -0
- package/node_modules/@maka/acp-executor-plugin/dist/plugin.mjs +24446 -0
- package/node_modules/@maka/acp-executor-plugin/package.json +15 -0
- package/node_modules/@maka/antigravity-acp-plugin/dist/index.js +88 -0
- package/node_modules/@maka/antigravity-acp-plugin/dist/model-presentation.js +53 -0
- package/node_modules/@maka/antigravity-acp-plugin/dist/plugin.mjs +115 -0
- package/node_modules/@maka/antigravity-acp-plugin/package.json +15 -0
- package/node_modules/@maka/core/dist/events.js +13 -0
- package/node_modules/@maka/core/dist/executor-catalog.js +106 -0
- package/node_modules/@maka/core/dist/llm-connections.js +2 -5
- package/node_modules/@maka/core/dist/mcp.js +4 -1
- package/node_modules/@maka/core/dist/model-facts.js +2 -4
- package/node_modules/@maka/core/dist/model-metadata.generated.js +345 -248
- package/node_modules/@maka/core/dist/model-metadata.js +28 -1
- package/node_modules/@maka/core/dist/model-thinking.js +17 -17
- package/node_modules/@maka/core/dist/model-web-search.js +7 -9
- package/node_modules/@maka/core/dist/models-dev-projection.js +1 -1
- package/node_modules/@maka/core/dist/onboarding.js +1 -4
- package/node_modules/@maka/core/dist/provider-registry.js +60 -86
- package/node_modules/@maka/core/dist/runtime-event-store.js +25 -0
- package/node_modules/@maka/core/dist/runtime-event.js +2 -2
- package/node_modules/@maka/core/dist/runtime-invocation.js +5 -0
- package/node_modules/@maka/core/dist/runtime-policy/connection-catalog-codec.js +28 -16
- package/node_modules/@maka/core/dist/runtime-policy/credential-vault-codec.js +6 -0
- package/node_modules/@maka/core/dist/runtime-policy/policy-codec.js +21 -0
- package/node_modules/@maka/core/dist/runtime-policy.js +1 -1
- package/node_modules/@maka/core/dist/session.js +25 -9
- package/node_modules/@maka/core/dist/settings.js +1 -0
- package/node_modules/@maka/core/dist/tool-ledger-scanner.js +365 -104
- package/node_modules/@maka/core/dist/transcript-search.js +1 -0
- package/node_modules/@maka/core/dist/turn-origin.js +14 -0
- package/node_modules/@maka/core/dist/usage-stats/types.js +1 -0
- package/node_modules/@maka/core/package.json +2 -0
- package/node_modules/@maka/eval/dist/harbor-maka-subject.js +3 -0
- package/node_modules/@maka/eval/dist/maka-subject.js +8 -1
- package/node_modules/@maka/mcp/dist/credential-coordinator.js +6 -1
- package/node_modules/@maka/mcp/dist/index.js +31 -5
- package/node_modules/@maka/mcp/dist/oauth.js +54 -6
- package/node_modules/@maka/runtime/dist/agent-run-inspect.js +1 -1
- package/node_modules/@maka/runtime/dist/ai-sdk-backend.js +1 -11
- package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +2 -12
- package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +3 -71
- package/node_modules/@maka/runtime/dist/conversation-copy.js +58 -3
- package/node_modules/@maka/runtime/dist/local-web-fetch.js +23 -11
- package/node_modules/@maka/runtime/dist/mcp-tools.js +9 -2
- package/node_modules/@maka/runtime/dist/model-adapter.js +10 -5
- package/node_modules/@maka/runtime/dist/model-factory.js +33 -30
- package/node_modules/@maka/runtime/dist/model-fetcher.js +4 -1
- package/node_modules/@maka/runtime/dist/model-runtime.js +3 -9
- package/node_modules/@maka/runtime/dist/plugin-executor-backend.js +116 -3
- package/node_modules/@maka/runtime/dist/plugin-executor-service.js +212 -16
- package/node_modules/@maka/runtime/dist/read-page.js +11 -8
- package/node_modules/@maka/runtime/dist/recovery-resolver.js +47 -20
- package/node_modules/@maka/runtime/dist/runtime-event-backfill.js +1 -0
- package/node_modules/@maka/runtime/dist/runtime-ledger-repair.js +2 -2
- package/node_modules/@maka/runtime/dist/scheduled-task-tools.js +39 -8
- package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +3 -0
- package/node_modules/@maka/runtime/dist/session-manager.js +182 -127
- package/node_modules/@maka/runtime/dist/shell-run-manager.js +3 -0
- package/node_modules/@maka/runtime/dist/stream-graph-coordinator.js +29 -4
- package/node_modules/@maka/runtime/dist/telemetry/model-pricing.generated.js +141 -134
- package/node_modules/@maka/runtime/dist/tool-result-archive-transition.js +3 -3
- package/node_modules/@maka/runtime/dist/workers/filesystem-worker.js +7 -6
- package/node_modules/@maka/runtime-host/dist/adapter/session-projector.js +28 -62
- package/node_modules/@maka/runtime-host/dist/candidate-entry.js +8 -5
- package/node_modules/@maka/runtime-host/dist/client/hosted-execution-target.js +7 -1
- package/node_modules/@maka/runtime-host/dist/client/index.js +1 -1
- package/node_modules/@maka/runtime-host/dist/client/reconnect-lifecycle.js +8 -1
- package/node_modules/@maka/runtime-host/dist/client/session-catalog-summary.js +6 -1
- package/node_modules/@maka/runtime-host/dist/client/session-subscription.js +3 -0
- package/node_modules/@maka/runtime-host/dist/composition-identity.js +19 -0
- package/node_modules/@maka/runtime-host/dist/protocol/connection-effects.js +6 -3
- package/node_modules/@maka/runtime-host/dist/protocol/index.js +14 -2
- package/node_modules/@maka/runtime-host/dist/protocol/operations.js +4 -1
- package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +34 -0
- package/node_modules/@maka/runtime-host/dist/protocol/prompt-suggestions.js +61 -0
- package/node_modules/@maka/runtime-host/dist/protocol/runtime-policy.js +4 -1
- package/node_modules/@maka/runtime-host/dist/protocol/session-catalog.js +40 -2
- package/node_modules/@maka/runtime-host/dist/protocol/session-continuity.js +2 -1
- package/node_modules/@maka/runtime-host/dist/server/builtin-external-agent-plugins.js +188 -0
- package/node_modules/@maka/runtime-host/dist/server/candidate.js +12 -7
- package/node_modules/@maka/runtime-host/dist/server/client-capability-recovery.js +44 -46
- package/node_modules/@maka/runtime-host/dist/server/connection-effect-coordinator.js +3 -0
- package/node_modules/@maka/runtime-host/dist/server/context-coordinator.js +2 -0
- package/node_modules/@maka/runtime-host/dist/server/execution-composition-factory.js +1 -1
- package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +212 -24
- package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +41 -2
- package/node_modules/@maka/runtime-host/dist/server/extension-bundle.js +4 -0
- package/node_modules/@maka/runtime-host/dist/server/generated-text.js +39 -0
- package/node_modules/@maka/runtime-host/dist/server/host-composition-source.js +47 -0
- package/node_modules/@maka/runtime-host/dist/server/host-composition.js +1 -29
- package/node_modules/@maka/runtime-host/dist/server/host-kernel.js +2 -9
- package/node_modules/@maka/runtime-host/dist/server/hosted-execution-recovery.js +75 -9
- package/node_modules/@maka/runtime-host/dist/server/hosted-execution-tool-profile.js +12 -0
- package/node_modules/@maka/runtime-host/dist/server/interaction-coordinator.js +45 -0
- package/node_modules/@maka/runtime-host/dist/server/jev-routing-model.js +157 -0
- package/node_modules/@maka/runtime-host/dist/server/listener-set.js +2 -2
- package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +4 -0
- package/node_modules/@maka/runtime-host/dist/server/plugin-platform-coordinator.js +11 -1
- package/node_modules/@maka/runtime-host/dist/server/process-lifecycle.js +1 -1
- package/node_modules/@maka/runtime-host/dist/server/process-termination-error.js +27 -0
- package/node_modules/@maka/runtime-host/dist/server/prompt-suggestion.js +179 -0
- package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +93 -14
- package/node_modules/@maka/runtime-host/dist/server/runtime-policy-coordinator.js +2 -0
- package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +99 -12
- package/node_modules/@maka/runtime-host/dist/server/session-continuity-coordinator.js +48 -16
- package/node_modules/@maka/runtime-host/dist/server/session-effect-coordinator.js +12 -6
- package/node_modules/@maka/runtime-host/dist/server/session-title.js +3 -16
- package/node_modules/@maka/runtime-host/dist/server/session-transcript-reader.js +71 -3
- package/node_modules/@maka/runtime-host/dist/server/shared-session-transcript.js +3 -0
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-action-gate.js +6 -13
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +39 -11
- package/node_modules/@maka/runtime-host/dist/server/workhub-result-coordinator.js +173 -0
- package/node_modules/@maka/runtime-host/dist/server/workhub-result-runtime.js +293 -0
- package/node_modules/@maka/runtime-host/package.json +2 -0
- package/node_modules/@maka/storage/dist/agent-run-store-contract.js +8 -0
- package/node_modules/@maka/storage/dist/config-transfer.js +14 -8
- package/node_modules/@maka/storage/dist/execution-stores.js +19 -6
- package/node_modules/@maka/storage/dist/interaction-store.js +13 -0
- package/node_modules/@maka/storage/dist/mcp-config-store.js +91 -2
- package/node_modules/@maka/storage/dist/operational-state-store.js +15 -1
- package/node_modules/@maka/storage/dist/plan-authority.js +2 -0
- package/node_modules/@maka/storage/dist/plan-store.js +30 -0
- package/node_modules/@maka/storage/dist/runtime-event-persistence.js +1 -0
- package/node_modules/@maka/storage/dist/runtime-policy/connection-catalog-document.js +28 -17
- package/node_modules/@maka/storage/dist/runtime-policy/coordinator.js +9 -3
- package/node_modules/@maka/storage/dist/runtime-policy/credential-vault-document.js +4 -1
- package/node_modules/@maka/storage/dist/runtime-policy/legacy-custom-connection.js +65 -0
- package/node_modules/@maka/storage/dist/runtime-policy/onboarding-transaction.js +10 -5
- package/node_modules/@maka/storage/dist/runtime-policy/policy-document.js +2 -0
- package/node_modules/@maka/storage/dist/session-bundle-policy.js +11 -0
- package/node_modules/@maka/storage/dist/session-store-values.js +16 -4
- package/node_modules/@maka/storage/dist/session-store.js +29 -6
- package/node_modules/@maka/storage/dist/shell-run-authority.js +1 -0
- package/node_modules/@maka/storage/dist/shell-run-store.js +15 -0
- package/node_modules/@maka/storage/dist/sqlite-core-execution-schema.js +3 -0
- package/node_modules/@maka/storage/dist/sqlite-runtime-schema.js +74 -1
- package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +849 -91
- package/node_modules/@maka/storage/dist/sqlite-session-metadata-store.js +21 -3
- package/node_modules/@maka/storage/dist/usage-screen.js +138 -108
- 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
|
+
}
|