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
package/dist/priming.js
CHANGED
|
@@ -19,7 +19,9 @@ const promises_1 = __importDefault(require("fs/promises"));
|
|
|
19
19
|
const path_1 = __importDefault(require("path"));
|
|
20
20
|
const yaml_1 = __importDefault(require("yaml"));
|
|
21
21
|
const persistence_1 = require("./persistence");
|
|
22
|
+
const storage_1 = require("./shared/types/storage");
|
|
22
23
|
const time_1 = require("./shared/utils/time");
|
|
24
|
+
const registry_1 = require("./tools/registry");
|
|
23
25
|
const PRIMING_ROOT_DIR = path_1.default.resolve(process.cwd(), '.minds', 'priming');
|
|
24
26
|
const PRIMING_INDIVIDUAL_DIR = path_1.default.resolve(PRIMING_ROOT_DIR, 'individual');
|
|
25
27
|
const PRIMING_TEAM_SHARED_DIR = path_1.default.resolve(PRIMING_ROOT_DIR, 'team_shared');
|
|
@@ -28,6 +30,21 @@ const RECENT_PRIMING_MAX = 20;
|
|
|
28
30
|
function isRecord(value) {
|
|
29
31
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
30
32
|
}
|
|
33
|
+
function isJsonValue(value) {
|
|
34
|
+
if (value === null ||
|
|
35
|
+
typeof value === 'string' ||
|
|
36
|
+
typeof value === 'number' ||
|
|
37
|
+
typeof value === 'boolean') {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
if (Array.isArray(value)) {
|
|
41
|
+
return value.every((item) => isJsonValue(item));
|
|
42
|
+
}
|
|
43
|
+
if (!isRecord(value)) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
return Object.values(value).every((item) => isJsonValue(item));
|
|
47
|
+
}
|
|
31
48
|
function ensureInside(basePath, candidatePath) {
|
|
32
49
|
const normalizedBase = basePath.endsWith(path_1.default.sep) ? basePath : `${basePath}${path_1.default.sep}`;
|
|
33
50
|
const resolved = path_1.default.resolve(candidatePath);
|
|
@@ -136,6 +153,96 @@ function parseApplicableMemberIds(frontmatter) {
|
|
|
136
153
|
}
|
|
137
154
|
return deduped.length > 0 ? deduped : undefined;
|
|
138
155
|
}
|
|
156
|
+
function parseReminderPriority(value, context) {
|
|
157
|
+
if (value === undefined)
|
|
158
|
+
return undefined;
|
|
159
|
+
if (value === 'high' || value === 'medium' || value === 'low')
|
|
160
|
+
return value;
|
|
161
|
+
throw new Error(`${context}.priority must be high | medium | low when provided`);
|
|
162
|
+
}
|
|
163
|
+
function parseReminderSnapshots(frontmatter) {
|
|
164
|
+
const raw = frontmatter['reminders'];
|
|
165
|
+
if (raw === undefined)
|
|
166
|
+
return undefined;
|
|
167
|
+
if (!Array.isArray(raw)) {
|
|
168
|
+
throw new Error('top-level frontmatter.reminders must be an array when provided');
|
|
169
|
+
}
|
|
170
|
+
const reminders = [];
|
|
171
|
+
for (let index = 0; index < raw.length; index += 1) {
|
|
172
|
+
const item = raw[index];
|
|
173
|
+
const context = `frontmatter.reminders[${String(index)}]`;
|
|
174
|
+
if (!isRecord(item)) {
|
|
175
|
+
throw new Error(`${context} must be an object`);
|
|
176
|
+
}
|
|
177
|
+
const content = typeof item['content'] === 'string'
|
|
178
|
+
? item['content']
|
|
179
|
+
: (() => {
|
|
180
|
+
throw new Error(`${context}.content must be a string`);
|
|
181
|
+
})();
|
|
182
|
+
if (content.trim() === '') {
|
|
183
|
+
throw new Error(`${context}.content must be a non-empty string`);
|
|
184
|
+
}
|
|
185
|
+
const ownerName = item['ownerName'];
|
|
186
|
+
if (ownerName !== undefined && (typeof ownerName !== 'string' || ownerName.trim() === '')) {
|
|
187
|
+
throw new Error(`${context}.ownerName must be a non-empty string when provided`);
|
|
188
|
+
}
|
|
189
|
+
const meta = item['meta'];
|
|
190
|
+
if (meta !== undefined && !isJsonValue(meta)) {
|
|
191
|
+
throw new Error(`${context}.meta must be valid JSON-compatible data when provided`);
|
|
192
|
+
}
|
|
193
|
+
const echoback = item['echoback'];
|
|
194
|
+
if (echoback !== undefined && typeof echoback !== 'boolean') {
|
|
195
|
+
throw new Error(`${context}.echoback must be a boolean when provided`);
|
|
196
|
+
}
|
|
197
|
+
const createdAt = item['createdAt'];
|
|
198
|
+
if (createdAt !== undefined && typeof createdAt !== 'string') {
|
|
199
|
+
throw new Error(`${context}.createdAt must be a string when provided`);
|
|
200
|
+
}
|
|
201
|
+
const priority = parseReminderPriority(item['priority'], context);
|
|
202
|
+
reminders.push({
|
|
203
|
+
content,
|
|
204
|
+
ownerName: typeof ownerName === 'string' ? ownerName.trim() : undefined,
|
|
205
|
+
meta,
|
|
206
|
+
echoback,
|
|
207
|
+
createdAt: typeof createdAt === 'string' ? createdAt : undefined,
|
|
208
|
+
priority,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
return reminders;
|
|
212
|
+
}
|
|
213
|
+
function reminderToSnapshot(reminder) {
|
|
214
|
+
const persistedReminder = reminder;
|
|
215
|
+
return {
|
|
216
|
+
content: reminder.content,
|
|
217
|
+
ownerName: reminder.owner?.name,
|
|
218
|
+
meta: reminder.meta,
|
|
219
|
+
echoback: reminder.echoback,
|
|
220
|
+
createdAt: persistedReminder.createdAt,
|
|
221
|
+
priority: persistedReminder.priority,
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
function materializeReminderSnapshot(snapshot, context) {
|
|
225
|
+
const owner = snapshot.ownerName === undefined
|
|
226
|
+
? undefined
|
|
227
|
+
: (() => {
|
|
228
|
+
const resolved = (0, registry_1.getReminderOwner)(snapshot.ownerName);
|
|
229
|
+
if (!resolved) {
|
|
230
|
+
throw new Error(`${context}.ownerName '${snapshot.ownerName}' is not registered`);
|
|
231
|
+
}
|
|
232
|
+
return resolved;
|
|
233
|
+
})();
|
|
234
|
+
const reminder = {
|
|
235
|
+
content: snapshot.content,
|
|
236
|
+
owner,
|
|
237
|
+
meta: snapshot.meta,
|
|
238
|
+
echoback: snapshot.echoback,
|
|
239
|
+
};
|
|
240
|
+
if (snapshot.createdAt !== undefined)
|
|
241
|
+
reminder.createdAt = snapshot.createdAt;
|
|
242
|
+
if (snapshot.priority !== undefined)
|
|
243
|
+
reminder.priority = snapshot.priority;
|
|
244
|
+
return reminder;
|
|
245
|
+
}
|
|
139
246
|
function isPrimingRecordType(raw) {
|
|
140
247
|
return (raw === 'agent_thought_record' ||
|
|
141
248
|
raw === 'agent_words_record' ||
|
|
@@ -618,8 +725,9 @@ function normalizePrimingRecordFromJson(raw) {
|
|
|
618
725
|
result: expectStringField(raw, 'result', context, true),
|
|
619
726
|
callId: expectStringField(raw, 'callId', context),
|
|
620
727
|
};
|
|
621
|
-
if (callingGenseq !== undefined)
|
|
622
|
-
record.calling_genseq = callingGenseq;
|
|
728
|
+
if (callingGenseq !== undefined) {
|
|
729
|
+
record.calling_genseq = (0, storage_1.toCallingGenerationSeqNumber)(callingGenseq);
|
|
730
|
+
}
|
|
623
731
|
if (mentionList)
|
|
624
732
|
record.mentionList = mentionList;
|
|
625
733
|
if (sourceTag)
|
|
@@ -646,14 +754,17 @@ function normalizePrimingRecordFromJson(raw) {
|
|
|
646
754
|
callId: expectStringField(raw, 'callId', context),
|
|
647
755
|
genseq: expectIntegerField(raw, 'genseq', context),
|
|
648
756
|
};
|
|
649
|
-
if (assignmentCourse !== undefined)
|
|
650
|
-
record.assignmentCourse = assignmentCourse;
|
|
651
|
-
|
|
652
|
-
|
|
757
|
+
if (assignmentCourse !== undefined) {
|
|
758
|
+
record.assignmentCourse = (0, storage_1.toAssignmentCourseNumber)(assignmentCourse);
|
|
759
|
+
}
|
|
760
|
+
if (assignmentGenseq !== undefined) {
|
|
761
|
+
record.assignmentGenseq = (0, storage_1.toAssignmentGenerationSeqNumber)(assignmentGenseq);
|
|
762
|
+
}
|
|
653
763
|
if (callerDialogId !== undefined)
|
|
654
764
|
record.callerDialogId = callerDialogId;
|
|
655
|
-
if (callerCourse !== undefined)
|
|
656
|
-
record.callerCourse = callerCourse;
|
|
765
|
+
if (callerCourse !== undefined) {
|
|
766
|
+
record.callerCourse = (0, storage_1.toCallerCourseNumber)(callerCourse);
|
|
767
|
+
}
|
|
657
768
|
if (sourceTag)
|
|
658
769
|
record.sourceTag = sourceTag;
|
|
659
770
|
const { ts: _unusedTs, ...withoutTs } = record;
|
|
@@ -735,14 +846,17 @@ function normalizePrimingRecordFromJson(raw) {
|
|
|
735
846
|
}
|
|
736
847
|
}
|
|
737
848
|
})();
|
|
738
|
-
if (callingGenseq !== undefined)
|
|
739
|
-
record.calling_genseq = callingGenseq;
|
|
849
|
+
if (callingGenseq !== undefined) {
|
|
850
|
+
record.calling_genseq = (0, storage_1.toCallingGenerationSeqNumber)(callingGenseq);
|
|
851
|
+
}
|
|
740
852
|
if (calleeDialogId !== undefined)
|
|
741
853
|
record.calleeDialogId = calleeDialogId;
|
|
742
|
-
if (calleeCourse !== undefined)
|
|
743
|
-
record.calleeCourse = calleeCourse;
|
|
744
|
-
|
|
745
|
-
|
|
854
|
+
if (calleeCourse !== undefined) {
|
|
855
|
+
record.calleeCourse = (0, storage_1.toCalleeCourseNumber)(calleeCourse);
|
|
856
|
+
}
|
|
857
|
+
if (calleeGenseq !== undefined) {
|
|
858
|
+
record.calleeGenseq = (0, storage_1.toCalleeGenerationSeqNumber)(calleeGenseq);
|
|
859
|
+
}
|
|
746
860
|
if (sourceTag)
|
|
747
861
|
record.sourceTag = sourceTag;
|
|
748
862
|
const { ts: _unusedTs, ...withoutTs } = record;
|
|
@@ -867,8 +981,9 @@ function parsePrimingScript(raw) {
|
|
|
867
981
|
const titleRaw = frontmatter['title'];
|
|
868
982
|
const title = typeof titleRaw === 'string' && titleRaw.trim() !== '' ? titleRaw.trim() : undefined;
|
|
869
983
|
const applicableMemberIds = parseApplicableMemberIds(frontmatter);
|
|
984
|
+
const reminders = parseReminderSnapshots(frontmatter);
|
|
870
985
|
const records = parseRecordsFromBody(body);
|
|
871
|
-
return { title, applicableMemberIds, records };
|
|
986
|
+
return { title, applicableMemberIds, reminders, records };
|
|
872
987
|
}
|
|
873
988
|
async function listMarkdownFilesRecursively(dirPath) {
|
|
874
989
|
const files = [];
|
|
@@ -1198,6 +1313,7 @@ async function loadPrimingScriptByRef(scriptRefRaw, agentIdRaw) {
|
|
|
1198
1313
|
}
|
|
1199
1314
|
return {
|
|
1200
1315
|
summary: loaded.summary,
|
|
1316
|
+
reminders: (loaded.parsed.reminders ?? []).map((item, index) => materializeReminderSnapshot(item, `priming script '${scriptRef}' frontmatter.reminders[${String(index)}]`)),
|
|
1201
1317
|
records: loaded.parsed.records,
|
|
1202
1318
|
};
|
|
1203
1319
|
}
|
|
@@ -1223,12 +1339,16 @@ function remapRecordGenseq(record, mapGenseq) {
|
|
|
1223
1339
|
case 'teammate_call_result_record':
|
|
1224
1340
|
return {
|
|
1225
1341
|
...record,
|
|
1226
|
-
calling_genseq:
|
|
1342
|
+
calling_genseq: record.calling_genseq !== undefined
|
|
1343
|
+
? (0, storage_1.toCallingGenerationSeqNumber)(remapOptionalGenseq(record.calling_genseq))
|
|
1344
|
+
: undefined,
|
|
1227
1345
|
};
|
|
1228
1346
|
case 'teammate_response_record':
|
|
1229
1347
|
return {
|
|
1230
1348
|
...record,
|
|
1231
|
-
calling_genseq:
|
|
1349
|
+
calling_genseq: record.calling_genseq !== undefined
|
|
1350
|
+
? (0, storage_1.toCallingGenerationSeqNumber)(remapOptionalGenseq(record.calling_genseq))
|
|
1351
|
+
: undefined,
|
|
1232
1352
|
};
|
|
1233
1353
|
default: {
|
|
1234
1354
|
const _exhaustive = record;
|
|
@@ -1422,16 +1542,26 @@ async function applyPrimingScriptsToDialog(args) {
|
|
|
1422
1542
|
return { appliedScriptRefs: [], appendedMessageCount: 0 };
|
|
1423
1543
|
}
|
|
1424
1544
|
const allRecords = [];
|
|
1545
|
+
const allReminders = [];
|
|
1425
1546
|
let nextGenseq = getNextDialogGenseq(args.dialog);
|
|
1426
1547
|
for (const scriptRef of normalizedRefs) {
|
|
1427
1548
|
const loaded = await loadPrimingScriptByRef(scriptRef, agentId);
|
|
1428
1549
|
const remapped = remapScriptRecordsForReplay(loaded.records, nextGenseq);
|
|
1429
1550
|
nextGenseq = remapped.nextGenseq;
|
|
1551
|
+
allReminders.push(...loaded.reminders);
|
|
1430
1552
|
allRecords.push(...remapped.records);
|
|
1431
1553
|
}
|
|
1432
1554
|
if (allRecords.length === 0) {
|
|
1433
1555
|
return { appliedScriptRefs: normalizedRefs, appendedMessageCount: 0 };
|
|
1434
1556
|
}
|
|
1557
|
+
if (allReminders.length > 0) {
|
|
1558
|
+
args.dialog.reminders.splice(0, args.dialog.reminders.length, ...allReminders);
|
|
1559
|
+
await persistence_1.DialogPersistence._saveReminderState(args.dialog.id, [...args.dialog.reminders], args.status);
|
|
1560
|
+
await persistence_1.DialogPersistence.appendRemindersReconciledRecord(args.dialog.id, args.dialog.reminders, {
|
|
1561
|
+
kind: 'root_anchor',
|
|
1562
|
+
rootAnchor: (0, storage_1.toRootGenerationAnchor)({ rootCourse: 1, rootGenseq: 0 }),
|
|
1563
|
+
}, args.status);
|
|
1564
|
+
}
|
|
1435
1565
|
for (const record of allRecords) {
|
|
1436
1566
|
const withSourceTag = addPrimingSourceTag(record);
|
|
1437
1567
|
const persisted = withTimestamp(withSourceTag, (0, time_1.formatUnifiedTimestamp)(new Date()));
|
|
@@ -1656,6 +1786,13 @@ function stripTimestampFromRecord(event) {
|
|
|
1656
1786
|
const { ts: _unusedTs, ...withoutTs } = event;
|
|
1657
1787
|
return withoutTs;
|
|
1658
1788
|
}
|
|
1789
|
+
case 'subdialog_created_record':
|
|
1790
|
+
case 'reminders_reconciled_record':
|
|
1791
|
+
case 'questions4human_reconciled_record':
|
|
1792
|
+
case 'pending_subdialogs_reconciled_record':
|
|
1793
|
+
case 'subdialog_registry_reconciled_record':
|
|
1794
|
+
case 'subdialog_responses_reconciled_record':
|
|
1795
|
+
throw new Error(`Record type ${event.type} is not supported in priming scripts`);
|
|
1659
1796
|
default: {
|
|
1660
1797
|
const _exhaustive = event;
|
|
1661
1798
|
throw new Error(`Unhandled persisted record type: ${String(_exhaustive)}`);
|
|
@@ -1663,7 +1800,19 @@ function stripTimestampFromRecord(event) {
|
|
|
1663
1800
|
}
|
|
1664
1801
|
}
|
|
1665
1802
|
function extractPrimingRecordsFromEvents(events) {
|
|
1666
|
-
return events.
|
|
1803
|
+
return events.flatMap((event) => {
|
|
1804
|
+
switch (event.type) {
|
|
1805
|
+
case 'subdialog_created_record':
|
|
1806
|
+
case 'reminders_reconciled_record':
|
|
1807
|
+
case 'questions4human_reconciled_record':
|
|
1808
|
+
case 'pending_subdialogs_reconciled_record':
|
|
1809
|
+
case 'subdialog_registry_reconciled_record':
|
|
1810
|
+
case 'subdialog_responses_reconciled_record':
|
|
1811
|
+
return [];
|
|
1812
|
+
default:
|
|
1813
|
+
return [stripTimestampFromRecord(event)];
|
|
1814
|
+
}
|
|
1815
|
+
});
|
|
1667
1816
|
}
|
|
1668
1817
|
async function saveDialogCourseAsIndividualPrimingScript(args) {
|
|
1669
1818
|
const normalizedSlug = normalizeSlug(args.slug);
|
|
@@ -1693,6 +1842,7 @@ async function saveDialogCourseAsIndividualPrimingScript(args) {
|
|
|
1693
1842
|
throw new Error(`Priming script directory escapes individual scope: ${parentDir}`);
|
|
1694
1843
|
}
|
|
1695
1844
|
const now = (0, time_1.formatUnifiedTimestamp)(new Date());
|
|
1845
|
+
const reminders = await persistence_1.DialogPersistence.loadReminderState(args.dialogId, args.status);
|
|
1696
1846
|
const frontmatter = {
|
|
1697
1847
|
kind: 'agent_priming_script',
|
|
1698
1848
|
version: 3,
|
|
@@ -1706,6 +1856,9 @@ async function saveDialogCourseAsIndividualPrimingScript(args) {
|
|
|
1706
1856
|
status: args.status,
|
|
1707
1857
|
},
|
|
1708
1858
|
};
|
|
1859
|
+
if (reminders.length > 0) {
|
|
1860
|
+
frontmatter['reminders'] = reminders.map((item) => reminderToSnapshot(item));
|
|
1861
|
+
}
|
|
1709
1862
|
const markdown = formatScriptMarkdown({ frontmatter, records });
|
|
1710
1863
|
await promises_1.default.mkdir(parentDir, { recursive: true });
|
|
1711
1864
|
const writeMode = args.overwrite === true ? 'w' : 'wx';
|
|
@@ -45,7 +45,9 @@ exports.handleApiRoute = handleApiRoute;
|
|
|
45
45
|
*/
|
|
46
46
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
47
47
|
const path = __importStar(require("path"));
|
|
48
|
+
const runtime_1 = require("../apps/runtime");
|
|
48
49
|
const dialog_1 = require("../dialog");
|
|
50
|
+
const dialog_fork_1 = require("../dialog-fork");
|
|
49
51
|
const dialog_global_registry_1 = require("../dialog-global-registry");
|
|
50
52
|
const dialog_run_state_1 = require("../dialog-run-state");
|
|
51
53
|
const log_1 = require("../log");
|
|
@@ -1044,9 +1046,21 @@ async function handleApiRoute(req, res, pathname, context) {
|
|
|
1044
1046
|
if (pathname === '/api/dialogs/move' && req.method === 'POST') {
|
|
1045
1047
|
return await handleMoveDialogs(req, res, context);
|
|
1046
1048
|
}
|
|
1049
|
+
if (pathname.startsWith('/api/dialogs/') &&
|
|
1050
|
+
pathname.endsWith('/fork') &&
|
|
1051
|
+
req.method === 'POST') {
|
|
1052
|
+
const parts = pathname.split('/');
|
|
1053
|
+
const rawRoot = parts[3];
|
|
1054
|
+
if (!rawRoot) {
|
|
1055
|
+
respondJson(res, 400, { success: false, error: 'Missing root dialog id' });
|
|
1056
|
+
return true;
|
|
1057
|
+
}
|
|
1058
|
+
return await handleForkDialog(req, res, context, rawRoot.replace(/%2F/g, '/'));
|
|
1059
|
+
}
|
|
1047
1060
|
// Delete a dialog (root dialogs only for now)
|
|
1048
1061
|
if (pathname.startsWith('/api/dialogs/') &&
|
|
1049
1062
|
!pathname.endsWith('/hierarchy') &&
|
|
1063
|
+
!pathname.endsWith('/fork') &&
|
|
1050
1064
|
req.method === 'DELETE') {
|
|
1051
1065
|
const parts = pathname.split('/');
|
|
1052
1066
|
const rawRoot = parts[3];
|
|
@@ -1606,6 +1620,7 @@ async function handleReadWorkspaceEntry(req, res) {
|
|
|
1606
1620
|
}
|
|
1607
1621
|
async function handleGetToolsRegistry(res) {
|
|
1608
1622
|
try {
|
|
1623
|
+
await (0, runtime_1.registerEnabledAppsToolProxies)({ rtwsRootAbs: process.cwd() });
|
|
1609
1624
|
const snapshot = (0, registry_snapshot_1.createToolsRegistrySnapshot)();
|
|
1610
1625
|
res.writeHead(200, {
|
|
1611
1626
|
'Content-Type': 'application/json',
|
|
@@ -1975,6 +1990,73 @@ async function handleCreateDialog(req, res, context) {
|
|
|
1975
1990
|
return true;
|
|
1976
1991
|
}
|
|
1977
1992
|
}
|
|
1993
|
+
async function handleForkDialog(req, res, context, rootIdRaw) {
|
|
1994
|
+
try {
|
|
1995
|
+
const body = await readRequestBody(req);
|
|
1996
|
+
const parsed = JSON.parse(body);
|
|
1997
|
+
if (!isRecord(parsed)) {
|
|
1998
|
+
const payload = { success: false, error: 'Invalid JSON body' };
|
|
1999
|
+
respondJson(res, 400, payload);
|
|
2000
|
+
return true;
|
|
2001
|
+
}
|
|
2002
|
+
const courseRaw = parsed['course'];
|
|
2003
|
+
const genseqRaw = parsed['genseq'];
|
|
2004
|
+
const statusRaw = parsed['status'];
|
|
2005
|
+
const rootId = rootIdRaw.trim();
|
|
2006
|
+
const course = typeof courseRaw === 'number' && Number.isFinite(courseRaw) ? Math.floor(courseRaw) : 0;
|
|
2007
|
+
const genseq = typeof genseqRaw === 'number' && Number.isFinite(genseqRaw) ? Math.floor(genseqRaw) : 0;
|
|
2008
|
+
const status = parseDialogStatusKind(statusRaw) ?? 'running';
|
|
2009
|
+
if (rootId === '') {
|
|
2010
|
+
const payload = { success: false, error: 'rootId is required' };
|
|
2011
|
+
respondJson(res, 400, payload);
|
|
2012
|
+
return true;
|
|
2013
|
+
}
|
|
2014
|
+
if (course <= 0 || genseq <= 0) {
|
|
2015
|
+
const payload = {
|
|
2016
|
+
success: false,
|
|
2017
|
+
error: 'course and genseq must be positive integers',
|
|
2018
|
+
};
|
|
2019
|
+
respondJson(res, 400, payload);
|
|
2020
|
+
return true;
|
|
2021
|
+
}
|
|
2022
|
+
const result = await (0, dialog_fork_1.forkRootDialogTreeAtGeneration)({
|
|
2023
|
+
sourceRootId: rootId,
|
|
2024
|
+
sourceStatus: status,
|
|
2025
|
+
course,
|
|
2026
|
+
genseq,
|
|
2027
|
+
});
|
|
2028
|
+
const payload = {
|
|
2029
|
+
success: true,
|
|
2030
|
+
dialog: {
|
|
2031
|
+
rootId: result.rootId,
|
|
2032
|
+
selfId: result.selfId,
|
|
2033
|
+
agentId: result.agentId,
|
|
2034
|
+
agentName: result.agentId,
|
|
2035
|
+
taskDocPath: result.taskDocPath,
|
|
2036
|
+
status: 'running',
|
|
2037
|
+
},
|
|
2038
|
+
action: result.action,
|
|
2039
|
+
};
|
|
2040
|
+
respondJson(res, 201, payload);
|
|
2041
|
+
broadcastDialogCreates(context.clients, {
|
|
2042
|
+
type: 'dialogs_created',
|
|
2043
|
+
scope: { kind: 'root', rootId: result.rootId },
|
|
2044
|
+
status: 'running',
|
|
2045
|
+
createdRootIds: [result.rootId],
|
|
2046
|
+
timestamp: (0, time_1.formatUnifiedTimestamp)(new Date()),
|
|
2047
|
+
});
|
|
2048
|
+
return true;
|
|
2049
|
+
}
|
|
2050
|
+
catch (error) {
|
|
2051
|
+
log.error('Error forking dialog:', error);
|
|
2052
|
+
const payload = {
|
|
2053
|
+
success: false,
|
|
2054
|
+
error: error instanceof Error ? error.message : 'Failed to fork dialog',
|
|
2055
|
+
};
|
|
2056
|
+
respondJson(res, 500, payload);
|
|
2057
|
+
return true;
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
1978
2060
|
async function handleMoveDialogs(req, res, context) {
|
|
1979
2061
|
try {
|
|
1980
2062
|
const body = await readRequestBody(req);
|
|
@@ -371,11 +371,26 @@ function extractProminentEnumModelParams(modelParamOptions) {
|
|
|
371
371
|
const defaultValue = typeof opt.default === 'string' && opt.values.includes(opt.default)
|
|
372
372
|
? opt.default
|
|
373
373
|
: undefined;
|
|
374
|
+
const rawValueLabels = opt.value_labels;
|
|
375
|
+
let valueLabels;
|
|
376
|
+
if (rawValueLabels && typeof rawValueLabels === 'object' && !Array.isArray(rawValueLabels)) {
|
|
377
|
+
const next = {};
|
|
378
|
+
for (const [rawKey, rawLabel] of Object.entries(rawValueLabels)) {
|
|
379
|
+
if (!opt.values.includes(rawKey))
|
|
380
|
+
continue;
|
|
381
|
+
if (typeof rawLabel !== 'string' || rawLabel.length === 0)
|
|
382
|
+
continue;
|
|
383
|
+
next[rawKey] = rawLabel;
|
|
384
|
+
}
|
|
385
|
+
if (Object.keys(next).length > 0)
|
|
386
|
+
valueLabels = next;
|
|
387
|
+
}
|
|
374
388
|
out.push({
|
|
375
389
|
namespace,
|
|
376
390
|
key,
|
|
377
391
|
description: opt.description,
|
|
378
392
|
values: opt.values,
|
|
393
|
+
...(valueLabels ? { valueLabels } : {}),
|
|
379
394
|
...(defaultValue ? { defaultValue } : {}),
|
|
380
395
|
});
|
|
381
396
|
}
|
|
@@ -6,5 +6,82 @@
|
|
|
6
6
|
* Uses modern TypeScript patterns for statically verifiable field access.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.toRootCourseNumber = toRootCourseNumber;
|
|
10
|
+
exports.toRootGenerationSeqNumber = toRootGenerationSeqNumber;
|
|
11
|
+
exports.toDialogCourseNumber = toDialogCourseNumber;
|
|
12
|
+
exports.toCallingCourseNumber = toCallingCourseNumber;
|
|
13
|
+
exports.toCallingGenerationSeqNumber = toCallingGenerationSeqNumber;
|
|
14
|
+
exports.toAssignmentCourseNumber = toAssignmentCourseNumber;
|
|
15
|
+
exports.toAssignmentGenerationSeqNumber = toAssignmentGenerationSeqNumber;
|
|
16
|
+
exports.toCallerCourseNumber = toCallerCourseNumber;
|
|
17
|
+
exports.toCalleeCourseNumber = toCalleeCourseNumber;
|
|
18
|
+
exports.toCalleeGenerationSeqNumber = toCalleeGenerationSeqNumber;
|
|
19
|
+
exports.toRootGenerationAnchor = toRootGenerationAnchor;
|
|
20
|
+
function toRootCourseNumber(value) {
|
|
21
|
+
if (!Number.isFinite(value) || value <= 0) {
|
|
22
|
+
throw new Error(`Invalid root course number: ${String(value)}`);
|
|
23
|
+
}
|
|
24
|
+
return Math.floor(value);
|
|
25
|
+
}
|
|
26
|
+
function toRootGenerationSeqNumber(value) {
|
|
27
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
28
|
+
throw new Error(`Invalid root generation sequence number: ${String(value)}`);
|
|
29
|
+
}
|
|
30
|
+
return Math.floor(value);
|
|
31
|
+
}
|
|
32
|
+
function toDialogCourseNumber(value) {
|
|
33
|
+
if (!Number.isFinite(value) || value <= 0) {
|
|
34
|
+
throw new Error(`Invalid dialog course number: ${String(value)}`);
|
|
35
|
+
}
|
|
36
|
+
return Math.floor(value);
|
|
37
|
+
}
|
|
38
|
+
function toCallingCourseNumber(value) {
|
|
39
|
+
if (!Number.isFinite(value) || value <= 0) {
|
|
40
|
+
throw new Error(`Invalid calling course number: ${String(value)}`);
|
|
41
|
+
}
|
|
42
|
+
return Math.floor(value);
|
|
43
|
+
}
|
|
44
|
+
function toCallingGenerationSeqNumber(value) {
|
|
45
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
46
|
+
throw new Error(`Invalid calling generation sequence number: ${String(value)}`);
|
|
47
|
+
}
|
|
48
|
+
return Math.floor(value);
|
|
49
|
+
}
|
|
50
|
+
function toAssignmentCourseNumber(value) {
|
|
51
|
+
if (!Number.isFinite(value) || value <= 0) {
|
|
52
|
+
throw new Error(`Invalid assignment course number: ${String(value)}`);
|
|
53
|
+
}
|
|
54
|
+
return Math.floor(value);
|
|
55
|
+
}
|
|
56
|
+
function toAssignmentGenerationSeqNumber(value) {
|
|
57
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
58
|
+
throw new Error(`Invalid assignment generation sequence number: ${String(value)}`);
|
|
59
|
+
}
|
|
60
|
+
return Math.floor(value);
|
|
61
|
+
}
|
|
62
|
+
function toCallerCourseNumber(value) {
|
|
63
|
+
if (!Number.isFinite(value) || value <= 0) {
|
|
64
|
+
throw new Error(`Invalid caller course number: ${String(value)}`);
|
|
65
|
+
}
|
|
66
|
+
return Math.floor(value);
|
|
67
|
+
}
|
|
68
|
+
function toCalleeCourseNumber(value) {
|
|
69
|
+
if (!Number.isFinite(value) || value <= 0) {
|
|
70
|
+
throw new Error(`Invalid callee course number: ${String(value)}`);
|
|
71
|
+
}
|
|
72
|
+
return Math.floor(value);
|
|
73
|
+
}
|
|
74
|
+
function toCalleeGenerationSeqNumber(value) {
|
|
75
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
76
|
+
throw new Error(`Invalid callee generation sequence number: ${String(value)}`);
|
|
77
|
+
}
|
|
78
|
+
return Math.floor(value);
|
|
79
|
+
}
|
|
80
|
+
function toRootGenerationAnchor(args) {
|
|
81
|
+
return {
|
|
82
|
+
rootCourse: toRootCourseNumber(args.rootCourse),
|
|
83
|
+
rootGenseq: toRootGenerationSeqNumber(args.rootGenseq),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
9
86
|
// always use switch statement for descriminated unions as modern typescript idiom,
|
|
10
87
|
// no type guards and other helper functions should be defined and used
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as isSymbol, c as baseFlatten, g as baseIteratee, k as keys, h as baseFindIndex, j as baseEach, l as arrayMap, m as hasPath, n as castPath, t as toKey, o as baseGet } from "./_baseUniq-
|
|
2
|
-
import { aR as isObject, aA as baseRest, aS as isIterateeCall, aT as keysIn, aU as eq, aV as isArrayLike, aW as isArray, aX as identity, aY as isIndex, aZ as assignValue } from "./index-
|
|
1
|
+
import { e as isSymbol, c as baseFlatten, g as baseIteratee, k as keys, h as baseFindIndex, j as baseEach, l as arrayMap, m as hasPath, n as castPath, t as toKey, o as baseGet } from "./_baseUniq-BANLb0cu.js";
|
|
2
|
+
import { aR as isObject, aA as baseRest, aS as isIterateeCall, aT as keysIn, aU as eq, aV as isArrayLike, aW as isArray, aX as identity, aY as isIndex, aZ as assignValue } from "./index-DrTqAfFy.js";
|
|
3
3
|
var reWhitespace = /\s/;
|
|
4
4
|
function trimmedEndIndex(string) {
|
|
5
5
|
var index = string.length;
|
|
@@ -193,4 +193,4 @@ export {
|
|
|
193
193
|
map as m,
|
|
194
194
|
toFinite as t
|
|
195
195
|
};
|
|
196
|
-
//# sourceMappingURL=_basePickBy-
|
|
196
|
+
//# sourceMappingURL=_basePickBy-B-A5XrWM.js.map
|