dominds 1.4.2 → 1.5.2
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 +24 -0
- package/README.zh.md +24 -0
- package/dist/apps/app-json.js +38 -3
- package/dist/apps/dialog-run-controls.js +4 -0
- package/dist/apps/enabled-apps.js +8 -1
- package/dist/apps/installed-file.js +207 -0
- package/dist/apps/run-app-json.js +6 -6
- package/dist/apps/runtime-port.js +91 -0
- package/dist/apps/runtime.js +316 -68
- package/dist/apps-host/client.js +153 -3
- package/dist/apps-host/host.js +339 -2
- package/dist/apps-host/ipc-types.js +215 -30
- package/dist/cli/install.js +21 -1
- package/dist/dialog-fork.js +609 -0
- package/dist/dialog.js +2 -2
- package/dist/docs/agent-priming.md +38 -0
- package/dist/docs/agent-priming.zh.md +34 -0
- package/dist/docs/app-constitution.md +153 -2
- package/dist/docs/app-constitution.zh.md +153 -2
- package/dist/docs/dialog-persistence.md +31 -0
- package/dist/docs/dialog-persistence.zh.md +31 -0
- package/dist/docs/dialog-system.md +29 -0
- package/dist/docs/dialog-system.zh.md +29 -0
- package/dist/docs/kernel-app-architecture.md +286 -0
- package/dist/docs/kernel-app-architecture.zh.md +285 -0
- package/dist/llm/defaults.yaml +16 -0
- package/dist/llm/driver-entry.js +28 -0
- package/dist/llm/driver-v2/context-health.js +121 -0
- package/dist/llm/driver-v2/context.js +56 -0
- package/dist/llm/driver-v2/core.js +1545 -0
- package/dist/llm/driver-v2/index.js +26 -0
- package/dist/llm/driver-v2/orchestrator.js +158 -0
- package/dist/llm/driver-v2/policy.js +129 -0
- package/dist/llm/driver-v2/restore-dialog-hierarchy.js +73 -0
- package/dist/llm/driver-v2/round.js +366 -0
- package/dist/llm/driver-v2/runtime-utils.js +365 -0
- package/dist/llm/driver-v2/saying-events.js +20 -0
- package/dist/llm/driver-v2/subdialog-txn.js +42 -0
- package/dist/llm/driver-v2/supdialog-response.js +400 -0
- package/dist/llm/driver-v2/tellask-bridge.js +1148 -0
- package/dist/llm/driver-v2/types.js +10 -0
- package/dist/llm/driver-v2-ref-only/context-health.js +121 -0
- package/dist/llm/driver-v2-ref-only/context.js +17 -0
- package/dist/llm/driver-v2-ref-only/core.js +1710 -0
- package/dist/llm/driver-v2-ref-only/index.js +26 -0
- package/dist/llm/driver-v2-ref-only/orchestrator.js +158 -0
- package/dist/llm/driver-v2-ref-only/policy.js +129 -0
- package/dist/llm/driver-v2-ref-only/restore-dialog-hierarchy.js +73 -0
- package/dist/llm/driver-v2-ref-only/round.js +366 -0
- package/dist/llm/driver-v2-ref-only/runtime-utils.js +473 -0
- package/dist/llm/driver-v2-ref-only/saying-events.js +18 -0
- package/dist/llm/driver-v2-ref-only/subdialog-txn.js +42 -0
- package/dist/llm/driver-v2-ref-only/supdialog-response.js +453 -0
- package/dist/llm/driver-v2-ref-only/tellask-bridge.js +1178 -0
- package/dist/llm/driver-v2-ref-only/types.js +10 -0
- package/dist/llm/gen/anthropic.js +68 -15
- package/dist/llm/gen/codex.js +59 -10
- package/dist/llm/gen/openai-compatible.js +38 -9
- package/dist/llm/gen/openai.js +58 -11
- package/dist/llm/gen/tool-output-limit.js +50 -0
- package/dist/llm/kernel-driver/subdialog.js +23 -12
- package/dist/llm/kernel-driver/tellask-special.js +20 -4
- package/dist/minds/load.js +7 -0
- package/dist/persistence.js +216 -30
- package/dist/priming.js +171 -18
- package/dist/server/api-routes.js +82 -0
- package/dist/server/setup-routes.js +15 -0
- package/dist/shared/types/storage.js +77 -0
- package/dist/static/assets/{_basePickBy-B2o4z1Hf.js → _basePickBy-B-A5XrWM.js} +3 -3
- package/dist/static/assets/{_basePickBy-B2o4z1Hf.js.map → _basePickBy-B-A5XrWM.js.map} +1 -1
- package/dist/static/assets/{_baseUniq-CLmcxjdl.js → _baseUniq-BANLb0cu.js} +2 -2
- package/dist/static/assets/{_baseUniq-CLmcxjdl.js.map → _baseUniq-BANLb0cu.js.map} +1 -1
- package/dist/static/assets/{arc-CymD_KN7.js → arc-CYZYnojf.js} +2 -2
- package/dist/static/assets/{arc-CymD_KN7.js.map → arc-CYZYnojf.js.map} +1 -1
- package/dist/static/assets/{architectureDiagram-VXUJARFQ-DJQfSJUH.js → architectureDiagram-VXUJARFQ-Cxf4pmYG.js} +7 -7
- package/dist/static/assets/{architectureDiagram-VXUJARFQ-DJQfSJUH.js.map → architectureDiagram-VXUJARFQ-Cxf4pmYG.js.map} +1 -1
- package/dist/static/assets/{blockDiagram-VD42YOAC-pHVz60D0.js → blockDiagram-VD42YOAC-wvs0G30c.js} +7 -7
- package/dist/static/assets/{blockDiagram-VD42YOAC-pHVz60D0.js.map → blockDiagram-VD42YOAC-wvs0G30c.js.map} +1 -1
- package/dist/static/assets/{c4Diagram-YG6GDRKO-B0WnCfAT.js → c4Diagram-YG6GDRKO-BKFNexn4.js} +3 -3
- package/dist/static/assets/{c4Diagram-YG6GDRKO-B0WnCfAT.js.map → c4Diagram-YG6GDRKO-BKFNexn4.js.map} +1 -1
- package/dist/static/assets/{channel-CX9BlKil.js → channel-_1qpxJWy.js} +2 -2
- package/dist/static/assets/{channel-CX9BlKil.js.map → channel-_1qpxJWy.js.map} +1 -1
- package/dist/static/assets/{chunk-4BX2VUAB-lXArRj3o.js → chunk-4BX2VUAB-BIdC0phm.js} +2 -2
- package/dist/static/assets/{chunk-4BX2VUAB-lXArRj3o.js.map → chunk-4BX2VUAB-BIdC0phm.js.map} +1 -1
- package/dist/static/assets/{chunk-55IACEB6-CdqwynH9.js → chunk-55IACEB6-BNvGenQ9.js} +2 -2
- package/dist/static/assets/{chunk-55IACEB6-CdqwynH9.js.map → chunk-55IACEB6-BNvGenQ9.js.map} +1 -1
- package/dist/static/assets/{chunk-B4BG7PRW-Y-uXcJst.js → chunk-B4BG7PRW-jmf-1Wv7.js} +5 -5
- package/dist/static/assets/{chunk-B4BG7PRW-Y-uXcJst.js.map → chunk-B4BG7PRW-jmf-1Wv7.js.map} +1 -1
- package/dist/static/assets/{chunk-DI55MBZ5-C5xSbRST.js → chunk-DI55MBZ5-nmEmcikR.js} +4 -4
- package/dist/static/assets/{chunk-DI55MBZ5-C5xSbRST.js.map → chunk-DI55MBZ5-nmEmcikR.js.map} +1 -1
- package/dist/static/assets/{chunk-FMBD7UC4-5uefwCjI.js → chunk-FMBD7UC4-kGysaq_j.js} +2 -2
- package/dist/static/assets/{chunk-FMBD7UC4-5uefwCjI.js.map → chunk-FMBD7UC4-kGysaq_j.js.map} +1 -1
- package/dist/static/assets/{chunk-QN33PNHL-DzWVcvpI.js → chunk-QN33PNHL-8JwMLFIJ.js} +2 -2
- package/dist/static/assets/{chunk-QN33PNHL-DzWVcvpI.js.map → chunk-QN33PNHL-8JwMLFIJ.js.map} +1 -1
- package/dist/static/assets/{chunk-QZHKN3VN-BrrvAZdP.js → chunk-QZHKN3VN-DZleEj00.js} +2 -2
- package/dist/static/assets/{chunk-QZHKN3VN-BrrvAZdP.js.map → chunk-QZHKN3VN-DZleEj00.js.map} +1 -1
- package/dist/static/assets/{chunk-TZMSLE5B-DyKOlPTY.js → chunk-TZMSLE5B-CXxl_uqH.js} +2 -2
- package/dist/static/assets/{chunk-TZMSLE5B-DyKOlPTY.js.map → chunk-TZMSLE5B-CXxl_uqH.js.map} +1 -1
- package/dist/static/assets/{classDiagram-2ON5EDUG-FCrnlCWC.js → classDiagram-2ON5EDUG-C-7R0QB6.js} +6 -6
- package/dist/static/assets/{classDiagram-2ON5EDUG-FCrnlCWC.js.map → classDiagram-2ON5EDUG-C-7R0QB6.js.map} +1 -1
- package/dist/static/assets/{classDiagram-v2-WZHVMYZB-FCrnlCWC.js → classDiagram-v2-WZHVMYZB-C-7R0QB6.js} +6 -6
- package/dist/static/assets/{classDiagram-v2-WZHVMYZB-FCrnlCWC.js.map → classDiagram-v2-WZHVMYZB-C-7R0QB6.js.map} +1 -1
- package/dist/static/assets/{clone-BlI81KqZ.js → clone-BwOKYSj8.js} +2 -2
- package/dist/static/assets/{clone-BlI81KqZ.js.map → clone-BwOKYSj8.js.map} +1 -1
- package/dist/static/assets/{cose-bilkent-S5V4N54A-yM7S2atz.js → cose-bilkent-S5V4N54A-BCBalM7p.js} +2 -2
- package/dist/static/assets/{cose-bilkent-S5V4N54A-yM7S2atz.js.map → cose-bilkent-S5V4N54A-BCBalM7p.js.map} +1 -1
- package/dist/static/assets/{dagre-6UL2VRFP-BcweuZHt.js → dagre-6UL2VRFP-uV2ekQoj.js} +7 -7
- package/dist/static/assets/{dagre-6UL2VRFP-BcweuZHt.js.map → dagre-6UL2VRFP-uV2ekQoj.js.map} +1 -1
- package/dist/static/assets/{diagram-PSM6KHXK-D4-QwLW1.js → diagram-PSM6KHXK-D-ZMog1-.js} +8 -8
- package/dist/static/assets/{diagram-PSM6KHXK-D4-QwLW1.js.map → diagram-PSM6KHXK-D-ZMog1-.js.map} +1 -1
- package/dist/static/assets/{diagram-QEK2KX5R-BVbuejJn.js → diagram-QEK2KX5R-BThSELUH.js} +7 -7
- package/dist/static/assets/{diagram-QEK2KX5R-BVbuejJn.js.map → diagram-QEK2KX5R-BThSELUH.js.map} +1 -1
- package/dist/static/assets/{diagram-S2PKOQOG-pB6N6Tq_.js → diagram-S2PKOQOG-Di-YN5cd.js} +7 -7
- package/dist/static/assets/{diagram-S2PKOQOG-pB6N6Tq_.js.map → diagram-S2PKOQOG-Di-YN5cd.js.map} +1 -1
- package/dist/static/assets/{erDiagram-Q2GNP2WA-DLKmthuw.js → erDiagram-Q2GNP2WA-lBZ9DITn.js} +5 -5
- package/dist/static/assets/{erDiagram-Q2GNP2WA-DLKmthuw.js.map → erDiagram-Q2GNP2WA-lBZ9DITn.js.map} +1 -1
- package/dist/static/assets/{flowDiagram-NV44I4VS-BsBhWukh.js → flowDiagram-NV44I4VS-C_60PNQR.js} +6 -6
- package/dist/static/assets/{flowDiagram-NV44I4VS-BsBhWukh.js.map → flowDiagram-NV44I4VS-C_60PNQR.js.map} +1 -1
- package/dist/static/assets/{ganttDiagram-JELNMOA3-Debz-J-C.js → ganttDiagram-JELNMOA3-Dvqq-VHJ.js} +3 -3
- package/dist/static/assets/{ganttDiagram-JELNMOA3-Debz-J-C.js.map → ganttDiagram-JELNMOA3-Dvqq-VHJ.js.map} +1 -1
- package/dist/static/assets/{gitGraphDiagram-V2S2FVAM-BnAPFBGR.js → gitGraphDiagram-V2S2FVAM-BTj8orRe.js} +8 -8
- package/dist/static/assets/{gitGraphDiagram-V2S2FVAM-BnAPFBGR.js.map → gitGraphDiagram-V2S2FVAM-BTj8orRe.js.map} +1 -1
- package/dist/static/assets/{graph-DbzWiBNK.js → graph-BqCzR2Nl.js} +3 -3
- package/dist/static/assets/{graph-DbzWiBNK.js.map → graph-BqCzR2Nl.js.map} +1 -1
- package/dist/static/assets/{index-B-8J28g7.js → index-DrTqAfFy.js} +386 -201
- package/dist/static/assets/index-DrTqAfFy.js.map +1 -0
- package/dist/static/assets/{infoDiagram-HS3SLOUP-CZ5hWoxV.js → infoDiagram-HS3SLOUP-DlC6wsrv.js} +6 -6
- package/dist/static/assets/{infoDiagram-HS3SLOUP-CZ5hWoxV.js.map → infoDiagram-HS3SLOUP-DlC6wsrv.js.map} +1 -1
- package/dist/static/assets/{journeyDiagram-XKPGCS4Q-CKN3oSxk.js → journeyDiagram-XKPGCS4Q-Dg_RgtQX.js} +5 -5
- package/dist/static/assets/{journeyDiagram-XKPGCS4Q-CKN3oSxk.js.map → journeyDiagram-XKPGCS4Q-Dg_RgtQX.js.map} +1 -1
- package/dist/static/assets/{kanban-definition-3W4ZIXB7-BQCMklfJ.js → kanban-definition-3W4ZIXB7-DuGS3lId.js} +3 -3
- package/dist/static/assets/{kanban-definition-3W4ZIXB7-BQCMklfJ.js.map → kanban-definition-3W4ZIXB7-DuGS3lId.js.map} +1 -1
- package/dist/static/assets/{layout-C5B58szc.js → layout-FDz2bstZ.js} +5 -5
- package/dist/static/assets/{layout-C5B58szc.js.map → layout-FDz2bstZ.js.map} +1 -1
- package/dist/static/assets/{linear-_32fut6G.js → linear-CzsdvPGb.js} +2 -2
- package/dist/static/assets/{linear-_32fut6G.js.map → linear-CzsdvPGb.js.map} +1 -1
- package/dist/static/assets/{mindmap-definition-VGOIOE7T-C_goMzjx.js → mindmap-definition-VGOIOE7T-WsAF5UNp.js} +4 -4
- package/dist/static/assets/{mindmap-definition-VGOIOE7T-C_goMzjx.js.map → mindmap-definition-VGOIOE7T-WsAF5UNp.js.map} +1 -1
- package/dist/static/assets/{pieDiagram-ADFJNKIX-BQ2n0cOB.js → pieDiagram-ADFJNKIX-DJpRJ5ei.js} +8 -8
- package/dist/static/assets/{pieDiagram-ADFJNKIX-BQ2n0cOB.js.map → pieDiagram-ADFJNKIX-DJpRJ5ei.js.map} +1 -1
- package/dist/static/assets/{quadrantDiagram-AYHSOK5B-BLg7_neg.js → quadrantDiagram-AYHSOK5B-CMyIzTkY.js} +3 -3
- package/dist/static/assets/{quadrantDiagram-AYHSOK5B-BLg7_neg.js.map → quadrantDiagram-AYHSOK5B-CMyIzTkY.js.map} +1 -1
- package/dist/static/assets/{requirementDiagram-UZGBJVZJ-DwkJt0zi.js → requirementDiagram-UZGBJVZJ-D_yqVXGu.js} +4 -4
- package/dist/static/assets/{requirementDiagram-UZGBJVZJ-DwkJt0zi.js.map → requirementDiagram-UZGBJVZJ-D_yqVXGu.js.map} +1 -1
- package/dist/static/assets/{sankeyDiagram-TZEHDZUN-DmxmatUB.js → sankeyDiagram-TZEHDZUN-D4-cF724.js} +2 -2
- package/dist/static/assets/{sankeyDiagram-TZEHDZUN-DmxmatUB.js.map → sankeyDiagram-TZEHDZUN-D4-cF724.js.map} +1 -1
- package/dist/static/assets/{sequenceDiagram-WL72ISMW-KHU_eApU.js → sequenceDiagram-WL72ISMW-B7J3gWYN.js} +4 -4
- package/dist/static/assets/{sequenceDiagram-WL72ISMW-KHU_eApU.js.map → sequenceDiagram-WL72ISMW-B7J3gWYN.js.map} +1 -1
- package/dist/static/assets/{stateDiagram-FKZM4ZOC-B3DBCxAL.js → stateDiagram-FKZM4ZOC-DwEYYCcu.js} +9 -9
- package/dist/static/assets/{stateDiagram-FKZM4ZOC-B3DBCxAL.js.map → stateDiagram-FKZM4ZOC-DwEYYCcu.js.map} +1 -1
- package/dist/static/assets/{stateDiagram-v2-4FDKWEC3-C-uIk7gh.js → stateDiagram-v2-4FDKWEC3-D4LOOQV5.js} +5 -5
- package/dist/static/assets/{stateDiagram-v2-4FDKWEC3-C-uIk7gh.js.map → stateDiagram-v2-4FDKWEC3-D4LOOQV5.js.map} +1 -1
- package/dist/static/assets/{timeline-definition-IT6M3QCI-SysEcQCC.js → timeline-definition-IT6M3QCI-CyG-TJ_A.js} +3 -3
- package/dist/static/assets/{timeline-definition-IT6M3QCI-SysEcQCC.js.map → timeline-definition-IT6M3QCI-CyG-TJ_A.js.map} +1 -1
- package/dist/static/assets/{treemap-GDKQZRPO-d0AbKEc4.js → treemap-GDKQZRPO-yY4GiKmU.js} +5 -5
- package/dist/static/assets/{treemap-GDKQZRPO-d0AbKEc4.js.map → treemap-GDKQZRPO-yY4GiKmU.js.map} +1 -1
- package/dist/static/assets/{xychartDiagram-PRI3JC2R-CmSQMxUh.js → xychartDiagram-PRI3JC2R-5TYN_q15.js} +3 -3
- package/dist/static/assets/{xychartDiagram-PRI3JC2R-CmSQMxUh.js.map → xychartDiagram-PRI3JC2R-5TYN_q15.js.map} +1 -1
- package/dist/static/index.html +1 -1
- package/dist/team.js +33 -4
- package/dist/tools/app-reminders.js +280 -0
- package/dist/tools/prompts/memory/en/errors.md +155 -0
- package/dist/tools/prompts/memory/en/index.md +47 -0
- package/dist/tools/prompts/memory/en/principles.md +79 -0
- package/dist/tools/prompts/memory/en/scenarios.md +174 -0
- package/dist/tools/prompts/memory/en/tools.md +154 -0
- package/dist/tools/prompts/memory/zh/errors.md +155 -0
- package/dist/tools/prompts/memory/zh/index.md +47 -0
- package/dist/tools/prompts/memory/zh/principles.md +79 -0
- package/dist/tools/prompts/memory/zh/scenarios.md +174 -0
- package/dist/tools/prompts/memory/zh/tools.md +154 -0
- package/dist/tools/ripgrep.js +197 -63
- package/package.json +2 -2
- package/dist/static/assets/index-B-8J28g7.js.map +0 -1
|
@@ -7,11 +7,6 @@ function isRecord(v) {
|
|
|
7
7
|
function asString(v) {
|
|
8
8
|
return typeof v === 'string' ? v : null;
|
|
9
9
|
}
|
|
10
|
-
function asNullableString(v) {
|
|
11
|
-
if (v === null)
|
|
12
|
-
return null;
|
|
13
|
-
return typeof v === 'string' ? v : null;
|
|
14
|
-
}
|
|
15
10
|
function asNullableNumber(v) {
|
|
16
11
|
if (v === null)
|
|
17
12
|
return null;
|
|
@@ -22,6 +17,82 @@ function asNullableNumber(v) {
|
|
|
22
17
|
function asLanguageCode(v) {
|
|
23
18
|
return v === 'zh' || v === 'en' ? v : null;
|
|
24
19
|
}
|
|
20
|
+
function isJsonPrimitive(value) {
|
|
21
|
+
return (typeof value === 'string' ||
|
|
22
|
+
typeof value === 'number' ||
|
|
23
|
+
typeof value === 'boolean' ||
|
|
24
|
+
value === null);
|
|
25
|
+
}
|
|
26
|
+
function isJsonValue(value) {
|
|
27
|
+
if (isJsonPrimitive(value))
|
|
28
|
+
return true;
|
|
29
|
+
if (Array.isArray(value))
|
|
30
|
+
return value.every((item) => isJsonValue(item));
|
|
31
|
+
if (!isRecord(value))
|
|
32
|
+
return false;
|
|
33
|
+
return Object.values(value).every((item) => isJsonValue(item));
|
|
34
|
+
}
|
|
35
|
+
function parseReminderState(v, at) {
|
|
36
|
+
if (!isRecord(v))
|
|
37
|
+
throw new Error(`Invalid ${at}: expected object`);
|
|
38
|
+
const content = asString(v['content']);
|
|
39
|
+
if (content === null)
|
|
40
|
+
throw new Error(`Invalid ${at}.content: required`);
|
|
41
|
+
const metaRaw = v['meta'];
|
|
42
|
+
if (metaRaw !== undefined && !isJsonValue(metaRaw)) {
|
|
43
|
+
throw new Error(`Invalid ${at}.meta: must be JSON-serializable`);
|
|
44
|
+
}
|
|
45
|
+
const echobackRaw = v['echoback'];
|
|
46
|
+
const echoback = echobackRaw === undefined ? undefined : typeof echobackRaw === 'boolean' ? echobackRaw : null;
|
|
47
|
+
if (echoback === null)
|
|
48
|
+
throw new Error(`Invalid ${at}.echoback: must be boolean`);
|
|
49
|
+
return { content, meta: metaRaw, echoback };
|
|
50
|
+
}
|
|
51
|
+
function parseReminderApplyRequest(v, at) {
|
|
52
|
+
if (!isRecord(v))
|
|
53
|
+
throw new Error(`Invalid ${at}: expected object`);
|
|
54
|
+
const kind = v['kind'];
|
|
55
|
+
const ownerRef = asString(v['ownerRef']);
|
|
56
|
+
if (!ownerRef)
|
|
57
|
+
throw new Error(`Invalid ${at}.ownerRef: required`);
|
|
58
|
+
if (kind === 'upsert') {
|
|
59
|
+
const content = asString(v['content']);
|
|
60
|
+
if (content === null)
|
|
61
|
+
throw new Error(`Invalid ${at}.content: required`);
|
|
62
|
+
const metaRaw = v['meta'];
|
|
63
|
+
if (metaRaw !== undefined && !isJsonValue(metaRaw)) {
|
|
64
|
+
throw new Error(`Invalid ${at}.meta: must be JSON-serializable`);
|
|
65
|
+
}
|
|
66
|
+
const positionRaw = v['position'];
|
|
67
|
+
const position = positionRaw === undefined
|
|
68
|
+
? undefined
|
|
69
|
+
: typeof positionRaw === 'number' && Number.isFinite(positionRaw)
|
|
70
|
+
? Math.floor(positionRaw)
|
|
71
|
+
: null;
|
|
72
|
+
if (position === null)
|
|
73
|
+
throw new Error(`Invalid ${at}.position: must be finite number`);
|
|
74
|
+
const echobackRaw = v['echoback'];
|
|
75
|
+
const echoback = echobackRaw === undefined ? undefined : typeof echobackRaw === 'boolean' ? echobackRaw : null;
|
|
76
|
+
if (echoback === null)
|
|
77
|
+
throw new Error(`Invalid ${at}.echoback: must be boolean`);
|
|
78
|
+
return {
|
|
79
|
+
kind: 'upsert',
|
|
80
|
+
ownerRef,
|
|
81
|
+
content,
|
|
82
|
+
meta: metaRaw,
|
|
83
|
+
position,
|
|
84
|
+
echoback,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
if (kind === 'delete') {
|
|
88
|
+
const metaRaw = v['meta'];
|
|
89
|
+
if (metaRaw !== undefined && !isJsonValue(metaRaw)) {
|
|
90
|
+
throw new Error(`Invalid ${at}.meta: must be JSON-serializable`);
|
|
91
|
+
}
|
|
92
|
+
return { kind: 'delete', ownerRef, meta: metaRaw };
|
|
93
|
+
}
|
|
94
|
+
throw new Error(`Invalid ${at}.kind: unsupported value ${String(kind)}`);
|
|
95
|
+
}
|
|
25
96
|
function parseAppsHostMessageFromKernel(v) {
|
|
26
97
|
if (!isRecord(v))
|
|
27
98
|
throw new Error('Invalid IPC message from kernel: expected object');
|
|
@@ -43,8 +114,9 @@ function parseAppsHostMessageFromKernel(v) {
|
|
|
43
114
|
const port = typeof portRaw === 'number' && Number.isFinite(portRaw) ? Math.floor(portRaw) : null;
|
|
44
115
|
if (!host)
|
|
45
116
|
throw new Error('Invalid init message: kernel.host required');
|
|
46
|
-
if (port === null || port < 0)
|
|
117
|
+
if (port === null || port < 0) {
|
|
47
118
|
throw new Error('Invalid init message: kernel.port must be non-negative number');
|
|
119
|
+
}
|
|
48
120
|
if (!Array.isArray(apps))
|
|
49
121
|
throw new Error('Invalid init message: apps must be array');
|
|
50
122
|
const parsedApps = apps.map((a, idx) => {
|
|
@@ -54,7 +126,7 @@ function parseAppsHostMessageFromKernel(v) {
|
|
|
54
126
|
const runtimePortRaw = asNullableNumber(a['runtimePort']);
|
|
55
127
|
const runtimePort = runtimePortRaw === null
|
|
56
128
|
? null
|
|
57
|
-
:
|
|
129
|
+
: Number.isFinite(runtimePortRaw)
|
|
58
130
|
? Math.floor(runtimePortRaw)
|
|
59
131
|
: null;
|
|
60
132
|
if (!appId)
|
|
@@ -63,8 +135,9 @@ function parseAppsHostMessageFromKernel(v) {
|
|
|
63
135
|
throw new Error(`Invalid init message: apps[${idx}].runtimePort must be non-negative number|null`);
|
|
64
136
|
}
|
|
65
137
|
const installJson = a['installJson'];
|
|
66
|
-
if (!isRecord(installJson))
|
|
138
|
+
if (!isRecord(installJson)) {
|
|
67
139
|
throw new Error(`Invalid init message: apps[${idx}].installJson must be object`);
|
|
140
|
+
}
|
|
68
141
|
return { appId, runtimePort, installJson: installJson };
|
|
69
142
|
});
|
|
70
143
|
return { type: 'init', rtwsRootAbs, kernel: { host, port }, apps: parsedApps };
|
|
@@ -83,17 +156,132 @@ function parseAppsHostMessageFromKernel(v) {
|
|
|
83
156
|
if (!isRecord(ctx))
|
|
84
157
|
throw new Error('Invalid tool_call message: ctx must be object');
|
|
85
158
|
const dialogId = asString(ctx['dialogId']);
|
|
159
|
+
const rootDialogId = asString(ctx['rootDialogId']);
|
|
160
|
+
const agentId = asString(ctx['agentId']);
|
|
161
|
+
const sessionSlugRaw = ctx['sessionSlug'];
|
|
162
|
+
const sessionSlug = sessionSlugRaw === undefined
|
|
163
|
+
? undefined
|
|
164
|
+
: typeof sessionSlugRaw === 'string'
|
|
165
|
+
? sessionSlugRaw
|
|
166
|
+
: null;
|
|
86
167
|
const callerId = asString(ctx['callerId']);
|
|
87
168
|
if (!dialogId)
|
|
88
169
|
throw new Error('Invalid tool_call message: ctx.dialogId required');
|
|
170
|
+
if (!rootDialogId)
|
|
171
|
+
throw new Error('Invalid tool_call message: ctx.rootDialogId required');
|
|
172
|
+
if (!agentId)
|
|
173
|
+
throw new Error('Invalid tool_call message: ctx.agentId required');
|
|
174
|
+
if (sessionSlugRaw !== undefined && !sessionSlug) {
|
|
175
|
+
throw new Error('Invalid tool_call message: ctx.sessionSlug must be string when present');
|
|
176
|
+
}
|
|
89
177
|
if (!callerId)
|
|
90
178
|
throw new Error('Invalid tool_call message: ctx.callerId required');
|
|
179
|
+
const normalizedSessionSlug = sessionSlug ?? undefined;
|
|
91
180
|
return {
|
|
92
181
|
type: 'tool_call',
|
|
93
182
|
callId,
|
|
94
183
|
toolName,
|
|
95
184
|
args: args,
|
|
96
|
-
ctx: { dialogId, callerId },
|
|
185
|
+
ctx: { dialogId, rootDialogId, agentId, sessionSlug: normalizedSessionSlug, callerId },
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
if (type === 'reminder_apply') {
|
|
189
|
+
const callId = asString(v['callId']);
|
|
190
|
+
const appId = asString(v['appId']);
|
|
191
|
+
const ownerRef = asString(v['ownerRef']);
|
|
192
|
+
const request = v['request'];
|
|
193
|
+
const ctx = v['ctx'];
|
|
194
|
+
if (!callId)
|
|
195
|
+
throw new Error('Invalid reminder_apply message: callId required');
|
|
196
|
+
if (!appId)
|
|
197
|
+
throw new Error('Invalid reminder_apply message: appId required');
|
|
198
|
+
if (!ownerRef)
|
|
199
|
+
throw new Error('Invalid reminder_apply message: ownerRef required');
|
|
200
|
+
if (!isRecord(ctx))
|
|
201
|
+
throw new Error('Invalid reminder_apply message: ctx must be object');
|
|
202
|
+
const dialogId = asString(ctx['dialogId']);
|
|
203
|
+
const ownedRemindersRaw = ctx['ownedReminders'];
|
|
204
|
+
if (!dialogId)
|
|
205
|
+
throw new Error('Invalid reminder_apply message: ctx.dialogId required');
|
|
206
|
+
if (!Array.isArray(ownedRemindersRaw)) {
|
|
207
|
+
throw new Error('Invalid reminder_apply message: ctx.ownedReminders must be array');
|
|
208
|
+
}
|
|
209
|
+
return {
|
|
210
|
+
type: 'reminder_apply',
|
|
211
|
+
callId,
|
|
212
|
+
appId,
|
|
213
|
+
ownerRef,
|
|
214
|
+
request: parseReminderApplyRequest(request, 'reminder_apply.request'),
|
|
215
|
+
ctx: {
|
|
216
|
+
dialogId,
|
|
217
|
+
ownedReminders: ownedRemindersRaw.map((item, index) => parseReminderState(item, `reminder_apply.ctx.ownedReminders[${index}]`)),
|
|
218
|
+
},
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
if (type === 'reminder_update') {
|
|
222
|
+
const callId = asString(v['callId']);
|
|
223
|
+
const appId = asString(v['appId']);
|
|
224
|
+
const ownerRef = asString(v['ownerRef']);
|
|
225
|
+
const ctx = v['ctx'];
|
|
226
|
+
if (!callId)
|
|
227
|
+
throw new Error('Invalid reminder_update message: callId required');
|
|
228
|
+
if (!appId)
|
|
229
|
+
throw new Error('Invalid reminder_update message: appId required');
|
|
230
|
+
if (!ownerRef)
|
|
231
|
+
throw new Error('Invalid reminder_update message: ownerRef required');
|
|
232
|
+
if (!isRecord(ctx))
|
|
233
|
+
throw new Error('Invalid reminder_update message: ctx must be object');
|
|
234
|
+
const dialogId = asString(ctx['dialogId']);
|
|
235
|
+
if (!dialogId)
|
|
236
|
+
throw new Error('Invalid reminder_update message: ctx.dialogId required');
|
|
237
|
+
return {
|
|
238
|
+
type: 'reminder_update',
|
|
239
|
+
callId,
|
|
240
|
+
appId,
|
|
241
|
+
ownerRef,
|
|
242
|
+
ctx: {
|
|
243
|
+
dialogId,
|
|
244
|
+
reminder: parseReminderState(ctx['reminder'], 'reminder_update.ctx.reminder'),
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
if (type === 'reminder_render') {
|
|
249
|
+
const callId = asString(v['callId']);
|
|
250
|
+
const appId = asString(v['appId']);
|
|
251
|
+
const ownerRef = asString(v['ownerRef']);
|
|
252
|
+
const ctx = v['ctx'];
|
|
253
|
+
if (!callId)
|
|
254
|
+
throw new Error('Invalid reminder_render message: callId required');
|
|
255
|
+
if (!appId)
|
|
256
|
+
throw new Error('Invalid reminder_render message: appId required');
|
|
257
|
+
if (!ownerRef)
|
|
258
|
+
throw new Error('Invalid reminder_render message: ownerRef required');
|
|
259
|
+
if (!isRecord(ctx))
|
|
260
|
+
throw new Error('Invalid reminder_render message: ctx must be object');
|
|
261
|
+
const dialogId = asString(ctx['dialogId']);
|
|
262
|
+
const reminderNoRaw = ctx['reminderNo'];
|
|
263
|
+
const reminderNo = typeof reminderNoRaw === 'number' && Number.isFinite(reminderNoRaw)
|
|
264
|
+
? Math.floor(reminderNoRaw)
|
|
265
|
+
: null;
|
|
266
|
+
const workLanguage = asLanguageCode(ctx['workLanguage']);
|
|
267
|
+
if (!dialogId)
|
|
268
|
+
throw new Error('Invalid reminder_render message: ctx.dialogId required');
|
|
269
|
+
if (reminderNo === null || reminderNo <= 0) {
|
|
270
|
+
throw new Error('Invalid reminder_render message: ctx.reminderNo must be positive integer');
|
|
271
|
+
}
|
|
272
|
+
if (!workLanguage)
|
|
273
|
+
throw new Error('Invalid reminder_render message: ctx.workLanguage invalid');
|
|
274
|
+
return {
|
|
275
|
+
type: 'reminder_render',
|
|
276
|
+
callId,
|
|
277
|
+
appId,
|
|
278
|
+
ownerRef,
|
|
279
|
+
ctx: {
|
|
280
|
+
dialogId,
|
|
281
|
+
reminder: parseReminderState(ctx['reminder'], 'reminder_render.ctx.reminder'),
|
|
282
|
+
reminderNo,
|
|
283
|
+
workLanguage,
|
|
284
|
+
},
|
|
97
285
|
};
|
|
98
286
|
}
|
|
99
287
|
if (type === 'run_control_apply') {
|
|
@@ -116,9 +304,8 @@ function parseAppsHostMessageFromKernel(v) {
|
|
|
116
304
|
const genIterNo = typeof genIterNoRaw === 'number' && Number.isFinite(genIterNoRaw)
|
|
117
305
|
? Math.max(0, Math.floor(genIterNoRaw))
|
|
118
306
|
: null;
|
|
119
|
-
if (genIterNo === null)
|
|
307
|
+
if (genIterNo === null)
|
|
120
308
|
throw new Error('Invalid run_control_apply payload: genIterNo required');
|
|
121
|
-
}
|
|
122
309
|
if (source !== 'drive_dlg_by_user_msg' && source !== 'drive_dialog_by_user_answer') {
|
|
123
310
|
throw new Error('Invalid run_control_apply payload: source invalid');
|
|
124
311
|
}
|
|
@@ -132,9 +319,8 @@ function parseAppsHostMessageFromKernel(v) {
|
|
|
132
319
|
const promptParsed = (() => {
|
|
133
320
|
if (prompt === undefined)
|
|
134
321
|
return undefined;
|
|
135
|
-
if (!isRecord(prompt))
|
|
322
|
+
if (!isRecord(prompt))
|
|
136
323
|
throw new Error('Invalid run_control_apply payload: prompt must be object');
|
|
137
|
-
}
|
|
138
324
|
const content = asString(prompt['content']);
|
|
139
325
|
const msgId = asString(prompt['msgId']);
|
|
140
326
|
const grammar = asString(prompt['grammar']);
|
|
@@ -153,13 +339,7 @@ function parseAppsHostMessageFromKernel(v) {
|
|
|
153
339
|
if (!userLanguageCode) {
|
|
154
340
|
throw new Error('Invalid run_control_apply payload: prompt.userLanguageCode must be zh|en');
|
|
155
341
|
}
|
|
156
|
-
return {
|
|
157
|
-
content,
|
|
158
|
-
msgId,
|
|
159
|
-
grammar: 'markdown',
|
|
160
|
-
userLanguageCode,
|
|
161
|
-
origin,
|
|
162
|
-
};
|
|
342
|
+
return { content, msgId, grammar: 'markdown', userLanguageCode, origin };
|
|
163
343
|
})();
|
|
164
344
|
const q4hRaw = payload['q4h'];
|
|
165
345
|
const q4h = (() => {
|
|
@@ -169,16 +349,24 @@ function parseAppsHostMessageFromKernel(v) {
|
|
|
169
349
|
throw new Error('Invalid run_control_apply payload: q4h must be object');
|
|
170
350
|
const questionId = asString(q4hRaw['questionId']);
|
|
171
351
|
const continuationTypeRaw = asString(q4hRaw['continuationType']);
|
|
172
|
-
if (!questionId)
|
|
352
|
+
if (!questionId)
|
|
173
353
|
throw new Error('Invalid run_control_apply payload: q4h.questionId required');
|
|
354
|
+
let continuationType;
|
|
355
|
+
if (continuationTypeRaw === 'answer') {
|
|
356
|
+
continuationType = 'answer';
|
|
357
|
+
}
|
|
358
|
+
else if (continuationTypeRaw === 'followup') {
|
|
359
|
+
continuationType = 'followup';
|
|
360
|
+
}
|
|
361
|
+
else if (continuationTypeRaw === 'retry') {
|
|
362
|
+
continuationType = 'retry';
|
|
363
|
+
}
|
|
364
|
+
else if (continuationTypeRaw === 'new_message') {
|
|
365
|
+
continuationType = 'new_message';
|
|
174
366
|
}
|
|
175
|
-
|
|
176
|
-
continuationTypeRaw !== 'followup' &&
|
|
177
|
-
continuationTypeRaw !== 'retry' &&
|
|
178
|
-
continuationTypeRaw !== 'new_message') {
|
|
367
|
+
else {
|
|
179
368
|
throw new Error('Invalid run_control_apply payload: q4h.continuationType invalid');
|
|
180
369
|
}
|
|
181
|
-
const continuationType = continuationTypeRaw;
|
|
182
370
|
return { questionId, continuationType };
|
|
183
371
|
})();
|
|
184
372
|
return {
|
|
@@ -186,10 +374,7 @@ function parseAppsHostMessageFromKernel(v) {
|
|
|
186
374
|
callId,
|
|
187
375
|
controlId,
|
|
188
376
|
payload: {
|
|
189
|
-
dialog: {
|
|
190
|
-
selfId: dialogSelfId,
|
|
191
|
-
rootId: dialogRootId,
|
|
192
|
-
},
|
|
377
|
+
dialog: { selfId: dialogSelfId, rootId: dialogRootId },
|
|
193
378
|
genIterNo,
|
|
194
379
|
prompt: promptParsed,
|
|
195
380
|
source,
|
package/dist/cli/install.js
CHANGED
|
@@ -16,6 +16,7 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
16
16
|
const app_lock_file_1 = require("../apps/app-lock-file");
|
|
17
17
|
const configuration_file_1 = require("../apps/configuration-file");
|
|
18
18
|
const manifest_1 = require("../apps/manifest");
|
|
19
|
+
const resolution_file_1 = require("../apps/resolution-file");
|
|
19
20
|
const run_app_json_1 = require("../apps/run-app-json");
|
|
20
21
|
const workspace_app_state_1 = require("../apps/workspace-app-state");
|
|
21
22
|
function printHelp() {
|
|
@@ -24,7 +25,7 @@ function printHelp() {
|
|
|
24
25
|
|
|
25
26
|
Options:
|
|
26
27
|
--local Treat <spec|path> as a local package directory (dev package)
|
|
27
|
-
--id <appId> Require app id (must match app --
|
|
28
|
+
--id <appId> Require app id (must match app --dominds-app appId)
|
|
28
29
|
--enable Remove the app from disabledApps after install
|
|
29
30
|
--force Reserved for future use; currently ignored
|
|
30
31
|
|
|
@@ -155,6 +156,25 @@ async function main() {
|
|
|
155
156
|
},
|
|
156
157
|
});
|
|
157
158
|
await (0, app_lock_file_1.writeAppLockFileIfChanged)({ rtwsRootAbs, file: nextLock });
|
|
159
|
+
if (shouldUseLocal) {
|
|
160
|
+
const loadedResolution = await (0, resolution_file_1.loadAppsResolutionFile)({ rtwsRootAbs });
|
|
161
|
+
if (loadedResolution.kind === 'error') {
|
|
162
|
+
console.error(`Error: failed to read .apps/resolution.yaml: ${loadedResolution.errorText}`);
|
|
163
|
+
process.exit(1);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const nextResolution = (0, resolution_file_1.upsertResolvedApp)({
|
|
167
|
+
existing: loadedResolution.file,
|
|
168
|
+
next: {
|
|
169
|
+
id: installJson.appId,
|
|
170
|
+
enabled: true,
|
|
171
|
+
source: { kind: 'local', pathAbs: localAbs },
|
|
172
|
+
assignedPort: null,
|
|
173
|
+
installJson,
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
await (0, resolution_file_1.writeAppsResolutionFileIfChanged)({ rtwsRootAbs, file: nextResolution });
|
|
177
|
+
}
|
|
158
178
|
await (0, workspace_app_state_1.refreshAppsDerivedState)({ rtwsRootAbs });
|
|
159
179
|
void args.force;
|
|
160
180
|
console.log(shouldUseLocal
|