@dsmm/dsmm 0.3.31 → 0.3.33
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/agent-presets/dsmm-oracle/agent.cordis.yml +2 -0
- package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +2 -0
- package/agent-presets/dsmm-plan-critic/agent.cordis.yml +2 -0
- package/agent-presets/dsmm-planner/agent.cordis.yml +1 -0
- package/agent-presets/dsmm-reviewer/agent.cordis.yml +2 -0
- package/dsh-plugin.json +1 -1
- package/lib/client/RoleToolView.js +9 -8
- package/lib/client.js +5 -5
- package/lib/native-admission.js +16 -8
- package/lib/resident-root.d.ts +1 -1
- package/lib/resident-root.js +39 -6
- package/package.json +1 -1
- package/prompts/source/agents/plan-critic.md +2 -0
- package/prompts/source/agents/planner.md +1 -0
- package/prompts/source/agents/reviewer.md +2 -0
- package/skills/avoid-ai-slop/SKILL.md +1 -1
- package/skills/brainstorming/SKILL.md +1 -1
- package/skills/receiving-code-review/SKILL.md +2 -2
- package/skills/requesting-code-review/SKILL.md +1 -1
- package/skills/writing-plans/SKILL.md +1 -1
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
|
|
27
27
|
Evaluate existing evidence by material relevance; request missing or affected coverage instead of blanket reruns for unrelated code, dependency, or environment changes. Explicitly name any important behavior you considered but cannot judge, why, and the missing evidence; do not require a dedicated heading, list, or quota. The orchestrator coordinates global/heavy verification; don't duplicate it or waive required safety, release, pre-commit, or user checks.
|
|
28
28
|
|
|
29
|
+
Trace a local defect far enough to establish its impact and the smallest correction. Prefer a local fix when it restores the contract. Extend the investigation only as far as the changed behavior or a concrete risk warrants; assess independent defects in the diff on their own impact. Look for unnecessary complexity in the diff, such as an abstraction with no current consumer or a check that repeats an upstream guarantee. When complexity is the only issue, suggest a simpler alternative as non-blocking advice. Process rules about stopping your own unnecessary work do not require cleanup of the reviewed diff. If the change violates a requirement or creates a concrete safety risk, report that finding separately at its actual severity.
|
|
30
|
+
|
|
29
31
|
Report material findings first with severity when useful, file path, concrete evidence, likely impact, and the smallest valid correction. Judge whether useful functionality is complete, interfaces are clear, and meaningful regression and real-surface evidence support the result. Review informs engineering judgment; it is not delivery authorization or a protocol gate. Repeat only the affected review for a newly identified or resolved blocker, a substantive correction, or relevant new evidence; repeated concerns or unchanged uncertainty do not justify another pass. Apply strict review only when the user explicitly requests it or a scoped, concrete high-risk condition warrants it.
|
|
30
32
|
|
|
31
33
|
Use direct read/search tools first; a leaf read-only lookup may verify one finding but returns evidence, not delegated judgment. Never dispatch planner, reviewer, any Oracle profile, plan-critic, clarifier, coordinator, or an implementation agent.
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
|
|
27
27
|
Evaluate existing evidence by material relevance; request missing or affected coverage instead of blanket reruns for unrelated code, dependency, or environment changes. Explicitly name any important behavior you considered but cannot judge, why, and the missing evidence; do not require a dedicated heading, list, or quota. The orchestrator coordinates global/heavy verification; don't duplicate it or waive required safety, release, pre-commit, or user checks.
|
|
28
28
|
|
|
29
|
+
Trace a local defect far enough to establish its impact and the smallest correction. Prefer a local fix when it restores the contract. Extend the investigation only as far as the changed behavior or a concrete risk warrants; assess independent defects in the diff on their own impact. Look for unnecessary complexity in the diff, such as an abstraction with no current consumer or a check that repeats an upstream guarantee. When complexity is the only issue, suggest a simpler alternative as non-blocking advice. Process rules about stopping your own unnecessary work do not require cleanup of the reviewed diff. If the change violates a requirement or creates a concrete safety risk, report that finding separately at its actual severity.
|
|
30
|
+
|
|
29
31
|
Report material findings first with severity when useful, file path, concrete evidence, likely impact, and the smallest valid correction. Judge whether useful functionality is complete, interfaces are clear, and meaningful regression and real-surface evidence support the result. Review informs engineering judgment; it is not delivery authorization or a protocol gate. Repeat only the affected review for a newly identified or resolved blocker, a substantive correction, or relevant new evidence; repeated concerns or unchanged uncertainty do not justify another pass. Apply strict review only when the user explicitly requests it or a scoped, concrete high-risk condition warrants it.
|
|
30
32
|
|
|
31
33
|
Use direct read/search tools first; a leaf read-only lookup may verify one finding but returns evidence, not delegated judgment. Never dispatch planner, reviewer, any Oracle profile, plan-critic, clarifier, coordinator, or an implementation agent.
|
|
@@ -30,6 +30,8 @@
|
|
|
30
30
|
|
|
31
31
|
Treat as blockers only issues that contradict an explicit requirement or constraint, omit a necessary prerequisite, preserve a known failing regression, create a concrete security/data-loss/compatibility/release/runtime risk, or conflict with an external API, provider, protocol, platform, packaging, or release contract. Recommend the smallest useful correction without expanding scope.
|
|
32
32
|
|
|
33
|
+
For a missing required safeguard, cite the governing requirement and the gap. For an additional safeguard, treat its absence as a blocker only when a concrete failure path escapes existing controls. If the plan makes valid work wait for redundant validation or approval, recommend removing that gate while retaining the actual boundary check. Hypothetical future uses and optional hardening do not hold up implementation.
|
|
34
|
+
|
|
33
35
|
Everything else is a non-blocking note and does not delay implementation. Give current findings and supporting evidence as clear prose rather than protocol fields or approval tokens. Every substantive blocker must be corrected, rebutted with concrete evidence, or escalated for clarification; it cannot be relabeled advisory and ignored. Critique informs judgment and does not authorize implementation or delivery.
|
|
34
36
|
|
|
35
37
|
Do not require another review merely because the plan changed. Revisit only affected claims and dependent risks when a blocker is newly identified or resolved, or relevant new evidence or another substantive input could change the prior conclusion. Wording changes, repeated concerns, and unchanged uncertainty are not progress; stop and return an unresolved blocker rather than continuing a no-progress loop. Do not require hashes, a fixed receipt or verdict format, a fixed iteration count, or an open-ended loop. Do not object to preference, optional polish, or a merely better approach.
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
- Read, search, and analyze. Return a complete Markdown product plan when durable coordination is useful or requested; the authorized coordinator persists it if an artifact is needed. This native planner is read-only, including plan files: do not use shell, write/edit or a child proxy to persist one. Non-product coordination and reports stay in conversation unless explicitly requested as deliverables. Do not edit source, tests, configuration, or product documentation.
|
|
20
20
|
- Reserve `docs/superpowers/specs/` and `docs/superpowers/plans/` for final product requirements to be delivered. Each artifact describes one final deliverable, not development decisions, rejected alternatives, assumption rationale/cost, or change history. Changed requirements use separate plans. Non-product tasks, regardless of complexity, use conversation coordination or a task-owned temporary plan outside those directories.
|
|
21
21
|
- Plan around the ideal end state, dependencies, interfaces, material risks, wave goals, and useful outcome evidence. Record decisions an implementer cannot safely infer: necessary paths and names, interface signatures and types, requirement-fixed values, and decisive test assertions or observable results. Do not transcribe implementation bodies already determined by those decisions. Treat steps and ordering as informed guidance that execution may adjust as evidence changes, not as a hard script.
|
|
22
|
+
- Choose the simplest design that delivers the approved behavior and preserves contracts outside the authorized change. Validate at trust boundaries and reuse an established guarantee for as long as it holds. Add an abstraction, retry, fallback, lock, or approval step only when a current requirement or concrete failure path needs it; keep independent work moving.
|
|
22
23
|
- Plan verification around valid requirements, functionality, and external interfaces, including material input classes and failure conditions implied by the approved behavior and local contracts. Attach plausible regression coverage to the owning task; when an important behavior remains unjudged, state why and what evidence is missing without imposing a fixed review-focus heading, list, or quota. Do not expand scope from speculation or add descriptive-text locks. Requirement changes update tests; removed components lose their dedicated tests rather than gaining absence tests. Git commits bound compatibility: interim uncommitted behavior need not be preserved, but existing committed contracts and API/security/data/permission/irreversible-action authorization remain binding.
|
|
23
24
|
- Return unresolved software design choices that affect implementation to the orchestrator for `brainstorming`; use `writing-plans` techniques proportionally rather than imposing ceremony.
|
|
24
25
|
- Use direct tools first. A leaf read-only `code-search`, `doc-search`, or equivalent lookup is allowed only to resolve a named fact. If evidence leaves a genuinely difficult decision, report the blocker to the orchestrator for optional `hard-reasoning`; strict or high-risk conditions alone do not qualify.
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
|
|
27
27
|
Evaluate existing evidence by material relevance; request missing or affected coverage instead of blanket reruns for unrelated code, dependency, or environment changes. Explicitly name any important behavior you considered but cannot judge, why, and the missing evidence; do not require a dedicated heading, list, or quota. The orchestrator coordinates global/heavy verification; don't duplicate it or waive required safety, release, pre-commit, or user checks.
|
|
28
28
|
|
|
29
|
+
Trace a local defect far enough to establish its impact and the smallest correction. Prefer a local fix when it restores the contract. Extend the investigation only as far as the changed behavior or a concrete risk warrants; assess independent defects in the diff on their own impact. Look for unnecessary complexity in the diff, such as an abstraction with no current consumer or a check that repeats an upstream guarantee. When complexity is the only issue, suggest a simpler alternative as non-blocking advice. Process rules about stopping your own unnecessary work do not require cleanup of the reviewed diff. If the change violates a requirement or creates a concrete safety risk, report that finding separately at its actual severity.
|
|
30
|
+
|
|
29
31
|
Report material findings first with severity when useful, file path, concrete evidence, likely impact, and the smallest valid correction. Judge whether useful functionality is complete, interfaces are clear, and meaningful regression and real-surface evidence support the result. Review informs engineering judgment; it is not delivery authorization or a protocol gate. Repeat only the affected review for a newly identified or resolved blocker, a substantive correction, or relevant new evidence; repeated concerns or unchanged uncertainty do not justify another pass. Apply strict review only when the user explicitly requests it or a scoped, concrete high-risk condition warrants it.
|
|
30
32
|
|
|
31
33
|
Use direct read/search tools first; a leaf read-only lookup may verify one finding but returns evidence, not delegated judgment. Never dispatch planner, reviewer, any Oracle profile, plan-critic, clarifier, coordinator, or an implementation agent.
|
package/dsh-plugin.json
CHANGED
|
@@ -57,17 +57,18 @@ export function RoleToolView(props) {
|
|
|
57
57
|
const actual = persisted?.phase === "settled" ? persisted : observed ?? inactivePersisted;
|
|
58
58
|
const comparison = actual?.routeComparison;
|
|
59
59
|
const target = actual?.role ?? requested.target;
|
|
60
|
-
const
|
|
60
|
+
const observedStop = actual?.phase === "settled" ? actual.stopReason : undefined;
|
|
61
|
+
const state = result?.error?.code === "interrupted" || observedStop === "aborted" ? "stopped"
|
|
62
|
+
: failed || observedStop !== undefined && observedStop !== "completed" ? "error"
|
|
63
|
+
: result !== undefined && actual?.delivery === "parent" && actual.phase !== "settled" ? "background"
|
|
64
|
+
: actual?.phase === "settled" || result !== undefined ? "result"
|
|
65
|
+
: props.phase === "preparing" ? "preparing" : "running";
|
|
66
|
+
const isOngoing = state === "running" || state === "preparing";
|
|
67
|
+
const action = state === "preparing" ? t("calling") : t("call");
|
|
61
68
|
const targetLabel = target === undefined ? t("unknownTarget") : roleToolDisplay(target);
|
|
62
69
|
const rawDesc = requested.description?.trim();
|
|
63
70
|
const singleLineDesc = rawDesc ? rawDesc.replace(/\s+/gu, " ") : undefined;
|
|
64
71
|
const title = `${action} ${targetLabel}`;
|
|
65
|
-
const observedStop = actual?.phase === "settled" ? actual.stopReason : undefined;
|
|
66
|
-
const state = result?.error?.code === "interrupted" || observedStop === "aborted" ? "stopped"
|
|
67
|
-
: failed || observedStop !== undefined && observedStop !== "completed" ? "error"
|
|
68
|
-
: result === undefined ? props.phase === "preparing" ? "preparing" : "running"
|
|
69
|
-
: actual?.delivery === "parent" && actual.phase !== "settled" ? "background" : "result";
|
|
70
|
-
const isOngoing = state === "running" || props.phase === "preparing";
|
|
71
72
|
const code = (value) => _jsx(CodeBlock, { code: value, copyLabel: t("copy"), copiedLabel: t("copied") });
|
|
72
73
|
const [viewMode, setViewMode] = useState("table");
|
|
73
74
|
const controlId = `dsmm-tech-${props.callId || "call"}`;
|
|
@@ -84,7 +85,7 @@ export function RoleToolView(props) {
|
|
|
84
85
|
const actualRoute = comparison?.liveRoute;
|
|
85
86
|
const routeLabel = (route, missingEffort = false) => `${route.provider}/${route.model}${route.reasoningEffort === undefined ? missingEffort ? ` · ${t("effortUnreported")}` : "" : ` · ${route.reasoningEffort}`}`;
|
|
86
87
|
const collapsedContent = singleLineDesc ? _jsxs(_Fragment, { children: [_jsx("span", { className: "dsmm-role-sep", "aria-hidden": "true" }), _jsx("span", { className: "dsmm-role-summary", children: _jsx(TextShimmer, { active: isOngoing, children: singleLineDesc }) })] }) : undefined;
|
|
87
|
-
const stateDotState = state === "error" ? "error" : state === "stopped" ? "warning" :
|
|
88
|
+
const stateDotState = state === "error" ? "error" : state === "stopped" ? "warning" : state === "background" ? "idle" : state === "result" ? "done" : "ongoing";
|
|
88
89
|
return _jsxs("div", { className: "dsmm-role-tool", "data-dsmm-role-tool": props.toolName, "data-identity": actual === undefined ? "requested" : "actual", "data-state": state, "data-delivery": actual?.delivery, "data-phase": actual?.phase, "data-expanded": expanded ? "true" : "false", children: [_jsx(DisclosureRow, { title: title, titleClassName: "dsmm-role-title", rowClassName: "dsmm-role-heading", contentClassName: "dsmm-role-text", icon: _jsx(IconAgentPresetOutlineRegular, { size: 14, className: "dsmm-role-icon" }), collapsedContent: collapsedContent, keepContentWhenOpen: true, running: isOngoing, open: expanded, expandable: true, onToggle: toggle, expandOnRowClick: true, children: _jsxs("div", { className: "dsmm-role-body", children: [_jsxs("p", { className: "dsmm-role-identity", children: [showRequestedVsActual ? _jsxs(_Fragment, { children: [_jsxs("span", { className: "dsmm-role-dim", children: [t("requested"), ": "] }), _jsxs("span", { children: [requested.target === undefined ? t("unknown") : roleToolDisplay(requested.target), requested.level ? ` (${requested.level})` : ""] }), _jsx("span", { className: "dsmm-role-dim", children: " \u2192 " }), _jsxs("span", { className: "dsmm-role-dim", children: [t("actual"), ": "] }), _jsxs("span", { children: [roleToolDisplay(actual.role), " (", actual.level, ")"] })] }) : _jsxs("span", { children: [actual === undefined && _jsxs("span", { className: "dsmm-role-dim", children: [t("requested"), ": "] }), actual !== undefined ? roleToolDisplay(actual.role) : requested.target === undefined ? t("unknownTarget") : roleToolDisplay(requested.target), (actual?.level ?? requested.level) !== undefined && ` · ${actual?.level ?? requested.level}`, props.phase !== "preparing" && actual === undefined && _jsxs("span", { className: "dsmm-role-dim", children: [" \u00B7 ", t("actualUnknown")] })] }), initialRoute !== undefined && _jsxs("span", { className: "dsmm-role-model", children: [" · ", t("initialRoute"), ": ", initialRoute.status === "known" ? routeLabel(initialRoute.route) : t("routeUnknown")] }), actualRoute !== undefined ? _jsxs("span", { className: "dsmm-role-model", children: [" · ", t("actualRoute"), ": ", actualRoute.status === "known" ? routeLabel(actualRoute.route, true) : t("routeUnknown")] }) : props.phase !== "preparing" && _jsxs("span", { className: "dsmm-role-model", children: [" · ", t("actualRoute"), ": ", t("routeUnknown")] })] }), _jsxs("p", { className: "dsmm-role-identity", "data-observation-status": observationStatus, children: [t("observation"), ": ", t({ unavailable: "observationUnavailable", connecting: "observationConnecting", live: "observationLive", stale: "observationStale" }[observationStatus]), observationIssue !== undefined && ` · ${observationIssue.kind}/${observationIssue.code}`] }), requested.description !== undefined && _jsx("p", { className: "dsmm-role-task", children: requested.description }), result?.error != null && _jsxs("div", { className: "dsmm-role-failure", children: [_jsx("p", { className: "dsmm-role-section-title", children: t("failure") }), code(JSON.stringify(result.error, null, 2))] }), _jsxs("details", { className: "dsmm-role-details", children: [_jsx("summary", { children: t("technicalDetails") }), _jsxs("div", { className: "dsmm-role-details-body", children: [_jsx("div", { className: "dsmm-role-details-header", children: _jsx(SegmentedControl, { id: controlId, value: viewMode, options: viewOptions, onChange: setViewMode, label: t("viewMode"), className: "dsmm-role-view-switch" }) }), _jsx("div", { id: `${controlId}-table-panel`, role: "tabpanel", "aria-labelledby": `${controlId}-table`, hidden: viewMode !== "table", tabIndex: 0, children: viewMode === "table" && _jsxs("table", { className: "dsmm-role-table", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", children: t("property") }), _jsx("th", { scope: "col", children: t("value") })] }) }), _jsx("tbody", { children: tableRows.map(row => _jsxs("tr", { children: [_jsx("td", { className: "dsmm-role-prop-cell", children: row.property }), _jsx("td", { className: "dsmm-role-val-cell", children: row.isComplex ? _jsx("pre", { className: "dsmm-role-cell-code", children: JSON.stringify(row.value, null, 2) })
|
|
89
90
|
: typeof row.value === "string" ? _jsx("span", { className: "dsmm-role-cell-text", children: row.value })
|
|
90
91
|
: _jsx("span", { children: row.value === null ? "null" : row.value === undefined ? "undefined" : String(row.value) }) })] }, row.property)) })] }) }), _jsx("div", { id: `${controlId}-json-panel`, role: "tabpanel", "aria-labelledby": `${controlId}-json`, hidden: viewMode !== "json", tabIndex: 0, children: viewMode === "json" && code(JSON.stringify(jsonData, null, 2)) })] })] })] }) }), _jsxs("div", { className: "dsmm-role-actions", children: [_jsx(StateDot, { state: stateDotState }), _jsx("p", { className: "dsmm-role-status", role: "status", children: t(state) }), props.inspect !== undefined && _jsx(Button, { variant: "ghost", size: "sm", onClick: props.inspect, children: t("inspect") })] })] });
|
package/lib/client.js
CHANGED
|
@@ -9659,14 +9659,14 @@ function RoleToolView(props) {
|
|
|
9659
9659
|
const actual = persisted?.phase === "settled" ? persisted : observed ?? inactivePersisted;
|
|
9660
9660
|
const comparison = actual?.routeComparison;
|
|
9661
9661
|
const target = actual?.role ?? requested.target;
|
|
9662
|
-
const
|
|
9662
|
+
const observedStop = actual?.phase === "settled" ? actual.stopReason : void 0;
|
|
9663
|
+
const state = result?.error?.code === "interrupted" || observedStop === "aborted" ? "stopped" : failed || observedStop !== void 0 && observedStop !== "completed" ? "error" : result !== void 0 && actual?.delivery === "parent" && actual.phase !== "settled" ? "background" : actual?.phase === "settled" || result !== void 0 ? "result" : props.phase === "preparing" ? "preparing" : "running";
|
|
9664
|
+
const isOngoing = state === "running" || state === "preparing";
|
|
9665
|
+
const action2 = state === "preparing" ? t("calling") : t("call");
|
|
9663
9666
|
const targetLabel = target === void 0 ? t("unknownTarget") : roleToolDisplay(target);
|
|
9664
9667
|
const rawDesc = requested.description?.trim();
|
|
9665
9668
|
const singleLineDesc = rawDesc ? rawDesc.replace(/\s+/gu, " ") : void 0;
|
|
9666
9669
|
const title = `${action2} ${targetLabel}`;
|
|
9667
|
-
const observedStop = actual?.phase === "settled" ? actual.stopReason : void 0;
|
|
9668
|
-
const state = result?.error?.code === "interrupted" || observedStop === "aborted" ? "stopped" : failed || observedStop !== void 0 && observedStop !== "completed" ? "error" : result === void 0 ? props.phase === "preparing" ? "preparing" : "running" : actual?.delivery === "parent" && actual.phase !== "settled" ? "background" : "result";
|
|
9669
|
-
const isOngoing = state === "running" || props.phase === "preparing";
|
|
9670
9670
|
const code = (value) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_dsh_client_ui_primitives12.CodeBlock, { code: value, copyLabel: t("copy"), copiedLabel: t("copied") });
|
|
9671
9671
|
const [viewMode, setViewMode] = (0, import_react11.useState)("table");
|
|
9672
9672
|
const controlId = `dsmm-tech-${props.callId || "call"}`;
|
|
@@ -9686,7 +9686,7 @@ function RoleToolView(props) {
|
|
|
9686
9686
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "dsmm-role-sep", "aria-hidden": "true" }),
|
|
9687
9687
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "dsmm-role-summary", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_dsh_client_ui_primitives12.TextShimmer, { active: isOngoing, children: singleLineDesc }) })
|
|
9688
9688
|
] }) : void 0;
|
|
9689
|
-
const stateDotState = state === "error" ? "error" : state === "stopped" ? "warning" :
|
|
9689
|
+
const stateDotState = state === "error" ? "error" : state === "stopped" ? "warning" : state === "background" ? "idle" : state === "result" ? "done" : "ongoing";
|
|
9690
9690
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
9691
9691
|
"div",
|
|
9692
9692
|
{
|
package/lib/native-admission.js
CHANGED
|
@@ -198,6 +198,9 @@ export class NativeAdmission {
|
|
|
198
198
|
}, { global: true, prepend: true });
|
|
199
199
|
ctx.on("tools/pre-execute", async (exec, next) => {
|
|
200
200
|
if (exec.agent) {
|
|
201
|
+
const publication = !this.live.has(exec.agent) && this.awaitingPublication.get(exec.agent);
|
|
202
|
+
if (publication)
|
|
203
|
+
await publication.promise;
|
|
201
204
|
captureResidentTool(exec.agent, this, exec.token);
|
|
202
205
|
this.trackExecution(exec);
|
|
203
206
|
await this.guardExecution(exec.agent);
|
|
@@ -616,8 +619,10 @@ export class NativeAdmission {
|
|
|
616
619
|
/** Exact process-local capture, retained after retirement so stale objects never become native. */
|
|
617
620
|
owns(agent) { return this.agentLifetimes.has(agent); }
|
|
618
621
|
async guardExecution(agent) {
|
|
622
|
+
const publication = this.awaitingPublication.get(agent);
|
|
623
|
+
if (publication)
|
|
624
|
+
await publication.promise;
|
|
619
625
|
assertResidentRootCurrent(agent, this);
|
|
620
|
-
await this.awaitingPublication.get(agent)?.promise;
|
|
621
626
|
if (!this.owns(agent)) {
|
|
622
627
|
const registry = agent.ctx.get("agents");
|
|
623
628
|
if (registry && original(registry) === original(this.ctx.agents) && scopeOf(agent.ctx) === agent && registry.get(agent.id) !== agent
|
|
@@ -1091,7 +1096,7 @@ export class NativeAdmission {
|
|
|
1091
1096
|
if (restoring)
|
|
1092
1097
|
guardResidentRealm(agent);
|
|
1093
1098
|
else
|
|
1094
|
-
markResidentAgent(agent, this, isRoot);
|
|
1099
|
+
markResidentAgent(agent, this, isRoot, this.awaitingPublication.get(agent)?.promise);
|
|
1095
1100
|
const scope = agent.ctx.plugin(function dsmmAgentGeneration() { }).ctx;
|
|
1096
1101
|
this.scopes.set(agent, scope);
|
|
1097
1102
|
this.agentLifetimes.set(agent, new AbortController());
|
|
@@ -1253,15 +1258,12 @@ export class NativeAdmission {
|
|
|
1253
1258
|
}
|
|
1254
1259
|
await this.install(agent, this.getter(agent), scope);
|
|
1255
1260
|
check();
|
|
1256
|
-
await this.profiles.revalidateActivation(admission);
|
|
1257
|
-
check();
|
|
1258
|
-
if (pending)
|
|
1259
|
-
this.check(pending);
|
|
1260
|
-
if (continuationProvider && this.ctx.get("subagents").getProvider(continuationProvider.name) !== continuationProvider)
|
|
1261
|
-
throw new SubagentError("Role provider changed", "UNAUTHORIZED");
|
|
1262
1261
|
// Occupancy precedes the installed guards' async policy and approval work.
|
|
1263
1262
|
scope.on("tools/pre-execute", async (exec, next) => {
|
|
1264
1263
|
if (exec.agent === agent) {
|
|
1264
|
+
const publication = !this.live.has(agent) && this.awaitingPublication.get(agent);
|
|
1265
|
+
if (publication)
|
|
1266
|
+
await publication.promise;
|
|
1265
1267
|
captureResidentTool(agent, this, exec.token);
|
|
1266
1268
|
this.trackExecution(exec);
|
|
1267
1269
|
await this.ensure(agent);
|
|
@@ -1271,6 +1273,12 @@ export class NativeAdmission {
|
|
|
1271
1273
|
}
|
|
1272
1274
|
return next();
|
|
1273
1275
|
}, { prepend: true });
|
|
1276
|
+
await this.profiles.revalidateActivation(admission);
|
|
1277
|
+
check();
|
|
1278
|
+
if (pending)
|
|
1279
|
+
this.check(pending);
|
|
1280
|
+
if (continuationProvider && this.ctx.get("subagents").getProvider(continuationProvider.name) !== continuationProvider)
|
|
1281
|
+
throw new SubagentError("Role provider changed", "UNAUTHORIZED");
|
|
1274
1282
|
const routeCandidate = await this.admissionModelSelection?.(agent, {
|
|
1275
1283
|
settings: admission.settings, epoch: admission.epoch, admission, signal, assertCurrent: check,
|
|
1276
1284
|
});
|
package/lib/resident-root.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Agent } from "@deepseek-ai/dsh-agent";
|
|
|
2
2
|
import type { ToolExecution } from "@deepseek-ai/dsh-tools";
|
|
3
3
|
import type { NativeAdmission } from "./native-admission.js";
|
|
4
4
|
export declare function assertResidentRootCurrent(agent: Agent, owner: NativeAdmission | undefined): void;
|
|
5
|
-
export declare function markResidentAgent(agent: Agent, owner: NativeAdmission, root: boolean): void;
|
|
5
|
+
export declare function markResidentAgent(agent: Agent, owner: NativeAdmission, root: boolean, publication?: Promise<void>): void;
|
|
6
6
|
export declare function captureResidentTool(agent: Agent, owner: NativeAdmission, token: ToolExecution["token"]): void;
|
|
7
7
|
export declare function guardResidentRealm(agent: Agent): void;
|
|
8
8
|
export declare function publishResidentAgent(agent: Agent, owner: NativeAdmission): void;
|
package/lib/resident-root.js
CHANGED
|
@@ -32,7 +32,7 @@ function claim(record, owner) {
|
|
|
32
32
|
owner.lifetime.signal.addEventListener("abort", revoke, { once: true });
|
|
33
33
|
record.detachOwner = () => owner.lifetime.signal.removeEventListener("abort", revoke);
|
|
34
34
|
}
|
|
35
|
-
export function markResidentAgent(agent, owner, root) {
|
|
35
|
+
export function markResidentAgent(agent, owner, root, publication) {
|
|
36
36
|
if (records.has(agent))
|
|
37
37
|
deny();
|
|
38
38
|
const deployment = owner.ctx.get("dsmmDeploymentConfig");
|
|
@@ -50,12 +50,26 @@ export function markResidentAgent(agent, owner, root) {
|
|
|
50
50
|
record.owner = undefined;
|
|
51
51
|
record.afterDrain = undefined;
|
|
52
52
|
});
|
|
53
|
-
agent.ctx.on("agent/pre-step", async (frame, next) => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
agent.ctx.on("agent/pre-step", async (frame, next) => {
|
|
54
|
+
if (frame.agent === agent) {
|
|
55
|
+
if (!record.published && publication)
|
|
56
|
+
await publication;
|
|
57
|
+
await current(record).ensure(agent);
|
|
58
|
+
}
|
|
59
|
+
return next();
|
|
60
|
+
}, { prepend: true });
|
|
61
|
+
agent.ctx.on("agent/request", async (frame, next) => {
|
|
62
|
+
if (frame.agent === agent) {
|
|
63
|
+
if (!record.published && publication)
|
|
64
|
+
await publication;
|
|
65
|
+
await current(record).ensure(agent);
|
|
66
|
+
}
|
|
67
|
+
return next();
|
|
68
|
+
}, { prepend: true });
|
|
57
69
|
agent.ctx.on("tools/pre-execute", async (exec, next) => {
|
|
58
70
|
if (exec.agent === agent) {
|
|
71
|
+
if (!record.published && publication)
|
|
72
|
+
await publication;
|
|
59
73
|
const owner = current(record);
|
|
60
74
|
record.tokens.add(exec.token);
|
|
61
75
|
await owner.ensure(agent);
|
|
@@ -101,10 +115,29 @@ export function guardResidentRealm(agent) {
|
|
|
101
115
|
});
|
|
102
116
|
record.tools.add(realm);
|
|
103
117
|
}
|
|
118
|
+
function loaderEntry(owner) {
|
|
119
|
+
const entry = owner.ctx.fiber.entry, profileDir = owner.ctx.get("profileContext")?.dir;
|
|
120
|
+
return entry && profileDir ? { name: entry.options.name, profileDir } : null;
|
|
121
|
+
}
|
|
122
|
+
function sameDeployment(record, owner) {
|
|
123
|
+
const deployment = owner.ctx.get("dsmmDeploymentConfig");
|
|
124
|
+
if (!deployment || record.home !== deployment.home)
|
|
125
|
+
return false;
|
|
126
|
+
const entry = loaderEntry(owner);
|
|
127
|
+
if (record.loaderEntry && entry) {
|
|
128
|
+
// Reinstalling a plugin mints a new Loader entry ID within the same physical profile.
|
|
129
|
+
return record.loaderEntry.name === entry.name && record.loaderEntry.profileDir === entry.profileDir;
|
|
130
|
+
}
|
|
131
|
+
if (record.loaderEntry === undefined && record.profile && entry)
|
|
132
|
+
return true;
|
|
133
|
+
return record.deploymentKey === deployment.hostProfileKey && (record.loaderEntry === undefined || record.loaderEntry === entry);
|
|
134
|
+
}
|
|
104
135
|
export function publishResidentAgent(agent, owner) {
|
|
105
136
|
const record = records.get(agent);
|
|
106
137
|
if (record.disposed || original(record.owner) !== original(owner) || !owner.isReady)
|
|
107
138
|
deny();
|
|
139
|
+
record.loaderEntry = loaderEntry(owner);
|
|
140
|
+
record.deploymentKey = owner.ctx.get("dsmmDeploymentConfig")?.hostProfileKey;
|
|
108
141
|
record.scopeParent = scopeParentOf(agent);
|
|
109
142
|
record.preset = agent.ctx.get("agentPresets")?.composedPreset(agent.ctx);
|
|
110
143
|
record.published = record.active = true;
|
|
@@ -114,7 +147,7 @@ export function restoreResidentRoot(agent, owner, install) {
|
|
|
114
147
|
if (!record || record.version !== 1 || !record.root || record.disposed || !record.published || record.owner)
|
|
115
148
|
return;
|
|
116
149
|
const valid = () => record.profile === original(owner.ctx.get("profileContext")) && record.registry === original(owner.ctx.agents) && record.registry === original(agent.ctx.get("agents"))
|
|
117
|
-
&&
|
|
150
|
+
&& sameDeployment(record, owner)
|
|
118
151
|
&& record.sessions === original(owner.ctx.get("sessions")) && record.session === agent.session && owner.ctx.get("sessions")?.get(agent.id) === record.session
|
|
119
152
|
&& record.presets === original(agent.ctx.get("agentPresets")) && record.preset === agent.ctx.get("agentPresets")?.composedPreset(agent.ctx)
|
|
120
153
|
&& record.scopeParent === scopeParentOf(agent) && scopeOf(agent.ctx) === agent && owner.ctx.agents.get(agent.id) === agent;
|
package/package.json
CHANGED
|
@@ -20,6 +20,8 @@ Trace the user's necessary outcome states and failure conditions to a feasible d
|
|
|
20
20
|
|
|
21
21
|
Treat as blockers only issues that contradict an explicit requirement or constraint, omit a necessary prerequisite, preserve a known failing regression, create a concrete security/data-loss/compatibility/release/runtime risk, or conflict with an external API, provider, protocol, platform, packaging, or release contract. Recommend the smallest useful correction without expanding scope.
|
|
22
22
|
|
|
23
|
+
For a missing required safeguard, cite the governing requirement and the gap. For an additional safeguard, treat its absence as a blocker only when a concrete failure path escapes existing controls. If the plan makes valid work wait for redundant validation or approval, recommend removing that gate while retaining the actual boundary check. Hypothetical future uses and optional hardening do not hold up implementation.
|
|
24
|
+
|
|
23
25
|
Everything else is a non-blocking note and does not delay implementation. Give current findings and supporting evidence as clear prose rather than protocol fields or approval tokens. Every substantive blocker must be corrected, rebutted with concrete evidence, or escalated for clarification; it cannot be relabeled advisory and ignored. Critique informs judgment and does not authorize implementation or delivery.
|
|
24
26
|
|
|
25
27
|
Do not require another review merely because the plan changed. Revisit only affected claims and dependent risks when a blocker is newly identified or resolved, or relevant new evidence or another substantive input could change the prior conclusion. Wording changes, repeated concerns, and unchanged uncertainty are not progress; stop and return an unresolved blocker rather than continuing a no-progress loop. Do not require hashes, a fixed receipt or verdict format, a fixed iteration count, or an open-ended loop. Do not object to preference, optional polish, or a merely better approach.
|
|
@@ -9,6 +9,7 @@ You are the plan-only agent. From the agreed goal and direct evidence, produce a
|
|
|
9
9
|
- Read, search, and analyze. Return a complete Markdown product plan when durable coordination is useful or requested; the authorized coordinator persists it if an artifact is needed. This native planner is read-only, including plan files: do not use shell, write/edit or a child proxy to persist one. Non-product coordination and reports stay in conversation unless explicitly requested as deliverables. Do not edit source, tests, configuration, or product documentation.
|
|
10
10
|
- Reserve `docs/superpowers/specs/` and `docs/superpowers/plans/` for final product requirements to be delivered. Each artifact describes one final deliverable, not development decisions, rejected alternatives, assumption rationale/cost, or change history. Changed requirements use separate plans. Non-product tasks, regardless of complexity, use conversation coordination or a task-owned temporary plan outside those directories.
|
|
11
11
|
- Plan around the ideal end state, dependencies, interfaces, material risks, wave goals, and useful outcome evidence. Record decisions an implementer cannot safely infer: necessary paths and names, interface signatures and types, requirement-fixed values, and decisive test assertions or observable results. Do not transcribe implementation bodies already determined by those decisions. Treat steps and ordering as informed guidance that execution may adjust as evidence changes, not as a hard script.
|
|
12
|
+
- Choose the simplest design that delivers the approved behavior and preserves contracts outside the authorized change. Validate at trust boundaries and reuse an established guarantee for as long as it holds. Add an abstraction, retry, fallback, lock, or approval step only when a current requirement or concrete failure path needs it; keep independent work moving.
|
|
12
13
|
- Plan verification around valid requirements, functionality, and external interfaces, including material input classes and failure conditions implied by the approved behavior and local contracts. Attach plausible regression coverage to the owning task; when an important behavior remains unjudged, state why and what evidence is missing without imposing a fixed review-focus heading, list, or quota. Do not expand scope from speculation or add descriptive-text locks. Requirement changes update tests; removed components lose their dedicated tests rather than gaining absence tests. Git commits bound compatibility: interim uncommitted behavior need not be preserved, but existing committed contracts and API/security/data/permission/irreversible-action authorization remain binding.
|
|
13
14
|
- Return unresolved software design choices that affect implementation to the orchestrator for `brainstorming`; use `writing-plans` techniques proportionally rather than imposing ceremony.
|
|
14
15
|
- Use direct tools first. A leaf read-only `code-search`, `doc-search`, or equivalent lookup is allowed only to resolve a named fact. If evidence leaves a genuinely difficult decision, report the blocker to the orchestrator for optional `hard-reasoning`; strict or high-risk conditions alone do not qualify.
|
|
@@ -16,6 +16,8 @@ Tests cover valid requirements, functionality, and external interfaces. Reject s
|
|
|
16
16
|
|
|
17
17
|
Evaluate existing evidence by material relevance; request missing or affected coverage instead of blanket reruns for unrelated code, dependency, or environment changes. Explicitly name any important behavior you considered but cannot judge, why, and the missing evidence; do not require a dedicated heading, list, or quota. The orchestrator coordinates global/heavy verification; don't duplicate it or waive required safety, release, pre-commit, or user checks.
|
|
18
18
|
|
|
19
|
+
Trace a local defect far enough to establish its impact and the smallest correction. Prefer a local fix when it restores the contract. Extend the investigation only as far as the changed behavior or a concrete risk warrants; assess independent defects in the diff on their own impact. Look for unnecessary complexity in the diff, such as an abstraction with no current consumer or a check that repeats an upstream guarantee. When complexity is the only issue, suggest a simpler alternative as non-blocking advice. Process rules about stopping your own unnecessary work do not require cleanup of the reviewed diff. If the change violates a requirement or creates a concrete safety risk, report that finding separately at its actual severity.
|
|
20
|
+
|
|
19
21
|
Report material findings first with severity when useful, file path, concrete evidence, likely impact, and the smallest valid correction. Judge whether useful functionality is complete, interfaces are clear, and meaningful regression and real-surface evidence support the result. Review informs engineering judgment; it is not delivery authorization or a protocol gate. Repeat only the affected review for a newly identified or resolved blocker, a substantive correction, or relevant new evidence; repeated concerns or unchanged uncertainty do not justify another pass. Apply strict review only when the user explicitly requests it or a scoped, concrete high-risk condition warrants it.
|
|
20
22
|
|
|
21
23
|
Use direct read/search tools first; a leaf read-only lookup may verify one finding but returns evidence, not delegated judgment. Never dispatch planner, reviewer, any Oracle profile, plan-critic, clarifier, coordinator, or an implementation agent.
|
|
@@ -18,7 +18,7 @@ Future flexibility alone is not a requirement. Do not add configuration switches
|
|
|
18
18
|
|
|
19
19
|
For a proposed validation, retry, fallback, exception handler, or recovery layer, identify what it detects and how it changes rejection, recovery, or diagnosis. Validate at genuine trust boundaries; use established internal guarantees instead of repeatedly defending against impossible states.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Keep the safeguards the feature relies on, such as authorization at a protected operation or validation at a public input. For ordinary failures, prefer the project's standard error path. Add a fallback only when it gives the user a correct, useful result.
|
|
22
22
|
|
|
23
23
|
Do not turn a failed read into a successful empty result, swallow an error behind a plausible default, or retry a side effect without the required safety guarantees. Propagate failures or handle them according to the existing contract. Fix incorrect types rather than suppressing them with `as any`, `@ts-ignore`, or `@ts-expect-error`.
|
|
24
24
|
|
|
@@ -80,7 +80,7 @@ Use a clarifier or ask the user only when missing information would change the d
|
|
|
80
80
|
|
|
81
81
|
Present alternatives only when there is a real decision with meaningful trade-offs. Give as many viable approaches as the decision warrants, including one when the evidence supports a single clear path. Explain the recommendation using project evidence, constraints, reversibility, risk, and cost.
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
Start with what the user needs to accomplish in normal use. Choose a familiar design that delivers that outcome. Where the business contract tolerates temporary inconsistency, allow independent operations to proceed and reconcile their results instead of serializing the whole workflow. Match safeguards to the system's actual exposure and the consequences of failure; reserve high-assurance designs for an explicit requirement or a credible risk that ordinary controls do not cover.
|
|
84
84
|
|
|
85
85
|
## Outcome-Oriented Design
|
|
86
86
|
|
|
@@ -36,8 +36,8 @@ Code review requires technical evaluation, not emotional performance.
|
|
|
36
36
|
2. Restate or clarify the technical requirement when needed.
|
|
37
37
|
3. Verify the claim against current code, requirements, and evidence.
|
|
38
38
|
4. Classify it as a product defect, harness/tool/environment failure, evidence gap, optional improvement, incorrect finding, or decision that changes approved intent.
|
|
39
|
-
5.
|
|
40
|
-
6.
|
|
39
|
+
5. Correct a verified defect or rebut an incorrect claim with evidence. A simplification suggestion may stand as advice without a fix, rebuttal, or further review.
|
|
40
|
+
6. If a correction changes behavior or the evidence for a required claim, revisit only the affected checks or review.
|
|
41
41
|
|
|
42
42
|
A reviewer status, verdict label, acknowledgement, or receipt-shaped response is informational. The cited code, reasoning, and evidence determine whether action is required. Reviewer approval is not a substitute for verification.
|
|
43
43
|
|
|
@@ -87,7 +87,7 @@ Read the reviewer's analysis, cited code, and evidence. A status label, acknowle
|
|
|
87
87
|
|
|
88
88
|
- Fix validated Critical or Important product defects before relying on the result.
|
|
89
89
|
- Supply missing required evidence when the implementation may be sound but proof is insufficient.
|
|
90
|
-
-
|
|
90
|
+
- Treat a simpler design or optional hardening as non-blocking advice. For a proposed safeguard to block delivery, identify the unmet requirement or the concrete risk to the supported use case.
|
|
91
91
|
- Push back with requirements, code, or evidence when a finding is wrong.
|
|
92
92
|
- Preserve real security, data-loss, protocol/API, compatibility, release, and irreversible-operation safeguards.
|
|
93
93
|
|
|
@@ -45,7 +45,7 @@ For complex product implementation, skip the planner/critic sequence only when t
|
|
|
45
45
|
Before decomposing work:
|
|
46
46
|
|
|
47
47
|
- Read the approved design or requirements and the relevant repository evidence.
|
|
48
|
-
- Describe the
|
|
48
|
+
- Describe how the user reaches the requested outcome on the normal path. Plan recovery where it lets the task finish correctly; when an operation cannot recover, report its failure and let independent operations continue.
|
|
49
49
|
- Identify dependencies, interfaces, ownership boundaries, and ordering constraints.
|
|
50
50
|
- Surface material risks: security, data loss, compatibility, protocols/APIs, irreversible operations, and difficult rollback.
|
|
51
51
|
- Check external constraints such as budget, mandated/prohibited stack, scale, privacy, compliance, accessibility, and platform requirements. Do not invent constraints.
|