dsh-harness-reflex 0.1.0 → 0.3.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 (124) hide show
  1. package/README.md +20 -6
  2. package/client.js +3511 -185
  3. package/dist/attribution.d.ts +266 -0
  4. package/dist/attribution.js +238 -0
  5. package/dist/attribution.js.map +1 -0
  6. package/dist/bridge.d.ts +311 -13
  7. package/dist/bridge.js +714 -42
  8. package/dist/bridge.js.map +1 -1
  9. package/dist/client-bundle.js +4 -1
  10. package/dist/client-bundle.js.map +1 -1
  11. package/dist/command.js +10 -0
  12. package/dist/command.js.map +1 -1
  13. package/dist/config.d.ts +530 -22
  14. package/dist/config.js +808 -27
  15. package/dist/config.js.map +1 -1
  16. package/dist/delegation-dispatch.d.ts +132 -0
  17. package/dist/delegation-dispatch.js +186 -0
  18. package/dist/delegation-dispatch.js.map +1 -0
  19. package/dist/delegation-health.d.ts +131 -0
  20. package/dist/delegation-health.js +97 -0
  21. package/dist/delegation-health.js.map +1 -0
  22. package/dist/delegation.d.ts +148 -0
  23. package/dist/delegation.js +186 -0
  24. package/dist/delegation.js.map +1 -0
  25. package/dist/effort-delegation.d.ts +144 -0
  26. package/dist/effort-delegation.js +280 -0
  27. package/dist/effort-delegation.js.map +1 -0
  28. package/dist/effort.d.ts +141 -0
  29. package/dist/effort.js +251 -9
  30. package/dist/effort.js.map +1 -1
  31. package/dist/host-patch.d.ts +156 -0
  32. package/dist/host-patch.js +534 -0
  33. package/dist/host-patch.js.map +1 -0
  34. package/dist/index.d.ts +12 -3
  35. package/dist/index.js +99 -7
  36. package/dist/index.js.map +1 -1
  37. package/dist/interventions.d.ts +98 -373
  38. package/dist/interventions.js +442 -1702
  39. package/dist/interventions.js.map +1 -1
  40. package/dist/panel-api.d.ts +328 -4
  41. package/dist/panel-api.js +322 -15
  42. package/dist/panel-api.js.map +1 -1
  43. package/dist/panel-mount.d.ts +81 -22
  44. package/dist/panel-mount.js +228 -7
  45. package/dist/panel-mount.js.map +1 -1
  46. package/dist/routing.d.ts +23 -18
  47. package/dist/routing.js +471 -153
  48. package/dist/routing.js.map +1 -1
  49. package/dist/session-audit.d.ts +70 -0
  50. package/dist/session-audit.js +73 -0
  51. package/dist/session-audit.js.map +1 -1
  52. package/dist/systemone-probe.d.ts +114 -0
  53. package/dist/systemone-probe.js +383 -0
  54. package/dist/systemone-probe.js.map +1 -0
  55. package/dist/testing.d.ts +212 -7
  56. package/dist/testing.js +333 -27
  57. package/dist/testing.js.map +1 -1
  58. package/dist/tools.d.ts +109 -3
  59. package/dist/tools.js +103 -4
  60. package/dist/tools.js.map +1 -1
  61. package/dist/unconfigured-backend.d.ts +72 -0
  62. package/dist/unconfigured-backend.js +94 -0
  63. package/dist/unconfigured-backend.js.map +1 -0
  64. package/dist/vendor/harness-reflex/backend/factory.d.ts +31 -1
  65. package/dist/vendor/harness-reflex/backend/factory.js +18 -3
  66. package/dist/vendor/harness-reflex/backend/factory.js.map +1 -1
  67. package/dist/vendor/harness-reflex/backend/jev.d.ts +20 -0
  68. package/dist/vendor/harness-reflex/backend/jev.js +11 -4
  69. package/dist/vendor/harness-reflex/backend/jev.js.map +1 -1
  70. package/dist/vendor/harness-reflex/backend/simple-jev.d.ts +16 -0
  71. package/dist/vendor/harness-reflex/backend/simple-jev.js +17 -6
  72. package/dist/vendor/harness-reflex/backend/simple-jev.js.map +1 -1
  73. package/dist/vendor/harness-reflex/core/closing.d.ts +90 -0
  74. package/dist/vendor/harness-reflex/core/closing.js +111 -0
  75. package/dist/vendor/harness-reflex/core/closing.js.map +1 -0
  76. package/dist/vendor/harness-reflex/core/evidence.d.ts +119 -0
  77. package/dist/vendor/harness-reflex/core/evidence.js +209 -0
  78. package/dist/vendor/harness-reflex/core/evidence.js.map +1 -0
  79. package/dist/vendor/harness-reflex/core/judge.d.ts +221 -0
  80. package/dist/vendor/harness-reflex/core/judge.js +251 -0
  81. package/dist/vendor/harness-reflex/core/judge.js.map +1 -0
  82. package/dist/vendor/harness-reflex/core/orchestrate-closing.d.ts +237 -0
  83. package/dist/vendor/harness-reflex/core/orchestrate-closing.js +250 -0
  84. package/dist/vendor/harness-reflex/core/orchestrate-closing.js.map +1 -0
  85. package/dist/vendor/harness-reflex/core/orchestrate-correction.d.ts +209 -0
  86. package/dist/vendor/harness-reflex/core/orchestrate-correction.js +141 -0
  87. package/dist/vendor/harness-reflex/core/orchestrate-correction.js.map +1 -0
  88. package/dist/vendor/harness-reflex/core/orchestrate-host.d.ts +225 -0
  89. package/dist/vendor/harness-reflex/core/orchestrate-host.js +80 -0
  90. package/dist/vendor/harness-reflex/core/orchestrate-host.js.map +1 -0
  91. package/dist/vendor/harness-reflex/core/orchestrate-stagnation.d.ts +259 -0
  92. package/dist/vendor/harness-reflex/core/orchestrate-stagnation.js +270 -0
  93. package/dist/vendor/harness-reflex/core/orchestrate-stagnation.js.map +1 -0
  94. package/dist/vendor/harness-reflex/core/orchestrate.d.ts +357 -0
  95. package/dist/vendor/harness-reflex/core/orchestrate.js +418 -0
  96. package/dist/vendor/harness-reflex/core/orchestrate.js.map +1 -0
  97. package/dist/vendor/harness-reflex/core/policy.d.ts +122 -0
  98. package/dist/vendor/harness-reflex/core/policy.js +102 -0
  99. package/dist/vendor/harness-reflex/core/policy.js.map +1 -0
  100. package/dist/vendor/harness-reflex/core/prune-plan.d.ts +141 -0
  101. package/dist/vendor/harness-reflex/core/prune-plan.js +390 -0
  102. package/dist/vendor/harness-reflex/core/prune-plan.js.map +1 -0
  103. package/dist/vendor/harness-reflex/core/text.d.ts +36 -0
  104. package/dist/vendor/harness-reflex/core/text.js +66 -0
  105. package/dist/vendor/harness-reflex/core/text.js.map +1 -0
  106. package/dist/vendor/harness-reflex/ports/audit.d.ts +18 -0
  107. package/dist/vendor/harness-reflex/ports/audit.js +11 -0
  108. package/dist/vendor/harness-reflex/ports/audit.js.map +1 -0
  109. package/dist/vendor/harness-reflex/ports/clock.d.ts +14 -0
  110. package/dist/vendor/harness-reflex/ports/clock.js +11 -0
  111. package/dist/vendor/harness-reflex/ports/clock.js.map +1 -0
  112. package/dist/vendor/harness-reflex/ports/decision.d.ts +75 -0
  113. package/dist/vendor/harness-reflex/ports/decision.js +2 -0
  114. package/dist/vendor/harness-reflex/ports/decision.js.map +1 -0
  115. package/dist/vendor/harness-reflex/ports/index.d.ts +14 -0
  116. package/dist/vendor/harness-reflex/ports/index.js +2 -0
  117. package/dist/vendor/harness-reflex/ports/index.js.map +1 -0
  118. package/dist/vendor/harness-reflex/ports/log.d.ts +22 -0
  119. package/dist/vendor/harness-reflex/ports/log.js +12 -0
  120. package/dist/vendor/harness-reflex/ports/log.js.map +1 -0
  121. package/dist/vendor/harness-reflex/ports/state.d.ts +46 -0
  122. package/dist/vendor/harness-reflex/ports/state.js +13 -0
  123. package/dist/vendor/harness-reflex/ports/state.js.map +1 -0
  124. package/package.json +25 -13
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prune-plan.js","sourceRoot":"","sources":["../../../../src/vendor/harness-reflex/core/prune-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,iFAAiF;AACjF,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AACpC,iFAAiF;AACjF,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAuEpC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,cAAc,CAC5B,aAAqB,EACrB,cAAsB,EACtB,OAA0B;IAE1B,IAAI,cAAc,KAAK,CAAC,IAAI,cAAc,IAAI,aAAa,EAAE,CAAC;QAC5D,OAAO,aAAa,CAAC,aAAa,CAAC,CAAC;IACtC,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,WAAW,IAAI,CAAC,CAAC,CAAC;IACrD,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,SAAS,IAAI,gBAAgB,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B,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,IAAI,EAAE,QAAQ,CAAC,IAAI;KACpB,CAAC;AACJ,CAAC","sourcesContent":["/**\n * The deterministic floor of a judged reduction.\n *\n * A prune judgment proposes; this module disposes. Given the original payload,\n * the judged candidate, and the floor options, it decides whether the head /\n * extract / tail form replaces the candidate, composes that form out of whole\n * lines, and reports the size the installed text really has. Everything here is\n * pure arithmetic over strings: no host type, no retention sink, no audit.\n *\n * @module core/prune-plan\n */\n\n/** Default share of a floored reduction's context budget taken from the head. */\nexport const FLOOR_HEAD_CHARS = 400;\n/** Default share of a floored reduction's context budget taken from the tail. */\nexport const FLOOR_TAIL_CHARS = 400;\n\n/**\n * The floor decision of one reduction, computed from lengths alone.\n *\n * {@link pruneFloorPlan} returns the *decision*: whether the floor applies and\n * the size that decision was modelled on. {@link applyPruneFloor} returns the\n * same decision next to the size the composed text *really* has, because line\n * alignment and duplicate removal move that size. Callers account for the text\n * a mode really installs, so the composed numbers are the authoritative ones.\n */\nexport interface PruneFloorPlan {\n /** Whether the floor form replaces the judged candidate. */\n floored: boolean;\n /**\n * Whether the installed reduction fell short of the floor's promised share.\n *\n * True exactly when the composition could not build a form that both carries\n * `floorRatio` of the original and stays smaller than it, so the judged\n * candidate itself was installed. It is what separates \"nothing was reduced\"\n * from \"the reduction was real, but it did not reach the floor's promise\"; a\n * plan that never needed the floor reports `false`.\n */\n floorMissed: boolean;\n /** Characters the installed text carries: modelled by the plan, real once composed. */\n resultChars: number;\n /** Characters the installed form does not carry. */\n omittedChars: number;\n /** Context characters taken from the head of the original. */\n headChars: number;\n /** Context characters taken from the tail of the original. */\n tailChars: number;\n /**\n * Marker characters the installed form carries, summed over its sides.\n *\n * Zero when nothing is floored, one marker when only the mandatory locator side\n * fits, two when the share's budget can pay for a matching marker after the\n * candidate. Publishing it is what lets {@link applyPruneFloor} rebuild exactly\n * the form whose size the plan promised.\n */\n markerChars: number;\n /**\n * Whether a floor-missed install wanted the locator marker but could not carry it.\n *\n * The marker is what tells a reader that the reduction happened and where the\n * full payload lives, so a candidate that fits only *without* it is still\n * installed — the reduction is real — but the omission is recorded instead of\n * being silently dropped. Always `false` when `floorMissed` is false.\n */\n markerOmitted: boolean;\n}\n\n/** The floor options shared by the plan and the composition. */\nexport interface PruneFloorOptions {\n /** Lowest share of the original a reduction may keep. */\n floorRatio: number;\n /** Default split of the context budget, in characters. */\n headChars?: number;\n /** Default split of the context budget, in characters. */\n tailChars?: number;\n /**\n * Length of the marker the installed form carries per side.\n *\n * A caller that composes a locator-carrying form passes the real marker\n * length here; a caller that only accounts for it passes the same number. That\n * is what keeps the predicted size and the installed size identical in both\n * modes.\n */\n markerChars?: number;\n}\n\n/**\n * Decide the deterministic floor of one reduction from lengths alone.\n *\n * Lengths are enough because the floor form is fixed: context, marker, candidate,\n * marker, context. Deciding it this way is what lets `observe` account for the\n * *same* candidate `active` would install without building it.\n *\n * The floor is a *share*, not a suggestion. `pruneFloorRatio` says how much of\n * the original must survive, so the context budget is derived from it rather than\n * capped by the head/tail hints: a candidate that keeps 8% of a long payload is\n * not \"floored\" to 8% plus two small slices, it is widened until the installed\n * form really carries the promised share. The head/tail hints only decide how\n * that budget is split. A plan that cannot reach the share — because the marker\n * alone would eat the whole allowance — is refused, so a reduction never grows\n * the context.\n *\n * @param originalChars - length of the raw payload.\n * @param candidateChars - length of the judged candidate.\n * @param options - floor ratio, split hints, and marker length.\n * @returns the floor decision.\n */\nexport function pruneFloorPlan(\n originalChars: number,\n candidateChars: number,\n options: PruneFloorOptions\n): PruneFloorPlan {\n if (candidateChars === 0 || candidateChars >= originalChars) {\n return idleFloorPlan(originalChars);\n }\n const marker = Math.max(0, options.markerChars ?? 0);\n const head = Math.max(0, options.headChars ?? FLOOR_HEAD_CHARS);\n const tail = Math.max(0, options.tailChars ?? FLOOR_TAIL_CHARS);\n const share = Math.min(1, Math.max(0, options.floorRatio));\n const target = Math.ceil(originalChars * share);\n // The judged candidate is already the installed text when the floor does not\n // apply, and it carries no marker; only a deeper cut pays for the marker.\n if (candidateChars >= target) {\n return {\n floored: false,\n floorMissed: false,\n resultChars: candidateChars,\n omittedChars: originalChars - candidateChars,\n headChars: 0,\n tailChars: 0,\n markerChars: 0,\n markerOmitted: false\n };\n }\n // One marker side is mandatory: it carries the locator of the original. The\n // second is bought only when the share's budget leaves room for it. A candidate\n // that cannot even pay for the mandatory marker is still a real reduction, so\n // it is installed *without* the marker and the omission is recorded: dropping\n // it would trade a smaller answer for the whole payload over a missing line.\n if (candidateChars + marker >= originalChars) {\n return {\n floored: false,\n floorMissed: true,\n resultChars: candidateChars,\n omittedChars: originalChars - candidateChars,\n headChars: 0,\n tailChars: 0,\n markerChars: 0,\n markerOmitted: true\n };\n }\n let budget = Math.max(candidateChars + marker, Math.min(originalChars, target));\n let markerChars = marker;\n let context = budget - candidateChars - markerChars;\n if (context >= marker) {\n markerChars += marker;\n context -= marker;\n }\n const split = splitContext(context, head, tail);\n const resultChars = candidateChars + markerChars + context;\n if (resultChars >= originalChars) return idleFloorPlan(originalChars);\n return {\n floored: true,\n floorMissed: false,\n resultChars,\n omittedChars: originalChars - resultChars,\n headChars: split.head,\n tailChars: split.tail,\n markerChars,\n markerOmitted: false\n };\n}\n\n/**\n * Split one context budget between the head and the tail.\n *\n * The hints describe the *shape* of the context, not its ceiling, so a large\n * budget keeps their proportion instead of stopping at their sum. A zero-shaped\n * split degrades to an even one rather than dropping the context.\n * @param context - characters available for context.\n * @param head - head hint.\n * @param tail - tail hint.\n * @returns the two slice lengths, summing to the context.\n */\nfunction splitContext(context: number, head: number, tail: number): { head: number; tail: number } {\n const total = head + tail;\n const headChars = total <= 0 ? Math.ceil(context / 2) : Math.ceil((context * head) / total);\n return { head: Math.min(context, headChars), tail: context - Math.min(context, headChars) };\n}\n\n/** The plan of a reduction that is not happening. */\nfunction idleFloorPlan(originalChars: number): PruneFloorPlan {\n return {\n floored: false,\n floorMissed: false,\n resultChars: originalChars,\n omittedChars: 0,\n headChars: 0,\n tailChars: 0,\n markerChars: 0,\n markerOmitted: false\n };\n}\n\n/** The marker one floored reduction carries on each side of its candidate. */\nexport function pruneMarker(locator: string): string {\n return `\\n… [reflex prune: full original retrievable as ${locator}] …\\n`;\n}\n\n/**\n * The marker a floor-missed install appends after its candidate.\n *\n * The floored form opens with the marker because the head has just ended with a\n * newline. A candidate that already ends with one needs no blank line before the\n * marker, so only the leading newline is dropped in that case; the trailing\n * newline is the same one the floored form carries.\n * @param candidate - the judged candidate about to be installed.\n * @param marker - the locator marker.\n * @returns the suffix to append.\n */\nfunction pruneMarkerSuffix(candidate: string, marker: string): string {\n return candidate.endsWith('\\n') ? marker.slice(1) : marker;\n}\n\n/** Split one payload into whole lines, the terminator kept with its line. */\nfunction floorLines(text: string): string[] {\n return text.match(/[^\\n]*\\n|[^\\n]+$/g) ?? [];\n}\n\n/** The identity of one line for the duplicate test: its text without its terminator. */\nfunction floorLineIdentity(line: string): string {\n return line.replace(/\\r?\\n$/, '').replace(/\\r$/, '');\n}\n\n/**\n * How many whole lines of the head a budget can pay for.\n *\n * The head never crosses its budget and never stops inside a line: a cut that\n * cannot pay for the next line stops before it, so the kept prefix is always a\n * run of complete lines.\n * @param lines - the payload, split into whole lines.\n * @param budget - characters the head may spend.\n * @returns the number of lines to keep from the top.\n */\nfunction alignedHeadLines(lines: readonly string[], budget: number): number {\n let used = 0;\n let count = 0;\n for (const line of lines) {\n if (used + line.length > budget) break;\n used += line.length;\n count += 1;\n }\n return count;\n}\n\n/**\n * How many whole lines of the tail a budget needs.\n *\n * The tail is the *shortest* run of complete lines from the end that still\n * carries the budget. A payload whose lines are longer than the budget cannot\n * honour it with a line-aligned suffix; the caller refuses instead of cutting\n * one, because half a line is not a shorter answer but a broken one.\n * @param lines - the payload, split into whole lines.\n * @param budget - characters the tail must carry.\n * @returns the number of lines to keep from the bottom.\n */\nfunction alignedTailLines(lines: readonly string[], budget: number): number {\n if (budget <= 0) return 0;\n let used = 0;\n let count = 0;\n for (let index = lines.length - 1; index >= 0; index -= 1) {\n used += lines[index]!.length;\n count += 1;\n if (used >= budget) break;\n }\n return count;\n}\n\n/**\n * Drop the candidate lines the kept context already shows verbatim.\n *\n * The judgment reads the whole payload, so its extract repeats the lines a\n * reader can already see around it — `BEGIN`, `RESULT`, `END` in the trace that\n * prompted this. Repeating them is pure cost: the same line twice in one\n * message. Removal is per line and verbatim, so a diagnostic the context does\n * *not* carry always survives.\n * @param candidate - the judged extract.\n * @param head - the kept head.\n * @param tail - the kept tail.\n * @returns the candidate without the lines the context already shows.\n */\nfunction dedupeCandidateLines(candidate: string, head: string, tail: string): string {\n const seen = new Set([...floorLines(head), ...floorLines(tail)].map(floorLineIdentity));\n const lines = floorLines(candidate);\n if (seen.size === 0 || lines.length === 0) return candidate;\n return lines.filter((line) => !seen.has(floorLineIdentity(line))).join('');\n}\n\n/** One composed floor form and the sizes it really kept. */\ninterface ComposedFloor {\n text: string;\n headChars: number;\n tailChars: number;\n markerChars: number;\n}\n\n/**\n * Compose one floored form out of whole lines of the original.\n * @param lines - the original, split into whole lines.\n * @param headCount - lines kept from the top.\n * @param tailCount - lines kept from the bottom.\n * @param candidate - the judged extract.\n * @param marker - the locator marker.\n * @param secondMarker - the closing marker, or `''` when the share cannot pay for it.\n * @returns the installed text and the sizes it really carries.\n */\nfunction composeFloorLines(\n lines: readonly string[],\n headCount: number,\n tailCount: number,\n candidate: string,\n marker: string,\n secondMarker: string\n): ComposedFloor {\n const head = lines.slice(0, headCount).join('');\n const tail = tailCount === 0 ? '' : lines.slice(lines.length - tailCount).join('');\n const middle = dedupeCandidateLines(candidate, head, tail);\n // The marker opens with a newline so it sits on its own line after the head.\n // With no head there is nothing to separate it from, and a leading blank line\n // would be the first thing a reader sees.\n const lead = head.length === 0 ? marker.replace(/^\\n/, '') : marker;\n const closing = middle.length === 0 ? '' : secondMarker;\n return {\n text: `${head}${lead}${middle}${closing}${tail}`,\n headChars: head.length,\n tailChars: tail.length,\n markerChars: lead.length + closing.length\n };\n}\n\n/**\n * The plan of a floor the composition refused.\n *\n * A refusal is *not* a reason to throw the candidate away. The candidate is the\n * reduction the judgment already produced, and a floor that cannot widen it\n * without either breaking the share or growing past the original has simply\n * missed the floor, not invalidated the reduction: installing the candidate is\n * strictly better than carrying the whole payload. So the candidate is installed\n * with `floored: false` (no head/tail form was built) and `floorMissed: true`\n * (the promised share is not carried), and the sizes are booked against the text\n * that is really installed.\n *\n * The locator marker is appended when the candidate can still pay for it, so the\n * reader sees that a prune happened and where the full payload lives. When the\n * marker would push the install to the original's size or past it, the reduction\n * wins and the marker is omitted — recorded as `markerOmitted: true`, never\n * silently dropped.\n *\n * Only a candidate that is not actually smaller leaves the original untouched —\n * that is a real \"no reduction\", and the caller's own degradation path owns it.\n *\n * @param original - the raw payload.\n * @param candidate - the judged reduction the composition could not widen.\n * @param marker - the locator marker a floor-missed install wants to carry.\n * @returns the text to install and the floor decision that says why.\n */\nfunction refusedFloor(original: string, candidate: string, marker: string): PruneFloorPlan & { text: string } {\n if (candidate.length >= original.length) {\n return { ...idleFloorPlan(original.length), text: original };\n }\n const suffix = pruneMarkerSuffix(candidate, marker);\n if (candidate.length + suffix.length < original.length) {\n return {\n floored: false,\n floorMissed: true,\n resultChars: candidate.length + suffix.length,\n omittedChars: original.length - candidate.length - suffix.length,\n headChars: 0,\n tailChars: 0,\n markerChars: suffix.length,\n markerOmitted: false,\n text: `${candidate}${suffix}`\n };\n }\n return {\n floored: false,\n floorMissed: true,\n resultChars: candidate.length,\n omittedChars: original.length - candidate.length,\n headChars: 0,\n tailChars: 0,\n markerChars: 0,\n markerOmitted: true,\n text: candidate\n };\n}\n\n/**\n * Enforce the deterministic floor of a judged reduction.\n *\n * The judgment proposes; this floor disposes. A candidate that cut deeper than\n * {@link ResolvedInterventionsConfig.pruneFloorRatio} of the original is replaced\n * by a form that keeps the head and the tail — the two places a compiler error, a\n * stack-trace summary, and a final result usually are — around the judgment's own\n * extract, with explicit markers that name where the full original was retained.\n * A candidate that is not actually smaller is refused outright, so a \"reduction\"\n * can never grow the context.\n *\n * The context is composed out of *whole lines* of the original, never out of\n * character slices: a cut that lands mid-line leaves the reader a fragment like\n * `=] progress 092`, which is not a shorter answer but a broken one. The head is\n * the longest run of complete lines its budget can pay for, the tail the shortest\n * run of complete lines that still carries its own, and any candidate line the\n * kept context already shows verbatim is dropped as a duplicate. Alignment and\n * removal move the real size, so the decision's modelled size is replaced here by\n * the size the text really has: a form that would fall short of the promised\n * share, or that would not be smaller than the original at all, is refused. A\n * refusal installs the judgment's own candidate with `floorMissed: true` rather\n * than the original — the candidate is a real reduction, and dropping it would\n * trade a smaller answer for the whole payload just because the floor form could\n * not be built.\n *\n * @param original - the raw payload.\n * @param candidate - the judged reduction.\n * @param options - floor options plus the locator the replacement publishes.\n * @returns the text to install, the floor decision, and the sizes involved.\n */\nexport function applyPruneFloor(\n original: string,\n candidate: string,\n options: PruneFloorOptions & { locator: string }\n): PruneFloorPlan & { text: string } {\n const marker = pruneMarker(options.locator);\n const plan = pruneFloorPlan(original.length, candidate.length, { ...options, markerChars: marker.length });\n if (!plan.floored) {\n return { ...plan, text: plan.resultChars === candidate.length ? candidate : original };\n }\n const lines = floorLines(original);\n const share = Math.min(1, Math.max(0, options.floorRatio));\n const target = Math.ceil(original.length * share);\n const secondMarker = plan.markerChars > marker.length ? marker : '';\n let headCount = alignedHeadLines(lines, plan.headChars);\n if (headCount === 0 && plan.headChars > 0 && lines.length > 0) {\n // A first line longer than the head budget: taking it whole keeps a real line\n // where a cut could only produce a fragment. Whether the enlarged form is\n // installable at all is decided by the size checks below.\n headCount = 1;\n }\n let tailCount = alignedTailLines(lines, plan.tailChars);\n if (headCount + tailCount > lines.length) return refusedFloor(original, candidate, marker);\n let composed = composeFloorLines(lines, headCount, tailCount, candidate, marker, secondMarker);\n // The share is a promise, and rounding to a boundary or dropping duplicates can\n // fall short of it: widen by whole lines until the form really carries the\n // share. A payload with no room left is refused by the checks below, never\n // installed short.\n while (composed.text.length < target) {\n // Grow the smaller side first, so the two keep their configured proportion.\n const order = composed.headChars <= composed.tailChars ? [0, 1] : [1, 0];\n let grew = false;\n for (const side of order) {\n const nextHead = side === 0 ? headCount + 1 : headCount;\n const nextTail = side === 1 ? tailCount + 1 : tailCount;\n if (nextHead + nextTail > lines.length) continue;\n const next = composeFloorLines(lines, nextHead, nextTail, candidate, marker, secondMarker);\n if (next.text.length <= composed.text.length) continue;\n headCount = nextHead;\n tailCount = nextTail;\n composed = next;\n grew = true;\n break;\n }\n if (!grew) break;\n }\n if (composed.text.length >= original.length || composed.text.length < target) {\n return refusedFloor(original, candidate, marker);\n }\n return {\n ...plan,\n resultChars: composed.text.length,\n omittedChars: original.length - composed.text.length,\n headChars: composed.headChars,\n tailChars: composed.tailChars,\n markerChars: composed.markerChars,\n text: composed.text\n };\n}\n"]}
@@ -0,0 +1,36 @@
1
+ /** One content block as the decision surface sees it: a tag and optional text. */
2
+ export interface TextBlockLike {
3
+ readonly type?: string;
4
+ readonly text?: string;
5
+ }
6
+ /**
7
+ * Bound one text to a character budget, marking the cut.
8
+ * @param text - any text.
9
+ * @param max - maximum characters to keep.
10
+ * @returns the bounded text.
11
+ */
12
+ export declare function clip(text: string, max: number): string;
13
+ /**
14
+ * Tokens one text costs, at the ledger's shared four-characters-per-token rate.
15
+ * @param text - any text.
16
+ * @returns the estimated token count.
17
+ */
18
+ export declare function estimateTokens(text: string): number;
19
+ /**
20
+ * Stable short digest of one value, used as a payload or call identity.
21
+ * @param value - the text to digest.
22
+ * @returns sixteen hexadecimal characters.
23
+ */
24
+ export declare function digestOf(value: string): string;
25
+ /**
26
+ * Concatenate the text blocks of one content list.
27
+ * @param content - message or result content.
28
+ * @returns the text, in block order.
29
+ */
30
+ export declare function textOfContent(content: readonly TextBlockLike[] | undefined): string;
31
+ /**
32
+ * Whether one content list carries at least one text block.
33
+ * @param content - message or result content.
34
+ * @returns whether there is text to rewrite.
35
+ */
36
+ export declare function hasTextBlock(content: readonly TextBlockLike[] | undefined): boolean;
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Text helpers shared by the intervention decision core.
3
+ *
4
+ * Everything here is host-agnostic: the unit of work is a string, an estimated
5
+ * token count, or a structural content block. No host message type, no session,
6
+ * no tool-execution type is imported or assumed.
7
+ *
8
+ * @module core/text
9
+ */
10
+ import { createHash } from 'node:crypto';
11
+ /**
12
+ * Bound one text to a character budget, marking the cut.
13
+ * @param text - any text.
14
+ * @param max - maximum characters to keep.
15
+ * @returns the bounded text.
16
+ */
17
+ export function clip(text, max) {
18
+ return text.length <= max ? text : `${text.slice(0, max)}…`;
19
+ }
20
+ /**
21
+ * Tokens one text costs, at the ledger's shared four-characters-per-token rate.
22
+ * @param text - any text.
23
+ * @returns the estimated token count.
24
+ */
25
+ export function estimateTokens(text) {
26
+ return text.length === 0 ? 0 : Math.ceil(text.length / 4);
27
+ }
28
+ /**
29
+ * Stable short digest of one value, used as a payload or call identity.
30
+ * @param value - the text to digest.
31
+ * @returns sixteen hexadecimal characters.
32
+ */
33
+ export function digestOf(value) {
34
+ return createHash('sha256').update(value).digest('hex').slice(0, 16);
35
+ }
36
+ /**
37
+ * Concatenate the text blocks of one content list.
38
+ * @param content - message or result content.
39
+ * @returns the text, in block order.
40
+ */
41
+ export function textOfContent(content) {
42
+ if (!content)
43
+ return '';
44
+ const parts = [];
45
+ for (const block of content) {
46
+ if (block && typeof block === 'object' && block.type === 'text') {
47
+ parts.push(block.text ?? '');
48
+ }
49
+ }
50
+ return parts.join('\n');
51
+ }
52
+ /**
53
+ * Whether one content list carries at least one text block.
54
+ * @param content - message or result content.
55
+ * @returns whether there is text to rewrite.
56
+ */
57
+ export function hasTextBlock(content) {
58
+ if (!content)
59
+ return false;
60
+ for (const block of content) {
61
+ if (block && typeof block === 'object' && block.type === 'text')
62
+ return true;
63
+ }
64
+ return false;
65
+ }
66
+ //# sourceMappingURL=text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.js","s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IG;AACH,MAAM,UAAU,YAAY,CAAC,OAA6C;IACxE,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAC3B,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM;YAAE,OAAO,IAAI,CAAC;IAC/E,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/**\n * Text helpers shared by the intervention decision core.\n *\n * Everything here is host-agnostic: the unit of work is a string, an estimated\n * token count, or a structural content block. No host message type, no session,\n * no tool-execution type is imported or assumed.\n *\n * @module core/text\n */\nimport { createHash } from 'node:crypto';\n\n/** One content block as the decision surface sees it: a tag and optional text. */\nexport interface TextBlockLike {\n readonly type?: string;\n readonly text?: string;\n}\n\n/**\n * Bound one text to a character budget, marking the cut.\n * @param text - any text.\n * @param max - maximum characters to keep.\n * @returns the bounded text.\n */\nexport function clip(text: string, max: number): string {\n return text.length <= max ? text : `${text.slice(0, max)}…`;\n}\n\n/**\n * Tokens one text costs, at the ledger's shared four-characters-per-token rate.\n * @param text - any text.\n * @returns the estimated token count.\n */\nexport function estimateTokens(text: string): number {\n return text.length === 0 ? 0 : Math.ceil(text.length / 4);\n}\n\n/**\n * Stable short digest of one value, used as a payload or call identity.\n * @param value - the text to digest.\n * @returns sixteen hexadecimal characters.\n */\nexport function digestOf(value: string): string {\n return createHash('sha256').update(value).digest('hex').slice(0, 16);\n}\n\n/**\n * Concatenate the text blocks of one content list.\n * @param content - message or result content.\n * @returns the text, in block order.\n */\nexport function textOfContent(content: readonly TextBlockLike[] | undefined): string {\n if (!content) return '';\n const parts: string[] = [];\n for (const block of content) {\n if (block && typeof block === 'object' && block.type === 'text') {\n parts.push(block.text ?? '');\n }\n }\n return parts.join('\\n');\n}\n\n/**\n * Whether one content list carries at least one text block.\n * @param content - message or result content.\n * @returns whether there is text to rewrite.\n */\nexport function hasTextBlock(content: readonly TextBlockLike[] | undefined): boolean {\n if (!content) return false;\n for (const block of content) {\n if (block && typeof block === 'object' && block.type === 'text') return true;\n }\n return false;\n}\n"]}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Audit-sink port.
3
+ *
4
+ * A decision that was *planned* must be auditable even when it was not applied,
5
+ * and a host's audit channel may be its session log, a file, or a test spy. The
6
+ * core produces the record; writing it somewhere durable is the host's job.
7
+ *
8
+ * @module ports/audit
9
+ */
10
+ /** A sink for one decision record, scoped to the session it belongs to. */
11
+ export interface AuditSinkPort<Record> {
12
+ /**
13
+ * Append one record, best-effort.
14
+ * @param record - the decision to retain.
15
+ * @param session - the session it belongs to, when one is visible.
16
+ */
17
+ write(record: Record, session: unknown): void;
18
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Audit-sink port.
3
+ *
4
+ * A decision that was *planned* must be auditable even when it was not applied,
5
+ * and a host's audit channel may be its session log, a file, or a test spy. The
6
+ * core produces the record; writing it somewhere durable is the host's job.
7
+ *
8
+ * @module ports/audit
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=audit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit.js","sourceRoot":"","sources":["../../../../src/vendor/harness-reflex/ports/audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG","sourcesContent":["/**\n * Audit-sink port.\n *\n * A decision that was *planned* must be auditable even when it was not applied,\n * and a host's audit channel may be its session log, a file, or a test spy. The\n * core produces the record; writing it somewhere durable is the host's job.\n *\n * @module ports/audit\n */\n\n/** A sink for one decision record, scoped to the session it belongs to. */\nexport interface AuditSinkPort<Record> {\n /**\n * Append one record, best-effort.\n * @param record - the decision to retain.\n * @param session - the session it belongs to, when one is visible.\n */\n write(record: Record, session: unknown): void;\n}\n"]}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Clock port.
3
+ *
4
+ * The decision core never reads the wall clock itself: latency accounting is a
5
+ * pure function of two readings, so a test (or a replay) supplies its own
6
+ * readings and the reported costs stay reproducible.
7
+ *
8
+ * @module ports/clock
9
+ */
10
+ /** A monotonic-enough source of milliseconds for latency accounting. */
11
+ export interface ClockPort {
12
+ /** Current time in milliseconds. */
13
+ now(): number;
14
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Clock port.
3
+ *
4
+ * The decision core never reads the wall clock itself: latency accounting is a
5
+ * pure function of two readings, so a test (or a replay) supplies its own
6
+ * readings and the reported costs stay reproducible.
7
+ *
8
+ * @module ports/clock
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=clock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clock.js","sourceRoot":"","sources":["../../../../src/vendor/harness-reflex/ports/clock.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG","sourcesContent":["/**\n * Clock port.\n *\n * The decision core never reads the wall clock itself: latency accounting is a\n * pure function of two readings, so a test (or a replay) supplies its own\n * readings and the reported costs stay reproducible.\n *\n * @module ports/clock\n */\n\n/** A monotonic-enough source of milliseconds for latency accounting. */\nexport interface ClockPort {\n /** Current time in milliseconds. */\n now(): number;\n}\n"]}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Decision-backend ports.
3
+ *
4
+ * The core asks questions; which transport answers them (a hosted gateway, an
5
+ * in-process model, a mock) is chosen by the composition root. These interfaces
6
+ * are intentionally *narrow*: they describe only the calls the intervention
7
+ * decision surface makes, so a host adapter supplies a couple of methods rather
8
+ * than the whole backend contract.
9
+ *
10
+ * @module ports/decision
11
+ */
12
+ import type { ActionStep, GateResponse, PruneResponse, StagnationCheckResponse } from '../backend/types.js';
13
+ /** One stagnation verdict request: the window, plus the question it is asked in. */
14
+ export interface StagnationBackendPort {
15
+ /**
16
+ * Judge one observed action window.
17
+ * @param goal - why the run is judged, when the caller knows.
18
+ * @param history - observed steps, oldest first.
19
+ * @returns the verdict and its recommended intervention.
20
+ */
21
+ check(goal: string | undefined, history: readonly ActionStep[]): Promise<StagnationCheckResponse>;
22
+ }
23
+ /** One prune request, narrowed to what the intervention surface sends. */
24
+ export interface PruneBackendOptionsPort {
25
+ intent?: string;
26
+ measureOnly?: boolean;
27
+ pruneJudgeMinChars?: number;
28
+ }
29
+ /** The reduction service, as the prune plan consumes it. */
30
+ export interface PruneBackendPort {
31
+ /**
32
+ * Ask for one reduction candidate.
33
+ * @param output - the payload to reduce.
34
+ * @param options - intent and measurement flags.
35
+ * @returns the candidate plus its provenance and sizes.
36
+ */
37
+ prune(output: string, options?: PruneBackendOptionsPort): Promise<PruneResponse>;
38
+ }
39
+ /** One completion-claim sentence classification. */
40
+ export interface ClaimClassificationPort {
41
+ statement: string;
42
+ /** Whether the winning criterion says the sentence claims completion. */
43
+ isClaim: boolean;
44
+ /** Probability of the completion-claim criterion, in `[0, 1]`. */
45
+ confidence: number;
46
+ }
47
+ /** The classification answer for one closing candidate batch. */
48
+ export interface ClaimClassificationResponsePort {
49
+ results: ClaimClassificationPort[];
50
+ latencyMs: number;
51
+ }
52
+ /** One batch of candidate sentences a closing check must classify. */
53
+ export interface ClaimClassificationRequestPort {
54
+ statements: string[];
55
+ intent: string;
56
+ context?: string;
57
+ }
58
+ /** The verification half of a closing judgment. */
59
+ export interface ClosingBackendPort {
60
+ /** Classify which candidate sentences really claim completion. */
61
+ classifyClaims(request: ClaimClassificationRequestPort): Promise<ClaimClassificationResponsePort>;
62
+ /** Verify completion claims against the assembled evidence. */
63
+ verify(assertions: Array<{
64
+ statement: string;
65
+ criteria?: string;
66
+ }>, evidence: string, options?: {
67
+ latchCacheKey?: string;
68
+ }): Promise<GateResponse>;
69
+ }
70
+ /** The whole decision surface of one composition, grouped for convenience. */
71
+ export interface DecisionBackendPort {
72
+ stagnation: StagnationBackendPort;
73
+ prune: PruneBackendPort;
74
+ closing: ClosingBackendPort;
75
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=decision.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decision.js","sourceRoot":"","sources":["../../../../src/vendor/harness-reflex/ports/decision.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Decision-backend ports.\n *\n * The core asks questions; which transport answers them (a hosted gateway, an\n * in-process model, a mock) is chosen by the composition root. These interfaces\n * are intentionally *narrow*: they describe only the calls the intervention\n * decision surface makes, so a host adapter supplies a couple of methods rather\n * than the whole backend contract.\n *\n * @module ports/decision\n */\nimport type {\n ActionStep,\n GateResponse,\n PruneResponse,\n StagnationCheckResponse\n} from '../backend/types.js';\n\n/** One stagnation verdict request: the window, plus the question it is asked in. */\nexport interface StagnationBackendPort {\n /**\n * Judge one observed action window.\n * @param goal - why the run is judged, when the caller knows.\n * @param history - observed steps, oldest first.\n * @returns the verdict and its recommended intervention.\n */\n check(goal: string | undefined, history: readonly ActionStep[]): Promise<StagnationCheckResponse>;\n}\n\n/** One prune request, narrowed to what the intervention surface sends. */\nexport interface PruneBackendOptionsPort {\n intent?: string;\n measureOnly?: boolean;\n pruneJudgeMinChars?: number;\n}\n\n/** The reduction service, as the prune plan consumes it. */\nexport interface PruneBackendPort {\n /**\n * Ask for one reduction candidate.\n * @param output - the payload to reduce.\n * @param options - intent and measurement flags.\n * @returns the candidate plus its provenance and sizes.\n */\n prune(output: string, options?: PruneBackendOptionsPort): Promise<PruneResponse>;\n}\n\n/** One completion-claim sentence classification. */\nexport interface ClaimClassificationPort {\n statement: string;\n /** Whether the winning criterion says the sentence claims completion. */\n isClaim: boolean;\n /** Probability of the completion-claim criterion, in `[0, 1]`. */\n confidence: number;\n}\n\n/** The classification answer for one closing candidate batch. */\nexport interface ClaimClassificationResponsePort {\n results: ClaimClassificationPort[];\n latencyMs: number;\n}\n\n/** One batch of candidate sentences a closing check must classify. */\nexport interface ClaimClassificationRequestPort {\n statements: string[];\n intent: string;\n context?: string;\n}\n\n/** The verification half of a closing judgment. */\nexport interface ClosingBackendPort {\n /** Classify which candidate sentences really claim completion. */\n classifyClaims(request: ClaimClassificationRequestPort): Promise<ClaimClassificationResponsePort>;\n /** Verify completion claims against the assembled evidence. */\n verify(\n assertions: Array<{ statement: string; criteria?: string }>,\n evidence: string,\n options?: { latchCacheKey?: string }\n ): Promise<GateResponse>;\n}\n\n/** The whole decision surface of one composition, grouped for convenience. */\nexport interface DecisionBackendPort {\n stagnation: StagnationBackendPort;\n prune: PruneBackendPort;\n closing: ClosingBackendPort;\n}\n"]}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The ports of the intervention decision core.
3
+ *
4
+ * Interfaces and pure types only: nothing here reads a file, holds a socket, or
5
+ * knows what a host is. Composition roots implement these and inject them into
6
+ * the core.
7
+ *
8
+ * @module ports
9
+ */
10
+ export type { ClockPort } from './clock.js';
11
+ export type { ClaimClassificationPort, ClaimClassificationRequestPort, ClaimClassificationResponsePort, ClosingBackendPort, DecisionBackendPort, PruneBackendOptionsPort, PruneBackendPort, StagnationBackendPort } from './decision.js';
12
+ export type { BudgetSnapshot, BudgetStorePort, StateStorePort } from './state.js';
13
+ export type { AuditSinkPort } from './audit.js';
14
+ export type { LoggerPort, LogLevel } from './log.js';
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/vendor/harness-reflex/ports/index.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The ports of the intervention decision core.\n *\n * Interfaces and pure types only: nothing here reads a file, holds a socket, or\n * knows what a host is. Composition roots implement these and inject them into\n * the core.\n *\n * @module ports\n */\nexport type { ClockPort } from './clock.js';\nexport type {\n ClaimClassificationPort,\n ClaimClassificationRequestPort,\n ClaimClassificationResponsePort,\n ClosingBackendPort,\n DecisionBackendPort,\n PruneBackendOptionsPort,\n PruneBackendPort,\n StagnationBackendPort\n} from './decision.js';\nexport type { BudgetSnapshot, BudgetStorePort, StateStorePort } from './state.js';\nexport type { AuditSinkPort } from './audit.js';\nexport type { LoggerPort, LogLevel } from './log.js';\n"]}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Logger port.
3
+ *
4
+ * The decision core is deliberately quiet — it reports through the audit record
5
+ * rather than through free-form logging — but a composition root may still want
6
+ * its own diagnostics. This interface is the only logging surface the core could
7
+ * ever call, and it is optional.
8
+ *
9
+ * @module ports/log
10
+ */
11
+ /** The severity vocabulary of the diagnostic sink. */
12
+ export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
13
+ /** A structured diagnostic sink. */
14
+ export interface LoggerPort {
15
+ /**
16
+ * Emit one diagnostic line.
17
+ * @param level - severity.
18
+ * @param message - human-readable text.
19
+ * @param fields - structured context, when the host can retain it.
20
+ */
21
+ log(level: LogLevel, message: string, fields?: Readonly<Record<string, unknown>>): void;
22
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Logger port.
3
+ *
4
+ * The decision core is deliberately quiet — it reports through the audit record
5
+ * rather than through free-form logging — but a composition root may still want
6
+ * its own diagnostics. This interface is the only logging surface the core could
7
+ * ever call, and it is optional.
8
+ *
9
+ * @module ports/log
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=log.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.js","sourceRoot":"","sources":["../../../../src/vendor/harness-reflex/ports/log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG","sourcesContent":["/**\n * Logger port.\n *\n * The decision core is deliberately quiet — it reports through the audit record\n * rather than through free-form logging — but a composition root may still want\n * its own diagnostics. This interface is the only logging surface the core could\n * ever call, and it is optional.\n *\n * @module ports/log\n */\n\n/** The severity vocabulary of the diagnostic sink. */\nexport type LogLevel = 'debug' | 'info' | 'warn' | 'error';\n\n/** A structured diagnostic sink. */\nexport interface LoggerPort {\n /**\n * Emit one diagnostic line.\n * @param level - severity.\n * @param message - human-readable text.\n * @param fields - structured context, when the host can retain it.\n */\n log(level: LogLevel, message: string, fields?: Readonly<Record<string, unknown>>): void;\n}\n"]}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * State-storage port.
3
+ *
4
+ * The core decisions are pure functions over an explicit state value; where that
5
+ * value is persisted between calls is the host's business. A host that runs each
6
+ * event in a fresh process writes through a file- or session-backed store; one
7
+ * that keeps its decision runtime mounted can use an in-memory map. The
8
+ * interface is the same so both see the same budget and dedupe semantics.
9
+ *
10
+ * @module ports/state
11
+ */
12
+ /** The per-session counters a decision turn spends from. */
13
+ export interface BudgetSnapshot {
14
+ /** Interventions planned or applied in the current turn. */
15
+ interventions: number;
16
+ /** System 1 judgments spent in the current turn. */
17
+ judgmentsTurn: number;
18
+ /** System 1 judgments spent in the current session. */
19
+ judgmentsSession: number;
20
+ }
21
+ /** A keyed store of per-session state, including the turn/session budget. */
22
+ export interface StateStorePort<T> {
23
+ /**
24
+ * Read one key, without creating it.
25
+ * @param key - session-scoped identity.
26
+ * @returns the stored value, when one exists.
27
+ */
28
+ read(key: string): T | undefined;
29
+ /**
30
+ * Write one key.
31
+ * @param key - session-scoped identity.
32
+ * @param value - the value to retain.
33
+ */
34
+ write(key: string, value: T): void;
35
+ /**
36
+ * Drop one key.
37
+ * @param key - session-scoped identity.
38
+ * @returns whether a value was removed.
39
+ */
40
+ delete(key: string): boolean;
41
+ /** Every key currently stored, for bounded-eviction housekeeping. */
42
+ keys(): Iterable<string>;
43
+ }
44
+ /** The budget half of a session store, narrowed to what the policy spends. */
45
+ export interface BudgetStorePort extends StateStorePort<BudgetSnapshot> {
46
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * State-storage port.
3
+ *
4
+ * The core decisions are pure functions over an explicit state value; where that
5
+ * value is persisted between calls is the host's business. A host that runs each
6
+ * event in a fresh process writes through a file- or session-backed store; one
7
+ * that keeps its decision runtime mounted can use an in-memory map. The
8
+ * interface is the same so both see the same budget and dedupe semantics.
9
+ *
10
+ * @module ports/state
11
+ */
12
+ export {};
13
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.js","sourceRoot":"","sources":["../../../../src/vendor/harness-reflex/ports/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG","sourcesContent":["/**\n * State-storage port.\n *\n * The core decisions are pure functions over an explicit state value; where that\n * value is persisted between calls is the host's business. A host that runs each\n * event in a fresh process writes through a file- or session-backed store; one\n * that keeps its decision runtime mounted can use an in-memory map. The\n * interface is the same so both see the same budget and dedupe semantics.\n *\n * @module ports/state\n */\n\n/** The per-session counters a decision turn spends from. */\nexport interface BudgetSnapshot {\n /** Interventions planned or applied in the current turn. */\n interventions: number;\n /** System 1 judgments spent in the current turn. */\n judgmentsTurn: number;\n /** System 1 judgments spent in the current session. */\n judgmentsSession: number;\n}\n\n/** A keyed store of per-session state, including the turn/session budget. */\nexport interface StateStorePort<T> {\n /**\n * Read one key, without creating it.\n * @param key - session-scoped identity.\n * @returns the stored value, when one exists.\n */\n read(key: string): T | undefined;\n /**\n * Write one key.\n * @param key - session-scoped identity.\n * @param value - the value to retain.\n */\n write(key: string, value: T): void;\n /**\n * Drop one key.\n * @param key - session-scoped identity.\n * @returns whether a value was removed.\n */\n delete(key: string): boolean;\n /** Every key currently stored, for bounded-eviction housekeeping. */\n keys(): Iterable<string>;\n}\n\n/** The budget half of a session store, narrowed to what the policy spends. */\nexport interface BudgetStorePort extends StateStorePort<BudgetSnapshot> {}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-harness-reflex",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "DSH Host plugin exposing the harness-reflex System One decision runtime (choice, score, route, screen, gate) as in-process reflex_* tools; pruning, stagnation detection and turn closing run as automatic interventions, and the ledger is the /reflex-ledger command.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -29,7 +29,14 @@
29
29
  "dist/**/*.d.ts",
30
30
  "!dist/**/*.test.js",
31
31
  "!dist/**/*.test.js.map",
32
- "!dist/**/*.test.d.ts"
32
+ "!dist/**/*.test.d.ts",
33
+ "!dist/baseline/**",
34
+ "!dist/prune-parity.js",
35
+ "!dist/prune-parity.js.map",
36
+ "!dist/prune-parity.d.ts",
37
+ "!dist/prune-parity-scripts.js",
38
+ "!dist/prune-parity-scripts.js.map",
39
+ "!dist/prune-parity-scripts.d.ts"
33
40
  ],
34
41
  "dsh": {
35
42
  "bundle": {
@@ -52,27 +59,32 @@
52
59
  "test": "node --test \"dist/**/*.test.js\""
53
60
  },
54
61
  "peerDependencies": {
55
- "@deepseek-ai/cordis": ">=4.0.0-alpha.0 <5.0.0",
56
- "@deepseek-ai/dsh-agent": ">=0.2.0-alpha.0 <0.2.2",
57
- "@deepseek-ai/dsh-commands": ">=0.2.0-alpha.0 <0.2.2",
58
- "@deepseek-ai/dsh-host-webserver": ">=0.2.0-alpha.0 <0.2.2",
59
- "@deepseek-ai/dsh-llm": ">=0.2.0-alpha.0 <0.2.2",
60
- "@deepseek-ai/dsh-session": ">=0.2.0-alpha.0 <0.2.2",
61
- "@deepseek-ai/dsh-system-prompt": ">=0.2.0-alpha.0 <0.2.2",
62
- "@deepseek-ai/dsh-tools": ">=0.2.0-alpha.0 <0.2.2"
62
+ "@deepseek-ai/cordis": ">=4.1.0 <5.0.0",
63
+ "@deepseek-ai/dsh-agent": ">=0.2.2-rc.1 <0.2.3",
64
+ "@deepseek-ai/dsh-commands": ">=0.2.2-rc.1 <0.2.3",
65
+ "@deepseek-ai/dsh-host-webserver": ">=0.2.2-rc.1 <0.2.3",
66
+ "@deepseek-ai/dsh-llm": ">=0.2.2-rc.1 <0.2.3",
67
+ "@deepseek-ai/dsh-scope": ">=0.2.2-rc.1 <0.2.3",
68
+ "@deepseek-ai/dsh-session": ">=0.2.2-rc.1 <0.2.3",
69
+ "@deepseek-ai/dsh-session-projection": ">=0.2.2-rc.1 <0.2.3",
70
+ "@deepseek-ai/dsh-system-prompt": ">=0.2.2-rc.1 <0.2.3",
71
+ "@deepseek-ai/dsh-tools": ">=0.2.2-rc.1 <0.2.3",
72
+ "@deepseek-ai/dsh-tool-executor-native": ">=0.2.2-rc.1 <0.2.3"
63
73
  },
64
74
  "dependencies": {
65
75
  "@deepseek-ai/schemastery": "~3.18.5-alpha.2",
66
76
  "zod": "^4.0.0"
67
77
  },
68
78
  "devDependencies": {
69
- "@deepseek-ai/dsh-host-webserver": "0.2.1-alpha.4",
70
- "@deepseek-ai/dsh-system-prompt": "0.2.1-alpha.4",
79
+ "@deepseek-ai/dsh-host-webserver": "0.2.2-rc.1",
80
+ "@deepseek-ai/dsh-session-projection": "0.2.2-rc.1",
81
+ "@deepseek-ai/dsh-system-prompt": "0.2.2-rc.1",
82
+ "@deepseek-ai/dsh-tool-executor-native": "0.2.2-rc.1",
71
83
  "@types/node": "^22.20.4",
72
84
  "typescript": "^5.5.0"
73
85
  },
74
86
  "license": "MIT",
75
87
  "engines": {
76
- "dsh": "<0.2.2"
88
+ "dsh": ">=0.2.2-rc.1 <0.2.3"
77
89
  }
78
90
  }