maka-agent 0.2.0-dev.25.20260908 → 0.2.0-dev.27.20260910
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/cli-core.js +21 -0
- package/dist/mcp-capability-provider.js +4 -1
- package/dist/pi-tui-mcp-status.js +2 -2
- package/dist/pi-tui-pickers.js +19 -29
- package/dist/runtime-host-cli.js +43 -3
- package/dist/runtime-host-handoff-surface.js +10 -8
- package/dist/runtime-host-lifecycle-transaction.js +28 -3
- package/dist/runtime-host-local-source-retirement.js +1 -1
- package/dist/runtime-host-setup-command.js +29 -6
- package/dist/runtime-host-update-command.js +49 -5
- package/dist/session-export-command.js +72 -0
- package/dist/tui-autocomplete-layout.js +3 -1
- package/dist/tui-copy-catalog.js +6 -3
- package/dist/tui-editor-render.js +36 -0
- package/dist/tui-mcp-control.js +41 -6
- package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
- package/node_modules/@maka/core/dist/runtime-event.js +3 -0
- package/node_modules/@maka/core/dist/session.js +29 -4
- package/node_modules/@maka/core/dist/usage-stats/types.js +2 -0
- package/node_modules/@maka/core/dist/workhub-action-result.js +68 -0
- package/node_modules/@maka/core/dist/workhub-routing.js +126 -0
- package/node_modules/@maka/core/package.json +3 -3
- package/node_modules/@maka/eval/dist/toolchain-verification.js +1 -1
- package/node_modules/@maka/mcp/dist/form-elicitation.js +213 -0
- package/node_modules/@maka/mcp/dist/index.js +337 -71
- package/node_modules/@maka/runtime/dist/agent-run.js +10 -1
- package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +7 -3
- package/node_modules/@maka/runtime/dist/builtin-tools.js +21 -2
- package/node_modules/@maka/runtime/dist/goal-continuation.js +5 -1
- package/node_modules/@maka/runtime/dist/plugin-agent-service.js +131 -0
- package/node_modules/@maka/runtime/dist/plugin-approval-service.js +33 -0
- package/node_modules/@maka/runtime/dist/plugin-attachment-service.js +53 -0
- package/node_modules/@maka/runtime/dist/plugin-command-service.js +100 -0
- package/node_modules/@maka/runtime/dist/plugin-data-services.js +332 -0
- package/node_modules/@maka/runtime/dist/plugin-fs-service.js +62 -0
- package/node_modules/@maka/runtime/dist/plugin-goal-service.js +61 -0
- package/node_modules/@maka/runtime/dist/plugin-invocation-signal.js +24 -0
- package/node_modules/@maka/runtime/dist/plugin-llm-service.js +85 -0
- package/node_modules/@maka/runtime/dist/plugin-lsp-service.js +94 -0
- package/node_modules/@maka/runtime/dist/plugin-scope-registry.js +91 -0
- package/node_modules/@maka/runtime/dist/plugin-session-query-service.js +71 -0
- package/node_modules/@maka/runtime/dist/plugin-shell-env-service.js +87 -0
- package/node_modules/@maka/runtime/dist/plugin-shell-service.js +74 -0
- package/node_modules/@maka/runtime/dist/plugin-skill-service.js +93 -0
- package/node_modules/@maka/runtime/dist/plugin-system-prompt-service.js +346 -0
- package/node_modules/@maka/runtime/dist/plugin-tool-service.js +18 -52
- package/node_modules/@maka/runtime/dist/plugin-user-question-service.js +43 -0
- package/node_modules/@maka/runtime/dist/plugin-web-service.js +69 -0
- package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +20 -1
- package/node_modules/@maka/runtime/dist/runtime-kernel.js +120 -13
- package/node_modules/@maka/runtime/dist/session-export.js +177 -0
- package/node_modules/@maka/runtime/dist/session-manager.js +20 -36
- package/node_modules/@maka/runtime/package.json +18 -0
- package/node_modules/@maka/runtime-host/dist/client/connection.js +30 -5
- package/node_modules/@maka/runtime-host/dist/client/host-handoff-copy.js +83 -18
- package/node_modules/@maka/runtime-host/dist/client/host-handoff.js +46 -12
- package/node_modules/@maka/runtime-host/dist/client/host-retirement.js +4 -2
- package/node_modules/@maka/runtime-host/dist/client/peer-client.js +18 -1
- package/node_modules/@maka/runtime-host/dist/operator/setup-frame.js +31 -21
- package/node_modules/@maka/runtime-host/dist/protocol/index.js +13 -1
- package/node_modules/@maka/runtime-host/dist/protocol/operations.js +3 -2
- package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +30 -5
- package/node_modules/@maka/runtime-host/dist/protocol/session-continuity.js +1 -0
- package/node_modules/@maka/runtime-host/dist/protocol/workhub-coordination.js +90 -188
- package/node_modules/@maka/runtime-host/dist/server/access-credential-store.js +4 -0
- package/node_modules/@maka/runtime-host/dist/server/canonical-session-projection.js +2 -1
- package/node_modules/@maka/runtime-host/dist/server/client-capability-coordinator.js +62 -4
- package/node_modules/@maka/runtime-host/dist/server/connection-session.js +28 -8
- package/node_modules/@maka/runtime-host/dist/server/daily-review-coordinator.js +112 -56
- package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +497 -27
- package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +74 -0
- package/node_modules/@maka/runtime-host/dist/server/failure-diagnostic.js +24 -0
- package/node_modules/@maka/runtime-host/dist/server/goal-coordinator.js +7 -3
- package/node_modules/@maka/runtime-host/dist/server/host-kernel.js +3 -3
- package/node_modules/@maka/runtime-host/dist/server/host-session-availability.js +5 -2
- package/node_modules/@maka/runtime-host/dist/server/hosted-execution-recovery.js +4 -3
- package/node_modules/@maka/runtime-host/dist/server/hosted-execution-tool-profile.js +64 -4
- package/node_modules/@maka/runtime-host/dist/server/interactive-run-composer.js +83 -17
- package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +25 -4
- package/node_modules/@maka/runtime-host/dist/server/operation-dispatcher.js +2 -7
- package/node_modules/@maka/runtime-host/dist/server/plugin-data-runtime.js +234 -0
- package/node_modules/@maka/runtime-host/dist/server/plugin-platform-coordinator.js +6 -0
- package/node_modules/@maka/runtime-host/dist/server/plugin-platform.js +12 -0
- package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +289 -96
- package/node_modules/@maka/runtime-host/dist/server/runtime-resource-coordinator.js +11 -8
- package/node_modules/@maka/runtime-host/dist/server/scheduled-task-coordinator.js +31 -21
- package/node_modules/@maka/runtime-host/dist/server/serial-outbound-writer.js +1 -1
- package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +20 -8
- package/node_modules/@maka/runtime-host/dist/server/session-transcript-reader.js +15 -104
- 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 +85 -117
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +201 -136
- package/node_modules/@maka/storage/dist/agent-run-store.js +60 -3
- package/node_modules/@maka/storage/dist/artifact-store.js +40 -3
- package/node_modules/@maka/storage/dist/atomic-file-write.js +74 -0
- package/node_modules/@maka/storage/dist/context-offload-snapshot.js +13 -6
- package/node_modules/@maka/storage/dist/credential-store.js +12 -63
- package/node_modules/@maka/storage/dist/execution-stores.js +5 -2
- package/node_modules/@maka/storage/dist/mcp-config-store.js +10 -25
- package/node_modules/@maka/storage/dist/session-bundle-policy.js +333 -30
- package/node_modules/@maka/storage/dist/session-store.js +16 -4
- package/node_modules/@maka/storage/dist/settings-store.js +8 -4
- package/node_modules/@maka/storage/dist/sqlite-artifact-metadata.js +11 -0
- package/node_modules/@maka/storage/dist/sqlite-session-metadata-schema.js +12 -1
- package/node_modules/@maka/storage/dist/sqlite-session-metadata-store.js +79 -8
- package/node_modules/@maka/storage/dist/stable-storage.js +14 -1
- package/node_modules/@maka/storage/package.json +2 -0
- package/package.json +1 -1
- package/node_modules/@maka/core/dist/workhub-creation-intent.js +0 -990
- package/node_modules/@maka/core/dist/workhub-session-resolver.js +0 -50
|
@@ -730,10 +730,12 @@ export class SqliteSessionMetadataStore {
|
|
|
730
730
|
throw new SessionNotFoundError(sessionId);
|
|
731
731
|
return record;
|
|
732
732
|
}
|
|
733
|
-
async readCatalogRecord(sessionId) {
|
|
733
|
+
async readCatalogRecord(sessionId, roleScope = 'ordinary') {
|
|
734
734
|
this.assertOpen();
|
|
735
735
|
assertSafeSessionId(sessionId);
|
|
736
|
-
const role =
|
|
736
|
+
const role = roleScope === 'recoverable'
|
|
737
|
+
? sqliteRecoverableSessionRolePredicate()
|
|
738
|
+
: sqliteOrdinarySessionRolePredicate();
|
|
737
739
|
const row = this.db
|
|
738
740
|
.prepare(`
|
|
739
741
|
SELECT
|
|
@@ -1206,7 +1208,11 @@ export class SqliteSessionMetadataStore {
|
|
|
1206
1208
|
assignment.id !== `wha_${suffix}` ||
|
|
1207
1209
|
assignment.targetMessageId !== `whm_${suffix}` ||
|
|
1208
1210
|
assignment.delegationId !== `whd_${suffix}` ||
|
|
1209
|
-
!
|
|
1211
|
+
!workHubAssignmentAttachmentsMatchTarget(assignment) ||
|
|
1212
|
+
!messageContentsEqual(admission.content, normalizeMessageContent({
|
|
1213
|
+
text: assignment.delegationText ?? assignment.userText,
|
|
1214
|
+
...(assignment.targetAttachments ? { attachments: assignment.targetAttachments } : {}),
|
|
1215
|
+
})) ||
|
|
1210
1216
|
admission.submittedContentDigest !== messageContentDigest(admission.content) ||
|
|
1211
1217
|
admission.submittedPlacement !== 'current_turn' ||
|
|
1212
1218
|
admission.placement !== 'current_turn' ||
|
|
@@ -1793,7 +1799,7 @@ export class SqliteSessionMetadataStore {
|
|
|
1793
1799
|
}
|
|
1794
1800
|
});
|
|
1795
1801
|
}
|
|
1796
|
-
async reorderMessageAdmissions(sessionId, messageIds) {
|
|
1802
|
+
async reorderMessageAdmissions(sessionId, messageIds, disposition = 'followup') {
|
|
1797
1803
|
this.assertOpen();
|
|
1798
1804
|
assertSafeSessionId(sessionId);
|
|
1799
1805
|
const unique = [...new Set(messageIds)];
|
|
@@ -1807,13 +1813,13 @@ export class SqliteSessionMetadataStore {
|
|
|
1807
1813
|
.prepare(`
|
|
1808
1814
|
SELECT message_id
|
|
1809
1815
|
FROM message_admissions
|
|
1810
|
-
WHERE session_id = ? AND disposition =
|
|
1816
|
+
WHERE session_id = ? AND disposition = ?
|
|
1811
1817
|
ORDER BY queue_order, sequence
|
|
1812
1818
|
`)
|
|
1813
|
-
.all(sessionId);
|
|
1819
|
+
.all(sessionId, disposition);
|
|
1814
1820
|
const current = rows.map((row) => row.message_id);
|
|
1815
1821
|
const currentIds = new Set(current);
|
|
1816
|
-
if (current.length !== unique.length ||
|
|
1822
|
+
if ((disposition === 'followup' && current.length !== unique.length) ||
|
|
1817
1823
|
unique.some((messageId) => !currentIds.has(messageId))) {
|
|
1818
1824
|
throw new SessionMetadataConflictError('Message admission reorder identity conflict');
|
|
1819
1825
|
}
|
|
@@ -1822,9 +1828,55 @@ export class SqliteSessionMetadataStore {
|
|
|
1822
1828
|
SET queue_order = ?
|
|
1823
1829
|
WHERE session_id = ? AND message_id = ?
|
|
1824
1830
|
`);
|
|
1825
|
-
|
|
1831
|
+
// Older steering may already be in flight. Keep those entries in their
|
|
1832
|
+
// slots so recovery never interleaves them with a newly reordered batch.
|
|
1833
|
+
const selected = new Set(unique);
|
|
1834
|
+
let next = 0;
|
|
1835
|
+
current.forEach((messageId, index) => {
|
|
1836
|
+
const orderedId = selected.has(messageId) ? unique[next++] : messageId;
|
|
1837
|
+
update.run(index, sessionId, orderedId);
|
|
1838
|
+
});
|
|
1839
|
+
});
|
|
1840
|
+
}
|
|
1841
|
+
async readCoordinationTranscriptIndexState() {
|
|
1842
|
+
this.assertOpen();
|
|
1843
|
+
return this.db
|
|
1844
|
+
.prepare(`SELECT (SELECT MAX(sequence) FROM coordination_transcript_index) AS highWater,
|
|
1845
|
+
(SELECT MAX(source_sequence) FROM coordination_transcript_index WHERE source = 'legacy') AS legacy,
|
|
1846
|
+
(SELECT MAX(source_sequence) FROM coordination_transcript_index WHERE source = 'runtime') AS runtime`)
|
|
1847
|
+
.get();
|
|
1848
|
+
}
|
|
1849
|
+
async appendCoordinationTranscriptIndex(records) {
|
|
1850
|
+
this.assertOpen();
|
|
1851
|
+
if (records.length > 64)
|
|
1852
|
+
throw new Error('Coordination transcript index batch exceeds limit');
|
|
1853
|
+
this.transaction(() => {
|
|
1854
|
+
let sequence = this.db
|
|
1855
|
+
.prepare('SELECT MAX(sequence) AS value FROM coordination_transcript_index')
|
|
1856
|
+
.get().value ?? -1;
|
|
1857
|
+
const insert = this.db.prepare(`INSERT INTO coordination_transcript_index
|
|
1858
|
+
(sequence, source, source_sequence) VALUES (?, ?, ?)
|
|
1859
|
+
ON CONFLICT(source, source_sequence) DO NOTHING`);
|
|
1860
|
+
for (const record of records) {
|
|
1861
|
+
if (!Number.isSafeInteger(record.sourceSequence) || record.sourceSequence < 0)
|
|
1862
|
+
throw new Error('Invalid Coordination source sequence');
|
|
1863
|
+
const result = insert.run(sequence + 1, record.source, record.sourceSequence);
|
|
1864
|
+
if (result.changes)
|
|
1865
|
+
sequence++;
|
|
1866
|
+
}
|
|
1826
1867
|
});
|
|
1827
1868
|
}
|
|
1869
|
+
async readCoordinationTranscriptIndex(request) {
|
|
1870
|
+
this.assertOpen();
|
|
1871
|
+
if (!Number.isSafeInteger(request.limit) || request.limit < 1 || request.limit > 64)
|
|
1872
|
+
throw new Error('Invalid Coordination transcript index limit');
|
|
1873
|
+
const older = request.direction === 'older';
|
|
1874
|
+
return this.db
|
|
1875
|
+
.prepare(`SELECT sequence, source, source_sequence AS sourceSequence
|
|
1876
|
+
FROM coordination_transcript_index WHERE sequence <= ? AND sequence ${older ? '<=' : '>='} ?
|
|
1877
|
+
ORDER BY sequence ${older ? 'DESC' : 'ASC'} LIMIT ?`)
|
|
1878
|
+
.all(request.throughSequence, request.position, request.limit);
|
|
1879
|
+
}
|
|
1828
1880
|
async readMessages(sessionId) {
|
|
1829
1881
|
return this.readMessagesWith(sessionId, decodeStoredMessage);
|
|
1830
1882
|
}
|
|
@@ -4566,6 +4618,21 @@ function isWorkHubActionOperation(value) {
|
|
|
4566
4618
|
value === 'replace' ||
|
|
4567
4619
|
value === 'stop');
|
|
4568
4620
|
}
|
|
4621
|
+
function workHubAssignmentAttachmentsMatchTarget(assignment) {
|
|
4622
|
+
const source = assignment.attachments ?? [];
|
|
4623
|
+
const target = assignment.targetAttachments ?? [];
|
|
4624
|
+
return (source.length === target.length &&
|
|
4625
|
+
source.every((attachment, index) => {
|
|
4626
|
+
const copied = target[index];
|
|
4627
|
+
const { ref: sourceRef, ...sourceMetadata } = attachment;
|
|
4628
|
+
const { ref: targetRef, ...targetMetadata } = copied;
|
|
4629
|
+
return (sourceRef.kind === 'session_file' &&
|
|
4630
|
+
sourceRef.sessionId === WORKHUB_COORDINATION_SESSION_ID &&
|
|
4631
|
+
targetRef.kind === 'session_file' &&
|
|
4632
|
+
targetRef.sessionId === assignment.targetSessionId &&
|
|
4633
|
+
isDeepStrictEqual(sourceMetadata, targetMetadata));
|
|
4634
|
+
}));
|
|
4635
|
+
}
|
|
4569
4636
|
function sameWorkHubAssignmentRequest(existing, requested) {
|
|
4570
4637
|
return isDeepStrictEqual({
|
|
4571
4638
|
actionId: existing.actionId,
|
|
@@ -4574,6 +4641,8 @@ function sameWorkHubAssignmentRequest(existing, requested) {
|
|
|
4574
4641
|
targetSessionId: existing.targetSessionId,
|
|
4575
4642
|
disposition: existing.disposition,
|
|
4576
4643
|
userText: existing.userText,
|
|
4644
|
+
delegationText: existing.delegationText,
|
|
4645
|
+
attachments: existing.attachments,
|
|
4577
4646
|
create: existing.create,
|
|
4578
4647
|
replacesActionId: existing.replacesActionId,
|
|
4579
4648
|
replacesDelegationId: existing.replacesDelegationId,
|
|
@@ -4584,6 +4653,8 @@ function sameWorkHubAssignmentRequest(existing, requested) {
|
|
|
4584
4653
|
targetSessionId: requested.targetSessionId,
|
|
4585
4654
|
disposition: requested.disposition,
|
|
4586
4655
|
userText: requested.userText,
|
|
4656
|
+
delegationText: requested.delegationText,
|
|
4657
|
+
attachments: requested.attachments,
|
|
4587
4658
|
create: requested.create,
|
|
4588
4659
|
replacesActionId: requested.replacesActionId,
|
|
4589
4660
|
replacesDelegationId: requested.replacesDelegationId,
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
import { constants } from 'node:fs';
|
|
20
|
-
import { lstat, open } from 'node:fs/promises';
|
|
20
|
+
import { chmod, lstat, mkdir, open } from 'node:fs/promises';
|
|
21
21
|
import { dirname, isAbsolute, relative, resolve, sep } from 'node:path';
|
|
22
22
|
const openStableFile = open;
|
|
23
23
|
const lstatStableFile = lstat;
|
|
@@ -74,6 +74,19 @@ export async function syncFile(path) {
|
|
|
74
74
|
await handle.close();
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Create (or harden) an owner-only directory: recursive mkdir plus a
|
|
79
|
+
* fail-closed chmod, since mkdir's mode only applies on creation. Callers that
|
|
80
|
+
* store secrets use this before creating their file or update lock.
|
|
81
|
+
*/
|
|
82
|
+
export async function hardenDirectory(dir, mode = 0o700) {
|
|
83
|
+
await mkdir(dir, { recursive: true, mode });
|
|
84
|
+
if (process.platform === 'win32') {
|
|
85
|
+
await chmod(dir, mode).catch(() => { });
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
await chmod(dir, mode);
|
|
89
|
+
}
|
|
77
90
|
export async function syncDirectoryChain(path, root, beforeSync) {
|
|
78
91
|
const boundary = resolve(root);
|
|
79
92
|
let current = resolve(path);
|
|
@@ -43,6 +43,8 @@
|
|
|
43
43
|
"./scheduled-task-store": "./dist/scheduled-task-store.js",
|
|
44
44
|
"./quiescent-session-snapshot": "./dist/quiescent-session-snapshot.js",
|
|
45
45
|
"./production-session-snapshot": "./dist/production-session-snapshot.js",
|
|
46
|
+
"./session-bundle-contract": "./dist/session-bundle-contract.js",
|
|
47
|
+
"./session-bundle-file-service": "./dist/session-bundle-file-service.js",
|
|
46
48
|
"./session-bundle-policy": "./dist/session-bundle-policy.js",
|
|
47
49
|
"./session-copy-cleanup": "./dist/session-copy-cleanup.js",
|
|
48
50
|
"./session-todo-authority": "./dist/session-todo-authority.js",
|