maka-agent 0.2.0-dev.35.20260915 → 0.2.0-dev.37.20260915
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/README.md +6 -0
- package/README.zh-CN.md +5 -0
- package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
- package/node_modules/@maka/core/dist/model-metadata.generated.js +175 -116
- package/node_modules/@maka/core/dist/models-dev-projection.js +1 -0
- package/node_modules/@maka/core/dist/provider-registry.js +17 -0
- package/node_modules/@maka/eval/dist/harbor-maka-subject.js +13 -3
- package/node_modules/@maka/eval/dist/maka-artifacts.js +28 -14
- package/node_modules/@maka/eval/dist/maka-subject.js +28 -3
- package/node_modules/@maka/eval/harbor/relay_agent.py +42 -2
- package/node_modules/@maka/runtime/dist/ai-sdk-backend.js +0 -1
- package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +40 -53
- package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +26 -29
- package/node_modules/@maka/runtime/dist/builtin-tools.js +20 -12
- package/node_modules/@maka/runtime/dist/runtime-kernel.js +1 -0
- package/node_modules/@maka/runtime/dist/telemetry/model-pricing.generated.js +144 -77
- package/node_modules/@maka/runtime/node_modules/@ai-sdk/code-mode/dist/run-code-mode.js +6 -19
- package/node_modules/@maka/runtime-host/dist/client/connect-or-spawn.js +24 -3
- package/node_modules/@maka/runtime-host/dist/client/connection.js +20 -2
- package/node_modules/@maka/runtime-host/dist/client/hosted-execution-target.js +27 -6
- package/node_modules/@maka/runtime-host/dist/client/hosted-execution.js +10 -28
- package/node_modules/@maka/runtime-host/dist/client/startup-error.js +1 -1
- package/node_modules/@maka/runtime-host/dist/execution-candidate-main.js +8 -1
- package/node_modules/@maka/runtime-host/dist/protocol/agent-graph.js +1 -11
- package/node_modules/@maka/runtime-host/dist/protocol/client-capability.js +2 -2
- package/node_modules/@maka/runtime-host/dist/protocol/codec.js +11 -0
- package/node_modules/@maka/runtime-host/dist/protocol/index.js +1 -1
- package/node_modules/@maka/runtime-host/dist/protocol/workhub-coordination.js +10 -2
- package/node_modules/@maka/runtime-host/dist/server/bootstrap-runtime-policy.js +65 -0
- package/node_modules/@maka/runtime-host/dist/server/execution-candidate.js +4 -1
- package/node_modules/@maka/runtime-host/dist/server/execution-composition-factory.js +9 -3
- package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +11 -0
- package/node_modules/@maka/runtime-host/dist/server/hosted-execution-tool-profile.js +3 -15
- package/node_modules/@maka/runtime-host/dist/server/interactive-run-composer.js +9 -4
- package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +1 -2
- package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +4 -1
- package/node_modules/@maka/storage/dist/agent-run-store-contract.js +11 -8
- package/node_modules/@maka/storage/dist/agent-run-store.js +1 -1
- package/node_modules/@maka/storage/dist/execution-stores.js +1 -1
- package/node_modules/@maka/storage/dist/message-admission-store.js +5 -3
- package/node_modules/@maka/storage/dist/sqlite-session-metadata-store.js +14 -6
- package/package.json +1 -1
- package/node_modules/@maka/eval/dist/maka-runtime-policy.js +0 -42
|
@@ -355,9 +355,14 @@ function assertUniqueToolNames(tools) {
|
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
357
|
function buildDefaultHostTools(sessionTodo, inventoryFor, builtinOptions, hostTools = [], scheduledTaskTool, goalTools = [], parentAgentTools = [], plan, deepResearchTools = []) {
|
|
358
|
-
|
|
358
|
+
// Full access has no boundary to widen, so neither the Bash declaration nor
|
|
359
|
+
// the widening tool is offered. An unknown mode is not Full access.
|
|
360
|
+
const fullAccess = plan?.permissionMode === 'bypass';
|
|
361
|
+
const builtins = builtinOptions
|
|
362
|
+
? buildBuiltinTools({ ...builtinOptions, declareSandboxBoundary: !fullAccess })
|
|
363
|
+
: [];
|
|
359
364
|
const question = buildAskUserQuestionTool();
|
|
360
|
-
const sandboxBoundary = buildRequestSandboxBoundaryTool();
|
|
365
|
+
const sandboxBoundary = fullAccess ? undefined : buildRequestSandboxBoundaryTool();
|
|
361
366
|
const todoTools = buildSessionTodoTools(sessionTodo);
|
|
362
367
|
const activeExecution = plan ? activePlanExecution(plan.state) : undefined;
|
|
363
368
|
const interruptedExecution = plan
|
|
@@ -377,7 +382,7 @@ function buildDefaultHostTools(sessionTodo, inventoryFor, builtinOptions, hostTo
|
|
|
377
382
|
...builtins.map((tool) => tool.name),
|
|
378
383
|
...hostTools.map((tool) => tool.name),
|
|
379
384
|
question.name,
|
|
380
|
-
sandboxBoundary.name,
|
|
385
|
+
...(sandboxBoundary ? [sandboxBoundary.name] : []),
|
|
381
386
|
'Skill',
|
|
382
387
|
'SkillSearch',
|
|
383
388
|
...todoTools.map((tool) => tool.name),
|
|
@@ -393,7 +398,7 @@ function buildDefaultHostTools(sessionTodo, inventoryFor, builtinOptions, hostTo
|
|
|
393
398
|
...builtins,
|
|
394
399
|
...hostTools,
|
|
395
400
|
question,
|
|
396
|
-
sandboxBoundary,
|
|
401
|
+
...(sandboxBoundary ? [sandboxBoundary] : []),
|
|
397
402
|
buildSkillAgentToolFromInventory(inventoryFor, skillHost, { shadowTracker }),
|
|
398
403
|
buildSkillSearchAgentToolFromInventory(inventoryFor, skillHost, { shadowTracker }),
|
|
399
404
|
...todoTools,
|
|
@@ -498,8 +498,7 @@ export class HostMessageCoordinator {
|
|
|
498
498
|
throw new RuntimeMessageAuthorityInvariantError(`Root admission does not prove Message handoff ${messageId}`);
|
|
499
499
|
}
|
|
500
500
|
return {
|
|
501
|
-
|
|
502
|
-
content: proof.sourceMessage.content,
|
|
501
|
+
...proof.sourceMessage,
|
|
503
502
|
admittedAt: proof.admission.admittedAt,
|
|
504
503
|
};
|
|
505
504
|
}
|
|
@@ -451,7 +451,10 @@ export class HostSessionCatalogCoordinator {
|
|
|
451
451
|
return this.#updateConfiguration({
|
|
452
452
|
sessionId: WORKHUB_COORDINATION_SESSION_ID,
|
|
453
453
|
expectedRevision: input.expectedRevision,
|
|
454
|
-
patch: {
|
|
454
|
+
patch: {
|
|
455
|
+
modelTarget: input.modelTarget,
|
|
456
|
+
thinkingLevel: input.thinkingLevel,
|
|
457
|
+
},
|
|
455
458
|
}, 'workhub');
|
|
456
459
|
}
|
|
457
460
|
async #updateConfiguration(input, authority = 'ordinary') {
|
|
@@ -490,17 +490,20 @@ export function rootTurnAdmissionPayloadsEqual(left, right) {
|
|
|
490
490
|
left.sourceMessages.every((source, index) => {
|
|
491
491
|
const other = right.sourceMessages[index];
|
|
492
492
|
return (other !== undefined &&
|
|
493
|
-
source
|
|
493
|
+
rootTurnSourceMessagePayloadsEqual(source, other) &&
|
|
494
494
|
source.placement === other.placement &&
|
|
495
|
-
source.disposition === other.disposition
|
|
496
|
-
source.submittedContentDigest === other.submittedContentDigest &&
|
|
497
|
-
(source.submittedPlacement ?? source.placement) ===
|
|
498
|
-
(other.submittedPlacement ?? other.placement) &&
|
|
499
|
-
submittedTurnIntentsEqual(source.submittedIntent, other.submittedIntent) &&
|
|
500
|
-
isDeepStrictEqual(source.skillInvocation, other.skillInvocation) &&
|
|
501
|
-
messageContentsEqual(source.content, other.content));
|
|
495
|
+
source.disposition === other.disposition);
|
|
502
496
|
}));
|
|
503
497
|
}
|
|
498
|
+
/** Whether two durable source records prove the same submitted Message payload. */
|
|
499
|
+
export function rootTurnSourceMessagePayloadsEqual(left, right) {
|
|
500
|
+
return (left.messageId === right.messageId &&
|
|
501
|
+
left.submittedContentDigest === right.submittedContentDigest &&
|
|
502
|
+
(left.submittedPlacement ?? left.placement) === (right.submittedPlacement ?? right.placement) &&
|
|
503
|
+
submittedTurnIntentsEqual(left.submittedIntent, right.submittedIntent) &&
|
|
504
|
+
isDeepStrictEqual(left.skillInvocation, right.skillInvocation) &&
|
|
505
|
+
messageContentsEqual(left.content, right.content));
|
|
506
|
+
}
|
|
504
507
|
export function assertRootTurnAdmissionRecordSize(admission) {
|
|
505
508
|
assertRootTurnAdmissionSerializedSize(`${JSON.stringify(admission)}\n`);
|
|
506
509
|
}
|
|
@@ -26,7 +26,7 @@ import { LATEST_CONTEXT_PROJECTION_TYPE, RUN_COMPOSITION_RECORDED_EVENT_TYPE, su
|
|
|
26
26
|
import { isSessionInlineInvocation } from '@maka/core/runtime-invocation';
|
|
27
27
|
import { decodeRuntimeInvocationOpened, runtimeEventInvocationOpening, } from '@maka/core/runtime-event';
|
|
28
28
|
import { normalizeRootTurnStartRejection, normalizeStoredRootTurnStartRejection, normalizeAdmitRootTurnInput, shouldPreserveCheckpointProjectionDuringAppend, shouldPreserveProjectionDuringRepair, isProjectedAgentRunEvent, assertSafeId, normalizeRootTurnAdmission, orderRootTurnAdmissionChain, rootTurnAdmissionPayloadsEqual, sanitizeJson, } from './agent-run-store-contract.js';
|
|
29
|
-
export { ROOT_TURN_ADMISSION_SCHEMA_VERSION, ROOT_TURN_ADMISSION_MAX_SOURCE_MESSAGES, ROOT_TURN_ADMISSION_MAX_CONTENT_BYTES, ROOT_TURN_ADMISSION_MAX_RECORD_BYTES, rootTurnAdmissionRecordFits, normalizeRootTurnAdmissionPayload, } from './agent-run-store-contract.js';
|
|
29
|
+
export { ROOT_TURN_ADMISSION_SCHEMA_VERSION, ROOT_TURN_ADMISSION_MAX_SOURCE_MESSAGES, ROOT_TURN_ADMISSION_MAX_CONTENT_BYTES, ROOT_TURN_ADMISSION_MAX_RECORD_BYTES, rootTurnSourceMessagePayloadsEqual, rootTurnAdmissionRecordFits, normalizeRootTurnAdmissionPayload, } from './agent-run-store-contract.js';
|
|
30
30
|
class RuntimeEventPostEffectError extends Error {
|
|
31
31
|
cause;
|
|
32
32
|
name = 'RuntimeEventPostEffectError';
|
|
@@ -32,7 +32,7 @@ const executionStoresWriterKinds = new WeakMap();
|
|
|
32
32
|
const executionStoresReaderKinds = new WeakMap();
|
|
33
33
|
const executionStoresWritersByLease = new WeakMap();
|
|
34
34
|
const executionStoresWritersOpeningByLease = new WeakMap();
|
|
35
|
-
export { normalizeRootTurnAdmissionPayload, rootTurnAdmissionRecordFits, } from './agent-run-store.js';
|
|
35
|
+
export { normalizeRootTurnAdmissionPayload, rootTurnAdmissionRecordFits, rootTurnSourceMessagePayloadsEqual, } from './agent-run-store.js';
|
|
36
36
|
export { isSessionNotFoundError } from './session-store-contract.js';
|
|
37
37
|
export { SessionMetadataConflictError, SessionMetadataVersionConflictError, } from './session-store-contract.js';
|
|
38
38
|
export { submittedTurnIntentsEqual } from './submitted-turn-intent.js';
|
|
@@ -20,6 +20,7 @@ import { isDeepStrictEqual } from 'node:util';
|
|
|
20
20
|
import { decodeMessageContent, normalizeMessageContent, } from '@maka/core/events';
|
|
21
21
|
import { decodeSkillInvocationResult, } from '@maka/core/skill-invocation';
|
|
22
22
|
import { normalizeSubmittedTurnIntent, submittedTurnIntentsEqual, } from './submitted-turn-intent.js';
|
|
23
|
+
import { normalizeRootTurnSourceMessages, } from './agent-run-store-contract.js';
|
|
23
24
|
const SAFE_ID_PATTERN = /^[A-Za-z0-9_-]{1,128}$/;
|
|
24
25
|
export function normalizePendingMessageAdmission(admission) {
|
|
25
26
|
for (const [name, value] of [
|
|
@@ -54,13 +55,14 @@ export function normalizePendingMessageAdmission(admission) {
|
|
|
54
55
|
return normalized;
|
|
55
56
|
}
|
|
56
57
|
export function normalizeProvenRootMessageHandoff(handoff) {
|
|
57
|
-
assertSafeId(handoff.messageId, 'Invalid proven Root Message identity');
|
|
58
58
|
if (!Number.isSafeInteger(handoff.admittedAt) || handoff.admittedAt < 0) {
|
|
59
59
|
throw new Error('Invalid proven Root Message timestamp');
|
|
60
60
|
}
|
|
61
|
+
const { admittedAt, ...source } = handoff;
|
|
62
|
+
const normalized = normalizeRootTurnSourceMessages([source])[0];
|
|
61
63
|
return Object.freeze({
|
|
62
|
-
...
|
|
63
|
-
|
|
64
|
+
...normalized,
|
|
65
|
+
admittedAt,
|
|
64
66
|
});
|
|
65
67
|
}
|
|
66
68
|
export function normalizeProvenSteeringMessageHandoff(handoff) {
|
|
@@ -34,6 +34,7 @@ import { assertAgentGraphIntentClaimRequest, decodeAgentGraphIntentClaim, } from
|
|
|
34
34
|
import { isSubagentSessionParent, isSubagentSessionRuntime, isSubagentSessionSpawn, WORKHUB_COORDINATION_SESSION_ID, WORKHUB_COORDINATION_SESSION_ROLE, decodeCanonicalMessage, decodeStoredMessage as decodePersistedStoredMessage, } from '@maka/core/session';
|
|
35
35
|
import { markPersisted } from '@maka/core/persisted-value';
|
|
36
36
|
import { normalizePendingMessageAdmission, normalizeProvenRootMessageHandoff, normalizeProvenSteeringMessageHandoff, samePendingMessageAdmission, } from './message-admission-store.js';
|
|
37
|
+
import { rootTurnSourceMessagePayloadsEqual } from './agent-run-store-contract.js';
|
|
37
38
|
import { normalizeSubmittedTurnIntent } from './submitted-turn-intent.js';
|
|
38
39
|
import { messageContentDigest, messageContentsEqual, normalizeMessageContent, } from '@maka/core/events';
|
|
39
40
|
import { AGENT_GRAPH_SUPERVISOR_WAKE_SCHEMA_VERSION, } from '@maka/core/agent-graph-supervisor-wake';
|
|
@@ -1659,20 +1660,27 @@ export class SqliteSessionMetadataStore {
|
|
|
1659
1660
|
admission.runId === steeringProof.admissionRunId &&
|
|
1660
1661
|
admission.admittedAt === steeringProof.admittedAt &&
|
|
1661
1662
|
messageContentsEqual(admission.content, steeringProof.content);
|
|
1663
|
+
// Root admission commits before this mutable queue projection is retired. A crash
|
|
1664
|
+
// between those writes can therefore leave the same Message looking like steering
|
|
1665
|
+
// for its predecessor even though the successor Root already owns it.
|
|
1666
|
+
const provenSuccessorRootHandoff = admission !== undefined &&
|
|
1667
|
+
fallback !== undefined &&
|
|
1668
|
+
rootTurnSourceMessagePayloadsEqual(admission, fallback);
|
|
1662
1669
|
if (admission !== undefined && steeringProof !== undefined && !provenCrossTurnSteering) {
|
|
1663
1670
|
throw new SessionMetadataConflictError('Proven steering admission identity conflict');
|
|
1664
1671
|
}
|
|
1672
|
+
if (admission !== undefined &&
|
|
1673
|
+
fallback !== undefined &&
|
|
1674
|
+
!rootTurnSourceMessagePayloadsEqual(admission, fallback)) {
|
|
1675
|
+
throw new SessionMetadataConflictError('Message admission fallback payload conflict');
|
|
1676
|
+
}
|
|
1665
1677
|
if (admission !== undefined &&
|
|
1666
1678
|
admission.turnId !== input.turnId &&
|
|
1667
1679
|
admission.disposition !== 'followup' &&
|
|
1668
|
-
!provenCrossTurnSteering
|
|
1680
|
+
!provenCrossTurnSteering &&
|
|
1681
|
+
!provenSuccessorRootHandoff) {
|
|
1669
1682
|
throw new SessionMetadataConflictError('Message admission Turn conflict');
|
|
1670
1683
|
}
|
|
1671
|
-
if (admission !== undefined &&
|
|
1672
|
-
fallback !== undefined &&
|
|
1673
|
-
!messageContentsEqual(admission.content, fallback.content)) {
|
|
1674
|
-
throw new SessionMetadataConflictError('Message admission fallback content conflict');
|
|
1675
|
-
}
|
|
1676
1684
|
if (!admission &&
|
|
1677
1685
|
this.db
|
|
1678
1686
|
.prepare('SELECT 1 AS present FROM cancelled_message_admissions WHERE session_id = ? AND message_id = ?')
|
package/package.json
CHANGED
|
@@ -1,42 +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 { createDefaultRuntimePolicy } from '@maka/core/runtime-policy';
|
|
20
|
-
export function makaEvalRuntimePolicyDocument(proxyUrl) {
|
|
21
|
-
const policy = createDefaultRuntimePolicy();
|
|
22
|
-
const proxy = proxyUrl ? new URL(proxyUrl) : undefined;
|
|
23
|
-
return {
|
|
24
|
-
schemaVersion: 2,
|
|
25
|
-
revision: 0,
|
|
26
|
-
policy: {
|
|
27
|
-
...policy,
|
|
28
|
-
...(proxy
|
|
29
|
-
? {
|
|
30
|
-
networkProxy: {
|
|
31
|
-
...policy.networkProxy,
|
|
32
|
-
enabled: true,
|
|
33
|
-
protocol: 'http',
|
|
34
|
-
host: proxy.hostname,
|
|
35
|
-
port: Number(proxy.port || 80),
|
|
36
|
-
},
|
|
37
|
-
}
|
|
38
|
-
: {}),
|
|
39
|
-
privacy: { incognitoActive: true },
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
}
|