@lmzhen/dsh-evolution-core 0.46.0 → 0.48.0

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.
Files changed (101) hide show
  1. package/lib/authority-plugin.js +1 -1
  2. package/lib/composition/index.js +3 -3
  3. package/lib/{composition-Da8NfRI7.js → composition-Cqjbho0t.js} +1 -1
  4. package/lib/{ensure-C5Mo1dbB.js → ensure-CAjLGd9f.js} +1 -2
  5. package/lib/http-routes.js +21 -96
  6. package/lib/index.js +47 -246
  7. package/lib/{io-AmUf4lVY.js → io-GxghO3Ip.js} +30 -70
  8. package/lib/io-node.js +1 -1
  9. package/lib/io-registry.js +1 -35
  10. package/lib/{mutation-authority-DeJ_Wz14.js → mutation-authority-l57R626O.js} +17 -15
  11. package/lib/{mutations-DwvbjRHF.js → mutations-DQXddSJd.js} +1 -1
  12. package/lib/{numeric-DLeLvvGb.js → numeric-D8js3sqC.js} +1 -5
  13. package/lib/platform/index.js +1 -1
  14. package/lib/{platform-CFA12Jam.js → platform-Cc9cNt5j.js} +4 -28
  15. package/lib/policy.js +1 -1
  16. package/lib/runtime/plugin.js +21 -43
  17. package/lib/{session-projection-EB7mUOlJ.js → session-projection-DSXnUNZG.js} +3 -21
  18. package/lib/{skill-health-D1pZGk5V.js → skill-health-DP8z9TPf.js} +4 -25
  19. package/lib/{skill-history-CjypdYqv.js → skill-history-CxrDE3Rb.js} +54 -102
  20. package/lib/skills.js +166 -184
  21. package/lib/subagent/index.js +4 -10
  22. package/lib/types/authority.d.ts +2 -0
  23. package/lib/types/authority.js +5 -0
  24. package/lib/types/composition/preset-ids.d.ts +0 -1
  25. package/lib/types/composition/preset-ids.js +0 -1
  26. package/lib/types/constants.d.ts +0 -4
  27. package/lib/types/constants.js +0 -4
  28. package/lib/types/contract.d.ts +0 -5
  29. package/lib/types/curator.d.ts +0 -1
  30. package/lib/types/curator.js +0 -1
  31. package/lib/types/document-body.d.ts +0 -12
  32. package/lib/types/document-body.js +0 -14
  33. package/lib/types/health-baseline.d.ts +0 -13
  34. package/lib/types/health-baseline.js +0 -20
  35. package/lib/types/home-fence.d.ts +2 -0
  36. package/lib/types/home-fence.js +11 -1
  37. package/lib/types/http-routes.d.ts +9 -4
  38. package/lib/types/http-routes.js +36 -116
  39. package/lib/types/index.d.ts +0 -3
  40. package/lib/types/index.js +0 -3
  41. package/lib/types/io-registry.d.ts +0 -16
  42. package/lib/types/io-registry.js +0 -27
  43. package/lib/types/io.d.ts +6 -54
  44. package/lib/types/io.js +35 -65
  45. package/lib/types/journal-protocol.d.ts +0 -15
  46. package/lib/types/journal-protocol.js +1 -19
  47. package/lib/types/lease-store.d.ts +1 -1
  48. package/lib/types/lease-store.js +4 -15
  49. package/lib/types/live.d.ts +0 -12
  50. package/lib/types/live.js +0 -18
  51. package/lib/types/memory-store.d.ts +0 -1
  52. package/lib/types/memory-store.js +13 -6
  53. package/lib/types/mutation-authority.js +5 -0
  54. package/lib/types/mutation-unit.d.ts +1 -1
  55. package/lib/types/mutation-unit.js +14 -31
  56. package/lib/types/params.d.ts +11 -29
  57. package/lib/types/params.js +13 -60
  58. package/lib/types/platform/llm.d.ts +2 -3
  59. package/lib/types/platform/llm.js +3 -10
  60. package/lib/types/platform/projections.d.ts +4 -5
  61. package/lib/types/platform/projections.js +4 -18
  62. package/lib/types/probe.d.ts +0 -3
  63. package/lib/types/probe.js +0 -7
  64. package/lib/types/run-registry.js +10 -12
  65. package/lib/types/runtime/llm.js +2 -2
  66. package/lib/types/runtime/platform.d.ts +7 -11
  67. package/lib/types/runtime/platform.js +13 -19
  68. package/lib/types/runtime/plugin.d.ts +1 -1
  69. package/lib/types/runtime/plugin.js +6 -4
  70. package/lib/types/runtime/projections.js +1 -2
  71. package/lib/types/session-fold.d.ts +0 -8
  72. package/lib/types/session-fold.js +0 -5
  73. package/lib/types/session-projection.js +2 -2
  74. package/lib/types/skill-discovery.d.ts +0 -2
  75. package/lib/types/skill-discovery.js +1 -2
  76. package/lib/types/skill-health.d.ts +29 -1
  77. package/lib/types/skill-history.d.ts +0 -24
  78. package/lib/types/skill-history.js +0 -41
  79. package/lib/types/skill-lint.d.ts +0 -3
  80. package/lib/types/skill-lint.js +0 -12
  81. package/lib/types/skill-store.d.ts +6 -0
  82. package/lib/types/skill-store.js +130 -142
  83. package/lib/types/subagent/readiness.d.ts +0 -1
  84. package/lib/types/subagent/readiness.js +2 -8
  85. package/lib/types/tool-dispatch.d.ts +1 -16
  86. package/lib/types/tool-dispatch.js +0 -18
  87. package/lib/types/unit-journal.d.ts +1 -1
  88. package/lib/types/unit-journal.js +20 -15
  89. package/lib/types/unit-storage.d.ts +1 -1
  90. package/lib/types/unit-storage.js +5 -16
  91. package/lib/types/write-inventory.d.ts +0 -4
  92. package/lib/types/write-inventory.js +0 -9
  93. package/lib/types/write-kernel.d.ts +3 -4
  94. package/lib/types/write-kernel.js +13 -25
  95. package/lib/write.js +2 -2
  96. package/package.json +1 -1
  97. package/persisted-write-inventory.json +72 -9
  98. package/lib/types/fold-untrusted.d.ts +0 -35
  99. package/lib/types/fold-untrusted.js +0 -44
  100. package/lib/types/unit-recovery.d.ts +0 -5
  101. package/lib/types/unit-recovery.js +0 -12
@@ -1,11 +1,8 @@
1
- import { h as restrictedPresetId, n as ensureRestrictedPreset, r as restrictedPresetState } from "../ensure-C5Mo1dbB.js";
1
+ import { m as restrictedPresetId, n as ensureRestrictedPreset, r as restrictedPresetState } from "../ensure-CAjLGd9f.js";
2
2
  //#region lib/types/subagent/readiness.js
3
3
  function serviceOf$1(ctx, name) {
4
4
  return ctx.get(name);
5
5
  }
6
- function kindOf(kind) {
7
- return kind === "reviewer" ? "reviewer" : "maintainer";
8
- }
9
6
  /** Pure derivation (no side effects): the doctor reads this, the channel re-probes on every run. */
10
7
  function probeChannelState(ctx, kind) {
11
8
  const subagents = serviceOf$1(ctx, "subagents");
@@ -40,14 +37,11 @@ function probeChannelState(ctx, kind) {
40
37
  kind: "available",
41
38
  provider: "spawn",
42
39
  preset: {
43
- id: restrictedPresetId(kindOf(kind)),
44
- registered: restrictedPresetState(ctx, kindOf(kind))?.kind === "ready"
40
+ id: restrictedPresetId(kind),
41
+ registered: restrictedPresetState(ctx, kind)?.kind === "ready"
45
42
  }
46
43
  };
47
44
  }
48
- function subagentChannelState(ctx, kind) {
49
- return probeChannelState(ctx, kind);
50
- }
51
45
  //#endregion
52
46
  //#region lib/types/subagent/channel.js
53
47
  function serviceOf(ctx, name) {
@@ -423,4 +417,4 @@ function createSubagentChannel(ctx) {
423
417
  };
424
418
  }
425
419
  //#endregion
426
- export { createSubagentChannel, probeChannelState, subagentChannelState };
420
+ export { createSubagentChannel, probeChannelState };
@@ -61,6 +61,8 @@ export declare class HomeAuthority {
61
61
  get releaseFailure(): AuthorityReleaseFailure | undefined;
62
62
  /** True while the current call context (or this instance) holds `scope`. */
63
63
  assertHeld(scope: LockScope): boolean;
64
+ /** True only when THIS async call context already holds `scope` (re-entrant nesting). */
65
+ holdsInContext(scope: LockScope): boolean;
64
66
  /** True while this instance holds the home lock for any scope. */
65
67
  get holding(): boolean;
66
68
  /**
@@ -93,6 +93,11 @@ export class HomeAuthority {
93
93
  return context.scopes.has(scope);
94
94
  return (this.held.get(scope) ?? 0) > 0;
95
95
  }
96
+ /** True only when THIS async call context already holds `scope` (re-entrant nesting). */
97
+ holdsInContext(scope) {
98
+ const context = CONTEXT.getStore();
99
+ return context?.owner === this && context.scopes.has(scope);
100
+ }
96
101
  /** True while this instance holds the home lock for any scope. */
97
102
  get holding() {
98
103
  return this.held.size > 0;
@@ -4,7 +4,6 @@ export declare const REVIEWER_PRESET_ID: "evolution-reviewer-readonly";
4
4
  export declare const MAINTAINER_PRESET_ID: "evolution-maintainer-readonly";
5
5
  export declare const RESTRICTED_TOOLS_ROW_ID: "evolution-restricted-tools";
6
6
  export declare const RESTRICTOR_MODULE: string;
7
- export declare const RESTRICTED_PRESET_DELIVERY: "runtime" | "installer";
8
7
  export interface RestrictedPresetDisplay {
9
8
  readonly name: string;
10
9
  readonly description: string;
@@ -6,7 +6,6 @@ export const REVIEWER_PRESET_ID = 'evolution-reviewer-readonly';
6
6
  export const MAINTAINER_PRESET_ID = 'evolution-maintainer-readonly';
7
7
  export const RESTRICTED_TOOLS_ROW_ID = 'evolution-restricted-tools';
8
8
  export const RESTRICTOR_MODULE = scopedPackageName('dsh-evolution-core/restrictor', import.meta.url);
9
- export const RESTRICTED_PRESET_DELIVERY = 'runtime';
10
9
  export const RESTRICTED_PRESET_DISPLAY = {
11
10
  reviewer: { name: 'evolution reviewer (read-only)', description: 'Internal restricted preset used by the family review channel.', order: 900 },
12
11
  maintainer: { name: 'evolution maintainer (read-only)', description: 'Internal restricted preset used by the family maintenance channel.', order: 901 },
@@ -75,7 +75,6 @@ export declare const UPSTREAM_LIMIT_CHARS_PER_TOKEN = 2.75;
75
75
  * tokenization is needed"), matching upstream's ESTIMATE-side heuristic — "~4
76
76
  * chars/token is the usual English heuristic" (\`agent/prompt_builder.py:1179\`).
77
77
  * Estimates use this; limits use the constant above. */
78
- export declare const PLATFORM_ESTIMATE_CHARS_PER_TOKEN = 4;
79
78
  export declare const MAX_SKILL_FILE_BYTES = 1048576;
80
79
  export declare const DEFAULT_REVIEW_MEMORY_INTERVAL = 10;
81
80
  export declare const DEFAULT_REVIEW_SKILL_INTERVAL = 10;
@@ -112,8 +111,6 @@ export declare const DEFAULT_SKILL_CONTENT_CHARS = 100000;
112
111
  /** P3-19 (v14): defaults that were written twice (schema `.default()` AND the
113
112
  * clamp fallback literal) now have one home per value. */
114
113
  export declare const DEFAULT_REVIEW_TIMEOUT_MS = 120000;
115
- export declare const DEFAULT_REVIEW_CONTEXT_MESSAGES = 60;
116
- export declare const DEFAULT_REVIEW_MESSAGE_CHARS = 2000;
117
114
  export declare const DEFAULT_CURATOR_BOOT_GRACE_SECONDS = 10;
118
115
  export declare const DEFAULT_CURATOR_REVIEW_MAX_TOKENS = 2048;
119
116
  /** Threat-scan WINDOW SIZE (not a total cap — E-12: the whole text is scanned in
@@ -147,7 +144,6 @@ export declare const AUTHORING_DESCRIPTION_BAR = 60;
147
144
  * this default only governs compositions that do not override it. It is NOT a refusal threshold:
148
145
  * the only refusal is `MAX_DESCRIPTION_LENGTH` / the row's `maxDescriptionLength`, and the catalog
149
146
  * cut is a view, not a validation. See tool-skill-manage/README.md for the three-number table. */
150
- export declare const PLATFORM_CATALOG_DESCRIPTION_DEFAULT = 500;
151
147
  /** The split hint both size refusals share (0.5.0 V1). The same sentence used to
152
148
  * be copied into validateFrontmatter AND the patch path, and neither copy named
153
149
  * where the content should go — the upstream cap message names the destination
@@ -91,7 +91,6 @@ export const UPSTREAM_LIMIT_CHARS_PER_TOKEN = 2.75;
91
91
  * tokenization is needed"), matching upstream's ESTIMATE-side heuristic — "~4
92
92
  * chars/token is the usual English heuristic" (\`agent/prompt_builder.py:1179\`).
93
93
  * Estimates use this; limits use the constant above. */
94
- export const PLATFORM_ESTIMATE_CHARS_PER_TOKEN = 4;
95
94
  export const MAX_SKILL_FILE_BYTES = 1_048_576;
96
95
  // ── Cross-package shared tunable defaults ────────────────────────────────────
97
96
  // Fallback defaults when no config override is set. Single-sourced here;
@@ -131,8 +130,6 @@ export const DEFAULT_SKILL_CONTENT_CHARS = MAX_SKILL_CONTENT_CHARS;
131
130
  /** P3-19 (v14): defaults that were written twice (schema `.default()` AND the
132
131
  * clamp fallback literal) now have one home per value. */
133
132
  export const DEFAULT_REVIEW_TIMEOUT_MS = 120_000;
134
- export const DEFAULT_REVIEW_CONTEXT_MESSAGES = 60;
135
- export const DEFAULT_REVIEW_MESSAGE_CHARS = 2_000;
136
133
  export const DEFAULT_CURATOR_BOOT_GRACE_SECONDS = 10;
137
134
  export const DEFAULT_CURATOR_REVIEW_MAX_TOKENS = 2_048;
138
135
  /** Threat-scan WINDOW SIZE (not a total cap — E-12: the whole text is scanned in
@@ -166,7 +163,6 @@ export const AUTHORING_DESCRIPTION_BAR = 60;
166
163
  * this default only governs compositions that do not override it. It is NOT a refusal threshold:
167
164
  * the only refusal is `MAX_DESCRIPTION_LENGTH` / the row's `maxDescriptionLength`, and the catalog
168
165
  * cut is a view, not a validation. See tool-skill-manage/README.md for the three-number table. */
169
- export const PLATFORM_CATALOG_DESCRIPTION_DEFAULT = 500;
170
166
  /** The split hint both size refusals share (0.5.0 V1). The same sentence used to
171
167
  * be copied into validateFrontmatter AND the patch path, and neither copy named
172
168
  * where the content should go — the upstream cap message names the destination
@@ -21,11 +21,6 @@ export interface EvolutionEvent<TPayload = unknown> {
21
21
  readonly version: 1;
22
22
  readonly payload: TPayload;
23
23
  }
24
- /** A lifecycle service implemented by a capability package. */
25
- export interface EvolutionLifecycleService {
26
- /** Stable service name used in diagnostics. */
27
- readonly name: string;
28
- }
29
24
  /** Legal kind of one pending write. The runtime source stays in state-storage. */
30
25
  export type PendingKind = 'memory' | 'skill' | 'capability';
31
26
  /** Legal status of one pending write. */
@@ -7,7 +7,6 @@
7
7
  */
8
8
  import type { UsageMap, UsageRecord } from './usage.ts';
9
9
  import { EvolutionGateSet } from './gates.ts';
10
- export { PROTECTED_BUILTIN_SKILLS } from './constants.ts';
11
10
  export interface CuratorConfig {
12
11
  staleAfterDays: number;
13
12
  archiveAfterDays: number;
@@ -8,7 +8,6 @@
8
8
  import { daysSinceIso, idleDays } from "./usage.js";
9
9
  import { createGateSet } from "./gates.js";
10
10
  import { PROTECTED_BUILTIN_SKILLS, SKILL_NAME_RE } from "./constants.js";
11
- export { PROTECTED_BUILTIN_SKILLS } from "./constants.js";
12
11
  export function buildCuratorRunReport(input) {
13
12
  return {
14
13
  schemaVersion: 1,
@@ -41,16 +41,4 @@ export interface H2Section {
41
41
  * @returns one row per H2 heading, with `count` filled in a second pass.
42
42
  */
43
43
  export declare function h2Sections(body: string): H2Section[];
44
- /** One move the panel can hand to `restructure` without the store refusing it. */
45
- export interface RestructureCandidate {
46
- heading: string;
47
- toFile: string;
48
- }
49
- /**
50
- * The sections a restructure proposal may name: heading unique, section non-empty. Derived from
51
- * `h2Sections`, i.e. from the SAME scan the store validates against.
52
- * @param body - the markdown after the frontmatter block.
53
- * @returns move-ready pairs in document order; empty when nothing qualifies.
54
- */
55
- export declare function restructureCandidates(body: string): RestructureCandidate[];
56
44
  //# sourceMappingURL=document-body.d.ts.map
@@ -74,18 +74,4 @@ export function h2Sections(body) {
74
74
  row.count = rows.filter(other => other.title === row.title).length;
75
75
  return rows;
76
76
  }
77
- /**
78
- * The sections a restructure proposal may name: heading unique, section non-empty. Derived from
79
- * `h2Sections`, i.e. from the SAME scan the store validates against.
80
- * @param body - the markdown after the frontmatter block.
81
- * @returns move-ready pairs in document order; empty when nothing qualifies.
82
- */
83
- export function restructureCandidates(body) {
84
- return h2Sections(body)
85
- .filter(section => section.count === 1 && section.end > section.start + 1)
86
- .map(section => ({
87
- heading: section.title,
88
- toFile: 'references/' + section.title.toLowerCase().replace(/[^a-z0-9\u4e00-\u9fa5]+/g, '-').replace(/^-+|-+$/g, '') + '.md',
89
- }));
90
- }
91
77
  //# sourceMappingURL=document-body.js.map
@@ -20,18 +20,5 @@ export interface HealthBaseline {
20
20
  };
21
21
  values: Record<string, RuleAdmission>;
22
22
  }
23
- export interface AdmissionThresholds {
24
- /** A user-library hit rate below this is too rare to be worth a rule. */
25
- minUserHitRate: number;
26
- /** …and above this it is furniture (every skill trips it, so it carries no signal). */
27
- maxUserHitRate: number;
28
- }
29
- export declare const DEFAULT_ADMISSION: AdmissionThresholds;
30
23
  export declare function buildHealthBaseline(skills: readonly CorpusSkill[]): HealthBaseline;
31
- /** The admission verdict for ONE rule id (contract §4): platform corpus must not trip it, and the
32
- * user-library hit rate must land inside the band. Every failure names the number it failed on. */
33
- export declare function admissionVerdict(baseline: HealthBaseline, ruleId: string, thresholds?: AdmissionThresholds): {
34
- admitted: boolean;
35
- failures: string[];
36
- };
37
24
  //# sourceMappingURL=health-baseline.d.ts.map
@@ -10,7 +10,6 @@
10
10
  * Pure: no IO. `values` is keyed by rule id so a diff between two baselines is a map diff.
11
11
  */
12
12
  import { lintSkill, RULES } from "./skill-lint.js";
13
- export const DEFAULT_ADMISSION = { minUserHitRate: 0.05, maxUserHitRate: 0.25 };
14
13
  export function buildHealthBaseline(skills) {
15
14
  const values = {};
16
15
  for (const rule of RULES)
@@ -41,23 +40,4 @@ export function buildHealthBaseline(skills) {
41
40
  values,
42
41
  };
43
42
  }
44
- /** The admission verdict for ONE rule id (contract §4): platform corpus must not trip it, and the
45
- * user-library hit rate must land inside the band. Every failure names the number it failed on. */
46
- export function admissionVerdict(baseline, ruleId, thresholds = DEFAULT_ADMISSION) {
47
- const row = baseline.values[ruleId];
48
- const failures = [];
49
- if (row === undefined)
50
- return { admitted: false, failures: ['rule ' + ruleId + ' has no baseline row'] };
51
- if (baseline.corpora.platform === 0)
52
- failures.push('no platform-corpus skills measured — a vacuous 0-hit count admits any rule');
53
- else if (row.platformHits !== 0)
54
- failures.push('platform corpus trips ' + ruleId + ' ' + String(row.platformHits) + ' time(s) — a rule the shipped library violates is unsatisfiable');
55
- if (baseline.corpora.user === 0)
56
- failures.push('no user-library skills measured — a rate over an empty corpus proves nothing');
57
- else if (row.userHitRate < thresholds.minUserHitRate)
58
- failures.push(ruleId + ' hits ' + row.userHitRate.toFixed(3) + ' of the user library, below ' + String(thresholds.minUserHitRate) + ' — too rare to be worth a rule');
59
- else if (row.userHitRate > thresholds.maxUserHitRate)
60
- failures.push(ruleId + ' hits ' + row.userHitRate.toFixed(3) + ' of the user library, above ' + String(thresholds.maxUserHitRate) + ' — furniture, no signal');
61
- return { admitted: failures.length === 0, failures };
62
- }
63
43
  //# sourceMappingURL=health-baseline.js.map
@@ -33,6 +33,8 @@ export declare class HomeFence {
33
33
  constructor(options: HomeFenceOptions);
34
34
  /** The last release failure, if any; diagnostics only. */
35
35
  get releaseFailure(): AuthorityReleaseFailure | undefined;
36
+ /** True only when this async call context already holds the home tree scope. */
37
+ holdsTree(): boolean;
36
38
  run<T>(body: (lock: TreeLock) => Promise<T>): Promise<T>;
37
39
  acquire(): Promise<HomeFenceLease>;
38
40
  }
@@ -43,9 +43,19 @@ export class HomeFence {
43
43
  get releaseFailure() {
44
44
  return this.authority.releaseFailure;
45
45
  }
46
+ /** True only when this async call context already holds the home tree scope. */
47
+ holdsTree() {
48
+ return this.authority.holdsInContext('tree');
49
+ }
46
50
  async run(body) {
51
+ const invoke = async () => await body(lockView(this.authority));
47
52
  try {
48
- return await this.authority.runExclusive('tree', async () => await body(lockView(this.authority)));
53
+ // Bookkeeping called from inside a write already holds the tree scope. It must
54
+ // run inline rather than request the same fence again (that is an undeclared
55
+ // re-entry). A caller that does NOT hold it still acquires normally.
56
+ if (this.authority.holdsInContext('tree'))
57
+ return await this.authority.runNested('tree', invoke);
58
+ return await this.authority.runExclusive('tree', invoke);
49
59
  }
50
60
  catch (error) {
51
61
  throw classify(error);
@@ -65,10 +65,6 @@ export declare const HOST_ROUTES: {
65
65
  readonly diagnostics: {
66
66
  readonly view: "/api/dsh-evolution/diagnostics";
67
67
  };
68
- readonly settings: {
69
- readonly describe: "/api/dsh-evolution/settings/describe";
70
- readonly mutate: "/api/dsh-evolution/settings/mutate";
71
- };
72
68
  };
73
69
  export type HostSurface = {
74
70
  readonly available: true;
@@ -79,6 +75,15 @@ export type HostSurface = {
79
75
  readonly reason: 'connection-missing' | 'service-absent';
80
76
  };
81
77
  export declare function hostSurface(ctx: Context): HostSurface;
78
+ /**
79
+ * Register the family host surface on the platform's exact-route carrier.
80
+ *
81
+ * The platform owns admission (Host/Origin hygiene + browserAuth + exact-route owner peer) and the
82
+ * disposer is bound to the CALLING fiber, not the connection service: the connection service can
83
+ * outlive a reloaded family fiber, so the family must release its own registrations on dispose.
84
+ * Routes carry the audit snapshot taken at registration time (deployment-level facts only — the
85
+ * exact-route handler receives a Request, not the peer identity).
86
+ */
82
87
  export declare function registerHostRoutes(owner: Context, build: (audit: DecisionAudit) => readonly ConnectionFetchRouteLike[]): void;
83
88
  export declare function json(status: number, body: unknown): Response;
84
89
  export declare function methodNotAllowed(allowed: readonly HttpMethod[]): Response;
@@ -62,10 +62,6 @@ export const HOST_ROUTES = {
62
62
  diagnostics: {
63
63
  view: '/api/dsh-evolution/diagnostics',
64
64
  },
65
- settings: {
66
- describe: '/api/dsh-evolution/settings/describe',
67
- mutate: '/api/dsh-evolution/settings/mutate',
68
- },
69
65
  };
70
66
  export function hostSurface(ctx) {
71
67
  const connection = ctx.get('connection');
@@ -74,78 +70,15 @@ export function hostSurface(ctx) {
74
70
  const allows = connection.allowsRemoteAuthorities === true;
75
71
  return { available: true, allowsRemoteAuthorities: allows };
76
72
  }
77
- function isLoopback(address) {
78
- const value = address ?? '';
79
- return value === '127.0.0.1' || value === '::1' || value === '::ffff:127.0.0.1';
80
- }
81
- function sameOrigin(origin, host) {
82
- if (origin === undefined)
83
- return true;
84
- try {
85
- const parsed = new URL(origin);
86
- return isLoopback(parsed.hostname) && host !== undefined && parsed.host === host;
87
- }
88
- catch {
89
- return false;
90
- }
91
- }
92
- function nodeRoute(route) {
93
- return {
94
- kind: 'exact',
95
- path: route.path,
96
- handler: async (req, res) => {
97
- if (!isLoopback(req.socket.remoteAddress)) {
98
- res.statusCode = 403;
99
- res.end('forbidden');
100
- return;
101
- }
102
- if (!sameOrigin(req.headers.origin, req.headers.host)) {
103
- res.statusCode = 403;
104
- res.end('forbidden');
105
- return;
106
- }
107
- const fetchSite = req.headers['sec-fetch-site'];
108
- if (fetchSite !== undefined && fetchSite !== 'same-origin' && fetchSite !== 'none') {
109
- res.statusCode = 403;
110
- res.end('forbidden');
111
- return;
112
- }
113
- const method = req.method ?? 'GET';
114
- if (method !== 'GET' && method !== 'HEAD' && !(req.headers['content-type'] ?? '').toLowerCase().startsWith('application/json')) {
115
- res.statusCode = 415;
116
- res.end('json required');
117
- return;
118
- }
119
- try {
120
- const chunks = [];
121
- for await (const chunk of req)
122
- chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
123
- const headers = new Headers();
124
- for (const [key, value] of Object.entries(req.headers)) {
125
- if (value === undefined)
126
- continue;
127
- headers.set(key, Array.isArray(value) ? value.join(',') : value);
128
- }
129
- const request = new Request(new URL(req.url ?? '/', 'http://127.0.0.1'), {
130
- method,
131
- headers,
132
- ...(method === 'GET' || method === 'HEAD' || chunks.length === 0 ? {} : { body: Buffer.concat(chunks) }),
133
- });
134
- const response = await route.fetch(request);
135
- res.statusCode = response.status;
136
- response.headers.forEach((value, key) => { try {
137
- res.setHeader(key, value);
138
- }
139
- catch { /* ignore forbidden node header */ } });
140
- res.end(Buffer.from(await response.arrayBuffer()));
141
- }
142
- catch (error) {
143
- res.statusCode = 500;
144
- res.end(error instanceof Error ? error.message : String(error));
145
- }
146
- },
147
- };
148
- }
73
+ /**
74
+ * Register the family host surface on the platform's exact-route carrier.
75
+ *
76
+ * The platform owns admission (Host/Origin hygiene + browserAuth + exact-route owner peer) and the
77
+ * disposer is bound to the CALLING fiber, not the connection service: the connection service can
78
+ * outlive a reloaded family fiber, so the family must release its own registrations on dispose.
79
+ * Routes carry the audit snapshot taken at registration time (deployment-level facts only — the
80
+ * exact-route handler receives a Request, not the peer identity).
81
+ */
149
82
  export function registerHostRoutes(owner, build) {
150
83
  const injecting = owner;
151
84
  if (typeof injecting.inject !== 'function')
@@ -166,50 +99,37 @@ export function registerHostRoutes(owner, build) {
166
99
  const effect = scope.effect;
167
100
  if (typeof effect !== 'function')
168
101
  throw new Error('connection scope has no effect() to own the registration');
169
- if (connection?.fetch !== undefined && typeof connection.fetch.register === 'function') {
170
- const register = connection.fetch.register.bind(connection.fetch);
171
- effect.call(scope, () => {
172
- const disposers = [];
173
- try {
174
- for (const route of routes)
175
- disposers.push(register(route));
176
- }
177
- catch (error) {
178
- for (const dispose of disposers) {
179
- try {
180
- void dispose();
181
- }
182
- catch { /* best-effort rollback */ }
102
+ // Phase 0 #3 (W11): 0.2.2-rc.0 is not a published line for @deepseek-ai/dsh; the earliest
103
+ // installable platform (rc.1) always carries connection.fetch. A missing register is an
104
+ // assembly error, not a reason to fall back to a loopback webserver bridge — that bridge was
105
+ // the second admission path the audit found (G4 had already deleted the fence it duplicated).
106
+ if (connection?.fetch === undefined || typeof connection.fetch.register !== 'function') {
107
+ throw new Error('connection.fetch.register() is required to register family host routes (platform >= 0.2.2-rc.1); no fallback admission path exists');
108
+ }
109
+ const register = connection.fetch.register.bind(connection.fetch);
110
+ effect.call(scope, () => {
111
+ const disposers = [];
112
+ try {
113
+ for (const route of routes)
114
+ disposers.push(register(route));
115
+ }
116
+ catch (error) {
117
+ for (const dispose of disposers) {
118
+ try {
119
+ void dispose();
183
120
  }
184
- throw error;
121
+ catch { /* best-effort rollback */ }
185
122
  }
186
- return () => {
187
- for (const dispose of disposers) {
188
- try {
189
- void dispose();
190
- }
191
- catch { /* a failed disposer must not mask the others */ }
123
+ throw error;
124
+ }
125
+ return () => {
126
+ for (const dispose of disposers) {
127
+ try {
128
+ void dispose();
192
129
  }
193
- };
194
- }, 'evolution-host-routes');
195
- return;
196
- }
197
- // Platform 0.2.x moved Host data-plane registration to connection.rpc. The family
198
- // HTTP contract stays exact paths; a loopback-only webserver bridge preserves it
199
- // without exposing these routes to remote authorities.
200
- const web = (scope.get?.('webServer')
201
- ?? owner.get?.('webServer'));
202
- if (web === undefined || typeof web.register !== 'function') {
203
- throw new Error('connection service has no fetch.register(), and webServer is not mounted for the loopback host-route bridge');
204
- }
205
- effect.call(scope, () => {
206
- const disposers = routes.map(route => web.register(nodeRoute(route)));
207
- return () => { for (const dispose of disposers) {
208
- try {
209
- dispose();
130
+ catch { /* a failed disposer must not mask the others */ }
210
131
  }
211
- catch { /* best-effort */ }
212
- } };
132
+ };
213
133
  }, 'evolution-host-routes');
214
134
  });
215
135
  }
@@ -18,8 +18,6 @@
18
18
  * `payload.ts` (which of `facts`/`content` is the payload — one rule for the whole family).
19
19
  * - **Security primitives** — `threats.ts` (content threat scanner),
20
20
  * `redact.ts` (credential masking at model boundaries),
21
- * `fold-untrusted.ts` (untrusted text must not become prompt structure). Consumers:
22
- * evolution-policy/threat, both stores, review, maintenance.
23
21
  * - **Core domain stores/logic** — `skill-store.ts` (skill tree engine +
24
22
  * IO-seam consumer), `memory-store.ts`, `usage.ts`, `curator.ts`,
25
23
  * `quality.ts`, `signals.ts`, `skill-reads.ts` (the read-before-write rule, shared by the
@@ -99,7 +97,6 @@ export * from './live.ts';
99
97
  export * from './numeric.ts';
100
98
  export * from './opt-in.ts';
101
99
  export * from './payload.ts';
102
- export * from './fold-untrusted.ts';
103
100
  export * from './subagent/index.ts';
104
101
  export { EVOLUTION_PRESET_IDS, REVIEWER_PRESET_ID, MAINTAINER_PRESET_ID, RESTRICTED_TOOLS_ROW_ID, RESTRICTOR_MODULE, RESTRICTED_PRESET_DISPLAY, } from './composition/index.ts';
105
102
  export type { RestrictedPresetKind, RestrictedPresetDisplay, RestrictedPresetRequest, RestrictedPresetState, } from './composition/index.ts';
@@ -18,8 +18,6 @@
18
18
  * `payload.ts` (which of `facts`/`content` is the payload — one rule for the whole family).
19
19
  * - **Security primitives** — `threats.ts` (content threat scanner),
20
20
  * `redact.ts` (credential masking at model boundaries),
21
- * `fold-untrusted.ts` (untrusted text must not become prompt structure). Consumers:
22
- * evolution-policy/threat, both stores, review, maintenance.
23
21
  * - **Core domain stores/logic** — `skill-store.ts` (skill tree engine +
24
22
  * IO-seam consumer), `memory-store.ts`, `usage.ts`, `curator.ts`,
25
23
  * `quality.ts`, `signals.ts`, `skill-reads.ts` (the read-before-write rule, shared by the
@@ -100,7 +98,6 @@ export * from "./live.js";
100
98
  export * from "./numeric.js";
101
99
  export * from "./opt-in.js";
102
100
  export * from "./payload.js";
103
- export * from "./fold-untrusted.js";
104
101
  // G0 contract surface: /subagent types + state probe, /composition preset constants.
105
102
  export * from "./subagent/index.js";
106
103
  export { EVOLUTION_PRESET_IDS, REVIEWER_PRESET_ID, MAINTAINER_PRESET_ID, RESTRICTED_TOOLS_ROW_ID, RESTRICTOR_MODULE, RESTRICTED_PRESET_DISPLAY, } from "./composition/index.js";
@@ -51,21 +51,5 @@ export declare class EvolutionIoRegistry extends Service {
51
51
  }): () => void;
52
52
  provider(name?: string): EvolutionIo;
53
53
  }
54
- /**
55
- * The read-only face of the marker: what served THIS registry, without resolving anything.
56
- * @param registry - the seam registry the caller already holds.
57
- * @returns `known` with the observation, or `unknown` when nothing resolved through this registry yet.
58
- */
59
- export declare function describeMedium(registry: object): {
60
- readonly state: 'known';
61
- readonly requested: readonly string[];
62
- readonly resolved: string | undefined;
63
- readonly via: string;
64
- } | {
65
- readonly state: 'unknown';
66
- };
67
- export declare function preferProvider<T>(registry: {
68
- provider(name?: string): T;
69
- }, names: readonly string[]): T;
70
54
  export default EvolutionIoRegistry;
71
55
  //# sourceMappingURL=io-registry.d.ts.map
@@ -95,32 +95,5 @@ export class EvolutionIoRegistry extends Service {
95
95
  return first;
96
96
  }
97
97
  }
98
- const mediumObservations = new WeakMap();
99
- /**
100
- * The read-only face of the marker: what served THIS registry, without resolving anything.
101
- * @param registry - the seam registry the caller already holds.
102
- * @returns `known` with the observation, or `unknown` when nothing resolved through this registry yet.
103
- */
104
- export function describeMedium(registry) {
105
- const observation = mediumObservations.get(registry);
106
- if (observation === undefined)
107
- return { state: 'unknown' };
108
- return { state: 'known', requested: observation.requested, resolved: observation.resolved, via: observation.via };
109
- }
110
- export function preferProvider(registry, names) {
111
- for (const name of names) {
112
- try {
113
- const resolved = registry.provider(name);
114
- mediumObservations.set(registry, { requested: names, resolved: name, via: 'preference' });
115
- return resolved;
116
- }
117
- catch {
118
- // Not registered: this name is a preference, not a requirement (see the JSDoc).
119
- }
120
- }
121
- const fallback = registry.provider();
122
- mediumObservations.set(registry, { requested: names, resolved: undefined, via: 'default' });
123
- return fallback;
124
- }
125
98
  export default EvolutionIoRegistry;
126
99
  //# sourceMappingURL=io-registry.js.map