@dsmm/dsmm 0.2.0 → 0.2.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 +38 -66
- package/agent-presets/dsmm-builder/agent.cordis.yml +10 -2015
- package/agent-presets/dsmm-clarifier/agent.cordis.yml +24 -343
- package/agent-presets/dsmm-code-search/agent.cordis.yml +19 -6
- package/agent-presets/dsmm-coding/agent.cordis.yml +19 -438
- package/agent-presets/dsmm-complex/agent.cordis.yml +23 -1009
- package/agent-presets/dsmm-creative/agent.cordis.yml +25 -442
- package/agent-presets/dsmm-cross-cutting/agent.cordis.yml +29 -1013
- package/agent-presets/dsmm-deep/agent.cordis.yml +24 -1008
- package/agent-presets/dsmm-doc-search/agent.cordis.yml +19 -6
- package/agent-presets/dsmm-documenting/agent.cordis.yml +26 -439
- package/agent-presets/dsmm-frontend/agent.cordis.yml +21 -440
- package/agent-presets/dsmm-hard-reasoning/agent.cordis.yml +22 -441
- package/agent-presets/dsmm-media-reader/agent.cordis.yml +19 -6
- package/agent-presets/dsmm-normal-task/agent.cordis.yml +19 -438
- package/agent-presets/dsmm-oracle/agent.cordis.yml +25 -340
- package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +25 -340
- package/agent-presets/dsmm-orchestrator/agent.cordis.yml +29 -2025
- package/agent-presets/dsmm-plan-critic/agent.cordis.yml +24 -341
- package/agent-presets/dsmm-planner/agent.cordis.yml +14 -344
- package/agent-presets/dsmm-quick/agent.cordis.yml +19 -6
- package/agent-presets/dsmm-research/agent.cordis.yml +23 -8
- package/agent-presets/dsmm-reviewer/agent.cordis.yml +25 -340
- package/docs/agent-presets.md +36 -52
- package/docs/compatibility.md +50 -108
- package/docs/deferred-native-approval-risk.md +19 -0
- package/docs/design.md +2 -2
- package/docs/lsp.md +11 -21
- package/docs/migration-from-ocmm.md +2 -2
- package/docs/model-routing.md +84 -59
- package/docs/native-permissions.md +35 -0
- package/docs/profiles.md +40 -87
- package/docs/releasing.md +83 -2
- package/docs/roadmap.md +71 -17
- package/docs/settings-status.md +34 -169
- package/docs/skill-sync.md +52 -15
- package/lib/child-admission-contract.d.ts +37 -0
- package/lib/child-admission-contract.js +2 -0
- package/lib/child-admission.d.ts +42 -0
- package/lib/child-admission.js +162 -0
- package/lib/child-capture.d.ts +81 -0
- package/lib/child-capture.js +203 -0
- package/lib/child-evidence.d.ts +17 -0
- package/lib/child-evidence.js +43 -0
- package/lib/client/ChildrenPanel.d.ts +43 -0
- package/lib/client/ChildrenPanel.js +82 -0
- package/lib/client/DeploymentPage.js +15 -8
- package/lib/client/EditableChoice.d.ts +17 -0
- package/lib/client/EditableChoice.js +49 -0
- package/lib/client/PermissionsPanel.d.ts +14 -0
- package/lib/client/PermissionsPanel.js +46 -0
- package/lib/client/ProfilesSection.js +30 -15
- package/lib/client/RoleAvailability.d.ts +7 -0
- package/lib/client/RoleAvailability.js +19 -0
- package/lib/client/SessionProfiles.js +27 -9
- package/lib/client/StructuredEditor.js +15 -7
- package/lib/client/children-controller.d.ts +98 -0
- package/lib/client/children-controller.js +296 -0
- package/lib/client/children-locales.d.ts +367 -0
- package/lib/client/children-locales.js +69 -0
- package/lib/client/controller.d.ts +6 -1
- package/lib/client/controller.js +14 -8
- package/lib/client/deployment-data.d.ts +2 -1
- package/lib/client/deployment-data.js +34 -5
- package/lib/client/deployment-locales.d.ts +4 -0
- package/lib/client/deployment-locales.js +11 -2
- package/lib/client/diagnostics.d.ts +14 -0
- package/lib/client/diagnostics.js +53 -0
- package/lib/client/index.d.ts +4 -0
- package/lib/client/index.js +96 -2
- package/lib/client/locales.d.ts +54 -0
- package/lib/client/locales.js +34 -16
- package/lib/client/permission-client.d.ts +16 -0
- package/lib/client/permission-client.js +38 -0
- package/lib/client/permission-controller.d.ts +62 -0
- package/lib/client/permission-controller.js +149 -0
- package/lib/client/permission-locales.d.ts +114 -0
- package/lib/client/permission-locales.js +75 -0
- package/lib/client/session-labels.js +4 -4
- package/lib/client/structured.js +19 -5
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/styles.js +20 -0
- package/lib/client.js +5780 -1679
- package/lib/core-permission-authority.d.ts +18 -0
- package/lib/core-permission-authority.js +255 -0
- package/lib/core-permissions.d.ts +8 -0
- package/lib/core-permissions.js +33 -0
- package/lib/delivery-authority.d.ts +68 -0
- package/lib/delivery-authority.js +260 -0
- package/lib/deployment-config.d.ts +23 -0
- package/lib/deployment-config.js +61 -40
- package/lib/deployment-permission-rules.d.ts +55 -0
- package/lib/deployment-permission-rules.js +306 -0
- package/lib/dsh-types.d.ts +10 -4
- package/lib/guards.d.ts +1 -1
- package/lib/guards.js +29 -8
- package/lib/host-llm-startup.d.ts +41 -0
- package/lib/host-llm-startup.js +65 -0
- package/lib/host-llm.d.ts +92 -0
- package/lib/host-llm.js +325 -0
- package/lib/index.d.ts +15 -4
- package/lib/index.js +300 -47
- package/lib/legacy-child-policy.d.ts +51 -0
- package/lib/legacy-child-policy.js +123 -0
- package/lib/legacy-read-composition.d.ts +20 -0
- package/lib/legacy-read-composition.js +144 -0
- package/lib/legacy-read-contracts.d.ts +157 -0
- package/lib/legacy-read-contracts.js +39 -0
- package/lib/legacy-read-host.d.ts +19 -0
- package/lib/legacy-read-host.js +67 -0
- package/lib/legacy-read-integration.d.ts +121 -0
- package/lib/legacy-read-integration.js +522 -0
- package/lib/legacy-read-proxy.d.ts +26 -0
- package/lib/legacy-read-proxy.js +237 -0
- package/lib/live-pi-ai-owner.d.ts +18 -0
- package/lib/live-pi-ai-owner.js +144 -0
- package/lib/llm-runtime.d.ts +11 -0
- package/lib/llm-runtime.js +21 -0
- package/lib/managed-settings.d.ts +5 -0
- package/lib/managed-settings.js +14 -0
- package/lib/model-parameter-policy.d.ts +11 -0
- package/lib/model-parameter-policy.js +27 -0
- package/lib/model-routing.js +28 -17
- package/lib/modules.d.ts +13 -5
- package/lib/modules.js +17 -1
- package/lib/native-child-evidence.d.ts +42 -0
- package/lib/native-child-evidence.js +133 -0
- package/lib/native-pi-ai-wire.d.ts +37 -0
- package/lib/native-pi-ai-wire.js +261 -0
- package/lib/native-scope.js +1 -1
- package/lib/permission-bash.d.ts +6 -0
- package/lib/permission-bash.js +7 -0
- package/lib/permission-control.d.ts +73 -0
- package/lib/permission-control.js +205 -0
- package/lib/permission-controller.d.ts +68 -0
- package/lib/permission-controller.js +317 -0
- package/lib/permission-errors.d.ts +7 -0
- package/lib/permission-errors.js +21 -0
- package/lib/permission-fs-search.d.ts +5 -0
- package/lib/permission-fs-search.js +7 -0
- package/lib/permission-fs.d.ts +5 -0
- package/lib/permission-fs.js +7 -0
- package/lib/permission-native-access.d.ts +11 -0
- package/lib/permission-native-access.js +6 -0
- package/lib/permission-native-command.d.ts +10 -0
- package/lib/permission-native-command.js +93 -0
- package/lib/permission-native-rules.d.ts +75 -0
- package/lib/permission-native-rules.js +278 -0
- package/lib/permission-pwsh.d.ts +6 -0
- package/lib/permission-pwsh.js +7 -0
- package/lib/permission-remote.d.ts +26 -0
- package/lib/permission-remote.js +53 -0
- package/lib/permission-rpc.d.ts +29 -0
- package/lib/permission-rpc.js +152 -0
- package/lib/permission-rules.d.ts +115 -0
- package/lib/permission-rules.js +256 -0
- package/lib/permission-settings.d.ts +45 -0
- package/lib/permission-settings.js +48 -0
- package/lib/permission-shell.d.ts +38 -0
- package/lib/permission-shell.js +150 -0
- package/lib/permission-web.d.ts +5 -0
- package/lib/permission-web.js +7 -0
- package/lib/preset-registry.js +36 -25
- package/lib/profile-diagnostics.d.ts +45 -0
- package/lib/profile-diagnostics.js +148 -0
- package/lib/profile-locale.d.ts +3 -0
- package/lib/profile-locale.js +2 -0
- package/lib/profile-remote.d.ts +8 -0
- package/lib/profile-remote.js +163 -39
- package/lib/profile-rpc.d.ts +4 -3
- package/lib/profile-rpc.js +14 -12
- package/lib/profile-runtime.d.ts +40 -1
- package/lib/profile-runtime.js +368 -93
- package/lib/profile-store.d.ts +11 -0
- package/lib/profile-store.js +143 -11
- package/lib/profile-types.d.ts +70 -1
- package/lib/profile-types.js +1 -0
- package/lib/profiles.d.ts +16 -2
- package/lib/profiles.js +156 -79
- package/lib/prompt-content.js +1 -1
- package/lib/prompts.d.ts +37 -2
- package/lib/prompts.js +111 -9
- package/lib/recovery-policy.js +20 -7
- package/lib/role-control-remote.d.ts +38 -0
- package/lib/role-control-remote.js +211 -0
- package/lib/role-control-rpc.d.ts +51 -0
- package/lib/role-control-rpc.js +377 -0
- package/lib/role-control-types.d.ts +92 -0
- package/lib/role-control-types.js +8 -0
- package/lib/role-invocation.d.ts +47 -0
- package/lib/role-invocation.js +135 -0
- package/lib/role-llm-runtime.d.ts +17 -0
- package/lib/role-llm-runtime.js +62 -0
- package/lib/role-llm.d.ts +31 -0
- package/lib/role-llm.js +66 -0
- package/lib/role-policy.d.ts +49 -8
- package/lib/role-policy.js +437 -60
- package/lib/role-providers.d.ts +1 -1
- package/lib/role-providers.js +30 -35
- package/lib/role-routing.d.ts +11 -2
- package/lib/role-routing.js +42 -25
- package/lib/role-runs.d.ts +135 -0
- package/lib/role-runs.js +304 -0
- package/lib/role-subagents.d.ts +58 -3
- package/lib/role-subagents.js +169 -56
- package/lib/roles.d.ts +5 -6
- package/lib/roles.js +10 -39
- package/lib/route-json.d.ts +19 -0
- package/lib/route-json.js +129 -0
- package/lib/routing-policy.d.ts +2 -0
- package/lib/routing-policy.js +12 -2
- package/lib/runtime-integration.d.ts +112 -0
- package/lib/runtime-integration.js +784 -0
- package/lib/runtime-recovery.js +18 -8
- package/lib/settings.d.ts +47 -13
- package/lib/settings.js +217 -82
- package/lib/skills.js +2 -2
- package/lib/status.d.ts +10 -1
- package/lib/status.js +11 -8
- package/lib/subagent-runtime.d.ts +45 -0
- package/lib/subagent-runtime.js +131 -0
- package/package.json +106 -56
- package/patches/subagent-runtime.yml +15 -0
- package/prompts/deepseek-flash.md +1 -1
- package/prompts/deepseek-v4-pro.md +2 -2
- package/prompts/deepwork.md +27 -18
- package/prompts/source/agents/clarifier.md +5 -3
- package/prompts/source/agents/orchestrator.md +18 -9
- package/prompts/source/agents/plan-critic.md +5 -1
- package/prompts/source/agents/planner.md +4 -2
- package/prompts/source/agents/reviewer.md +6 -0
- package/prompts/source/category/complex.md +4 -4
- package/prompts/source/category/creative.md +6 -4
- package/prompts/source/category/cross-cutting.md +10 -8
- package/prompts/source/category/deep.md +5 -3
- package/prompts/source/category/documenting.md +7 -1
- package/prompts/source/category/frontend.md +2 -2
- package/prompts/source/category/hard-reasoning.md +3 -3
- package/prompts/source/category/research.md +4 -2
- package/prompts/source/deepwork/claude-opus-5.md +2 -2
- package/prompts/source/deepwork/codex.md +1 -1
- package/prompts/source/deepwork/default.md +22 -15
- package/prompts/source/deepwork/gemini.md +23 -16
- package/prompts/source/deepwork/glm.md +21 -14
- package/prompts/source/deepwork/gpt.md +12 -6
- package/prompts/source/deepwork/planner.md +8 -5
- package/prompts/source/manifest.json +178 -63
- package/prompts/source/shared/dsh-host-contract.md +5 -3
- package/prompts/source/shared/locale.md +2 -2
- package/prompts/source/terminal/orchestrator.md +1 -1
- package/scripts/cold-profile-composition.mjs +329 -0
- package/scripts/cold-profile-sources.mjs +238 -0
- package/scripts/migrate-cold-profile.mjs +315 -0
- package/skills/ast-grep/SKILL.md +7 -4
- package/skills/brainstorming/SKILL.md +43 -22
- package/skills/coding-agent-sessions/SKILL.md +7 -4
- package/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +46 -46
- package/skills/coding-agent-sessions/scripts/tests/test_pi_family_scanners.py +130 -130
- package/skills/debugging/SKILL.md +14 -9
- package/skills/debugging/references/methodology/00-setup.md +14 -62
- package/skills/debugging/references/methodology/02-investigate.md +4 -4
- package/skills/debugging/references/methodology/03-flaky-triage.md +3 -3
- package/skills/debugging/references/methodology/04-hard-reasoning-escalation.md +2 -14
- package/skills/debugging/references/methodology/06-fix.md +6 -6
- package/skills/debugging/references/methodology/08-qa.md +5 -5
- package/skills/debugging/references/methodology/09-cleanup.md +15 -153
- package/skills/debugging/references/methodology/partial-runtime-evidence.md +3 -16
- package/skills/debugging/references/runtimes/bundled-js-binary.md +1 -16
- package/skills/debugging/references/runtimes/native-binary.md +9 -54
- package/skills/debugging/references/runtimes/node.md +4 -15
- package/skills/debugging/references/runtimes/python.md +3 -15
- package/skills/debugging/references/runtimes/rust.md +2 -18
- package/skills/debugging/references/tools/dap.md +1 -1
- package/skills/debugging/references/tools/ghidra.md +4 -15
- package/skills/debugging/references/tools/playwright-cli.md +3 -15
- package/skills/debugging/references/tools/pwntools.md +4 -16
- package/skills/dispatching-parallel-agents/SKILL.md +18 -16
- package/skills/frontend/SKILL.md +7 -4
- package/skills/frontend/references/design/react-dev-tooling-skill.md +1 -1
- package/skills/git-master/SKILL.md +7 -4
- package/skills/init-deep/SKILL.md +7 -4
- package/skills/receiving-code-review/SKILL.md +17 -12
- package/skills/remove-ai-slops/SKILL.md +39 -38
- package/skills/requesting-code-review/SKILL.md +19 -17
- package/skills/requesting-code-review/code-reviewer.md +13 -1
- package/skills/subagent-driven-development/SKILL.md +29 -26
- package/skills/subagent-driven-development/implementer-prompt.md +29 -11
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +6 -1
- package/skills/using-git-worktrees/SKILL.md +7 -4
- package/skills/writing-plans/SKILL.md +29 -24
- package/skills/writing-plans/plan-document-reviewer-prompt.md +10 -1
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { lstatSync, readFileSync } from "node:fs";
|
|
3
|
+
import { mkdir, open } from "node:fs/promises";
|
|
4
|
+
import { basename, dirname, isAbsolute, join, parse, resolve } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { BASE_BUNDLE, MODULE_REPLACEMENTS, inspectColdComposition } from "./cold-profile-composition.mjs";
|
|
7
|
+
import {
|
|
8
|
+
ColdProfileMigrationError, bundleToken, digest, jsonDocument, loadColdProfileSdk,
|
|
9
|
+
plainPath, refuse, replaceBundleToken,
|
|
10
|
+
} from "./cold-profile-sources.mjs";
|
|
11
|
+
|
|
12
|
+
export { ColdProfileMigrationError, loadColdProfileSdk };
|
|
13
|
+
const RECEIPT = ".dsmm-cold-profile.json";
|
|
14
|
+
const PROJECTION_PREFIX = "@dsmm/cold-base-";
|
|
15
|
+
const ownName = name => typeof name === "string" && /^@dsmm\/cold-base-[0-9a-f-]{36}$/.test(name);
|
|
16
|
+
|
|
17
|
+
function normalizeOptions(input) {
|
|
18
|
+
if (!input || !["dsh-tui", "desktop"].includes(input.target)) refuse("EXPLICIT_TARGET_REQUIRED");
|
|
19
|
+
for (const key of ["profileDir", "installAnchor", "home"]) {
|
|
20
|
+
if (typeof input[key] !== "string" || !isAbsolute(input[key])) refuse("EXPLICIT_ABSOLUTE_SCOPE_REQUIRED");
|
|
21
|
+
}
|
|
22
|
+
const profileDir = plainPath(resolve(input.profileDir));
|
|
23
|
+
const home = plainPath(resolve(input.home));
|
|
24
|
+
if (profileDir === parse(profileDir).root || home === parse(home).root || profileDir === home) refuse("INVALID_DIRECTORY_SCOPE");
|
|
25
|
+
if (!lstatSync(profileDir).isDirectory() || !lstatSync(home).isDirectory()) refuse("INVALID_DIRECTORY_SCOPE");
|
|
26
|
+
const overlays = input.overlays ?? [];
|
|
27
|
+
const sourceRoots = input.sourceRoots ?? [profileDir, home];
|
|
28
|
+
if (!Array.isArray(overlays) || !Array.isArray(sourceRoots) || ![...overlays, ...sourceRoots].every(value => typeof value === "string" && isAbsolute(value))) refuse("EXPLICIT_ABSOLUTE_SCOPE_REQUIRED");
|
|
29
|
+
if (input.rootConfig !== undefined && (typeof input.rootConfig !== "string" || !isAbsolute(input.rootConfig))) refuse("EXPLICIT_ABSOLUTE_SCOPE_REQUIRED");
|
|
30
|
+
if (input.migrateShell !== undefined && typeof input.migrateShell !== "boolean") refuse("INVALID_SHELL_OPTION");
|
|
31
|
+
if (input.migrateSubagent !== undefined && typeof input.migrateSubagent !== "boolean") refuse("INVALID_SUBAGENT_OPTION");
|
|
32
|
+
if (input.migrateSessionPersistence !== undefined && typeof input.migrateSessionPersistence !== "boolean") refuse("INVALID_SESSION_PERSISTENCE_OPTION");
|
|
33
|
+
return {
|
|
34
|
+
target: input.target, profileDir, home, installAnchor: resolve(input.installAnchor),
|
|
35
|
+
overlays: overlays.map(filename => plainPath(resolve(filename))),
|
|
36
|
+
sourceRoots: [...new Set(sourceRoots.map(filename => plainPath(resolve(filename))))],
|
|
37
|
+
migrateShell: input.migrateShell ?? true,
|
|
38
|
+
migrateSubagent: input.migrateSubagent ?? false,
|
|
39
|
+
migrateSessionPersistence: input.migrateSessionPersistence ?? false,
|
|
40
|
+
...(input.rootConfig ? { rootConfig: plainPath(resolve(input.rootConfig)) } : {}),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function projectionDir(options, name) {
|
|
45
|
+
if (!ownName(name)) refuse("INVALID_PROJECTION_IDENTITY");
|
|
46
|
+
return plainPath(join(options.profileDir, "node_modules", "@dsmm", basename(name)), { missing: true });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function activeReceipt(options) {
|
|
50
|
+
const text = readFileSync(join(options.profileDir, "package.json"), "utf8");
|
|
51
|
+
const bundles = jsonDocument(text).value.dsh?.profile?.bundles;
|
|
52
|
+
if (!Array.isArray(bundles)) refuse("INVALID_BUNDLES");
|
|
53
|
+
const owned = bundles.filter(name => typeof name === "string" && name.startsWith(PROJECTION_PREFIX));
|
|
54
|
+
if (owned.length === 0) return undefined;
|
|
55
|
+
if (owned.length !== 1 || bundles.includes(BASE_BUNDLE)) refuse("AMBIGUOUS_PROJECTION");
|
|
56
|
+
return readReceipt(options, owned[0]);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function readReceipt(options, name) {
|
|
60
|
+
const dir = projectionDir(options, name);
|
|
61
|
+
const receiptPath = plainPath(join(dir, RECEIPT));
|
|
62
|
+
const receipt = jsonDocument(readFileSync(receiptPath, "utf8")).value;
|
|
63
|
+
if (receipt.version !== 1 || receipt.projectionName !== name || receipt.profileDir !== options.profileDir ||
|
|
64
|
+
receipt.target !== options.target || receipt.home !== options.home || receipt.installAnchor !== options.installAnchor ||
|
|
65
|
+
receipt.migrateShell !== options.migrateShell || receipt.migrateSubagent !== options.migrateSubagent || !Number.isSafeInteger(receipt.slot) || receipt.slot < 0 ||
|
|
66
|
+
receipt.migrateSessionPersistence !== options.migrateSessionPersistence ||
|
|
67
|
+
!Array.isArray(receipt.changes) || !Array.isArray(receipt.outputs) ||
|
|
68
|
+
receipt.outputs.length !== 2 || receipt.outputs[0].name !== "package.json" || receipt.outputs[1].name !== "cordis.patch.yml" ||
|
|
69
|
+
receipt.originalLiteral === undefined || JSON.parse(receipt.originalLiteral) !== BASE_BUNDLE ||
|
|
70
|
+
![receipt.sourceRevision, receipt.beforeHash, receipt.afterHash, ...receipt.outputs.map(output => output.hash)].every(hash => typeof hash === "string" && /^[a-f0-9]{64}$/.test(hash))) refuse("INVALID_RECEIPT");
|
|
71
|
+
if (receipt.changes.length < 2 || receipt.changes.length > Object.keys(MODULE_REPLACEMENTS).length ||
|
|
72
|
+
new Set(receipt.changes.map(change => change.id)).size !== receipt.changes.length ||
|
|
73
|
+
!receipt.changes.some(change => change.id === "llm" && change.original === "@deepseek-ai/dsh-llm") ||
|
|
74
|
+
!receipt.changes.some(change => change.id === "settings" && change.original === "@deepseek-ai/dsh-settings") ||
|
|
75
|
+
receipt.changes.some(change => change.original === "@deepseek-ai/dsh-subagent") !== options.migrateSubagent ||
|
|
76
|
+
receipt.changes.some(change => change.original === "@deepseek-ai/dsh-subagent" && change.id !== "subagent") ||
|
|
77
|
+
receipt.changes.some(change => change.original === "@deepseek-ai/dsh-session-persistence-jsonl") !== options.migrateSessionPersistence ||
|
|
78
|
+
receipt.changes.some(change => change.original === "@deepseek-ai/dsh-session-persistence-jsonl" && change.id !== "session-persistence-jsonl") ||
|
|
79
|
+
!receipt.changes.every(change => typeof change.id === "string" && Object.hasOwn(MODULE_REPLACEMENTS, change.original) && change.replacement === MODULE_REPLACEMENTS[change.original])) refuse("INVALID_RECEIPT");
|
|
80
|
+
for (const output of receipt.outputs) {
|
|
81
|
+
const filename = plainPath(join(dir, output.name));
|
|
82
|
+
if (digest(readFileSync(filename)) !== output.hash) refuse("OWNED_OUTPUT_CONFLICT");
|
|
83
|
+
}
|
|
84
|
+
return receipt;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function summary(inspection, receipt) {
|
|
88
|
+
return {
|
|
89
|
+
status: receipt ? "already-applied" : "planned", revision: inspection.revision,
|
|
90
|
+
target: receipt?.target, slot: inspection.slot,
|
|
91
|
+
changes: inspection.changes, nativeToolSelection: inspection.nativeToolSelection,
|
|
92
|
+
...(receipt ? { projectionName: receipt.projectionName } : {}),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Read-only. Returned revision binds all effective composition sources and explicit launch inputs. */
|
|
97
|
+
async function planMigration(input) {
|
|
98
|
+
const options = normalizeOptions(input);
|
|
99
|
+
const sdk = await loadColdProfileSdk(options.installAnchor);
|
|
100
|
+
const receipt = activeReceipt(options);
|
|
101
|
+
const inspection = await inspectColdComposition(options, sdk, { receipt });
|
|
102
|
+
return { ...summary(inspection, receipt), target: options.target };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async function safeOperation(operation) {
|
|
106
|
+
try { return await operation(); } catch (error) {
|
|
107
|
+
if (error instanceof ColdProfileMigrationError) throw error;
|
|
108
|
+
throw new ColdProfileMigrationError("SOURCE_OR_IO_FAILURE");
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export const planColdProfileMigration = input => safeOperation(() => planMigration(input));
|
|
113
|
+
|
|
114
|
+
async function exclusiveFile(filename, text) {
|
|
115
|
+
const file = await open(filename, "wx", 0o600);
|
|
116
|
+
try {
|
|
117
|
+
await file.writeFile(text);
|
|
118
|
+
await file.sync();
|
|
119
|
+
} finally {
|
|
120
|
+
await file.close();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function requireRevision(inspection, expectedRevision) {
|
|
125
|
+
if (typeof expectedRevision !== "string" || !/^[a-f0-9]{64}$/.test(expectedRevision)) refuse("EXPECTED_REVISION_REQUIRED");
|
|
126
|
+
if (inspection.revision !== expectedRevision) refuse("SOURCE_CONFLICT");
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
async function prepareProjection(options, sdk, inspection) {
|
|
130
|
+
const projectionName = `${PROJECTION_PREFIX}${randomUUID()}`;
|
|
131
|
+
const dir = projectionDir(options, projectionName);
|
|
132
|
+
const patch = sdk.yaml.dump(inspection.projected, { schema: sdk.include.entryListSchema, noRefs: true, lineWidth: -1 });
|
|
133
|
+
const packageText = JSON.stringify({
|
|
134
|
+
name: projectionName, version: "1.0.0", private: true,
|
|
135
|
+
dsh: { bundle: { patch: "./cordis.patch.yml" } },
|
|
136
|
+
}, null, 2) + "\n";
|
|
137
|
+
const newText = replaceBundleToken(inspection.manifestText, inspection.slot, projectionName);
|
|
138
|
+
const transaction = {
|
|
139
|
+
version: 1, projectionName, profileDir: options.profileDir, target: options.target,
|
|
140
|
+
home: options.home, installAnchor: options.installAnchor, migrateShell: options.migrateShell, migrateSubagent: options.migrateSubagent,
|
|
141
|
+
migrateSessionPersistence: options.migrateSessionPersistence,
|
|
142
|
+
slot: inspection.slot, originalLiteral: bundleToken(inspection.manifestText, inspection.slot).literal,
|
|
143
|
+
sourceRevision: inspection.revision,
|
|
144
|
+
beforeHash: digest(inspection.manifestText), afterHash: digest(newText), changes: inspection.changes,
|
|
145
|
+
outputs: [{ name: "package.json", hash: digest(packageText) }, { name: "cordis.patch.yml", hash: digest(patch) }],
|
|
146
|
+
};
|
|
147
|
+
await mkdir(dirname(dir), { recursive: true });
|
|
148
|
+
plainPath(dirname(dir));
|
|
149
|
+
await mkdir(dir);
|
|
150
|
+
try {
|
|
151
|
+
await exclusiveFile(join(dir, "package.json"), packageText);
|
|
152
|
+
await exclusiveFile(join(dir, "cordis.patch.yml"), patch);
|
|
153
|
+
await exclusiveFile(join(dir, RECEIPT), JSON.stringify(transaction, null, 2) + "\n");
|
|
154
|
+
readReceipt(options, projectionName);
|
|
155
|
+
const serialized = sdk.boot.loadOverlayPatches("dsmm-cold-profile", join(dir, "cordis.patch.yml"));
|
|
156
|
+
if (JSON.stringify(serialized) !== JSON.stringify(inspection.projected)) refuse("PROJECTION_ROUNDTRIP_FAILED");
|
|
157
|
+
inspection.readset.assertCurrent();
|
|
158
|
+
return transaction;
|
|
159
|
+
} catch (error) {
|
|
160
|
+
const safe = error instanceof ColdProfileMigrationError ? error : new ColdProfileMigrationError("PREPARATION_FAILED");
|
|
161
|
+
safe.projectionName = projectionName;
|
|
162
|
+
throw safe;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
async function prepareMigration(input) {
|
|
167
|
+
const options = normalizeOptions(input);
|
|
168
|
+
const sdk = await loadColdProfileSdk(options.installAnchor);
|
|
169
|
+
const manifestPath = join(options.profileDir, "package.json");
|
|
170
|
+
plainPath(`${manifestPath}.lock`, { missing: true });
|
|
171
|
+
return sdk.atomic.withFileLock(manifestPath, async () => {
|
|
172
|
+
const active = activeReceipt(options);
|
|
173
|
+
const inspection = await inspectColdComposition(options, sdk, { receipt: active });
|
|
174
|
+
requireRevision(inspection, input.expectedRevision);
|
|
175
|
+
if (active) return { ...summary(inspection, active), target: options.target };
|
|
176
|
+
const receipt = await prepareProjection(options, sdk, inspection);
|
|
177
|
+
return { status: "prepared", projectionName: receipt.projectionName, revision: inspection.revision, nativeToolSelection: inspection.nativeToolSelection };
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** Prepare immutable, unreferenced outputs; interruption cannot affect the current boot composition. */
|
|
182
|
+
export const prepareColdProfileMigration = input => safeOperation(() => prepareMigration(input));
|
|
183
|
+
|
|
184
|
+
async function applyMigration(input) {
|
|
185
|
+
const options = normalizeOptions(input);
|
|
186
|
+
if (input.sourceWriteExclusion !== true) refuse("COLD_SOURCE_WRITE_EXCLUSION_REQUIRED");
|
|
187
|
+
const sdk = await loadColdProfileSdk(options.installAnchor);
|
|
188
|
+
const manifestPath = join(options.profileDir, "package.json");
|
|
189
|
+
plainPath(`${manifestPath}.lock`, { missing: true });
|
|
190
|
+
return sdk.atomic.withFileLock(manifestPath, async () => {
|
|
191
|
+
const receipt = activeReceipt(options);
|
|
192
|
+
const inspection = await inspectColdComposition(options, sdk, { receipt });
|
|
193
|
+
requireRevision(inspection, input.expectedRevision);
|
|
194
|
+
if (receipt) return { ...summary(inspection, receipt), target: options.target };
|
|
195
|
+
const transaction = input.projectionName ? readReceipt(options, input.projectionName) : await prepareProjection(options, sdk, inspection);
|
|
196
|
+
if (transaction.sourceRevision !== inspection.revision || transaction.beforeHash !== digest(inspection.manifestText)) refuse("SOURCE_CONFLICT");
|
|
197
|
+
const projectionName = transaction.projectionName;
|
|
198
|
+
const newText = replaceBundleToken(inspection.manifestText, inspection.slot, projectionName);
|
|
199
|
+
if (digest(newText) !== transaction.afterHash) refuse("INVALID_RECEIPT");
|
|
200
|
+
const current = await inspectColdComposition(options, sdk);
|
|
201
|
+
requireRevision(current, input.expectedRevision);
|
|
202
|
+
inspection.readset.assertCurrent();
|
|
203
|
+
readReceipt(options, projectionName);
|
|
204
|
+
if (resolve(sdk.boot.resolveBundleDir("dsmm-cold-profile", projectionName, options.installAnchor, options.profileDir)) !== projectionDir(options, projectionName)) refuse("PROJECTION_RESOLUTION_CONFLICT");
|
|
205
|
+
plainPath(manifestPath);
|
|
206
|
+
await sdk.atomic.writeFileAtomic(manifestPath, newText, { mode: lstatSync(manifestPath).mode & 0o777 });
|
|
207
|
+
return { status: "applied", target: options.target, projectionName, previousRevision: inspection.revision, nativeToolSelection: inspection.nativeToolSelection };
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Requires cold-source write exclusion. Manual editors and non-locking SDK HMR
|
|
213
|
+
* writers must be quiescent across final CAS/rename; the SDK manifest lock
|
|
214
|
+
* coordinates cooperating installers. Conditional rename against arbitrary
|
|
215
|
+
* editors is not a filesystem capability.
|
|
216
|
+
*/
|
|
217
|
+
export const applyColdProfileMigration = input => safeOperation(() => applyMigration(input));
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Inspect an exact transaction's recoverability. No directory scan and no profile backup.
|
|
221
|
+
* A prepared, unreferenced package is safe to leave in place and can be retired explicitly.
|
|
222
|
+
*/
|
|
223
|
+
async function planRecovery(input) {
|
|
224
|
+
const options = normalizeOptions(input);
|
|
225
|
+
const sdk = await loadColdProfileSdk(options.installAnchor);
|
|
226
|
+
const receipt = readReceipt(options, input.projectionName);
|
|
227
|
+
const text = readFileSync(plainPath(join(options.profileDir, "package.json")), "utf8");
|
|
228
|
+
const hash = digest(text);
|
|
229
|
+
if (hash !== receipt.beforeHash && hash !== receipt.afterHash) refuse("RECOVERY_CONFLICT");
|
|
230
|
+
const applied = hash === receipt.afterHash;
|
|
231
|
+
if (applied && JSON.parse(bundleToken(text, receipt.slot).literal) !== receipt.projectionName) refuse("RECOVERY_CONFLICT");
|
|
232
|
+
const inspection = await inspectColdComposition(options, sdk, { receipt: applied ? receipt : undefined });
|
|
233
|
+
return { status: applied ? "rollback-planned" : "unreferenced", revision: inspection.revision, projectionName: receipt.projectionName };
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export const planColdProfileRecovery = input => safeOperation(() => planRecovery(input));
|
|
237
|
+
|
|
238
|
+
/** Restore only the original reference token, and only against the current expected source revision. */
|
|
239
|
+
async function recoverMigration(input) {
|
|
240
|
+
const options = normalizeOptions(input);
|
|
241
|
+
if (input.sourceWriteExclusion !== true) refuse("COLD_SOURCE_WRITE_EXCLUSION_REQUIRED");
|
|
242
|
+
const sdk = await loadColdProfileSdk(options.installAnchor);
|
|
243
|
+
const manifestPath = join(options.profileDir, "package.json");
|
|
244
|
+
plainPath(`${manifestPath}.lock`, { missing: true });
|
|
245
|
+
return sdk.atomic.withFileLock(manifestPath, async () => {
|
|
246
|
+
const recovery = await planColdProfileRecovery(input);
|
|
247
|
+
if (recovery.revision !== input.expectedRevision) refuse("SOURCE_CONFLICT");
|
|
248
|
+
const receipt = readReceipt(options, input.projectionName);
|
|
249
|
+
const text = readFileSync(manifestPath, "utf8");
|
|
250
|
+
if (recovery.status === "rollback-planned") {
|
|
251
|
+
if (digest(text) !== receipt.afterHash) refuse("RECOVERY_CONFLICT");
|
|
252
|
+
const token = bundleToken(text, receipt.slot);
|
|
253
|
+
const original = text.slice(0, token.offset) + receipt.originalLiteral + text.slice(token.offset + token.length);
|
|
254
|
+
if (digest(original) !== receipt.beforeHash) refuse("RECOVERY_CONFLICT");
|
|
255
|
+
const inspection = await inspectColdComposition(options, sdk, { receipt });
|
|
256
|
+
requireRevision(inspection, input.expectedRevision);
|
|
257
|
+
inspection.readset.assertCurrent();
|
|
258
|
+
await sdk.atomic.writeFileAtomic(manifestPath, original, { mode: lstatSync(manifestPath).mode & 0o777 });
|
|
259
|
+
}
|
|
260
|
+
// Keep immutable outputs and receipt for idempotent recovery; they are no longer referenced.
|
|
261
|
+
return { status: "recovered", projectionName: receipt.projectionName };
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export const recoverColdProfileMigration = input => safeOperation(() => recoverMigration(input));
|
|
266
|
+
|
|
267
|
+
export async function coldProfileMigrationCli(argv) {
|
|
268
|
+
const [command, ...args] = argv;
|
|
269
|
+
const values = {};
|
|
270
|
+
const overlays = [];
|
|
271
|
+
const sourceRoots = [];
|
|
272
|
+
const flags = new Set(["--no-shell", "--migrate-subagent", "--migrate-session-persistence", "--source-write-exclusion"]);
|
|
273
|
+
const names = {
|
|
274
|
+
"--profile-dir": "profileDir", "--install-anchor": "installAnchor", "--home": "home",
|
|
275
|
+
"--target": "target", "--expected-revision": "expectedRevision", "--projection-name": "projectionName",
|
|
276
|
+
"--root-config": "rootConfig",
|
|
277
|
+
};
|
|
278
|
+
for (let index = 0; index < args.length; index++) {
|
|
279
|
+
const flag = args[index];
|
|
280
|
+
if (flags.has(flag)) {
|
|
281
|
+
if (Object.hasOwn(values, flag)) refuse("INVALID_ARGUMENTS");
|
|
282
|
+
values[flag] = true;
|
|
283
|
+
} else if (flag === "--patch" || flag === "--source-root" || Object.hasOwn(names, flag)) {
|
|
284
|
+
const value = args[++index];
|
|
285
|
+
if (!value || value.startsWith("--")) refuse("INVALID_ARGUMENTS");
|
|
286
|
+
if (flag === "--patch") overlays.push(value);
|
|
287
|
+
else if (flag === "--source-root") sourceRoots.push(value);
|
|
288
|
+
else {
|
|
289
|
+
if (Object.hasOwn(values, names[flag])) refuse("INVALID_ARGUMENTS");
|
|
290
|
+
values[names[flag]] = value;
|
|
291
|
+
}
|
|
292
|
+
} else refuse("INVALID_ARGUMENTS");
|
|
293
|
+
}
|
|
294
|
+
const input = {
|
|
295
|
+
...values, overlays, migrateShell: !values["--no-shell"], migrateSubagent: !!values["--migrate-subagent"],
|
|
296
|
+
migrateSessionPersistence: !!values["--migrate-session-persistence"], sourceWriteExclusion: !!values["--source-write-exclusion"],
|
|
297
|
+
};
|
|
298
|
+
if (sourceRoots.length) input.sourceRoots = sourceRoots;
|
|
299
|
+
const commands = {
|
|
300
|
+
plan: planColdProfileMigration, prepare: prepareColdProfileMigration, apply: applyColdProfileMigration,
|
|
301
|
+
"plan-recover": planColdProfileRecovery, recover: recoverColdProfileMigration,
|
|
302
|
+
};
|
|
303
|
+
if (!Object.hasOwn(commands, command)) refuse("INVALID_COMMAND");
|
|
304
|
+
return commands[command](input);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
308
|
+
try {
|
|
309
|
+
console.log(JSON.stringify(await coldProfileMigrationCli(process.argv.slice(2))));
|
|
310
|
+
} catch (error) {
|
|
311
|
+
// SDK/YAML/filesystem diagnostics can contain configuration values: never echo them.
|
|
312
|
+
console.error(JSON.stringify({ status: "refused", code: error instanceof ColdProfileMigrationError ? error.code : "SOURCE_OR_IO_FAILURE", ...(error.projectionName ? { projectionName: error.projectionName } : {}) }));
|
|
313
|
+
process.exitCode = 1;
|
|
314
|
+
}
|
|
315
|
+
}
|
package/skills/ast-grep/SKILL.md
CHANGED
|
@@ -8,10 +8,13 @@ description: "Use ast-grep (sg) only when the task explicitly requires exact syn
|
|
|
8
8
|
This is a full OCMM source adaptation for DSH 0.2.0-rc.2, not an OpenCode or Codex runtime. Source product names in transcript formats, examples, paths and attribution remain descriptive; they are not a host switch.
|
|
9
9
|
|
|
10
10
|
- Load this skill through the native skill tool only when its trigger matches. Resolve every relative reference/script/asset from the directory resourceBase returned with this skill, not from the project cwd or an OCMM checkout. Use available read/glob/grep to inspect resources; use write/edit and the active bash or pwsh only within the actual role and host permissions.
|
|
11
|
-
- External documentation uses actual web_search/web_fetch or an available documentation service. Context7, GitHub MCP, browser, image and LSP tools are optional catalog capabilities, not bundled calls. Use a real available equivalent or report unavailable evidence; never invent an MCP, Task, todo or compression API.
|
|
12
|
-
- Source role names are logical assignments: code-search/explore maps to dsmm-code-search, and other canonical roles/categories map to dsmm-<name>.
|
|
13
|
-
- Templates describe assignment content, not
|
|
14
|
-
-
|
|
11
|
+
- External documentation uses actual web_search/web_fetch or an available documentation service. Context7, GitHub MCP, browser, image and LSP tools are optional catalog capabilities, not bundled calls. Use a real available equivalent or report unavailable evidence; never invent an MCP, Task, todo or compression API. Native read uses file_path, not OpenCode filePath; inspect every actual schema before calling it. Use read_image only when exposed and the actual route supports its image result.
|
|
12
|
+
- Source role names are logical assignments: code-search/explore maps to role ID dsmm-code-search, and other canonical roles/categories map to dsmm-<name>. Use this Agent's observed admitted inventory: per-role topology has individual role tools (for example dsmm_plan_critic) plus dsmm_category; parameterized topology has dsmm_role and dsmm_category with their actual role/category enums. Never derive callability from generated files, names or templates. Both layouts preserve target, caller, read-only, inherited tool and depth ceilings; a missing required formal role returns to the stage owner, not a planning bypass.
|
|
13
|
+
- Templates describe assignment content, not callable schemas. Actual delegation takes description/prompt, an exposed level, a deployment-authorized exposed route, and an exposed run_in_background only. Omitted/normal retains the default; low/high/max must be configured at roleRouting.<id>.levels as a complete route or exact supported effort, never synthetic suffix roles or fixed max effort. A complete invocation route needs paired provider/model and cannot silently fall back; effort-only needs exact native preflight. Level/layout never change permissions or verification rigor. Reviewer/Oracle independence requires different observed native routes, not names.
|
|
14
|
+
- One-shot defaults foreground; permitted one-shot background is native-job-owned. A managed admitted continuable configuration defaults background; explicit run_in_background:false creates a non-reusable one-shot. Use only exposed job_output/job_list/job_kill or send_message/interrupt_agent and returned identities. Existing continuable children can receive nearest-step running messages, idle next turns or same-ID cold continuation; receipts mean inbox acceptance, not completion. Exposed native child-to-parent reporting retains exact-sender/adjacency semantics, not new parent-to-child authority. Settled one-shots never revive; reuse never reselects role/level/route or copies a parent's newer policy into the original child capture. Do not send OpenCode task_id/subagent_type/background/resume/retry or guessed control fields.
|
|
15
|
+
- Host observations alone establish lifecycle controls. Managed delivery requires explicit startup composition: disable the stock subagents row, bind the unique PUBLIC DSMM SubagentRuntime subclass and restart; never hot-replace/drain stock or add a shadow runtime. When actually wired and authorized, a user foreground handoff transfers the existing same run to native jobs without a second start; native user queue/steer follows its operator/connection/session/epoch gate. Do not announce unconnected tools/RPCs. Background enablement, capacity, ownership, depth, cancellation and provider support always gate execution. Legacy conservative evidence may permit useful proven capabilities under the same durable child ID; missing evidence denies that capability with a reason, not all legacy children and not an inheritance of current parent policy.
|
|
16
|
+
- When exposed, native todo_write replaces the owning Agent's whole list of content/status items; its schema and allowParallelInProgress policy govern updates. Otherwise use concise session coordination or an authorized plan. ask_user_question is conditional on exposure; otherwise ask in conversation. Native host compaction is not OCMM compress, and no model-facing compression call is assumed. A read-only planner returns complete Markdown; an authorized coordinator persists it, never the planner through shell or a proxy. Role responsibilities, explicit-off common/skill visibility, and the terminal delegation contract override broader examples in a resource.
|
|
17
|
+
- Follow the current user's explicit output-language request, otherwise this Agent's immutable captured DSMM locale when supplied, then applicable host/user language guidance or the current request/context. Supported configured locales are en/zh-Hans/zh-Hant/ja/ko/de/fr/es/pt-BR/ru; omission inherits, not an English default. Preserve code, identifiers, paths, commands, protocol fields and exact quotes, and pass explicit language instructions in child assignments. This resource imports no Root session preference, promises neither internal reasoning language nor UI translation, and never changes host/project locale. A later parent Apply does not rewrite a child's captured locale.
|
|
15
18
|
- Installation, package-manager bootstrap, downloads, authentication/login, credential/profile access, Git writes and destructive actions require explicit authorization for the exact action. Reference commands are not automatic operations. Worktree consent does not authorize dependency installation or later branch deletion. Read before changing an existing file; preserve unrelated user work. Never silently restore/reset a working tree to repair a failed cleanup.
|
|
16
19
|
- Browser/debug QA uses run-owned isolated state, no imported credentials or browser profile, and only already available software unless separately authorized. Keep commands in the active shell dialect. Report unverified surfaces honestly.
|
|
17
20
|
|
|
@@ -8,25 +8,50 @@ description: "Use before creative or materially ambiguous work to clarify outcom
|
|
|
8
8
|
This is a full OCMM source adaptation for DSH 0.2.0-rc.2, not an OpenCode or Codex runtime. Source product names in transcript formats, examples, paths and attribution remain descriptive; they are not a host switch.
|
|
9
9
|
|
|
10
10
|
- Load this skill through the native skill tool only when its trigger matches. Resolve every relative reference/script/asset from the directory resourceBase returned with this skill, not from the project cwd or an OCMM checkout. Use available read/glob/grep to inspect resources; use write/edit and the active bash or pwsh only within the actual role and host permissions.
|
|
11
|
-
- External documentation uses actual web_search/web_fetch or an available documentation service. Context7, GitHub MCP, browser, image and LSP tools are optional catalog capabilities, not bundled calls. Use a real available equivalent or report unavailable evidence; never invent an MCP, Task, todo or compression API.
|
|
12
|
-
- Source role names are logical assignments: code-search/explore maps to dsmm-code-search, and other canonical roles/categories map to dsmm-<name>.
|
|
13
|
-
- Templates describe assignment content, not
|
|
14
|
-
-
|
|
11
|
+
- External documentation uses actual web_search/web_fetch or an available documentation service. Context7, GitHub MCP, browser, image and LSP tools are optional catalog capabilities, not bundled calls. Use a real available equivalent or report unavailable evidence; never invent an MCP, Task, todo or compression API. Native read uses file_path, not OpenCode filePath; inspect every actual schema before calling it. Use read_image only when exposed and the actual route supports its image result.
|
|
12
|
+
- Source role names are logical assignments: code-search/explore maps to role ID dsmm-code-search, and other canonical roles/categories map to dsmm-<name>. Use this Agent's observed admitted inventory: per-role topology has individual role tools (for example dsmm_plan_critic) plus dsmm_category; parameterized topology has dsmm_role and dsmm_category with their actual role/category enums. Never derive callability from generated files, names or templates. Both layouts preserve target, caller, read-only, inherited tool and depth ceilings; a missing required formal role returns to the stage owner, not a planning bypass.
|
|
13
|
+
- Templates describe assignment content, not callable schemas. Actual delegation takes description/prompt, an exposed level, a deployment-authorized exposed route, and an exposed run_in_background only. Omitted/normal retains the default; low/high/max must be configured at roleRouting.<id>.levels as a complete route or exact supported effort, never synthetic suffix roles or fixed max effort. A complete invocation route needs paired provider/model and cannot silently fall back; effort-only needs exact native preflight. Level/layout never change permissions or verification rigor. Reviewer/Oracle independence requires different observed native routes, not names.
|
|
14
|
+
- One-shot defaults foreground; permitted one-shot background is native-job-owned. A managed admitted continuable configuration defaults background; explicit run_in_background:false creates a non-reusable one-shot. Use only exposed job_output/job_list/job_kill or send_message/interrupt_agent and returned identities. Existing continuable children can receive nearest-step running messages, idle next turns or same-ID cold continuation; receipts mean inbox acceptance, not completion. Exposed native child-to-parent reporting retains exact-sender/adjacency semantics, not new parent-to-child authority. Settled one-shots never revive; reuse never reselects role/level/route or copies a parent's newer policy into the original child capture. Do not send OpenCode task_id/subagent_type/background/resume/retry or guessed control fields.
|
|
15
|
+
- Host observations alone establish lifecycle controls. Managed delivery requires explicit startup composition: disable the stock subagents row, bind the unique PUBLIC DSMM SubagentRuntime subclass and restart; never hot-replace/drain stock or add a shadow runtime. When actually wired and authorized, a user foreground handoff transfers the existing same run to native jobs without a second start; native user queue/steer follows its operator/connection/session/epoch gate. Do not announce unconnected tools/RPCs. Background enablement, capacity, ownership, depth, cancellation and provider support always gate execution. Legacy conservative evidence may permit useful proven capabilities under the same durable child ID; missing evidence denies that capability with a reason, not all legacy children and not an inheritance of current parent policy.
|
|
16
|
+
- When exposed, native todo_write replaces the owning Agent's whole list of content/status items; its schema and allowParallelInProgress policy govern updates. Otherwise use concise session coordination or an authorized plan. ask_user_question is conditional on exposure; otherwise ask in conversation. Native host compaction is not OCMM compress, and no model-facing compression call is assumed. A read-only planner returns complete Markdown; an authorized coordinator persists it, never the planner through shell or a proxy. Role responsibilities, explicit-off common/skill visibility, and the terminal delegation contract override broader examples in a resource.
|
|
17
|
+
- Follow the current user's explicit output-language request, otherwise this Agent's immutable captured DSMM locale when supplied, then applicable host/user language guidance or the current request/context. Supported configured locales are en/zh-Hans/zh-Hant/ja/ko/de/fr/es/pt-BR/ru; omission inherits, not an English default. Preserve code, identifiers, paths, commands, protocol fields and exact quotes, and pass explicit language instructions in child assignments. This resource imports no Root session preference, promises neither internal reasoning language nor UI translation, and never changes host/project locale. A later parent Apply does not rewrite a child's captured locale.
|
|
15
18
|
- Installation, package-manager bootstrap, downloads, authentication/login, credential/profile access, Git writes and destructive actions require explicit authorization for the exact action. Reference commands are not automatic operations. Worktree consent does not authorize dependency installation or later branch deletion. Read before changing an existing file; preserve unrelated user work. Never silently restore/reset a working tree to repair a failed cleanup.
|
|
16
19
|
- Browser/debug QA uses run-owned isolated state, no imported credentials or browser profile, and only already available software unless separately authorized. Keep commands in the active shell dialect. Report unverified surfaces honestly.
|
|
17
20
|
|
|
18
|
-
<!--
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
authorized task does not require a separate design gate, rigid checklist,
|
|
23
|
-
fixed option count, or repeated approval loop; complex implementation still
|
|
24
|
-
follows the workflow planning policy. See docs/v1-maintenance.md
|
|
25
|
-
for sync rules. -->
|
|
21
|
+
<!-- Local fork of obra/superpowers/brainstorming v6.3.0.
|
|
22
|
+
Triggered native final-state policy and proportional discovery.
|
|
23
|
+
Authorized work follows applicable planning without redundant design approval.
|
|
24
|
+
Source and maintenance contract: docs/v1-maintenance.md. -->
|
|
26
25
|
|
|
27
26
|
# Brainstorming Outcomes Into Designs
|
|
28
27
|
|
|
29
|
-
Use discovery and design to remove material uncertainty before implementation. The
|
|
28
|
+
Use discovery and design to remove material uncertainty before implementation. The objective is a shared understanding of the goal, constraints, acceptance criteria, interfaces, risks, and ideal end state, not completion of a prescribed ceremony.
|
|
29
|
+
|
|
30
|
+
## Final-State Artifacts and Regression Tests
|
|
31
|
+
|
|
32
|
+
These rules apply when this triggered native skill is loaded. Shared workflow and role policies remain effective without injecting the skill body; packaging is not automatic skill execution or authority.
|
|
33
|
+
|
|
34
|
+
Documents, code and comments, tests, and commit messages express only the concise final requirements, design, and behavior. Update intermediate changes directly to the final text. Don't retain development or decision histories, rejected alternatives, or decision counterexamples. Trace history only through the Git commit tree. The only document exception is a strictly chronological purpose, such as a roadmap or changelog; ordinary maintenance notes aren't history archives.
|
|
35
|
+
|
|
36
|
+
`docs/superpowers/specs/` and `docs/superpowers/plans/` are reserved for final product requirements to be delivered. Each spec or plan describes its final deliverable, not an execution journal. Represent changed requirements with separate plans, not an accumulated change history. Other tasks use conversation-level coordination or a task-owned temporary plan and never write to those directories. Complexity can require planning without making a task a product-spec deliverable.
|
|
37
|
+
|
|
38
|
+
Tests protect valid requirements, functional behavior, and external interfaces against regressions. Don't add string, regex, snapshot, or parsed-content locks for documentation, commit messages, package information, or error/log wording that has no functional or system-boundary significance. Verify executable configuration, protocol fields, and resource delivery through their behavior rather than locking descriptive text. Don't add decision-counterexample tests or tests asserting that a deleted component is absent. When requirements change, update corresponding tests. When a module, helper, tool, or subsystem is removed, delete tests dedicated to it. Negative tests for valid safety, protocol, and input-handling requirements remain appropriate.
|
|
39
|
+
|
|
40
|
+
Don't add tests that freeze incidental files or lockfiles, build-tool details, descriptive package metadata, local OS/shell/path/PATH/CWD settings, dependency/runtime versions, or environment snapshots unrelated to product behavior or an explicit external or necessary delivery contract. A test must expose a concrete failure of a valid requirement, not preserve the current machine or tool setup. Verify configuration and delivery through observable behavior rather than whole-file string/hash equality or parsed incidental state. Necessary integrity, provenance, security, and protocol pins remain valid for their concrete boundary; prompt or document edits alone don't justify new infrastructure/environment tests.
|
|
41
|
+
|
|
42
|
+
Git commits are the compatibility boundary. Uncommitted intermediate implementations may be changed incompatibly to meet final requirements without transition shims or tests preserving intermediate behavior. An existing component with uncommitted edits still has its committed contracts. This rule doesn't authorize changes to public APIs/protocols, security or data guarantees, permissions, or irreversible behavior, and doesn't authorize any Git write.
|
|
43
|
+
|
|
44
|
+
Keep current constraints, authorization boundaries, unresolved risks, and verification evidence visible. State a necessary assumption as a current constraint or verification limit, not a ruling ledger. Agent reports stay in conversation; don't turn coordination, review conclusions, or evidence into workspace files unless explicitly requested as deliverables. Final-state discipline must never hide a real defect, blocker, or unverified requirement.
|
|
45
|
+
|
|
46
|
+
Delegation and delivery need clear goals, useful completion evidence, and material constraints, not exhaustive resource/file inventories, per-item revision/hash/receipt locks, or fixed report fields. Workers may discover relevant files, tests, docs, and other resources within the authorized scope. Communicate scope and ownership boundaries, irreversible-operation limits, and required protocol/integrity identities when they matter; resource discovery never expands permissions. Keep results in conversation and require exact identities only for a concrete safety, integrity, or external protocol requirement.
|
|
47
|
+
|
|
48
|
+
Temporary, debug, disposable, or retired files and directories do not need repeated stability checks, hash comparisons, or correct recorded status at every instant. Keep short-lived state in the agent session and synchronize useful results at delivery or major phase boundaries, not every checklist update. A completed disposable resource checklist can be deleted without first writing completion status; don't introduce repository debug journals or extra ledgers. Deliverables are proven by correct functionality, interfaces, and usability, not string/hash locks on all text files. Use hashes/checksums only for an explicitly necessary integrity, provenance/security, or protocol-identity requirement, preserving required release checks. Cleanup still requires exact task ownership, safe resolved paths, PID plus start identity for process termination, and preservation of user changes; lighter temporary-state handling never weakens authorization, API contracts, or data guarantees.
|
|
49
|
+
|
|
50
|
+
## Coordinated Verification and Evidence Reuse
|
|
51
|
+
|
|
52
|
+
For multi-task or parallel work, workers run lightweight local checks relevant to their substantive changes, not a full suite for each small task. Handoffs state what changed, local evidence/results, and material risks or unverified coverage. The orchestrator coordinates integration and global verification, consolidating necessary heavy checks at task completion or important phase boundaries and minimizing full-suite frequency.
|
|
53
|
+
|
|
54
|
+
Reuse passing evidence when it still covers the current claim and no change materially affects the tested behavior or interface. Unchanged code needs no repeat verification absent a relevant change. During long tasks, dependency/environment changes and unrelated parallel code edits may coexist with valid evidence; they don't automatically invalidate it. Assess concrete relevance: a dependency or environment change that affects tested behavior or interfaces is not unrelated. Rerun only affected or missing checks and state uncovered risks; don't treat failed, stale, or irrelevant evidence as a pass. This reduces duplication, not necessary verification: preserve safety/data/API/permission boundaries, required release checks, repository pre-commit typecheck/test/build gates, and explicit user verification requirements.
|
|
30
55
|
|
|
31
56
|
## Authorization and Intent
|
|
32
57
|
|
|
@@ -50,7 +75,7 @@ Choose and revise the path based on actual uncertainty, coordination, and risk.
|
|
|
50
75
|
|
|
51
76
|
Do not default upward merely because work is multi-file, creative, or unfamiliar. Do not default downward when concrete security, data-loss, compatibility, protocol/API, migration, release, or irreversible-operation risks require additional care.
|
|
52
77
|
|
|
53
|
-
These paths size discovery and design; they do not replace workflow planning policy. Complex business or behavior
|
|
78
|
+
These paths size discovery and design; they do not replace workflow planning policy. Complex implementation of product business logic or behavior defaults to `planner` → `plan-critic` → implementation even when requirements are clear and evidence is strong. Planning or criticism for that work may be skipped only for a limited, simple, low-risk, clearly bounded change, or when the user explicitly requests the skip; state the applicable condition in conversation. Non-product routine operations, docs, maintenance, and release preparation use direct execution when resolvable, otherwise a material question or useful `complex`/specialist delegation, not automatic or repeated planner/critic/review cycles. Explicit process requirements and verification for concrete major safety risks remain binding. An explicit skip never permits an unapproved security, data, API/protocol, permission, or irreversible-action decision.
|
|
54
79
|
|
|
55
80
|
## Discovery
|
|
56
81
|
|
|
@@ -72,7 +97,7 @@ Do not manufacture alternatives, architecture, or refactoring to make the proces
|
|
|
72
97
|
|
|
73
98
|
## Outcome-Oriented Design
|
|
74
99
|
|
|
75
|
-
Scale the design artifact to the work
|
|
100
|
+
Scale the design artifact to the work within the product-spec and temporary-plan boundaries above. A useful design makes the following discoverable without requiring fixed sections or order:
|
|
76
101
|
|
|
77
102
|
- goal and ideal end state;
|
|
78
103
|
- scope, exclusions, constraints, permissions, and acceptance criteria;
|
|
@@ -87,11 +112,7 @@ Organize waves by independently meaningful outcomes and dependency order. For ea
|
|
|
87
112
|
|
|
88
113
|
Resolve non-material ambiguity from the approved goal and repository evidence. Choose the smallest safe, reversible option that preserves the user's goal, constraints, permissions, and acceptance criteria.
|
|
89
114
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
- the decision or assumption;
|
|
93
|
-
- the evidence or reason;
|
|
94
|
-
- the cost if wrong.
|
|
115
|
+
Keep only the resulting current requirements, constraints, unresolved risks, and useful evidence in task coordination and handoffs. Don't write a decision or assumption history.
|
|
95
116
|
|
|
96
117
|
Escalate rather than guess when a choice changes scope or acceptance, weakens security or data guarantees, changes a public API/protocol, expands permissions, creates an irreversible effect, conflicts with a specific user mandate, or has no evidence-based path. Strict process is otherwise justified only by an explicit user request or concrete risk.
|
|
97
118
|
|
|
@@ -101,8 +122,8 @@ Self-review a material design for requirement coverage, internal consistency, in
|
|
|
101
122
|
|
|
102
123
|
Request user review or approval only when their decision is needed, they explicitly requested the checkpoint, or a governing high-risk boundary requires it. Do not require approval section-by-section, repeat review because wording changed, or restart a design loop after a non-substantive edit. If substantive inputs change, revisit only the affected decisions and evidence.
|
|
103
124
|
|
|
104
|
-
A saved spec is not mandatory for a clear bounded change. Create
|
|
125
|
+
A saved spec is not mandatory for a clear bounded change. Create a product spec only for final product requirements to be delivered; other tasks stay in conversation or a task-owned temporary plan. Do not create a separate design/spec commit by default.
|
|
105
126
|
|
|
106
127
|
## Implementation Handoff
|
|
107
128
|
|
|
108
|
-
Once the goal is authorized and material uncertainty is resolved, proceed through the applicable implementation workflow without asking for a second design approval. Hand off the goal, ideal end state, constraints, acceptance criteria, dependencies/interfaces, material risks, useful evidence
|
|
129
|
+
Once the goal is authorized and material uncertainty is resolved, proceed through the applicable implementation workflow without asking for a second design approval. Hand off the goal, ideal end state, constraints, acceptance criteria, dependencies/interfaces, material risks, and useful evidence. File-backed plans follow the location and final-deliverable rules above; delegated workers remain conditional on execution value.
|
|
@@ -8,10 +8,13 @@ description: "MUST USE when asked to find, read, list, search, inspect, fetch, e
|
|
|
8
8
|
This is a full OCMM source adaptation for DSH 0.2.0-rc.2, not an OpenCode or Codex runtime. Source product names in transcript formats, examples, paths and attribution remain descriptive; they are not a host switch.
|
|
9
9
|
|
|
10
10
|
- Load this skill through the native skill tool only when its trigger matches. Resolve every relative reference/script/asset from the directory resourceBase returned with this skill, not from the project cwd or an OCMM checkout. Use available read/glob/grep to inspect resources; use write/edit and the active bash or pwsh only within the actual role and host permissions.
|
|
11
|
-
- External documentation uses actual web_search/web_fetch or an available documentation service. Context7, GitHub MCP, browser, image and LSP tools are optional catalog capabilities, not bundled calls. Use a real available equivalent or report unavailable evidence; never invent an MCP, Task, todo or compression API.
|
|
12
|
-
- Source role names are logical assignments: code-search/explore maps to dsmm-code-search, and other canonical roles/categories map to dsmm-<name>.
|
|
13
|
-
- Templates describe assignment content, not
|
|
14
|
-
-
|
|
11
|
+
- External documentation uses actual web_search/web_fetch or an available documentation service. Context7, GitHub MCP, browser, image and LSP tools are optional catalog capabilities, not bundled calls. Use a real available equivalent or report unavailable evidence; never invent an MCP, Task, todo or compression API. Native read uses file_path, not OpenCode filePath; inspect every actual schema before calling it. Use read_image only when exposed and the actual route supports its image result.
|
|
12
|
+
- Source role names are logical assignments: code-search/explore maps to role ID dsmm-code-search, and other canonical roles/categories map to dsmm-<name>. Use this Agent's observed admitted inventory: per-role topology has individual role tools (for example dsmm_plan_critic) plus dsmm_category; parameterized topology has dsmm_role and dsmm_category with their actual role/category enums. Never derive callability from generated files, names or templates. Both layouts preserve target, caller, read-only, inherited tool and depth ceilings; a missing required formal role returns to the stage owner, not a planning bypass.
|
|
13
|
+
- Templates describe assignment content, not callable schemas. Actual delegation takes description/prompt, an exposed level, a deployment-authorized exposed route, and an exposed run_in_background only. Omitted/normal retains the default; low/high/max must be configured at roleRouting.<id>.levels as a complete route or exact supported effort, never synthetic suffix roles or fixed max effort. A complete invocation route needs paired provider/model and cannot silently fall back; effort-only needs exact native preflight. Level/layout never change permissions or verification rigor. Reviewer/Oracle independence requires different observed native routes, not names.
|
|
14
|
+
- One-shot defaults foreground; permitted one-shot background is native-job-owned. A managed admitted continuable configuration defaults background; explicit run_in_background:false creates a non-reusable one-shot. Use only exposed job_output/job_list/job_kill or send_message/interrupt_agent and returned identities. Existing continuable children can receive nearest-step running messages, idle next turns or same-ID cold continuation; receipts mean inbox acceptance, not completion. Exposed native child-to-parent reporting retains exact-sender/adjacency semantics, not new parent-to-child authority. Settled one-shots never revive; reuse never reselects role/level/route or copies a parent's newer policy into the original child capture. Do not send OpenCode task_id/subagent_type/background/resume/retry or guessed control fields.
|
|
15
|
+
- Host observations alone establish lifecycle controls. Managed delivery requires explicit startup composition: disable the stock subagents row, bind the unique PUBLIC DSMM SubagentRuntime subclass and restart; never hot-replace/drain stock or add a shadow runtime. When actually wired and authorized, a user foreground handoff transfers the existing same run to native jobs without a second start; native user queue/steer follows its operator/connection/session/epoch gate. Do not announce unconnected tools/RPCs. Background enablement, capacity, ownership, depth, cancellation and provider support always gate execution. Legacy conservative evidence may permit useful proven capabilities under the same durable child ID; missing evidence denies that capability with a reason, not all legacy children and not an inheritance of current parent policy.
|
|
16
|
+
- When exposed, native todo_write replaces the owning Agent's whole list of content/status items; its schema and allowParallelInProgress policy govern updates. Otherwise use concise session coordination or an authorized plan. ask_user_question is conditional on exposure; otherwise ask in conversation. Native host compaction is not OCMM compress, and no model-facing compression call is assumed. A read-only planner returns complete Markdown; an authorized coordinator persists it, never the planner through shell or a proxy. Role responsibilities, explicit-off common/skill visibility, and the terminal delegation contract override broader examples in a resource.
|
|
17
|
+
- Follow the current user's explicit output-language request, otherwise this Agent's immutable captured DSMM locale when supplied, then applicable host/user language guidance or the current request/context. Supported configured locales are en/zh-Hans/zh-Hant/ja/ko/de/fr/es/pt-BR/ru; omission inherits, not an English default. Preserve code, identifiers, paths, commands, protocol fields and exact quotes, and pass explicit language instructions in child assignments. This resource imports no Root session preference, promises neither internal reasoning language nor UI translation, and never changes host/project locale. A later parent Apply does not rewrite a child's captured locale.
|
|
15
18
|
- Installation, package-manager bootstrap, downloads, authentication/login, credential/profile access, Git writes and destructive actions require explicit authorization for the exact action. Reference commands are not automatic operations. Worktree consent does not authorize dependency installation or later branch deletion. Read before changing an existing file; preserve unrelated user work. Never silently restore/reset a working tree to repair a failed cleanup.
|
|
16
19
|
- Browser/debug QA uses run-owned isolated state, no imported credentials or browser profile, and only already available software unless separately authorized. Keep commands in the active shell dialect. Report unverified surfaces honestly.
|
|
17
20
|
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
|
|
5
|
-
from .transcript import env_path, existing, jsonl_parallel, recent, stem_id
|
|
6
|
-
from .types import Session
|
|
7
|
-
|
|
8
|
-
SENPI_CONFIG_DIRS = (".senpi", ".pi")
|
|
9
|
-
OH_MY_PI_CONFIG_DIRS = (".omp",)
|
|
10
|
-
GAJAE_CODE_CONFIG_DIRS = (".gjc",)
|
|
11
|
-
|
|
12
|
-
__all__ = ["scan_gajae_code", "scan_oh_my_pi", "scan_senpi"]
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def scan_senpi(extra_roots: tuple[Path, ...], workers: int) -> list[Session]:
|
|
16
|
-
return _scan_pi_family("senpi", SENPI_CONFIG_DIRS, "senpi", extra_roots, workers)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def scan_oh_my_pi(extra_roots: tuple[Path, ...], workers: int) -> list[Session]:
|
|
20
|
-
return _scan_pi_family("oh-my-pi", OH_MY_PI_CONFIG_DIRS, "omp", extra_roots, workers)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def scan_gajae_code(extra_roots: tuple[Path, ...], workers: int) -> list[Session]:
|
|
24
|
-
return _scan_pi_family("gajae-code", GAJAE_CODE_CONFIG_DIRS, "gjc", extra_roots, workers)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def _scan_pi_family(platform: str, config_dirs: tuple[str, ...], xdg_app: str, extra_roots: tuple[Path, ...], workers: int) -> list[Session]:
|
|
28
|
-
roots = _pi_family_roots(config_dirs, xdg_app, extra_roots)
|
|
29
|
-
paths = [path for root in roots for path in (root / "sessions").rglob("*.jsonl")]
|
|
30
|
-
return jsonl_parallel(recent(paths), workers, platform, lambda path: stem_id(path, "_"))
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def _pi_family_roots(config_dirs: tuple[str, ...], xdg_app: str, extra_roots: tuple[Path, ...]) -> list[Path]:
|
|
34
|
-
home = Path.home()
|
|
35
|
-
roots: list[Path] = []
|
|
36
|
-
for config_dir in config_dirs:
|
|
37
|
-
base = home / config_dir
|
|
38
|
-
roots.append(base / "agent")
|
|
39
|
-
roots.extend(sorted(base.glob("profiles/*/agent")))
|
|
40
|
-
xdg_data = env_path("XDG_DATA_HOME")
|
|
41
|
-
if xdg_data is not None:
|
|
42
|
-
app_root = xdg_data / xdg_app
|
|
43
|
-
roots.append(app_root)
|
|
44
|
-
roots.extend(sorted(app_root.glob("profiles/*")))
|
|
45
|
-
roots.extend(extra_roots)
|
|
46
|
-
return existing(roots)
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
from .transcript import env_path, existing, jsonl_parallel, recent, stem_id
|
|
6
|
+
from .types import Session
|
|
7
|
+
|
|
8
|
+
SENPI_CONFIG_DIRS = (".senpi", ".pi")
|
|
9
|
+
OH_MY_PI_CONFIG_DIRS = (".omp",)
|
|
10
|
+
GAJAE_CODE_CONFIG_DIRS = (".gjc",)
|
|
11
|
+
|
|
12
|
+
__all__ = ["scan_gajae_code", "scan_oh_my_pi", "scan_senpi"]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def scan_senpi(extra_roots: tuple[Path, ...], workers: int) -> list[Session]:
|
|
16
|
+
return _scan_pi_family("senpi", SENPI_CONFIG_DIRS, "senpi", extra_roots, workers)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def scan_oh_my_pi(extra_roots: tuple[Path, ...], workers: int) -> list[Session]:
|
|
20
|
+
return _scan_pi_family("oh-my-pi", OH_MY_PI_CONFIG_DIRS, "omp", extra_roots, workers)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def scan_gajae_code(extra_roots: tuple[Path, ...], workers: int) -> list[Session]:
|
|
24
|
+
return _scan_pi_family("gajae-code", GAJAE_CODE_CONFIG_DIRS, "gjc", extra_roots, workers)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _scan_pi_family(platform: str, config_dirs: tuple[str, ...], xdg_app: str, extra_roots: tuple[Path, ...], workers: int) -> list[Session]:
|
|
28
|
+
roots = _pi_family_roots(config_dirs, xdg_app, extra_roots)
|
|
29
|
+
paths = [path for root in roots for path in (root / "sessions").rglob("*.jsonl")]
|
|
30
|
+
return jsonl_parallel(recent(paths), workers, platform, lambda path: stem_id(path, "_"))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _pi_family_roots(config_dirs: tuple[str, ...], xdg_app: str, extra_roots: tuple[Path, ...]) -> list[Path]:
|
|
34
|
+
home = Path.home()
|
|
35
|
+
roots: list[Path] = []
|
|
36
|
+
for config_dir in config_dirs:
|
|
37
|
+
base = home / config_dir
|
|
38
|
+
roots.append(base / "agent")
|
|
39
|
+
roots.extend(sorted(base.glob("profiles/*/agent")))
|
|
40
|
+
xdg_data = env_path("XDG_DATA_HOME")
|
|
41
|
+
if xdg_data is not None:
|
|
42
|
+
app_root = xdg_data / xdg_app
|
|
43
|
+
roots.append(app_root)
|
|
44
|
+
roots.extend(sorted(app_root.glob("profiles/*")))
|
|
45
|
+
roots.extend(extra_roots)
|
|
46
|
+
return existing(roots)
|