maka-agent 0.2.0-dev.44.20260920 → 0.2.0-dev.46.20260922
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/runtime-host-service-manager.js +1 -6
- package/dist/runtime-host-update-command.js +39 -27
- package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
- package/node_modules/@maka/core/dist/artifacts.js +1 -0
- package/node_modules/@maka/core/dist/model-metadata.js +1 -2
- package/node_modules/@maka/core/dist/provider-auth.js +1 -7
- package/node_modules/@maka/core/dist/provider-registry.js +13 -7
- package/node_modules/@maka/core/dist/recall.js +5 -1
- package/node_modules/@maka/core/dist/session-start-mode.js +2 -5
- package/node_modules/@maka/core/dist/session.js +0 -1
- package/node_modules/@maka/core/dist/settings.js +17 -0
- package/node_modules/@maka/core/dist/tool-quiet-preview.js +2 -16
- package/node_modules/@maka/core/dist/transcript-search.js +46 -0
- package/node_modules/@maka/core/package.json +1 -4
- package/node_modules/@maka/runtime/dist/model-factory.js +0 -16
- package/node_modules/@maka/runtime/dist/model-fetcher.js +1 -4
- package/node_modules/@maka/runtime/dist/model-runtime.js +0 -8
- package/node_modules/@maka/runtime/dist/recall-tools.js +4 -0
- package/node_modules/@maka/runtime/dist/session-manager.js +4 -13
- package/node_modules/@maka/runtime/dist/subagent-tools.js +69 -11
- package/node_modules/@maka/runtime/dist/test-connection.js +1 -48
- package/node_modules/@maka/runtime/package.json +0 -1
- package/node_modules/@maka/runtime-host/dist/client/host-handoff-copy.js +25 -18
- package/node_modules/@maka/runtime-host/dist/client/host-handoff.js +3 -1
- package/node_modules/@maka/runtime-host/dist/protocol/connection-effects.js +0 -108
- package/node_modules/@maka/runtime-host/dist/protocol/index.js +6 -1
- package/node_modules/@maka/runtime-host/dist/protocol/operations.js +4 -5
- package/node_modules/@maka/runtime-host/dist/protocol/recall.js +270 -0
- package/node_modules/@maka/runtime-host/dist/protocol/session-continuity.js +1 -7
- package/node_modules/@maka/runtime-host/dist/protocol/usage-screen.js +12 -4
- package/node_modules/@maka/runtime-host/dist/server/access-credential-store.js +4 -0
- package/node_modules/@maka/runtime-host/dist/server/connection-effect-coordinator.js +1 -57
- package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +11 -33
- package/node_modules/@maka/runtime-host/dist/server/interactive-run-composer.js +3 -20
- package/node_modules/@maka/runtime-host/dist/server/recall-coordinator.js +117 -0
- package/node_modules/@maka/runtime-host/dist/server/session-revision-coordinator.js +0 -4
- package/node_modules/@maka/storage/dist/artifact-metadata-codec.js +4 -3
- package/node_modules/@maka/storage/dist/artifact-store.js +1 -11
- package/node_modules/@maka/storage/dist/process-lifetime-file-update-lock.js +0 -41
- package/node_modules/@maka/storage/dist/runtime-policy/coordinator.js +0 -28
- package/node_modules/@maka/storage/dist/runtime-policy-stores.js +0 -2
- package/node_modules/@maka/storage/dist/sqlite-usage-schema.js +29 -5
- package/node_modules/@maka/storage/dist/sqlite-workflow-schema.js +2 -0
- package/node_modules/@maka/storage/dist/storage-writer-composition.js +0 -3
- package/node_modules/@maka/storage/dist/telemetry-file-schema.js +5 -3
- package/node_modules/@maka/storage/dist/usage-screen.js +5 -6
- package/node_modules/@maka/storage/dist/usage-stores.js +14 -4
- package/node_modules/@maka/storage/package.json +0 -2
- package/package.json +1 -1
- package/node_modules/@maka/core/dist/connection-usage.js +0 -27
- package/node_modules/@maka/core/dist/deep-research-client-progress.js +0 -132
- package/node_modules/@maka/core/dist/deep-research-run.js +0 -625
- package/node_modules/@maka/core/dist/deep-research.js +0 -208
- package/node_modules/@maka/core/dist/thread-search.js +0 -498
- package/node_modules/@maka/runtime/dist/commandcode-cli-language-model.js +0 -837
- package/node_modules/@maka/runtime/dist/connection-usage.js +0 -232
- package/node_modules/@maka/runtime/dist/deep-research-tools.js +0 -732
- package/node_modules/@maka/runtime-host/dist/protocol/deep-research.js +0 -233
- package/node_modules/@maka/runtime-host/dist/server/deep-research-coordinator.js +0 -116
- package/node_modules/@maka/storage/dist/deep-research-authority.js +0 -129
- package/node_modules/@maka/storage/dist/deep-research-store.js +0 -343
|
@@ -1,132 +0,0 @@
|
|
|
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
|
-
import { buildDeepResearchImplementationPrompt } from './deep-research.js';
|
|
20
|
-
import { DEEP_RESEARCH_CLIENT_IMPLEMENTATION_PROMPT_MAX_BYTES, DEEP_RESEARCH_CLIENT_OBJECTIVE_MAX_BYTES, DEEP_RESEARCH_CLIENT_PROGRESS_MAX_BYTES, DEEP_RESEARCH_CLIENT_RECENT_ITEMS_MAX, DEEP_RESEARCH_CLIENT_TEXT_MAX_BYTES, } from './deep-research-run.js';
|
|
21
|
-
/** Build the single bounded product projection used by local and hosted clients. */
|
|
22
|
-
export function projectDeepResearchClientProgress(run) {
|
|
23
|
-
const blockers = [
|
|
24
|
-
...run.checklist.flatMap((item) => item.blockedReason ? [labeledBlocker(item.title, item.blockedReason)] : []),
|
|
25
|
-
...run.steps.flatMap((step) => step.blockedReason ? [labeledBlocker(step.objective, step.blockedReason)] : []),
|
|
26
|
-
];
|
|
27
|
-
const base = {
|
|
28
|
-
sessionId: run.sessionId,
|
|
29
|
-
objective: truncateUtf8(run.objective, DEEP_RESEARCH_CLIENT_OBJECTIVE_MAX_BYTES),
|
|
30
|
-
scopeLevel: run.scopeLevel,
|
|
31
|
-
status: run.status,
|
|
32
|
-
stage: run.stage,
|
|
33
|
-
round: run.round,
|
|
34
|
-
createdAt: run.createdAt,
|
|
35
|
-
updatedAt: run.updatedAt,
|
|
36
|
-
artifactsCount: run.artifacts.length,
|
|
37
|
-
stepsCount: run.steps.length,
|
|
38
|
-
checklist: run.checklist.map((item) => ({
|
|
39
|
-
itemId: item.itemId,
|
|
40
|
-
title: truncateUtf8(item.title, DEEP_RESEARCH_CLIENT_TEXT_MAX_BYTES),
|
|
41
|
-
status: item.status,
|
|
42
|
-
...(item.blockedReason
|
|
43
|
-
? { blockedReason: truncateUtf8(item.blockedReason, DEEP_RESEARCH_CLIENT_TEXT_MAX_BYTES) }
|
|
44
|
-
: {}),
|
|
45
|
-
})),
|
|
46
|
-
reportSections: run.reportSections.map(({ key, status }) => ({ key, status })),
|
|
47
|
-
recentInspectedRefs: run.steps
|
|
48
|
-
.flatMap((step) => step.inspectedRefs)
|
|
49
|
-
.slice(-DEEP_RESEARCH_CLIENT_RECENT_ITEMS_MAX)
|
|
50
|
-
.map((ref) => ({
|
|
51
|
-
kind: ref.kind,
|
|
52
|
-
locator: truncateUtf8(ref.locator, DEEP_RESEARCH_CLIENT_TEXT_MAX_BYTES),
|
|
53
|
-
...(ref.label
|
|
54
|
-
? { label: truncateUtf8(ref.label, DEEP_RESEARCH_CLIENT_TEXT_MAX_BYTES) }
|
|
55
|
-
: {}),
|
|
56
|
-
})),
|
|
57
|
-
workerRunIds: [...new Set(run.steps.flatMap((step) => step.workerRunIds))].slice(-DEEP_RESEARCH_CLIENT_RECENT_ITEMS_MAX),
|
|
58
|
-
blockers: [
|
|
59
|
-
...new Set(blockers.map((value) => truncateUtf8(value, DEEP_RESEARCH_CLIENT_TEXT_MAX_BYTES))),
|
|
60
|
-
].slice(-DEEP_RESEARCH_CLIENT_RECENT_ITEMS_MAX),
|
|
61
|
-
...(run.reportArtifactId ? { reportArtifactId: run.reportArtifactId } : {}),
|
|
62
|
-
};
|
|
63
|
-
if (encodedBytes(base) > DEEP_RESEARCH_CLIENT_PROGRESS_MAX_BYTES) {
|
|
64
|
-
throw new Error('Deep Research client progress cannot fit its required fields');
|
|
65
|
-
}
|
|
66
|
-
if (run.status !== 'completed')
|
|
67
|
-
return base;
|
|
68
|
-
return fitImplementationPrompt(base, buildDeepResearchImplementationPrompt(run));
|
|
69
|
-
}
|
|
70
|
-
function labeledBlocker(label, reason) {
|
|
71
|
-
const separator = ': ';
|
|
72
|
-
const reasonBudget = Math.floor(DEEP_RESEARCH_CLIENT_TEXT_MAX_BYTES * 0.75);
|
|
73
|
-
const boundedReason = truncateUtf8(reason, reasonBudget);
|
|
74
|
-
const titleBudget = DEEP_RESEARCH_CLIENT_TEXT_MAX_BYTES - utf8Bytes(separator) - utf8Bytes(boundedReason);
|
|
75
|
-
return `${truncateUtf8(label, titleBudget)}${separator}${boundedReason}`;
|
|
76
|
-
}
|
|
77
|
-
function fitImplementationPrompt(base, prompt) {
|
|
78
|
-
const bounded = truncateUtf8(prompt, DEEP_RESEARCH_CLIENT_IMPLEMENTATION_PROMPT_MAX_BYTES);
|
|
79
|
-
const full = { ...base, implementationPrompt: bounded };
|
|
80
|
-
if (encodedBytes(full) <= DEEP_RESEARCH_CLIENT_PROGRESS_MAX_BYTES)
|
|
81
|
-
return full;
|
|
82
|
-
const characters = Array.from(bounded);
|
|
83
|
-
let low = 1;
|
|
84
|
-
let high = characters.length;
|
|
85
|
-
let best = base;
|
|
86
|
-
while (low <= high) {
|
|
87
|
-
const midpoint = Math.floor((low + high) / 2);
|
|
88
|
-
const candidate = {
|
|
89
|
-
...base,
|
|
90
|
-
implementationPrompt: truncateCharacters(bounded, midpoint),
|
|
91
|
-
};
|
|
92
|
-
if (encodedBytes(candidate) <= DEEP_RESEARCH_CLIENT_PROGRESS_MAX_BYTES) {
|
|
93
|
-
best = candidate;
|
|
94
|
-
low = midpoint + 1;
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
high = midpoint - 1;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return best;
|
|
101
|
-
}
|
|
102
|
-
function truncateCharacters(value, maxCharacters) {
|
|
103
|
-
const characters = Array.from(value);
|
|
104
|
-
if (characters.length <= maxCharacters)
|
|
105
|
-
return value;
|
|
106
|
-
if (maxCharacters === 1)
|
|
107
|
-
return characters[0] ?? '…';
|
|
108
|
-
return `${characters.slice(0, maxCharacters - 1).join('')}…`;
|
|
109
|
-
}
|
|
110
|
-
function encodedBytes(value) {
|
|
111
|
-
return new TextEncoder().encode(JSON.stringify(value)).byteLength;
|
|
112
|
-
}
|
|
113
|
-
function utf8Bytes(value) {
|
|
114
|
-
return new TextEncoder().encode(value).byteLength;
|
|
115
|
-
}
|
|
116
|
-
function truncateUtf8(value, maxBytes) {
|
|
117
|
-
const encoder = new TextEncoder();
|
|
118
|
-
if (encoder.encode(value).byteLength <= maxBytes)
|
|
119
|
-
return value;
|
|
120
|
-
const marker = '…';
|
|
121
|
-
const markerBytes = encoder.encode(marker).byteLength;
|
|
122
|
-
let bytes = 0;
|
|
123
|
-
let output = '';
|
|
124
|
-
for (const character of value) {
|
|
125
|
-
const characterBytes = encoder.encode(character).byteLength;
|
|
126
|
-
if (bytes + characterBytes + markerBytes > maxBytes)
|
|
127
|
-
break;
|
|
128
|
-
output += character;
|
|
129
|
-
bytes += characterBytes;
|
|
130
|
-
}
|
|
131
|
-
return `${output}${marker}`;
|
|
132
|
-
}
|