@tangle-network/starter-foundry 0.7.2 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/starter-foundry",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "Deterministic project scaffold engine for AI coding platforms",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -109,7 +109,6 @@
109
109
  "@tangle-network/tcloud": "^0.4.2"
110
110
  },
111
111
  "optionalDependencies": {
112
- "@opentelemetry/api": "^1.9.0",
113
- "@tangle-network/tcloud-agent": "link:../tcloud/packages/tcloud-agent"
112
+ "@opentelemetry/api": "^1.9.0"
114
113
  }
115
114
  }
@@ -1,9 +0,0 @@
1
- /**
2
- * Pick a zk capability for a prompt that mentions a zk primitive generically.
3
- *
4
- * @param text - the prompt text; hashed for deterministic selection.
5
- * @param group - which preference group to consult (today: only "zkvm").
6
- * @returns the capability ID (e.g. "capability:zkvm-risczero") or null when
7
- * the group is unknown or has no weights.
8
- */
9
- export declare function pickZkCapability(text: string, group: string): string | null;
@@ -1,91 +0,0 @@
1
- // Operator-controlled weighted pick for ambiguous zk capability selection.
2
- // When a prompt mentions a zk primitive generically (e.g. "zkvm", "zk proof")
3
- // without naming a specific framework, resolve via weights in
4
- // .evolve/capability-preferences.json.
5
- //
6
- // Selection is DETERMINISTIC per prompt — we hash the prompt text into an
7
- // integer and use weighted-interval selection. Same prompt → same pick across
8
- // runs (no session-to-session variance), but different prompts cycle through
9
- // the weighted distribution.
10
- //
11
- // Explicit prompts bypass this entirely; see implicit-caps.ts for the
12
- // explicit-first branches.
13
- import { readFileSync, existsSync } from 'node:fs';
14
- import { dirname, join, resolve } from 'node:path';
15
- import { fileURLToPath } from 'node:url';
16
- // Repo-rooted path so this resolves correctly from test fixtures + production.
17
- // We re-resolve per call so test overrides via STARTER_FOUNDRY_REPO_OVERRIDE
18
- // work.
19
- function preferencesPath() {
20
- const override = process.env.STARTER_FOUNDRY_REPO_OVERRIDE;
21
- if (override)
22
- return join(override, '.evolve/capability-preferences.json');
23
- // __filename equivalent for ESM — resolve from dist/lib/planner/zk-preferences.js
24
- // up to the repo root. src/lib/planner/zk-preferences.ts compiles to the same
25
- // relative structure.
26
- return resolve(dirname(fileURLToPath(import.meta.url)), '../../../.evolve/capability-preferences.json');
27
- }
28
- function loadPreferences() {
29
- const path = preferencesPath();
30
- if (!existsSync(path))
31
- return null;
32
- try {
33
- return JSON.parse(readFileSync(path, 'utf8'));
34
- }
35
- catch {
36
- return null;
37
- }
38
- }
39
- // Deterministic integer hash over the prompt — stable across runs, no crypto
40
- // (fast + predictable). 32-bit unsigned; good enough for distribution
41
- // spreading across 3-10 weighted options.
42
- function hashText(text) {
43
- let h = 2166136261 >>> 0; // FNV-1a seed
44
- for (let i = 0; i < text.length; i += 1) {
45
- h ^= text.charCodeAt(i);
46
- h = Math.imul(h, 16777619) >>> 0;
47
- }
48
- return h >>> 0;
49
- }
50
- // Weighted interval selection: flatten weights into a cumulative array,
51
- // pick the bucket where hash%total falls. Returns null when the group has
52
- // no weights (operator disabled the pool) or the group is unknown.
53
- function weightedPick(weights, hash) {
54
- const entries = Object.entries(weights).filter(([, w]) => w > 0);
55
- if (entries.length === 0)
56
- return null;
57
- const total = entries.reduce((sum, [, w]) => sum + w, 0);
58
- if (total <= 0)
59
- return null;
60
- const target = hash % total;
61
- let acc = 0;
62
- for (const [name, w] of entries) {
63
- acc += w;
64
- if (target < acc)
65
- return name;
66
- }
67
- // Unreachable given total > 0 and target < total; belt-and-suspenders.
68
- return entries[entries.length - 1][0];
69
- }
70
- /**
71
- * Pick a zk capability for a prompt that mentions a zk primitive generically.
72
- *
73
- * @param text - the prompt text; hashed for deterministic selection.
74
- * @param group - which preference group to consult (today: only "zkvm").
75
- * @returns the capability ID (e.g. "capability:zkvm-risczero") or null when
76
- * the group is unknown or has no weights.
77
- */
78
- export function pickZkCapability(text, group) {
79
- const prefs = loadPreferences();
80
- if (!prefs)
81
- return null;
82
- const g = prefs.groups?.[group];
83
- if (!g)
84
- return null;
85
- const hash = hashText(text);
86
- const picked = weightedPick(g.weights, hash) ?? g.default;
87
- if (!picked)
88
- return null;
89
- return `capability:${picked}`;
90
- }
91
- //# sourceMappingURL=zk-preferences.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"zk-preferences.js","sourceRoot":"","sources":["../../../src/lib/planner/zk-preferences.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,8EAA8E;AAC9E,8DAA8D;AAC9D,uCAAuC;AACvC,EAAE;AACF,0EAA0E;AAC1E,8EAA8E;AAC9E,6EAA6E;AAC7E,6BAA6B;AAC7B,EAAE;AACF,sEAAsE;AACtE,2BAA2B;AAE3B,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAWxC,+EAA+E;AAC/E,6EAA6E;AAC7E,QAAQ;AACR,SAAS,eAAe;IACtB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAA;IAC1D,IAAI,QAAQ;QAAE,OAAO,IAAI,CAAC,QAAQ,EAAE,qCAAqC,CAAC,CAAA;IAC1E,kFAAkF;IAClF,8EAA8E;IAC9E,sBAAsB;IACtB,OAAO,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,8CAA8C,CAAC,CAAA;AACzG,CAAC;AAED,SAAS,eAAe;IACtB,MAAM,IAAI,GAAG,eAAe,EAAE,CAAA;IAC9B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IAClC,IAAI,CAAC;QACH,OA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