instar 1.3.1139 → 1.3.1140

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.
@@ -2,7 +2,7 @@
2
2
  "schemaVersion": 1,
3
3
  "generatedFrom": "source-tree",
4
4
  "registrySha256": "81b53363a440e832672618965540b3e507ae0d93adcc67ec2b93daf7933b3ab4",
5
- "packageVersion": "1.3.1139",
5
+ "packageVersion": "1.3.1140",
6
6
  "guards": [
7
7
  {
8
8
  "ref": "docs/audits/phase-b/f10-triage.md",
@@ -1,5 +1,5 @@
1
1
  {
2
- "sha256": "422eccbf1f686ac1baca812ee72a9dc62bad75bb662ab2482fa66457e9caedc4",
2
+ "sha256": "15c9d6c3753ee5491f6774991e683e3b99cc67f05376ab66dcbd63ebd26a9f38",
3
3
  "registrySha256": "81b53363a440e832672618965540b3e507ae0d93adcc67ec2b93daf7933b3ab4",
4
- "packageVersion": "1.3.1139"
4
+ "packageVersion": "1.3.1140"
5
5
  }
@@ -2,5 +2,5 @@
2
2
  "sha256": "81b53363a440e832672618965540b3e507ae0d93adcc67ec2b93daf7933b3ab4",
3
3
  "articleCount": 88,
4
4
  "generatedFrom": "docs/STANDARDS-REGISTRY.md",
5
- "packageVersion": "1.3.1139"
5
+ "packageVersion": "1.3.1140"
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instar",
3
- "version": "1.3.1139",
3
+ "version": "1.3.1140",
4
4
  "description": "Coherence infrastructure for self-evolving AI agents — on the Claude Code or Codex subscription you already have.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -66,7 +66,53 @@ const EXTENSIONS = new Set(['.ts', '.tsx', '.js', '.mjs', '.cjs']);
66
66
  // `new <ProviderClass>(` — the construction. An IMPORT of the class is fine
67
67
  // (the factory imports them); only a direct `new …(` outside the funnel is a
68
68
  // bypass.
69
- const PATTERNS = PROVIDER_CLASSES.map((cls) => new RegExp(`\\bnew\\s+${cls}\\s*\\(`));
69
+ //
70
+ // ALIAS + NAMESPACE AWARE (2026-08-14). The original matched the class NAME as
71
+ // literal text, so two ordinary import styles walked straight past a SAFETY
72
+ // floor — the spawn cap added after the 2026-06-20 OOM fork-bomb:
73
+ //
74
+ // import { ClaudeCliIntelligenceProvider as Provider } from '...';
75
+ // new Provider(...) // real uncapped construction, invisible
76
+ //
77
+ // import * as mod from '...';
78
+ // new mod.ClaudeCliIntelligenceProvider(...) // also invisible: `\bnew\s+Cls`
79
+ // // cannot match across `mod.`
80
+ //
81
+ // Found by a peer-agent audit for checks defeatable by renaming. Resolve the
82
+ // local bindings FIRST, then match constructions under any of them.
83
+
84
+ /** Every local name a provider class is bound to in this file, plus namespace forms. */
85
+ export function localProviderBindings(content, cls) {
86
+ const names = new Set([cls]);
87
+ // `import { Cls as Alias }` and `const { Cls: Alias } = await import(...)`
88
+ for (const m of content.matchAll(new RegExp(`\\b${cls}\\s+as\\s+([A-Za-z_$][\\w$]*)`, 'g'))) names.add(m[1]);
89
+ for (const m of content.matchAll(new RegExp(`\\b${cls}\\s*:\\s*([A-Za-z_$][\\w$]*)`, 'g'))) names.add(m[1]);
90
+ return [...names];
91
+ }
92
+
93
+ /**
94
+ * Line numbers (1-based) in `content` that construct a spawn-capable provider,
95
+ * under ANY local binding or namespace qualifier. Comment-only lines excluded.
96
+ */
97
+ export function findProviderConstructions(content, classes = PROVIDER_CLASSES) {
98
+ const hits = [];
99
+ const lines = content.split('\n');
100
+ const perClass = classes.map((cls) => ({
101
+ cls,
102
+ names: localProviderBindings(content, cls),
103
+ }));
104
+ for (let i = 0; i < lines.length; i++) {
105
+ const trimmed = lines[i].trimStart();
106
+ if (/^(\/\/|\*|\/\*|#)/.test(trimmed)) continue;
107
+ for (const { cls, names } of perClass) {
108
+ const bare = names.some((n) => new RegExp(`\\bnew\\s+${n}\\s*\\(`).test(lines[i]));
109
+ // `new <ns>.<Cls>(` — a namespace import the bare form cannot see.
110
+ const viaNs = new RegExp(`\\bnew\\s+[A-Za-z_$][\\w$]*\\.${cls}\\s*\\(`).test(lines[i]);
111
+ if (bare || viaNs) { hits.push({ line: i + 1, cls }); break; }
112
+ }
113
+ }
114
+ return hits;
115
+ }
70
116
 
71
117
  function listFiles() {
72
118
  const staged = process.argv.includes('--staged');
@@ -96,6 +142,15 @@ function listFiles() {
96
142
  return files;
97
143
  }
98
144
 
145
+ // ── CLI body ─────────────────────────────────────────────────────────────
146
+ // Guarded so the exported detector above can be imported by tests WITHOUT
147
+ // running the scan — this module calls process.exit(1) on a violation, so an
148
+ // unguarded import would kill any test run the moment the repo had one.
149
+ // Same pattern as scripts/eli16-pr-description-check.mjs.
150
+ const invokedDirectly =
151
+ process.argv[1] && import.meta.url === new URL(`file://${process.argv[1]}`).href;
152
+
153
+ if (invokedDirectly) {
99
154
  let violations = 0;
100
155
  for (const rel of listFiles()) {
101
156
  const normalized = rel.split(path.sep).join('/');
@@ -111,21 +166,13 @@ for (const rel of listFiles()) {
111
166
  } catch {
112
167
  continue;
113
168
  }
114
- const lines = content.split('\n');
115
- for (let i = 0; i < lines.length; i++) {
116
- // Comment-only mentions are documentation, not a construction.
117
- const trimmed = lines[i].trimStart();
118
- if (/^(\/\/|\*|\/\*|#)/.test(trimmed)) continue;
119
- for (const pattern of PATTERNS) {
120
- if (pattern.test(lines[i])) {
121
- console.error(
122
- `${normalized}:${i + 1} — direct LLM-CLI provider construction outside the spawn-cap funnel. ` +
123
- `Build it through buildIntelligenceProvider() (which installs the host-wide spawn cap + circuit breaker), ` +
124
- `or add an allowlist entry here with a spawn-bounding justification.`,
125
- );
126
- violations++;
127
- }
128
- }
169
+ for (const hit of findProviderConstructions(content)) {
170
+ console.error(
171
+ `${normalized}:${hit.line} — direct LLM-CLI provider construction outside the spawn-cap funnel. ` +
172
+ `Build it through buildIntelligenceProvider() (which installs the host-wide spawn cap + circuit breaker), ` +
173
+ `or add an allowlist entry here with a spawn-bounding justification.`,
174
+ );
175
+ violations++;
129
176
  }
130
177
  }
131
178
 
@@ -135,3 +182,4 @@ if (violations > 0) {
135
182
  process.exit(1);
136
183
  }
137
184
  console.log('lint-no-unbounded-llm-spawn: clean');
185
+ }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "./builtin-manifest.schema.json",
3
3
  "schemaVersion": 1,
4
- "generatedAt": "2026-08-14T18:20:02.541Z",
5
- "instarVersion": "1.3.1139",
4
+ "generatedAt": "2026-08-14T19:14:01.581Z",
5
+ "instarVersion": "1.3.1140",
6
6
  "entryCount": 202,
7
7
  "entries": {
8
8
  "hook:session-start": {
@@ -2,7 +2,7 @@
2
2
  "schemaVersion": 1,
3
3
  "generatedFrom": "source-tree",
4
4
  "registrySha256": "81b53363a440e832672618965540b3e507ae0d93adcc67ec2b93daf7933b3ab4",
5
- "packageVersion": "1.3.1139",
5
+ "packageVersion": "1.3.1140",
6
6
  "guards": [
7
7
  {
8
8
  "ref": "docs/audits/phase-b/f10-triage.md",
@@ -1,5 +1,5 @@
1
1
  {
2
- "sha256": "422eccbf1f686ac1baca812ee72a9dc62bad75bb662ab2482fa66457e9caedc4",
2
+ "sha256": "15c9d6c3753ee5491f6774991e683e3b99cc67f05376ab66dcbd63ebd26a9f38",
3
3
  "registrySha256": "81b53363a440e832672618965540b3e507ae0d93adcc67ec2b93daf7933b3ab4",
4
- "packageVersion": "1.3.1139"
4
+ "packageVersion": "1.3.1140"
5
5
  }
@@ -2,5 +2,5 @@
2
2
  "sha256": "81b53363a440e832672618965540b3e507ae0d93adcc67ec2b93daf7933b3ab4",
3
3
  "articleCount": 88,
4
4
  "generatedFrom": "docs/STANDARDS-REGISTRY.md",
5
- "packageVersion": "1.3.1139"
5
+ "packageVersion": "1.3.1140"
6
6
  }
@@ -0,0 +1,30 @@
1
+ # Upgrade Guide — vNEXT
2
+
3
+ <!-- assembled-by: assemble-next-md -->
4
+ <!-- bump: patch -->
5
+
6
+ ## What Changed
7
+
8
+ The check that stops an uncapped AI process being created outside its safety limit could be walked past by renaming an import.
9
+
10
+ - **It matched the class by its name as literal text.** Two ordinary import styles defeat that: rename it on import and use the new name, or import the whole module and reach the class through it. Either is a real, uncapped construction that the check could not see.
11
+ - **It now works out every local name the class is bound to** in a file before looking for constructions, and separately recognises the module-qualified form.
12
+ - **The detection is now a separate importable function**, so it can be tested with small fixtures rather than only by running the whole check over the whole codebase.
13
+ - **Importing it no longer runs it.** The command body stops the process when it finds a violation, so importing the detector in a test would have killed the test run the moment the codebase had one.
14
+ - **No new rule and no new work.** The same constructions are forbidden as before; more of them are visible. The codebase passes cleanly both before and after.
15
+
16
+ ## What to Tell Your User
17
+
18
+ In June this system created somewhere between two and three hundred AI processes at once and ran the machine out of memory. The fix was a hard ceiling, plus a check that refuses any code creating one of those processes outside the ceilinged path.
19
+
20
+ That check looked for the thing by name, and renaming something on import is completely ordinary — so a real violation could sit there in plain sight and the check would report everything fine. Nothing was actually wrong today; the hole was in the guard, not the code it guards.
21
+
22
+ It now recognises the renamed and module-qualified forms. This was chosen first out of twenty-five checks with the same weakness, because it guards a safety limit rather than a convention, and because the failure it prevents has already happened once.
23
+
24
+ ## Summary of New Capabilities
25
+
26
+ None. This widens what an existing check can see. No new command, route, setting, or rule, and no new violations are introduced.
27
+
28
+ ## Evidence
29
+
30
+ The blindness was confirmed in the check's own source before any change: it built a pattern from the class name and tested it line by line, which cannot match across a module qualifier and matches nothing at all once the name is replaced by an alias. Proven in both directions — restricted back to name-only matching, five tests fail and six still pass, those six being the plain case and four deliberate opposite-direction controls: an import alone is not a construction, a comment mentioning the class is not, a differently-named class is not flagged, and a plain variable sharing the name is not. Without those, something that flagged everything would pass every test about catching bypasses and be useless on a healthy codebase. The real codebase passes cleanly before and after, so no false positives were introduced. Import-safety verified in both modes. Source restored byte-identical after the check.