copperhead 0.8.1 → 0.10.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.
- package/NOTICE +1 -1
- package/README.md +13 -5
- package/dist/agent/filetools.js +24 -1
- package/dist/agent/filetools.js.map +1 -1
- package/dist/agent/ledger.js +24 -0
- package/dist/agent/ledger.js.map +1 -1
- package/dist/agent/loop.js +67 -62
- package/dist/agent/loop.js.map +1 -1
- package/dist/agent/prompts.js +4 -3
- package/dist/agent/prompts.js.map +1 -1
- package/dist/agent/providers/openai.js +28 -6
- package/dist/agent/providers/openai.js.map +1 -1
- package/dist/agent/providers/tool-protocol.js +21 -0
- package/dist/agent/providers/tool-protocol.js.map +1 -1
- package/dist/agent/recovery.js +95 -1
- package/dist/agent/recovery.js.map +1 -1
- package/dist/agent/response-cache.js +18 -2
- package/dist/agent/response-cache.js.map +1 -1
- package/dist/agent/tools.js +185 -1
- package/dist/agent/tools.js.map +1 -1
- package/dist/agent/transcript.js +2 -0
- package/dist/agent/transcript.js.map +1 -1
- package/dist/cli.js +77 -2
- package/dist/cli.js.map +1 -1
- package/dist/commands/check.js +33 -1
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/create.js +282 -26
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/doctor.js +211 -11
- package/dist/commands/doctor.js.map +1 -1
- package/dist/config.js +61 -4
- package/dist/config.js.map +1 -1
- package/dist/kicad/bootstrap.js +24 -3
- package/dist/kicad/bootstrap.js.map +1 -1
- package/dist/kicad/cli.js +7 -26
- package/dist/kicad/cli.js.map +1 -1
- package/dist/kicad/dossier.js +207 -0
- package/dist/kicad/dossier.js.map +1 -0
- package/dist/kicad/draft/draft.js +132 -0
- package/dist/kicad/draft/draft.js.map +1 -0
- package/dist/kicad/draft/engine.js +2389 -0
- package/dist/kicad/draft/engine.js.map +1 -0
- package/dist/kicad/draft/ir.js +368 -0
- package/dist/kicad/draft/ir.js.map +1 -0
- package/dist/kicad/draft/symsource.js +490 -0
- package/dist/kicad/draft/symsource.js.map +1 -0
- package/dist/kicad/emit.js +181 -0
- package/dist/kicad/emit.js.map +1 -0
- package/dist/kicad/fab.js +13 -0
- package/dist/kicad/fab.js.map +1 -1
- package/dist/kicad/legibility.js +561 -0
- package/dist/kicad/legibility.js.map +1 -0
- package/dist/kicad/score.js +261 -0
- package/dist/kicad/score.js.map +1 -0
- package/dist/kicad/sexp.js +262 -10
- package/dist/kicad/sexp.js.map +1 -1
- package/dist/kicad/symlib.js +346 -16
- package/dist/kicad/symlib.js.map +1 -1
- package/dist/memory/bom-table.js +108 -34
- package/dist/memory/bom-table.js.map +1 -1
- package/dist/memory/scaffold.js +6 -0
- package/dist/memory/scaffold.js.map +1 -1
- package/dist/openspec/cli.js +2 -1
- package/dist/openspec/cli.js.map +1 -1
- package/dist/util/preflight.js +17 -0
- package/dist/util/preflight.js.map +1 -1
- package/dist/util/redact.js +12 -2
- package/dist/util/redact.js.map +1 -1
- package/package.json +9 -7
- package/src/agent/filetools.ts +26 -1
- package/src/agent/ledger.ts +24 -0
- package/src/agent/loop.ts +88 -65
- package/src/agent/prompts.ts +4 -3
- package/src/agent/providers/openai.ts +38 -4
- package/src/agent/providers/tool-protocol.ts +22 -0
- package/src/agent/recovery.ts +94 -1
- package/src/agent/response-cache.ts +17 -1
- package/src/agent/tools.ts +189 -1
- package/src/agent/transcript.ts +6 -0
- package/src/cli.ts +73 -2
- package/src/commands/check.ts +51 -1
- package/src/commands/create.ts +278 -22
- package/src/commands/doctor.ts +219 -12
- package/src/config.ts +107 -2
- package/src/kicad/bootstrap.ts +24 -3
- package/src/kicad/cli.ts +6 -19
- package/src/kicad/dossier.ts +217 -0
- package/src/kicad/draft/draft.ts +171 -0
- package/src/kicad/draft/engine.ts +2466 -0
- package/src/kicad/draft/ir.ts +416 -0
- package/src/kicad/draft/symsource.ts +535 -0
- package/src/kicad/emit.ts +236 -0
- package/src/kicad/fab.ts +15 -0
- package/src/kicad/legibility.ts +646 -0
- package/src/kicad/score.ts +323 -0
- package/src/kicad/sexp.ts +339 -10
- package/src/kicad/symlib.ts +364 -18
- package/src/memory/bom-table.ts +119 -31
- package/src/memory/scaffold.ts +6 -0
- package/src/openspec/cli.ts +3 -2
- package/src/util/preflight.ts +18 -0
- package/src/util/redact.ts +12 -2
- package/dist/memory/synap.js +0 -152
- package/dist/memory/synap.js.map +0 -1
- package/src/memory/synap.ts +0 -217
package/dist/memory/bom-table.js
CHANGED
|
@@ -4,6 +4,23 @@
|
|
|
4
4
|
* the supplier BOM export work (add-supplier-bom-export) can parse BOM.md
|
|
5
5
|
* once, the same way, instead of duplicating this.
|
|
6
6
|
*/
|
|
7
|
+
/**
|
|
8
|
+
* Split one row into trimmed cells. The outer pipes are optional, because they
|
|
9
|
+
* are optional in GitHub-flavored markdown: `Refdes | Pin | Net` renders as a
|
|
10
|
+
* table exactly like `| Refdes | Pin | Net |` does, and a hand- or LLM-authored
|
|
11
|
+
* doc may legitimately be written either way.
|
|
12
|
+
*/
|
|
13
|
+
function splitRow(line) {
|
|
14
|
+
return line
|
|
15
|
+
.replace(/^\|/, '')
|
|
16
|
+
.replace(/\|$/, '')
|
|
17
|
+
.split('|')
|
|
18
|
+
.map((c) => c.trim());
|
|
19
|
+
}
|
|
20
|
+
/** `|---|:--:|` and friends: the row separating a header from its data. */
|
|
21
|
+
function isSeparatorRow(cells) {
|
|
22
|
+
return cells.length > 0 && cells.every((c) => /^:?-+:?$/.test(c));
|
|
23
|
+
}
|
|
7
24
|
/**
|
|
8
25
|
* Parses every markdown pipe-table row out of a document, across however
|
|
9
26
|
* many tables the file contains, skipping separator rows (e.g. `|---|---|`).
|
|
@@ -11,20 +28,83 @@
|
|
|
11
28
|
* whatever cells they split into — this function never throws.
|
|
12
29
|
*/
|
|
13
30
|
export function parseMarkdownTables(md) {
|
|
14
|
-
|
|
15
|
-
|
|
31
|
+
return (scanTableGroups(md)
|
|
32
|
+
// A group opened by an un-piped line with no delimiter row is not a table:
|
|
33
|
+
// GFM requires the delimiter row for one to exist at all. Without this,
|
|
34
|
+
// ordinary prose such as `Second-source options: Yageo | Vishay | KOA`
|
|
35
|
+
// under a BOM table becomes a part in `export bom`, which `check` cannot
|
|
36
|
+
// catch because `parseCanonicalTables` drops the header-less group.
|
|
37
|
+
.filter((g) => g[0].piped || g.some((l) => l.separator))
|
|
38
|
+
.flat()
|
|
39
|
+
.filter((l) => !l.separator)
|
|
40
|
+
.map((l) => ({ cells: l.cells })));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Group a document's table lines, one group per table. Both readers below go
|
|
44
|
+
* through this so they cannot disagree about which documents are readable:
|
|
45
|
+
* `check` accepting a BOM.md that `export bom` reads as empty is how a clean
|
|
46
|
+
* check turns into a header-only ordering file.
|
|
47
|
+
*
|
|
48
|
+
* Lines inside a fenced code block are skipped. Docs legitimately show the
|
|
49
|
+
* table format as an example, and an example row is not a part or a pin.
|
|
50
|
+
*/
|
|
51
|
+
function scanTableGroups(md) {
|
|
52
|
+
const groups = [];
|
|
53
|
+
let current = null;
|
|
54
|
+
let width = 0; // column count of the open group, set by its first line
|
|
55
|
+
// The open fence's delimiter, or null outside one. A fence closes only on the
|
|
56
|
+
// same character, at least as long (CommonMark). Toggling on any fence-like
|
|
57
|
+
// line would let a shorter or different delimiter *inside* a block end it
|
|
58
|
+
// early, and the example rows after it would be read as parts or pins.
|
|
59
|
+
let fence = null;
|
|
60
|
+
// Split on either line ending: a CRLF document would otherwise leave a
|
|
61
|
+
// trailing \r on every line, and \r is a line terminator that `.` does not
|
|
62
|
+
// match, so the fence patterns below would never fire on a CRLF file.
|
|
63
|
+
for (const line of md.split(/\r?\n/)) {
|
|
16
64
|
const t = line.trim();
|
|
17
|
-
|
|
65
|
+
// Matched against the raw line: CommonMark allows a fence up to three
|
|
66
|
+
// spaces of indentation, and four or more makes it content rather than a
|
|
67
|
+
// fence. Trimming first would let an indented delimiter inside a block
|
|
68
|
+
// read as a closer.
|
|
69
|
+
const delim = /^ {0,3}(`{3,}|~{3,})(.*)$/.exec(line);
|
|
70
|
+
if (delim) {
|
|
71
|
+
const marker = delim[1];
|
|
72
|
+
const char = marker[0];
|
|
73
|
+
if (!fence) {
|
|
74
|
+
fence = { char, length: marker.length };
|
|
75
|
+
current = null;
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
// A closing fence carries no info string; anything else stays content.
|
|
79
|
+
if (char === fence.char && marker.length >= fence.length && !delim[2].trim()) {
|
|
80
|
+
fence = null;
|
|
81
|
+
current = null;
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (fence || !t.includes('|')) {
|
|
86
|
+
current = null; // a blank, prose, or fenced line terminates the table
|
|
18
87
|
continue;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
88
|
+
}
|
|
89
|
+
const cells = splitRow(t);
|
|
90
|
+
// Outer pipes make a line unambiguously a table row. Without them, a
|
|
91
|
+
// pipe-bearing prose line (`Legend: A | B`) is indistinguishable from a
|
|
92
|
+
// row by shape alone, so the column count decides: matching the open
|
|
93
|
+
// table's width keeps it as a row, a mismatch ends the table there rather
|
|
94
|
+
// than reading the prose as a part/pin. The line still opens a new group,
|
|
95
|
+
// in case it is itself the header of an un-piped table.
|
|
96
|
+
if (current && !t.startsWith('|') && cells.length !== width)
|
|
97
|
+
current = null;
|
|
98
|
+
if (!current) {
|
|
99
|
+
current = [];
|
|
100
|
+
width = cells.length;
|
|
101
|
+
groups.push(current);
|
|
102
|
+
}
|
|
103
|
+
// The separator row stays in the group so the header can be located
|
|
104
|
+
// relative to it; it is dropped by the readers above and below.
|
|
105
|
+
current.push({ cells, separator: isSeparatorRow(cells), piped: t.startsWith('|') });
|
|
26
106
|
}
|
|
27
|
-
return
|
|
107
|
+
return groups;
|
|
28
108
|
}
|
|
29
109
|
/** True for a table's header row. BOM.md and PINOUT.md both lead with a
|
|
30
110
|
* Refdes or Pin column, so one check covers both doc types. */
|
|
@@ -60,30 +140,24 @@ export function parseCanonicalRows(md) {
|
|
|
60
140
|
* it loops on finish forever. Resolving by header name fixes that.
|
|
61
141
|
*/
|
|
62
142
|
export function parseCanonicalTables(md) {
|
|
63
|
-
const groups = [];
|
|
64
|
-
let current = null;
|
|
65
|
-
for (const line of md.split('\n')) {
|
|
66
|
-
const t = line.trim();
|
|
67
|
-
if (!t.startsWith('|')) {
|
|
68
|
-
current = null; // a blank or prose line terminates the current table
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
const cells = t
|
|
72
|
-
.split('|')
|
|
73
|
-
.slice(1, -1)
|
|
74
|
-
.map((c) => c.trim());
|
|
75
|
-
if (cells.every((c) => /^:?-+:?$/.test(c)))
|
|
76
|
-
continue; // separator row: stays within the table
|
|
77
|
-
if (!current) {
|
|
78
|
-
current = [];
|
|
79
|
-
groups.push(current);
|
|
80
|
-
}
|
|
81
|
-
current.push({ cells });
|
|
82
|
-
}
|
|
83
143
|
const tables = [];
|
|
84
|
-
for (const g of
|
|
85
|
-
|
|
86
|
-
|
|
144
|
+
for (const g of scanTableGroups(md)) {
|
|
145
|
+
// The header is the row directly above the separator. Falling back to the
|
|
146
|
+
// first row keeps a table that omits the separator working, and anchoring
|
|
147
|
+
// on the separator means a stray pipe-bearing prose line immediately above
|
|
148
|
+
// a table no longer hides it.
|
|
149
|
+
const sep = g.findIndex((l) => l.separator);
|
|
150
|
+
const headerIdx = sep > 0 ? sep - 1 : 0;
|
|
151
|
+
const header = g[headerIdx];
|
|
152
|
+
if (!header || header.separator || !isHeader({ cells: header.cells }))
|
|
153
|
+
continue;
|
|
154
|
+
tables.push({
|
|
155
|
+
header: { cells: header.cells },
|
|
156
|
+
rows: g
|
|
157
|
+
.slice(headerIdx + 1)
|
|
158
|
+
.filter((l) => !l.separator)
|
|
159
|
+
.map((l) => ({ cells: l.cells })),
|
|
160
|
+
});
|
|
87
161
|
}
|
|
88
162
|
return tables;
|
|
89
163
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bom-table.js","sourceRoot":"","sources":["../../src/memory/bom-table.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMD;;;;;GAKG;AACH,
|
|
1
|
+
{"version":3,"file":"bom-table.js","sourceRoot":"","sources":["../../src/memory/bom-table.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMD;;;;;GAKG;AACH,SAAS,QAAQ,CAAC,IAAY;IAC5B,OAAO,IAAI;SACR,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;SAClB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;SAClB,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AAC1B,CAAC;AAED,2EAA2E;AAC3E,SAAS,cAAc,CAAC,KAAe;IACrC,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACpE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAAU;IAC5C,OAAO,CACL,eAAe,CAAC,EAAE,CAAC;QACjB,2EAA2E;QAC3E,wEAAwE;QACxE,uEAAuE;QACvE,yEAAyE;QACzE,oEAAoE;SACnE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC,KAAK,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;SACxD,IAAI,EAAE;SACN,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;SAC3B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC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B,MAAM,SAAS,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACjC,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC5B,MAAM,KAAK,GAAa,EAAE,CAAC;YAC3B,IAAI,GAAG,KAAK,YAAY;gBAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;iBAC9C,IAAI,CAAC,GAAG;gBAAE,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YACzC,GAAG,CAAC,IAAI,CAAC;gBACP,MAAM;gBACN,KAAK,EAAE,KAAK,IAAI,SAAS;gBACzB,SAAS,EAAE,SAAS,IAAI,SAAS;gBACjC,GAAG,EAAE,GAAG,IAAI,SAAS;gBACrB,KAAK;aACN,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/memory/scaffold.js
CHANGED
|
@@ -56,6 +56,11 @@ What the device is, top-level constraints and budgets.
|
|
|
56
56
|
Every part: refdes, MPN, value, package, and WHY it was chosen. MPNs the agent
|
|
57
57
|
introduces without a datasheet check are flagged UNVERIFIED.
|
|
58
58
|
|
|
59
|
+
Value holds the component value only ("4.7uF", "1M", "500mAh Li-Po") — the
|
|
60
|
+
schematic stage draws it as the symbol's Value field, so a description there
|
|
61
|
+
collides with neighbouring symbols and fails the legibility gate. Prose belongs
|
|
62
|
+
in Rationale. One row per refdes; a grouped row ("C5-C8") matches no symbol.
|
|
63
|
+
|
|
59
64
|
${bomTable(symbols)}
|
|
60
65
|
`,
|
|
61
66
|
'PINOUT.md': `# Pinout
|
|
@@ -105,6 +110,7 @@ Generated by \`copperhead init\`; regenerated on re-runs (do not hand-edit).
|
|
|
105
110
|
- \`maxRepairCycles\`: ERC/DRC repair attempts before rollback (default 5)
|
|
106
111
|
- \`budgets\`: free-form hard constraints (e.g. \`"sleep_current_uA": 25\`); surfaced verbatim into every run's system prompt
|
|
107
112
|
- \`generatedHashes\`: content hashes of generated docs, used to detect hand edits on re-init
|
|
113
|
+
- \`legibility\` (optional): schematic legibility checker tuning. \`legibility.thresholds\` accepts \`gridPitch\` (default 1.27mm), \`minPitch\` (2.54mm edge-to-edge between symbol bodies), \`utilization\` (0.5 of the usable frame), \`maxWireLength\` (50.8mm), and \`familyCap\` (10 findings per family per sheet). \`legibility.severity.<kind>\` overrides any check family to \`error\`, \`advisory\`, or \`off\` (disables it). Absent keys use the defaults; \`check\` reports findings without failing, the \`create\` schematic stage gates on error-severity findings. \`legibility.score.weights.<metric>\` and \`legibility.score.floor\` tune the quantitative scorer.
|
|
108
114
|
|
|
109
115
|
## constraints.json
|
|
110
116
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffold.js","sourceRoot":"","sources":["../../src/memory/scaffold.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,OAAO,EAAqC,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,UAAU,EAAyB,MAAM,cAAc,CAAC;AAE7E,MAAM,OAAO,SAAU,SAAQ,KAAK;CAAG;AAQvC,MAAM,GAAG,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAEhF,KAAK,UAAU,cAAc,CAAC,UAAkB;IAC9C,IAAI,GAAG,GAAkB,IAAI,CAAC;IAC9B,IAAI,GAAG,GAAkB,IAAI,CAAC;IAC9B,KAAK,UAAU,IAAI,CAAC,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AAS,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,CAAC;IACzE,yDAAyD;IACzD,MAAM,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,aAAa,EAAE,WAAW,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IAEnG,IAAI,IAAI,CAAC,YAAY,KAAK,KAAK,EAAE,CAAC;QAChC,MAAM,IAAI,GAAG,MAAM,oBAAoB,CAAC,QAAQ,CAAC,CAAC;QAClD,IAAI,IAAI;YAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/openspec/cli.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { execa } from 'execa';
|
|
2
2
|
import { existsSync } from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
+
import { isNotFoundError } from '../util/preflight.js';
|
|
4
5
|
async function openspec(repo, args) {
|
|
5
6
|
try {
|
|
6
7
|
const { stdout, stderr } = await execa('openspec', args, { cwd: repo });
|
|
@@ -8,7 +9,7 @@ async function openspec(repo, args) {
|
|
|
8
9
|
}
|
|
9
10
|
catch (err) {
|
|
10
11
|
const e = err;
|
|
11
|
-
if (e
|
|
12
|
+
if (isNotFoundError(e)) {
|
|
12
13
|
return { ok: false, output: 'openspec CLI not found on PATH (npm i -g @fission-ai/openspec)' };
|
|
13
14
|
}
|
|
14
15
|
return { ok: false, output: [e.stdout, e.stderr].filter(Boolean).join('\n') || e.message };
|
package/dist/openspec/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/openspec/cli.ts"],"names":[],"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AY;IACtC,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAY;IAC7C,IAAI,WAAW,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,2BAA2B,EAAE,CAAC;IAChF,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,QAAiB;IAC9D,OAAO,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,QAAgB;IAC5D,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AACxD,CAAC"}
|
package/dist/util/preflight.js
CHANGED
|
@@ -22,6 +22,23 @@ export function formatPreflightFailure(reason, why, remedy) {
|
|
|
22
22
|
const steps = remedy.map((step, i) => ` ${i + 1}. ${step}`);
|
|
23
23
|
return [reason, '', `why it failed: ${why}`, 'to fix:', ...steps].join('\n');
|
|
24
24
|
}
|
|
25
|
+
export function isNotFoundError(err) {
|
|
26
|
+
if (!err)
|
|
27
|
+
return false;
|
|
28
|
+
if (err.code === 'ENOENT')
|
|
29
|
+
return true;
|
|
30
|
+
if (process.platform === 'win32') {
|
|
31
|
+
const msg = String(err.stderr || err.message || '');
|
|
32
|
+
if (err.exitCode === 9009) {
|
|
33
|
+
return (msg.includes('is not recognized') ||
|
|
34
|
+
msg.includes('cannot find the path specified'));
|
|
35
|
+
}
|
|
36
|
+
if (err.exitCode === 1) {
|
|
37
|
+
return msg.includes('is not recognized');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
25
42
|
/** Default minimum free space to start a run: 2 GiB. A create run emits gerbers,
|
|
26
43
|
* STEP, SVG renders and KiCad local history; 2 GiB is comfortably above a
|
|
27
44
|
* single board's output while still catching a nearly-full disk. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preflight.js","sourceRoot":"","sources":["../../src/util/preflight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IAE5B;IACA;IACA;IAHX,YACW,MAAc,EACd,GAAW,EACX,MAAgB;QAEzB,KAAK,CAAC,sBAAsB,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;QAJ1C,WAAM,GAAN,MAAM,CAAQ;QACd,QAAG,GAAH,GAAG,CAAQ;QACX,WAAM,GAAN,MAAM,CAAU;QAGzB,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AAED,MAAM,UAAU,sBAAsB,CAAC,MAAc,EAAE,GAAW,EAAE,MAAgB;IAClF,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IAC7D,OAAO,CAAC,MAAM,EAAE,EAAE,EAAE,kBAAkB,GAAG,EAAE,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC/E,CAAC;AAED;;qEAEqE;AACrE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE7D,MAAM,GAAG,GAAG,CAAC,CAAS,EAAU,EAAE,CAA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,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;AAEhF;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,GAAW;IAC7C,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7B,OAAO,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,KAAK,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,GAAW,EAAE,YAAY,GAAG,sBAAsB;IACtF,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,GAAG,CAAC,CAAC;IACtC,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,IAAI,YAAY;QAAE,OAAO;IAClD,MAAM,IAAI,cAAc,CACtB,wCAAwC,GAAG,CAAC,IAAI,CAAC,eAAe,GAAG,CAAC,YAAY,CAAC,YAAY,EAC7F,2JAA2J,EAC3J;QACE,+CAA+C;QAC/C,sFAAsF;QACtF,aAAa;KACd,CACF,CAAC;AACJ,CAAC"}
|
package/dist/util/redact.js
CHANGED
|
@@ -5,12 +5,22 @@
|
|
|
5
5
|
*/
|
|
6
6
|
const PATTERNS = [
|
|
7
7
|
/sk-[A-Za-z0-9_-]+/g,
|
|
8
|
-
|
|
8
|
+
// Auth schemes are case-insensitive (RFC 7235 §2.1), and the token charset has
|
|
9
|
+
// to include base64's +, / and = or the match stops at the first one and the
|
|
10
|
+
// tail of the secret gets written out verbatim.
|
|
11
|
+
/Bearer\s+[A-Za-z0-9._+/=-]{16,}/gi,
|
|
9
12
|
// Registry and forge tokens: a transcript that quotes a publish command or a
|
|
10
13
|
// failing CI log can carry these just as easily as a model API key.
|
|
11
|
-
|
|
14
|
+
// npm also issues UUID-shaped tokens, so the charset allows dashes.
|
|
15
|
+
/npm_[A-Za-z0-9-]{36,}/g,
|
|
12
16
|
/gh[pousr]_[A-Za-z0-9]{36,}/g,
|
|
13
17
|
/github_pat_[A-Za-z0-9_]{22,}/g,
|
|
18
|
+
// Gemini and Groq keys: same idea as sk- above, just a different prefix.
|
|
19
|
+
// Real keys are AIza + 35 chars, but AIzaSy (the common fifth/sixth pair)
|
|
20
|
+
// isn't the only prefix Google issues - match on AIza alone so other
|
|
21
|
+
// Google keys aren't left unredacted.
|
|
22
|
+
/AIza[A-Za-z0-9_-]{20,}/g,
|
|
23
|
+
/gsk_[A-Za-z0-9]{20,}/g,
|
|
14
24
|
];
|
|
15
25
|
export function redactSecrets(text) {
|
|
16
26
|
let out = text;
|
package/dist/util/redact.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redact.js","sourceRoot":"","sources":["../../src/util/redact.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,QAAQ,GAAa;IACzB,oBAAoB;IACpB,+
|
|
1
|
+
{"version":3,"file":"redact.js","sourceRoot":"","sources":["../../src/util/redact.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,QAAQ,GAAa;IACzB,oBAAoB;IACpB,+EAA+E;IAC/E,6EAA6E;IAC7E,gDAAgD;IAChD,mCAAmC;IACnC,6EAA6E;IAC7E,oEAAoE;IACpE,oEAAoE;IACpE,wBAAwB;IACxB,6BAA6B;IAC7B,+BAA+B;IAC/B,yEAAyE;IACzE,0EAA0E;IAC1E,qEAAqE;IACrE,sCAAsC;IACtC,yBAAyB;IACzB,uBAAuB;CACxB,CAAC;AAEF,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,IAAI,GAAG,GAAG,IAAI,CAAC;IACf,KAAK,MAAM,EAAE,IAAI,QAAQ;QAAE,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC;IAC/D,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "copperhead",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Cursor for circuit boards: an AI agent that designs, documents, and validates real PCBs on KiCad repositories",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Animesh Chouhan <animeshchouhan@outlook.com>",
|
|
7
7
|
"homepage": "https://copperhead.sh",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/
|
|
10
|
+
"url": "git+https://github.com/copperheadhq/copperhead.git"
|
|
11
11
|
},
|
|
12
12
|
"bugs": {
|
|
13
|
-
"url": "https://github.com/
|
|
13
|
+
"url": "https://github.com/copperheadhq/copperhead/issues"
|
|
14
14
|
},
|
|
15
15
|
"keywords": [
|
|
16
16
|
"kicad",
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
"provenance": true
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
|
-
"build": "tsc -p tsconfig.json",
|
|
47
|
+
"build": "tsc -p tsconfig.json && npm run postbuild",
|
|
48
|
+
"postbuild": "node -e \"require('fs').chmodSync('dist/cli.js', 0o755)\"",
|
|
48
49
|
"prepublishOnly": "npm run typecheck && npm run build",
|
|
49
50
|
"dev": "tsx src/cli.ts",
|
|
50
51
|
"demo:simple": "bash scripts/demo-simple.sh",
|
|
@@ -55,7 +56,9 @@
|
|
|
55
56
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
56
57
|
"docs:dev": "npm --prefix docs run dev",
|
|
57
58
|
"docs:build": "npm --prefix docs run build",
|
|
58
|
-
"docs:preview": "npm --prefix docs run preview"
|
|
59
|
+
"docs:preview": "npm --prefix docs run preview",
|
|
60
|
+
"refboards": "bash scripts/draft-reference-boards.sh",
|
|
61
|
+
"realdesigns": "tsx scripts/draft-real-designs.ts"
|
|
59
62
|
},
|
|
60
63
|
"dependencies": {
|
|
61
64
|
"@anthropic-ai/sdk": "^0.113.0",
|
|
@@ -64,8 +67,7 @@
|
|
|
64
67
|
"openai": "^6.49.0"
|
|
65
68
|
},
|
|
66
69
|
"optionalDependencies": {
|
|
67
|
-
"@anthropic-ai/claude-agent-sdk": "^0.3.217"
|
|
68
|
-
"@maximem/synap-js-sdk": "^0.3.0"
|
|
70
|
+
"@anthropic-ai/claude-agent-sdk": "^0.3.217"
|
|
69
71
|
},
|
|
70
72
|
"devDependencies": {
|
|
71
73
|
"@openai/codex-sdk": "^0.144.6",
|
package/src/agent/filetools.ts
CHANGED
|
@@ -75,6 +75,31 @@ export interface SearchMatch {
|
|
|
75
75
|
|
|
76
76
|
const SKIP_DIRS = new Set(['.git', 'node_modules', 'dist', '.copperhead']);
|
|
77
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Longest match line returned to the model, in characters.
|
|
80
|
+
*
|
|
81
|
+
* The file-size bound in `toolSearch` (5 MB) bounds the file, not the line, and
|
|
82
|
+
* on a one-object-per-line document those are very different limits. A
|
|
83
|
+
* `transcript.jsonl` line is an entire `{ts, type, data}` record with tool
|
|
84
|
+
* output inline, so a few matches inside one file can be hundreds of thousands
|
|
85
|
+
* of tokens. A live run died on exactly that — `Prompt is too long · the
|
|
86
|
+
* request is ~1003121 tokens (limit 1000000) but this conversation is only
|
|
87
|
+
* ~403383 tokens`, the balance being search results — and it cost a stage
|
|
88
|
+
* attempt. The agent had done nothing wrong: it searched the repo it was told
|
|
89
|
+
* to work in, and a `run-logs/` directory happened to be sitting in it.
|
|
90
|
+
*
|
|
91
|
+
* A match is a pointer, not a payload — enough to see the hit and decide
|
|
92
|
+
* whether to read the file. Truncation is marked so a clipped line is
|
|
93
|
+
* distinguishable from a short one.
|
|
94
|
+
*/
|
|
95
|
+
const MAX_MATCH_CHARS = 400;
|
|
96
|
+
|
|
97
|
+
/** Clip one match line to `MAX_MATCH_CHARS`, marking it when clipped. */
|
|
98
|
+
function clipMatch(line: string): string {
|
|
99
|
+
const t = line.trim();
|
|
100
|
+
return t.length <= MAX_MATCH_CHARS ? t : `${t.slice(0, MAX_MATCH_CHARS)}… [+${t.length - MAX_MATCH_CHARS} chars]`;
|
|
101
|
+
}
|
|
102
|
+
|
|
78
103
|
export function globToRegex(glob: string): RegExp {
|
|
79
104
|
let out = '';
|
|
80
105
|
for (let i = 0; i < glob.length; i++) {
|
|
@@ -125,7 +150,7 @@ export async function toolSearch(
|
|
|
125
150
|
if (text.includes('\u0000')) continue; // binary
|
|
126
151
|
const lines = text.split('\n');
|
|
127
152
|
for (let i = 0; i < lines.length && matches.length < maxMatches; i++) {
|
|
128
|
-
if (re.test(lines[i]!)) matches.push({ file: rel, line: i + 1, text: lines[i]
|
|
153
|
+
if (re.test(lines[i]!)) matches.push({ file: rel, line: i + 1, text: clipMatch(lines[i]!) });
|
|
129
154
|
}
|
|
130
155
|
}
|
|
131
156
|
if (matches.length >= maxMatches) return;
|
package/src/agent/ledger.ts
CHANGED
|
@@ -7,6 +7,7 @@ export type ObligationKind =
|
|
|
7
7
|
| 'erc'
|
|
8
8
|
| 'drc'
|
|
9
9
|
| 'drift'
|
|
10
|
+
| 'legibility'
|
|
10
11
|
| 'changelog'
|
|
11
12
|
| 'decision-log'
|
|
12
13
|
| 'constraint-dual-write'
|
|
@@ -21,6 +22,18 @@ export interface Obligation {
|
|
|
21
22
|
export class ObligationsLedger {
|
|
22
23
|
private open: Obligation[] = [];
|
|
23
24
|
|
|
25
|
+
/**
|
|
26
|
+
* @param gateLegibility whether error-severity legibility findings block
|
|
27
|
+
* `finish`. True for repos whose schematic copperhead authored (create
|
|
28
|
+
* origin) — there the standard is copperhead's own responsibility. False for
|
|
29
|
+
* hand-drawn repos (`do` on an init-ed or hand-maintained project), where a
|
|
30
|
+
* pre-existing sheet could never satisfy the standard without a full redraw
|
|
31
|
+
* and the obligation would wedge every schematic-touching run; those repos
|
|
32
|
+
* get the same findings as advisory information via the tool and `check`
|
|
33
|
+
* (design C6: check reports, create gates).
|
|
34
|
+
*/
|
|
35
|
+
constructor(private readonly gateLegibility = true) {}
|
|
36
|
+
|
|
24
37
|
add(kind: ObligationKind, detail: string, openedBy: string): void {
|
|
25
38
|
if (!this.open.some((o) => o.kind === kind && o.detail === detail)) {
|
|
26
39
|
this.open.push({ kind, detail, openedBy });
|
|
@@ -45,6 +58,9 @@ export class ObligationsLedger {
|
|
|
45
58
|
onKicadEdit(file: string): void {
|
|
46
59
|
this.add('erc', 'ERC must pass after schematic edits', file);
|
|
47
60
|
if (file.endsWith('.kicad_pcb')) this.add('drc', 'DRC must pass after board edits', file);
|
|
61
|
+
if (file.endsWith('.kicad_sch') && this.gateLegibility) {
|
|
62
|
+
this.add('legibility', 'check_legibility must run clean after schematic edits', file);
|
|
63
|
+
}
|
|
48
64
|
this.add('drift', 'check_drift must run clean after KiCad edits', file);
|
|
49
65
|
this.add('changelog', 'CHANGELOG.md entry for this run', file);
|
|
50
66
|
}
|
|
@@ -53,6 +69,14 @@ export class ObligationsLedger {
|
|
|
53
69
|
this.add('drift', 'check_drift must run clean after doc edits', file);
|
|
54
70
|
}
|
|
55
71
|
|
|
72
|
+
/** A checker run updates the obligation: clean clears it, errors re-open it (gated repos only). */
|
|
73
|
+
onLegibilityResult(errorCount: number): void {
|
|
74
|
+
this.clear('legibility');
|
|
75
|
+
if (errorCount > 0 && this.gateLegibility) {
|
|
76
|
+
this.add('legibility', `${errorCount} error-severity legibility finding(s) unreconciled`, 'check_legibility');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
56
80
|
onConstraintChange(constraintKey: string, affects: string[]): void {
|
|
57
81
|
this.add('constraint-dual-write', constraintKey, constraintKey);
|
|
58
82
|
for (const item of affects) {
|