maka-agent 0.2.0-dev.22.20260905 → 0.2.0-dev.24.20260907
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/maka-acp-agent.js +2 -1
- package/dist/acp/session-configuration.js +143 -0
- package/dist/acp/session-registry.js +90 -4
- package/dist/cli-core.js +2 -0
- package/dist/pi-transcript.js +5 -12
- package/dist/pi-tui-runner.js +74 -4
- package/dist/runtime-host-cli-context.js +167 -78
- package/dist/runtime-host-cli-installation.js +8 -2
- package/dist/runtime-host-cli.js +31 -1
- package/dist/runtime-host-handoff-surface.js +81 -0
- package/dist/runtime-host-installed-update-bootstrap.js +13 -0
- package/dist/runtime-host-installed-update-coordinator.js +33 -0
- package/dist/runtime-host-lifecycle-transaction.js +9 -1
- package/dist/runtime-host-local-handoff.js +37 -4
- package/dist/runtime-host-local-managed-activation.js +84 -0
- package/dist/runtime-host-local-source-retirement.js +18 -2
- package/dist/runtime-host-managed-lifecycle-manager.js +1 -0
- package/dist/runtime-host-operator-retirement.js +50 -0
- package/dist/runtime-host-service-manager.js +3 -0
- package/dist/runtime-host-session-driver.js +4 -25
- package/dist/runtime-host-session-update.js +62 -0
- package/dist/runtime-host-tui-command.js +38 -73
- package/dist/runtime-host-tui-context.js +1 -0
- package/dist/runtime-host-tui-owner.js +226 -0
- package/dist/tui-copy-catalog.js +140 -3
- package/dist/tui-host-owner-copy.js +24 -0
- package/native/runtime-host-peer/prebuilds/darwin-arm64/maka_runtime_host_peer.node +0 -0
- package/native/runtime-host-peer/prebuilds/linux-arm64/maka_runtime_host_peer.node +0 -0
- package/native/runtime-host-peer/prebuilds/linux-x64/maka_runtime_host_peer.node +0 -0
- package/native/runtime-host-peer/prebuilds/win32-x64/maka_runtime_host_peer.node +0 -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/bot-events.js +18 -63
- package/node_modules/@maka/core/dist/canonical-runtime-event.js +3 -1
- package/node_modules/@maka/core/dist/model-call-attempt.js +0 -82
- package/node_modules/@maka/core/dist/model-call-usage-projection.js +0 -186
- package/node_modules/@maka/core/dist/model-failure.js +40 -0
- package/node_modules/@maka/core/dist/model-metadata.generated.js +4 -4
- package/node_modules/@maka/core/dist/model-metadata.js +3 -3
- package/node_modules/@maka/core/dist/model-web-search.js +5 -4
- package/node_modules/@maka/core/dist/provider-registry.js +45 -4
- package/node_modules/@maka/core/dist/record-schema.js +22 -2
- package/node_modules/@maka/core/dist/redaction.js +41 -58
- package/node_modules/@maka/core/dist/runtime-boundary.js +31 -11
- package/node_modules/@maka/core/dist/runtime-event.js +37 -6
- package/node_modules/@maka/core/dist/runtime-handoff.js +98 -0
- package/node_modules/@maka/core/dist/runtime-invocation.js +1 -1
- package/node_modules/@maka/core/dist/runtime-logical-execution.js +112 -0
- package/node_modules/@maka/core/dist/session-trace.js +5 -1
- package/node_modules/@maka/core/dist/session.js +54 -52
- package/node_modules/@maka/core/dist/slash-command-catalog.js +2 -0
- package/node_modules/@maka/core/dist/tool-result-archive-evidence.js +20 -0
- package/node_modules/@maka/core/dist/usage-ledger-merge.js +7 -9
- package/node_modules/@maka/core/dist/usage-record-schema.js +26 -35
- package/node_modules/@maka/core/dist/workhub-creation-intent.js +34 -20
- package/node_modules/@maka/core/package.json +4 -0
- package/node_modules/@maka/eval/harbor/egress-proxy/entrypoint.sh +2 -1
- package/node_modules/@maka/mcp/dist/index.js +131 -1
- package/node_modules/@maka/runtime/dist/agent-run.js +272 -105
- package/node_modules/@maka/runtime/dist/ai-sdk-backend.js +13 -5
- package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +109 -34
- package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +155 -134
- package/node_modules/@maka/runtime/dist/bots/base-adapter.js +17 -0
- package/node_modules/@maka/runtime/dist/bots/bot-test.js +38 -22
- package/node_modules/@maka/runtime/dist/bots/dingtalk-bridge.js +7 -5
- package/node_modules/@maka/runtime/dist/bots/discord-bridge.js +4 -4
- package/node_modules/@maka/runtime/dist/bots/feishu-bridge.js +4 -5
- package/node_modules/@maka/runtime/dist/bots/qq-bridge.js +6 -4
- package/node_modules/@maka/runtime/dist/bots/slack-bridge.js +3 -4
- package/node_modules/@maka/runtime/dist/bots/telegram-bridge.js +4 -5
- package/node_modules/@maka/runtime/dist/bots/wechat-bridge.js +17 -19
- package/node_modules/@maka/runtime/dist/bots/wecom-bridge.js +5 -6
- package/node_modules/@maka/runtime/dist/bots/ws-bridge-base.js +2 -3
- package/node_modules/@maka/runtime/dist/context-budget.js +14 -9
- package/node_modules/@maka/runtime/dist/conversation-copy.js +5 -4
- package/node_modules/@maka/runtime/dist/goal-continuation.js +36 -4
- package/node_modules/@maka/runtime/dist/history-compact-checkpoint.js +18 -9
- package/node_modules/@maka/runtime/dist/history-compact-summarizer.js +30 -22
- package/node_modules/@maka/runtime/dist/history-compaction.js +29 -4
- package/node_modules/@maka/runtime/dist/ledger-tool-result-archive-reader.js +106 -0
- package/node_modules/@maka/runtime/dist/message-authority.js +9 -0
- package/node_modules/@maka/runtime/dist/model-adapter.js +19 -98
- package/node_modules/@maka/runtime/dist/model-factory.js +19 -81
- package/node_modules/@maka/runtime/dist/model-fetcher.js +7 -0
- package/node_modules/@maka/runtime/dist/model-runtime.js +85 -111
- package/node_modules/@maka/runtime/dist/native-web-search-tool.js +2 -1
- package/node_modules/@maka/runtime/dist/openai-codex-history-compactor.js +2 -2
- package/node_modules/@maka/runtime/dist/opencode-session-header.js +4 -2
- package/node_modules/@maka/runtime/dist/provider-error-classification.js +84 -123
- package/node_modules/@maka/runtime/dist/provider-request-telemetry.js +68 -108
- package/node_modules/@maka/runtime/dist/run-handoff-gate.js +97 -0
- package/node_modules/@maka/runtime/dist/runtime-event-backfill.js +82 -54
- package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +117 -159
- package/node_modules/@maka/runtime/dist/runtime-kernel.js +150 -112
- package/node_modules/@maka/runtime/dist/runtime-ledger-repair.js +160 -79
- package/node_modules/@maka/runtime/dist/runtime-read-model.js +30 -89
- package/node_modules/@maka/runtime/dist/runtime-resume.js +80 -4
- package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +5 -0
- package/node_modules/@maka/runtime/dist/session-manager.js +171 -288
- package/node_modules/@maka/runtime/dist/session-projection-helpers.js +0 -27
- package/node_modules/@maka/runtime/dist/session-trace-projection.js +3 -30
- package/node_modules/@maka/runtime/dist/subscription-model-fetch.js +3 -4
- package/node_modules/@maka/runtime/dist/test-connection.js +16 -16
- package/node_modules/@maka/runtime/dist/tool-result-archive-encoding.js +38 -0
- package/node_modules/@maka/runtime/dist/tool-runtime.js +3 -61
- package/node_modules/@maka/runtime/package.json +1 -0
- package/node_modules/@maka/runtime-host/dist/adapter/session-projector.js +35 -0
- package/node_modules/@maka/runtime-host/dist/candidate-entry.js +4 -1
- package/node_modules/@maka/runtime-host/dist/client/connect-or-spawn.js +9 -1
- package/node_modules/@maka/runtime-host/dist/client/connection.js +3 -0
- package/node_modules/@maka/runtime-host/dist/client/host-handoff-copy.js +156 -0
- package/node_modules/@maka/runtime-host/dist/client/host-handoff.js +273 -0
- package/node_modules/@maka/runtime-host/dist/client/host-retirement.js +26 -5
- package/node_modules/@maka/runtime-host/dist/client/index.js +3 -1
- package/node_modules/@maka/runtime-host/dist/client/launcher.js +3 -0
- package/node_modules/@maka/runtime-host/dist/client/peer-client.js +13 -0
- package/node_modules/@maka/runtime-host/dist/client/registered-host-termination.js +0 -59
- package/node_modules/@maka/runtime-host/dist/client/remote-compatibility-error.js +2 -0
- package/node_modules/@maka/runtime-host/dist/client/session-subscription.js +27 -5
- package/node_modules/@maka/runtime-host/dist/operator/index.js +2 -1
- package/node_modules/@maka/runtime-host/dist/operator/retirement-cancellation.js +20 -0
- package/node_modules/@maka/runtime-host/dist/peer-mesh/node.js +28 -16
- package/node_modules/@maka/runtime-host/dist/protocol/external-session.js +4 -0
- package/node_modules/@maka/runtime-host/dist/protocol/host-status.js +29 -12
- package/node_modules/@maka/runtime-host/dist/protocol/index.js +37 -1
- package/node_modules/@maka/runtime-host/dist/protocol/operations.js +2 -0
- package/node_modules/@maka/runtime-host/dist/protocol/session-collaboration.js +28 -1
- package/node_modules/@maka/runtime-host/dist/protocol/session-continuity.js +40 -20
- package/node_modules/@maka/runtime-host/dist/protocol/session-transcript.js +0 -5
- package/node_modules/@maka/runtime-host/dist/protocol/session-turns.js +29 -58
- package/node_modules/@maka/runtime-host/dist/protocol/turn.js +11 -1
- package/node_modules/@maka/runtime-host/dist/protocol/workhub-coordination.js +33 -0
- package/node_modules/@maka/runtime-host/dist/server/access-authority.js +26 -1
- package/node_modules/@maka/runtime-host/dist/server/access-credential-store.js +6 -1
- package/node_modules/@maka/runtime-host/dist/server/canonical-turn-snapshot.js +19 -4
- package/node_modules/@maka/runtime-host/dist/server/canonical-usage-reader.js +24 -11
- package/node_modules/@maka/runtime-host/dist/server/connection-session.js +7 -6
- package/node_modules/@maka/runtime-host/dist/server/daily-review-coordinator.js +7 -4
- package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +168 -28
- package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +5 -5
- package/node_modules/@maka/runtime-host/dist/server/execution-model-composition.js +3 -2
- package/node_modules/@maka/runtime-host/dist/server/external-session-coordinator.js +6 -3
- package/node_modules/@maka/runtime-host/dist/server/goal-coordinator.js +40 -1
- package/node_modules/@maka/runtime-host/dist/server/host-kernel.js +108 -23
- package/node_modules/@maka/runtime-host/dist/server/host-residency-registry.js +13 -7
- package/node_modules/@maka/runtime-host/dist/server/hosted-execution-admission-registry.js +3 -1
- package/node_modules/@maka/runtime-host/dist/server/hosted-execution-recovery.js +124 -62
- package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +85 -8
- package/node_modules/@maka/runtime-host/dist/server/root-admission-owner.js +7 -0
- package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +344 -71
- package/node_modules/@maka/runtime-host/dist/server/scheduled-task-coordinator.js +37 -2
- package/node_modules/@maka/runtime-host/dist/server/serial-outbound-writer.js +45 -3
- package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +201 -12
- package/node_modules/@maka/runtime-host/dist/server/session-continuity-coordinator.js +87 -25
- package/node_modules/@maka/runtime-host/dist/server/session-revision-coordinator.js +8 -55
- package/node_modules/@maka/runtime-host/dist/server/session-sidecar-purge.js +1 -16
- package/node_modules/@maka/runtime-host/dist/server/session-transcript-pager.js +0 -1
- package/node_modules/@maka/runtime-host/dist/server/session-transcript-reader.js +460 -70
- package/node_modules/@maka/runtime-host/dist/server/shared-session-transcript.js +1 -1
- package/node_modules/@maka/runtime-host/dist/server/storage-maintenance.js +109 -0
- package/node_modules/@maka/runtime-host/dist/server/usage-pricing-coordinator.js +4 -11
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-action-gate.js +44 -15
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +6 -2
- package/node_modules/@maka/storage/dist/agent-run-store.js +44 -0
- package/node_modules/@maka/storage/dist/artifact-store.js +21 -10
- package/node_modules/@maka/storage/dist/artifact-stores.js +1 -1
- package/node_modules/@maka/storage/dist/claude-code-session-adapter.js +0 -4
- package/node_modules/@maka/storage/dist/codex-session-adapter.js +0 -2
- package/node_modules/@maka/storage/dist/context-offload-snapshot.js +325 -0
- package/node_modules/@maka/storage/dist/conversation-operational-state.js +4 -0
- package/node_modules/@maka/storage/dist/execution-stores.js +11 -7
- package/node_modules/@maka/storage/dist/file-session-repository.js +1012 -0
- package/node_modules/@maka/storage/dist/model-call-ledger.js +199 -32
- package/node_modules/@maka/storage/dist/model-call-usage-sql.js +136 -0
- package/node_modules/@maka/storage/dist/opencode-session-adapter.js +0 -4
- package/node_modules/@maka/storage/dist/operational-state-backup.js +9 -5
- package/node_modules/@maka/storage/dist/operational-state-store-public.js +1 -1
- package/node_modules/@maka/storage/dist/operational-state-store.js +5 -3
- package/node_modules/@maka/storage/dist/runtime-event-persistence.js +1 -0
- package/node_modules/@maka/storage/dist/runtime-transcript-query.js +308 -0
- package/node_modules/@maka/storage/dist/session-bundle-policy.js +24 -4
- package/node_modules/@maka/storage/dist/session-message-projection.js +15 -0
- package/node_modules/@maka/storage/dist/session-repository.js +767 -0
- package/node_modules/@maka/storage/dist/session-store.js +25 -99
- package/node_modules/@maka/storage/dist/sqlite-artifact-metadata.js +10 -3
- package/node_modules/@maka/storage/dist/sqlite-context-offload-store.js +24 -8
- package/node_modules/@maka/storage/dist/sqlite-core-execution-schema.js +17 -1
- package/node_modules/@maka/storage/dist/sqlite-runtime-schema.js +44 -1
- package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +129 -25
- package/node_modules/@maka/storage/dist/sqlite-session-metadata-store.js +109 -892
- package/node_modules/@maka/storage/dist/sqlite-usage-schema.js +200 -20
- package/node_modules/@maka/storage/dist/tool-result-archive-evidence.js +111 -0
- package/node_modules/@maka/storage/dist/usage-stores.js +6 -2
- package/node_modules/@maka/storage/package.json +2 -0
- package/package.json +1 -1
|
@@ -407,10 +407,8 @@ export class HostSessionRevisionCoordinator {
|
|
|
407
407
|
// An empty copy carries no source state, including no in-progress Todo.
|
|
408
408
|
copyCurrent: kind === 'branch' && slice.beforeTs === undefined && input.sourceTurnId !== undefined,
|
|
409
409
|
});
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
}
|
|
413
|
-
await this.#stores.sessionStore.appendMessage(input.targetSessionId, conversationCopyStartNote(kind, input, createInput));
|
|
410
|
+
// `cloneConversationRuntimeLedger` already wrote the copy's own spine, and
|
|
411
|
+
// the copy reads back off that: nothing here writes a second transcript.
|
|
414
412
|
await this.#stores.sessionStore.updateHeader(input.targetSessionId, {
|
|
415
413
|
conversationCopy: {
|
|
416
414
|
...createInput.conversationCopy,
|
|
@@ -596,21 +594,13 @@ export class HostSessionRevisionCoordinator {
|
|
|
596
594
|
}, header.id);
|
|
597
595
|
await this.#stores.sessionStore.discardStableConversationCopy(header.id, copy.requestFingerprint);
|
|
598
596
|
}
|
|
597
|
+
/**
|
|
598
|
+
* A revision copy that admitted a turn of its own. The admission ledger is
|
|
599
|
+
* the whole answer: a copy clones the source's history but never its
|
|
600
|
+
* admissions, so every row it holds was admitted on this session.
|
|
601
|
+
*/
|
|
599
602
|
async #hasAdmittedRevisionTurn(sessionId) {
|
|
600
|
-
|
|
601
|
-
return true;
|
|
602
|
-
}
|
|
603
|
-
const messages = await this.#stores.sessionStore.readMessagesForRecovery(sessionId);
|
|
604
|
-
let boundary = -1;
|
|
605
|
-
for (let index = 0; index < messages.length; index += 1) {
|
|
606
|
-
const message = messages[index];
|
|
607
|
-
if (message.type === 'system_note' &&
|
|
608
|
-
message.kind === 'session_start' &&
|
|
609
|
-
isRevisionStartData(message.data)) {
|
|
610
|
-
boundary = index;
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
return boundary >= 0 && messages.slice(boundary + 1).some((message) => message.type === 'user');
|
|
603
|
+
return ((await this.#stores.agentRunStore.listRootTurnAdmissionsForRecovery(sessionId)).length > 0);
|
|
614
604
|
}
|
|
615
605
|
async #hasCommittedConversationCopyDependent(sessionId) {
|
|
616
606
|
return (await this.#stores.sessionStore.listHeaders()).some((header) => header.conversationCopy?.state === 'committed' &&
|
|
@@ -638,49 +628,12 @@ function conversationCopyFingerprint(kind, input) {
|
|
|
638
628
|
];
|
|
639
629
|
return `sha256:${createHash('sha256').update(JSON.stringify(identity)).digest('hex')}`;
|
|
640
630
|
}
|
|
641
|
-
function conversationCopyStartNote(kind, input, createInput) {
|
|
642
|
-
const base = {
|
|
643
|
-
type: 'system_note',
|
|
644
|
-
id: randomUUID(),
|
|
645
|
-
ts: Date.now(),
|
|
646
|
-
kind: 'session_start',
|
|
647
|
-
};
|
|
648
|
-
if (kind !== 'revision') {
|
|
649
|
-
// Empty copies record provenance without a branch turn.
|
|
650
|
-
return {
|
|
651
|
-
...base,
|
|
652
|
-
data: {
|
|
653
|
-
parentSessionId: input.sourceSessionId,
|
|
654
|
-
...(input.sourceTurnId === undefined ? {} : { branchOfTurnId: input.sourceTurnId }),
|
|
655
|
-
},
|
|
656
|
-
};
|
|
657
|
-
}
|
|
658
|
-
if (input.sourceTurnId === undefined) {
|
|
659
|
-
throw new Error('Session revision copy requires a turn boundary');
|
|
660
|
-
}
|
|
661
|
-
return {
|
|
662
|
-
...base,
|
|
663
|
-
data: {
|
|
664
|
-
revisionRootSessionId: createInput.revisionRootSessionId,
|
|
665
|
-
revisionParentSessionId: input.sourceSessionId,
|
|
666
|
-
revisionOfTurnId: input.sourceTurnId,
|
|
667
|
-
revisionIndex: createInput.revisionIndex,
|
|
668
|
-
revisionState: 'preparing',
|
|
669
|
-
},
|
|
670
|
-
};
|
|
671
|
-
}
|
|
672
631
|
function conversationCopySemanticKind(kind, input) {
|
|
673
632
|
return kind === 'branch' && input.intent === 'side_conversation' ? input.intent : kind;
|
|
674
633
|
}
|
|
675
634
|
function persistedConversationCopyKind(kind) {
|
|
676
635
|
return kind === 'revision' ? 'revision' : 'branch';
|
|
677
636
|
}
|
|
678
|
-
function isRevisionStartData(value) {
|
|
679
|
-
return (!!value &&
|
|
680
|
-
typeof value === 'object' &&
|
|
681
|
-
!Array.isArray(value) &&
|
|
682
|
-
'revisionRootSessionId' in value);
|
|
683
|
-
}
|
|
684
637
|
function collectArchivedToolResultPlaceholders(events, messages, copyTurnIds, operationalEvents) {
|
|
685
638
|
const retainedTurnIds = new Set(copyTurnIds);
|
|
686
639
|
const archives = new Map();
|
|
@@ -16,26 +16,11 @@
|
|
|
16
16
|
* specific language governing permissions and limitations
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
|
-
const CONTEXT_GARBAGE_BATCH_BLOBS = 64;
|
|
20
|
-
async function retireContextSession(contextOffload, sessionId) {
|
|
21
|
-
await contextOffload.retireSession(sessionId);
|
|
22
|
-
for (;;) {
|
|
23
|
-
const collected = await contextOffload.collectGarbage({
|
|
24
|
-
olderThan: Number.MAX_SAFE_INTEGER,
|
|
25
|
-
maxBlobs: CONTEXT_GARBAGE_BATCH_BLOBS,
|
|
26
|
-
maxBytes: Number.MAX_SAFE_INTEGER,
|
|
27
|
-
});
|
|
28
|
-
if (!collected.hasMore)
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
19
|
export async function purgeSessionSidecars(authority, sessionId) {
|
|
33
20
|
const outcomes = await Promise.allSettled([
|
|
34
21
|
authority.artifacts.purgeSessionArtifacts(sessionId),
|
|
35
22
|
authority.sessionTodo.purgeSessionState(sessionId),
|
|
36
|
-
...(authority.contextOffload
|
|
37
|
-
? [retireContextSession(authority.contextOffload, sessionId)]
|
|
38
|
-
: []),
|
|
23
|
+
...(authority.contextOffload ? [authority.contextOffload.retireSession(sessionId)] : []),
|
|
39
24
|
authority.purgeOperationalState(sessionId),
|
|
40
25
|
]);
|
|
41
26
|
const failures = outcomes.flatMap((outcome) => outcome.status === 'rejected' ? [outcome.reason] : []);
|
|
@@ -63,7 +63,6 @@ export async function createSessionTranscriptBootstrap(input) {
|
|
|
63
63
|
});
|
|
64
64
|
const bootstrap = {
|
|
65
65
|
throughSequence: input.throughSequence,
|
|
66
|
-
durableCoverage: projection === 'shared' ? 'projected' : 'complete',
|
|
67
66
|
overlayMessageCount: overlayMessages.length,
|
|
68
67
|
durable: pageFromSelection(state, 'durable', 'older', rangeEdges.selected, input.throughSequence, rangeEdges.rangeBoundarySequence, rangeEdges.protectedTurnSequence),
|
|
69
68
|
overlay: pageFromSelection(state, 'overlay', 'older', selectedOverlay),
|