@dungle-scrubs/harness-cli-normalizer 0.1.3 → 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 (151) hide show
  1. package/README.md +144 -7
  2. package/dist/cli/args.d.ts +74 -0
  3. package/dist/cli/args.d.ts.map +1 -0
  4. package/dist/cli/args.js +339 -0
  5. package/dist/cli/args.js.map +1 -0
  6. package/dist/cli/check.d.ts +2 -0
  7. package/dist/cli/check.d.ts.map +1 -0
  8. package/dist/cli/check.js +110 -0
  9. package/dist/cli/check.js.map +1 -0
  10. package/dist/cli/exit-codes.d.ts +7 -0
  11. package/dist/cli/exit-codes.d.ts.map +1 -0
  12. package/dist/cli/exit-codes.js +11 -0
  13. package/dist/cli/exit-codes.js.map +1 -0
  14. package/dist/cli/help.d.ts +7 -0
  15. package/dist/cli/help.d.ts.map +1 -0
  16. package/dist/cli/help.js +110 -0
  17. package/dist/cli/help.js.map +1 -0
  18. package/dist/cli/index.d.ts +4 -0
  19. package/dist/cli/index.d.ts.map +1 -0
  20. package/dist/cli/index.js +170 -0
  21. package/dist/cli/index.js.map +1 -0
  22. package/dist/cli/inspect.d.ts +3 -0
  23. package/dist/cli/inspect.d.ts.map +1 -0
  24. package/dist/cli/inspect.js +170 -0
  25. package/dist/cli/inspect.js.map +1 -0
  26. package/dist/cli/ls.d.ts +2 -0
  27. package/dist/cli/ls.d.ts.map +1 -0
  28. package/dist/cli/ls.js +10 -0
  29. package/dist/cli/ls.js.map +1 -0
  30. package/dist/cli/render.d.ts +8 -0
  31. package/dist/cli/render.d.ts.map +1 -0
  32. package/dist/cli/render.js +55 -0
  33. package/dist/cli/render.js.map +1 -0
  34. package/dist/cli/resolve-harness.d.ts +4 -0
  35. package/dist/cli/resolve-harness.d.ts.map +1 -0
  36. package/dist/cli/resolve-harness.js +31 -0
  37. package/dist/cli/resolve-harness.js.map +1 -0
  38. package/dist/cli/run.d.ts +2 -0
  39. package/dist/cli/run.d.ts.map +1 -0
  40. package/dist/cli/run.js +280 -0
  41. package/dist/cli/run.js.map +1 -0
  42. package/dist/cli/session.d.ts +2 -0
  43. package/dist/cli/session.d.ts.map +1 -0
  44. package/dist/cli/session.js +128 -0
  45. package/dist/cli/session.js.map +1 -0
  46. package/dist/cli/version.d.ts +2 -0
  47. package/dist/cli/version.d.ts.map +1 -0
  48. package/dist/cli/version.js +34 -0
  49. package/dist/cli/version.js.map +1 -0
  50. package/dist/cli.js +2 -0
  51. package/dist/execution/decode.d.ts.map +1 -1
  52. package/dist/execution/decode.js +32 -0
  53. package/dist/execution/decode.js.map +1 -1
  54. package/dist/execution/deps.d.ts +7 -1
  55. package/dist/execution/deps.d.ts.map +1 -1
  56. package/dist/execution/events.d.ts +6 -2
  57. package/dist/execution/events.d.ts.map +1 -1
  58. package/dist/execution/events.js.map +1 -1
  59. package/dist/execution/failure.d.ts +45 -0
  60. package/dist/execution/failure.d.ts.map +1 -0
  61. package/dist/execution/failure.js +121 -0
  62. package/dist/execution/failure.js.map +1 -0
  63. package/dist/execution/node-deps.d.ts.map +1 -1
  64. package/dist/execution/node-deps.js +19 -0
  65. package/dist/execution/node-deps.js.map +1 -1
  66. package/dist/execution/stream-turn.d.ts +2 -0
  67. package/dist/execution/stream-turn.d.ts.map +1 -1
  68. package/dist/execution/stream-turn.js +181 -16
  69. package/dist/execution/stream-turn.js.map +1 -1
  70. package/dist/interpretation/argv.d.ts +16 -4
  71. package/dist/interpretation/argv.d.ts.map +1 -1
  72. package/dist/interpretation/argv.js +68 -19
  73. package/dist/interpretation/argv.js.map +1 -1
  74. package/dist/interpretation/dimensions.d.ts +0 -2
  75. package/dist/interpretation/dimensions.d.ts.map +1 -1
  76. package/dist/interpretation/dimensions.js +0 -2
  77. package/dist/interpretation/dimensions.js.map +1 -1
  78. package/dist/interpretation/limits.d.ts +10 -1
  79. package/dist/interpretation/limits.d.ts.map +1 -1
  80. package/dist/interpretation/limits.js +84 -5
  81. package/dist/interpretation/limits.js.map +1 -1
  82. package/dist/interpretation/refusal.d.ts +31 -0
  83. package/dist/interpretation/refusal.d.ts.map +1 -0
  84. package/dist/interpretation/refusal.js +87 -0
  85. package/dist/interpretation/refusal.js.map +1 -0
  86. package/dist/interpretation/turn-options.d.ts +18 -0
  87. package/dist/interpretation/turn-options.d.ts.map +1 -0
  88. package/dist/interpretation/turn-options.js +417 -0
  89. package/dist/interpretation/turn-options.js.map +1 -0
  90. package/dist/interpretation/vocabulary.d.ts +5 -0
  91. package/dist/interpretation/vocabulary.d.ts.map +1 -1
  92. package/dist/interpretation/vocabulary.js +1 -1
  93. package/dist/interpretation/vocabulary.js.map +1 -1
  94. package/dist/knowledge/claude-code.d.ts +13 -1
  95. package/dist/knowledge/claude-code.d.ts.map +1 -1
  96. package/dist/knowledge/claude-code.js +35 -13
  97. package/dist/knowledge/claude-code.js.map +1 -1
  98. package/dist/knowledge/codex.d.ts.map +1 -1
  99. package/dist/knowledge/codex.js +25 -14
  100. package/dist/knowledge/codex.js.map +1 -1
  101. package/dist/knowledge/descriptor.d.ts +118 -14
  102. package/dist/knowledge/descriptor.d.ts.map +1 -1
  103. package/dist/knowledge/descriptor.js +58 -0
  104. package/dist/knowledge/descriptor.js.map +1 -1
  105. package/dist/knowledge/matchers.d.ts +3 -3
  106. package/dist/knowledge/matchers.d.ts.map +1 -1
  107. package/dist/knowledge/matchers.js +19 -6
  108. package/dist/knowledge/matchers.js.map +1 -1
  109. package/dist/knowledge/muse.d.ts +2 -2
  110. package/dist/knowledge/muse.d.ts.map +1 -1
  111. package/dist/knowledge/muse.js +22 -6
  112. package/dist/knowledge/muse.js.map +1 -1
  113. package/dist/knowledge/overrides.d.ts +7 -0
  114. package/dist/knowledge/overrides.d.ts.map +1 -1
  115. package/dist/knowledge/overrides.js +76 -0
  116. package/dist/knowledge/overrides.js.map +1 -1
  117. package/dist/knowledge/pi.d.ts.map +1 -1
  118. package/dist/knowledge/pi.js +25 -3
  119. package/dist/knowledge/pi.js.map +1 -1
  120. package/package.json +5 -2
  121. package/src/cli/args.ts +381 -0
  122. package/src/cli/check.ts +136 -0
  123. package/src/cli/exit-codes.ts +13 -0
  124. package/src/cli/help.ts +114 -0
  125. package/src/cli/index.ts +177 -0
  126. package/src/cli/inspect.ts +174 -0
  127. package/src/cli/ls.ts +14 -0
  128. package/src/cli/render.ts +62 -0
  129. package/src/cli/resolve-harness.ts +33 -0
  130. package/src/cli/run.ts +280 -0
  131. package/src/cli/session.ts +137 -0
  132. package/src/cli/version.ts +32 -0
  133. package/src/execution/decode.ts +32 -0
  134. package/src/execution/deps.ts +7 -1
  135. package/src/execution/events.ts +9 -2
  136. package/src/execution/failure.ts +159 -0
  137. package/src/execution/node-deps.ts +17 -0
  138. package/src/execution/stream-turn.ts +189 -17
  139. package/src/interpretation/argv.ts +85 -27
  140. package/src/interpretation/dimensions.ts +0 -6
  141. package/src/interpretation/limits.ts +97 -6
  142. package/src/interpretation/refusal.ts +116 -0
  143. package/src/interpretation/turn-options.ts +424 -0
  144. package/src/interpretation/vocabulary.ts +1 -1
  145. package/src/knowledge/claude-code.ts +35 -13
  146. package/src/knowledge/codex.ts +25 -14
  147. package/src/knowledge/descriptor.ts +138 -12
  148. package/src/knowledge/matchers.ts +22 -9
  149. package/src/knowledge/muse.ts +22 -6
  150. package/src/knowledge/overrides.ts +97 -0
  151. package/src/knowledge/pi.ts +25 -3
@@ -9,8 +9,17 @@
9
9
  * Feed these wall-eligible output only - stderr and the non-JSON tail of a
10
10
  * dying turn - never assistant message content, where the model merely
11
11
  * TALKING about limits would match.
12
+ *
13
+ * Matchers are serializable objects {pattern, flags, code/kind}; compilation
14
+ * to RegExp happens here with bounded inputs (pattern length, count, flags)
15
+ * and a WeakMap cache. The input window (first 4096 chars of a line), not
16
+ * pattern analysis, is the backtracking bound - a malicious pattern could
17
+ * otherwise catastrophically backtrack on a long line.
12
18
  */
13
- import type { AuthFailureKind, HarnessDescriptor, LimitCode } from "../knowledge/descriptor.js";
19
+ import type { AuthFailureKind, AuthMatcher, HarnessDescriptor, LimitCode, LimitMatcher } from "../knowledge/descriptor.js";
20
+ export declare const compileLimitMatchers: (matchers: ReadonlyArray<LimitMatcher>) => ReadonlyArray<readonly [RegExp, LimitCode]>;
21
+ export declare const compileAuthMatchers: (matchers: ReadonlyArray<AuthMatcher>) => ReadonlyArray<readonly [RegExp, AuthFailureKind]>;
22
+ export declare const compileMatchers: <T extends LimitMatcher | AuthMatcher>(matchers: ReadonlyArray<T>) => ReadonlyArray<readonly [RegExp, unknown]>;
14
23
  /** Per-line entry point for streaming readers: O(1) per line, no rescans. */
15
24
  export declare const detectLimitInLine: (h: HarnessDescriptor, line: string) => LimitCode | null;
16
25
  /** Batch convenience over a turn's tail, bounded and bottom-up. */
@@ -1 +1 @@
1
- {"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../src/interpretation/limits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAoChG,6EAA6E;AAC7E,eAAO,MAAM,iBAAiB,MAAO,iBAAiB,QAAQ,MAAM,KAAG,SAAS,GAAG,IAC3C,CAAC;AAEzC,mEAAmE;AACnE,eAAO,MAAM,WAAW,MAAO,iBAAiB,UAAU,MAAM,KAAG,SAAS,GAAG,IAC5C,CAAC;AAEpC,eAAO,MAAM,uBAAuB,MAC/B,iBAAiB,QACd,MAAM,KACX,eAAe,GAAG,IAA6C,CAAC;AAEnE,eAAO,MAAM,iBAAiB,MAAO,iBAAiB,UAAU,MAAM,KAAG,eAAe,GAAG,IACzD,CAAC"}
1
+ {"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../src/interpretation/limits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,SAAS,EACT,YAAY,EACb,MAAM,4BAA4B,CAAC;AA0CpC,eAAO,MAAM,oBAAoB,aACrB,aAAa,CAAC,YAAY,CAAC,KACpC,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,CAS5C,CAAC;AAEF,eAAO,MAAM,mBAAmB,aACpB,aAAa,CAAC,WAAW,CAAC,KACnC,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,eAAe,CAAC,CASlD,CAAC;AAGF,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,YAAY,GAAG,WAAW,YACxD,aAAa,CAAC,CAAC,CAAC,KACzB,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAW1C,CAAC;AAgCF,6EAA6E;AAC7E,eAAO,MAAM,iBAAiB,MAAO,iBAAiB,QAAQ,MAAM,KAAG,SAAS,GAAG,IACrB,CAAC;AAE/D,mEAAmE;AACnE,eAAO,MAAM,WAAW,MAAO,iBAAiB,UAAU,MAAM,KAAG,SAAS,GAAG,IACtB,CAAC;AAE1D,eAAO,MAAM,uBAAuB,MAC/B,iBAAiB,QACd,MAAM,KACX,eAAe,GAAG,IAAkE,CAAC;AAExF,eAAO,MAAM,iBAAiB,MAAO,iBAAiB,UAAU,MAAM,KAAG,eAAe,GAAG,IACpC,CAAC"}
@@ -1,11 +1,90 @@
1
+ /**
2
+ * Wall detection: pure classification of harness output against the
3
+ * descriptor's limit and auth matchers. Returns the CODE, never the matched
4
+ * line - the consumers of a detection are a retained record and a viewer
5
+ * warning, and anything the harness printed on that line (a prompt, a
6
+ * filename, a customer's name) must not ride along (v1 D-005: records carry
7
+ * identifiers and outcomes, never content).
8
+ *
9
+ * Feed these wall-eligible output only - stderr and the non-JSON tail of a
10
+ * dying turn - never assistant message content, where the model merely
11
+ * TALKING about limits would match.
12
+ *
13
+ * Matchers are serializable objects {pattern, flags, code/kind}; compilation
14
+ * to RegExp happens here with bounded inputs (pattern length, count, flags)
15
+ * and a WeakMap cache. The input window (first 4096 chars of a line), not
16
+ * pattern analysis, is the backtracking bound - a malicious pattern could
17
+ * otherwise catastrophically backtrack on a long line.
18
+ */
1
19
  /** Bottom-up batch scans stop after this many non-empty lines: the wall is
2
20
  * virtually always the last thing a dying turn printed, and an unbounded
3
21
  * scan over an accumulating session buffer is O(turns x output). */
4
22
  const BATCH_SCAN_MAX_LINES = 200;
23
+ /** Max pattern length and max matchers per harness per kind - load-bearing
24
+ * bounds that prevent a crafted override file from DoS'ing the matcher
25
+ * compiler or the scanner. */
26
+ const MAX_PATTERN_LENGTH = 200;
27
+ const MAX_MATCHERS_PER_KIND = 64;
28
+ const WINDOW = 4096;
29
+ // WeakMap cache: same matcher array instance reuses identical RegExp objects
30
+ const limitCache = new WeakMap();
31
+ const authCache = new WeakMap();
32
+ const validateAndCompile = (pattern, flags) => {
33
+ const f = flags ?? "i";
34
+ if (pattern.length > MAX_PATTERN_LENGTH) {
35
+ throw new Error(`pattern over ${MAX_PATTERN_LENGTH} characters`);
36
+ }
37
+ if (f.includes("g") || f.includes("y")) {
38
+ throw new Error(`flags must not contain g or y (got ${JSON.stringify(f)})`);
39
+ }
40
+ for (const ch of f) {
41
+ if (!"imsu".includes(ch))
42
+ throw new Error(`flag ${JSON.stringify(ch)} outside imsu`);
43
+ }
44
+ try {
45
+ return new RegExp(pattern, f);
46
+ }
47
+ catch (e) {
48
+ throw new Error(`uncompilable pattern ${JSON.stringify(pattern)}: ${e.message}`);
49
+ }
50
+ };
51
+ export const compileLimitMatchers = (matchers) => {
52
+ const cached = limitCache.get(matchers);
53
+ if (cached !== undefined)
54
+ return cached;
55
+ if (matchers.length > MAX_MATCHERS_PER_KIND) {
56
+ throw new Error(`more than ${MAX_MATCHERS_PER_KIND} matchers per harness per kind`);
57
+ }
58
+ const compiled = matchers.map((m) => [validateAndCompile(m.pattern, m.flags), m.code]);
59
+ limitCache.set(matchers, compiled);
60
+ return compiled;
61
+ };
62
+ export const compileAuthMatchers = (matchers) => {
63
+ const cached = authCache.get(matchers);
64
+ if (cached !== undefined)
65
+ return cached;
66
+ if (matchers.length > MAX_MATCHERS_PER_KIND) {
67
+ throw new Error(`more than ${MAX_MATCHERS_PER_KIND} matchers per harness per kind`);
68
+ }
69
+ const compiled = matchers.map((m) => [validateAndCompile(m.pattern, m.flags), m.kind]);
70
+ authCache.set(matchers, compiled);
71
+ return compiled;
72
+ };
73
+ // Generic alias for tests that call compileMatchers directly
74
+ export const compileMatchers = (matchers) => {
75
+ // Dispatch based on first element's shape - limit has code, auth has kind
76
+ if (matchers.length === 0)
77
+ return [];
78
+ const first = matchers[0];
79
+ if ("code" in first)
80
+ return compileLimitMatchers(matchers);
81
+ return compileAuthMatchers(matchers);
82
+ };
5
83
  const scanLine = (line, matchers) => {
84
+ const windowed = line.slice(0, WINDOW);
6
85
  for (let i = 0; i < matchers.length; i++) {
7
86
  const matcher = matchers[i];
8
- if (matcher?.[0].test(line))
87
+ if (matcher?.[0].test(windowed))
9
88
  return matcher[1];
10
89
  }
11
90
  return null;
@@ -27,9 +106,9 @@ const scanTail = (output, matchers) => {
27
106
  return null;
28
107
  };
29
108
  /** Per-line entry point for streaming readers: O(1) per line, no rescans. */
30
- export const detectLimitInLine = (h, line) => scanLine(line.trim(), h.limitMatchers);
109
+ export const detectLimitInLine = (h, line) => scanLine(line.trim(), compileLimitMatchers(h.limitMatchers));
31
110
  /** Batch convenience over a turn's tail, bounded and bottom-up. */
32
- export const detectLimit = (h, output) => scanTail(output, h.limitMatchers);
33
- export const detectAuthFailureInLine = (h, line) => scanLine(line.trim(), h.authMatchers);
34
- export const detectAuthFailure = (h, output) => scanTail(output, h.authMatchers);
111
+ export const detectLimit = (h, output) => scanTail(output, compileLimitMatchers(h.limitMatchers));
112
+ export const detectAuthFailureInLine = (h, line) => scanLine(line.trim(), compileAuthMatchers(h.authMatchers));
113
+ export const detectAuthFailure = (h, output) => scanTail(output, compileAuthMatchers(h.authMatchers));
35
114
  //# sourceMappingURL=limits.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"limits.js","sourceRoot":"","sources":["../../src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AAoB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC;AAE1D,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,CAAoB,EACpB,IAAY,EACY,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,mBAAmB,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;AAExF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAoB,EAAE,MAAc,EAA0B,EAAE,CAChG,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Structured argv refusals: closed issue vocabulary and the typed error
3
+ * that carries harness, option, facet, and supported alternatives. The
4
+ * helper builds the message from those fields so the two cannot drift - a
5
+ * consumer branching on `issue` never has to parse English.
6
+ */
7
+ import type { DiscoveryFacet, HarnessName, TurnOptionKey } from "../knowledge/descriptor.js";
8
+ export declare const REFUSAL_ISSUES: readonly ["unsupported-option", "unsupported-option-facet", "unsupported-on-resume", "invalid-option-value", "unknown-effort", "unknown-model", "invalid-env", "invalid-tool-grant", "prompt-flag-injection", "no-autonomy-mode", "no-session-mode"];
9
+ export type RefusalIssue = (typeof REFUSAL_ISSUES)[number];
10
+ /** One helper builds the message from the structured fields so message and
11
+ * fields cannot drift. Every message names an alternative, not only a
12
+ * negation, so an agent can pivot without reading the descriptor. */
13
+ export declare const buildRefusalMessage: (issue: RefusalIssue, harness: HarnessName, option?: TurnOptionKey, facet?: DiscoveryFacet, supported?: readonly string[], detail?: string) => string;
14
+ /** Raised when launch options would corrupt or subvert the spawned argv. */
15
+ export declare class ArgvRefusalError extends Error {
16
+ readonly issue: RefusalIssue;
17
+ readonly harness: HarnessName;
18
+ readonly option?: TurnOptionKey;
19
+ readonly facet?: DiscoveryFacet;
20
+ readonly supported: readonly string[];
21
+ constructor(args: {
22
+ readonly issue: RefusalIssue;
23
+ readonly harness: HarnessName;
24
+ readonly option?: TurnOptionKey;
25
+ readonly facet?: DiscoveryFacet;
26
+ readonly supported?: readonly string[];
27
+ readonly detail?: string;
28
+ readonly message?: string;
29
+ });
30
+ }
31
+ //# sourceMappingURL=refusal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refusal.d.ts","sourceRoot":"","sources":["../../src/interpretation/refusal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG7F,eAAO,MAAM,cAAc,sPAYhB,CAAC;AACZ,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D;;qEAEqE;AACrE,eAAO,MAAM,mBAAmB,UACvB,YAAY,WACV,WAAW,WACX,aAAa,UACd,cAAc,cACX,SAAS,MAAM,EAAE,WACnB,MAAM,KACd,MA4CF,CAAC;AAEF,4EAA4E;AAC5E,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,YAAY,IAAI,EAAE;QAChB,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;QAC7B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;QAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;QAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,cAAc,CAAC;QAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QACvC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;KAC3B,EAkBA;CACF"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Structured argv refusals: closed issue vocabulary and the typed error
3
+ * that carries harness, option, facet, and supported alternatives. The
4
+ * helper builds the message from those fields so the two cannot drift - a
5
+ * consumer branching on `issue` never has to parse English.
6
+ */
7
+ import { deepFreeze } from "../knowledge/descriptor.js";
8
+ export const REFUSAL_ISSUES = deepFreeze([
9
+ "unsupported-option",
10
+ "unsupported-option-facet",
11
+ "unsupported-on-resume",
12
+ "invalid-option-value",
13
+ "unknown-effort",
14
+ "unknown-model",
15
+ "invalid-env",
16
+ "invalid-tool-grant",
17
+ "prompt-flag-injection",
18
+ "no-autonomy-mode",
19
+ "no-session-mode",
20
+ ]);
21
+ /** One helper builds the message from the structured fields so message and
22
+ * fields cannot drift. Every message names an alternative, not only a
23
+ * negation, so an agent can pivot without reading the descriptor. */
24
+ export const buildRefusalMessage = (issue, harness, option, facet, supported = [], detail) => {
25
+ const supportedStr = supported.length > 0 ? `supported: ${supported.join(", ")}` : "supported: (none)";
26
+ const facetSuffix = facet ? ` facet ${JSON.stringify(facet)}` : "";
27
+ const optionPart = option
28
+ ? ` option ${JSON.stringify(option)}${facetSuffix}`
29
+ : facet
30
+ ? ` facet ${JSON.stringify(facet)}`
31
+ : "";
32
+ const detailSuffix = detail ? ` (${detail})` : "";
33
+ switch (issue) {
34
+ case "unsupported-option":
35
+ return `${harness} cannot express${optionPart}${detailSuffix}; ${supportedStr} - drop the option or route this work to a harness that supports it`;
36
+ case "unsupported-option-facet":
37
+ return `${harness} cannot express discovery${facetSuffix}${detailSuffix}; ${supportedStr} - drop the facet or route this work to a harness that supports it`;
38
+ case "unsupported-on-resume": {
39
+ const name = option
40
+ ? JSON.stringify(option) + (facet ? `:${facet}` : "")
41
+ : facet
42
+ ? JSON.stringify(facet)
43
+ : "option";
44
+ return `${name} cannot be expressed on resume for ${harness}${detailSuffix}; ${supportedStr} - re-launch instead of resuming or drop the option`;
45
+ }
46
+ case "invalid-option-value":
47
+ return `invalid value for${optionPart} on ${harness}${detailSuffix}; ${supportedStr} - use a supported value instead`;
48
+ case "unknown-effort":
49
+ return `unknown effort for ${harness}${detail ? ` ${JSON.stringify(detail)}` : ""}; ${supportedStr} - use one of the ladder values`;
50
+ case "unknown-model":
51
+ return `unknown ${harness} model${detail ? ` ${JSON.stringify(detail)}` : ""}; ${supportedStr} - use one of the supported models`;
52
+ case "invalid-env":
53
+ return `invalid env key or value for ${harness}${detailSuffix}; ${supportedStr} - keys must match ^[A-Za-z_][A-Za-z0-9_]*$ and contain no NUL`;
54
+ case "invalid-tool-grant":
55
+ return `tool grant for ${harness} contains an empty entry or a comma; a blank tool flag value grants nothing detectable, and a comma inside one name silently splits the grant; ${supportedStr} - provide comma-free, non-empty tool names as separate entries`;
56
+ case "prompt-flag-injection":
57
+ return `positional prompt may not start with '-'; it would be parsed as a flag by ${harness}${detailSuffix}; ${supportedStr} - remove leading '-' or prefix with a space`;
58
+ case "no-autonomy-mode":
59
+ return `${harness} has no unattended-run flag; ${supportedStr} - drop autonomy or route to a supporting harness (claude --dangerously-skip-permissions, codex/muse --yolo)`;
60
+ case "no-session-mode":
61
+ return `${harness} declares no persistent headless session mode; ${supportedStr} - use streamTurn instead of openSession`;
62
+ default: {
63
+ const exhaustive = issue;
64
+ return `${exhaustive} for ${harness}${optionPart}${detailSuffix}; ${supportedStr}`;
65
+ }
66
+ }
67
+ };
68
+ /** Raised when launch options would corrupt or subvert the spawned argv. */
69
+ export class ArgvRefusalError extends Error {
70
+ issue;
71
+ harness;
72
+ option;
73
+ facet;
74
+ supported;
75
+ constructor(args) {
76
+ const message = args.message ??
77
+ buildRefusalMessage(args.issue, args.harness, args.option, args.facet, args.supported ?? [], args.detail);
78
+ super(message);
79
+ this.name = "ArgvRefusalError";
80
+ this.issue = args.issue;
81
+ this.harness = args.harness;
82
+ this.option = args.option;
83
+ this.facet = args.facet;
84
+ this.supported = args.supported ?? [];
85
+ }
86
+ }
87
+ //# sourceMappingURL=refusal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refusal.js","sourceRoot":"","sources":["../../src/interpretation/refusal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;IACvC,oBAAoB;IACpB,0BAA0B;IAC1B,uBAAuB;IACvB,sBAAsB;IACtB,gBAAgB;IAChB,eAAe;IACf,aAAa;IACb,oBAAoB;IACpB,uBAAuB;IACvB,kBAAkB;IAClB,iBAAiB;CACT,CAAC,CAAC;AAGZ;;qEAEqE;AACrE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,KAAmB,EACnB,OAAoB,EACpB,MAAsB,EACtB,KAAsB,EACtB,SAAS,GAAsB,EAAE,EACjC,MAAe,EACP,EAAE;IACV,MAAM,YAAY,GAChB,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC;IACpF,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACnE,MAAM,UAAU,GAAG,MAAM;QACvB,CAAC,CAAC,WAAW,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,WAAW,EAAE;QACnD,CAAC,CAAC,KAAK;YACL,CAAC,CAAC,UAAU,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;YACnC,CAAC,CAAC,EAAE,CAAC;IACT,MAAM,YAAY,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAClD,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,oBAAoB;YACvB,O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G,YAAY,KAAK,YAAY,8CAA8C,CAAC;QAC5K,KAAK,kBAAkB;YACrB,OAAO,GAAG,OAAO,gCAAgC,YAAY,8GAA8G,CAAC;QAC9K,KAAK,iBAAiB;YACpB,OAAO,GAAG,OAAO,kDAAkD,YAAY,0CAA0C,CAAC;QAC5H,SAAS,CAAC;YACR,MAAM,UAAU,GAAU,KAAK,CAAC;YAChC,OAAO,GAAG,UAAoB,QAAQ,OAAO,GAAG,UAAU,GAAG,YAAY,KAAK,YAAY,EAAE,CAAC;QAC/F,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAEF,4EAA4E;AAC5E,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAChC,KAAK,CAAe;IACpB,OAAO,CAAc;IACrB,MAAM,CAAiB;IACvB,KAAK,CAAkB;IACvB,SAAS,CAAoB;IACtC,YAAY,IAQX;QACC,MAAM,OAAO,GACX,IAAI,CAAC,OAAO;YACZ,mBAAmB,CACjB,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,SAAS,IAAI,EAAE,EACpB,IAAI,CAAC,MAAM,CACZ,CAAC;QACJ,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC;IACxC,CAAC;CACF"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * turn-options: rendering and validation of per-call turn options into argv.
3
+ *
4
+ * This lives separately from argv.ts because argv.ts owns argv *assembly and
5
+ * ordering* (where the prompt goes, that tools is last, that resume never
6
+ * inherits launch flags). Turn-option *rendering and validation* - which
7
+ * flag spells a dimension, how its value is validated and quoted, and when
8
+ * it must refuse - is a distinct responsibility with its own vocabulary.
9
+ * Folding it into argv.ts would make the largest interpretation file the
10
+ * place two unrelated questions are answered.
11
+ */
12
+ import type { HarnessDescriptor } from "../knowledge/descriptor.js";
13
+ import type { TurnOptions } from "./argv.js";
14
+ /** Render turn options for a given phase, in TURN_OPTION_KEYS order and with
15
+ * discovery facets in DISCOVERY_FACETS order, de-duplicating by exact token
16
+ * sequence (first wins) so claude's two facets sharing one flag emit once. */
17
+ export declare const renderTurnOptions: (h: HarnessDescriptor, opts: TurnOptions, phase: "launch" | "resume") => string[];
18
+ //# sourceMappingURL=turn-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"turn-options.d.ts","sourceRoot":"","sources":["../../src/interpretation/turn-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAA0B,MAAM,4BAA4B,CAAC;AAE5F,OAAO,KAAK,EAAoB,WAAW,EAAE,MAAM,WAAW,CAAC;AAY/D;;8EAE8E;AAC9E,eAAO,MAAM,iBAAiB,MACzB,iBAAiB,QACd,WAAW,SACV,QAAQ,GAAG,QAAQ,KACzB,MAAM,EAuYR,CAAC"}