@skathio/somi 5.0.4 → 5.1.1
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.copilot-extension/extension.json +1 -1
- package/.copilot-extension/marketplace.json +1 -1
- package/VERSION +1 -1
- package/package.json +1 -1
- package/scripts/lib/advisor.mjs +1 -1
- package/scripts/lib/policy.mjs +30 -4
- package/scripts/lib/quality/gate.mjs +10 -3
- package/scripts/lib/quality/metrics.mjs +21 -8
- package/scripts/lib/quality/parse.mjs +1 -1
- package/scripts/lib/reviews.mjs +2 -0
- package/scripts/vendor/tree-sitter/manifest.json +9 -0
- package/scripts/vendor/tree-sitter/tree-sitter-c-sharp.wasm +0 -0
- package/workflows/deliver-stages.js +15 -3
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"url": "https://github.com/skathio/somi.git"
|
|
14
14
|
},
|
|
15
15
|
"description": "A workflow plugin for coding agents: say what you want or pass a ticket, and it picks the right workflow and keeps the cost down, while your agent stays in charge.",
|
|
16
|
-
"version": "5.
|
|
16
|
+
"version": "5.1.1",
|
|
17
17
|
"tags": [
|
|
18
18
|
"workflow",
|
|
19
19
|
"agents",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "somi",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.1",
|
|
4
4
|
"displayName": "SoMi",
|
|
5
5
|
"description": "A workflow plugin for coding agents: say what you want or pass a ticket, and it picks the right workflow and keeps the cost down, while your agent stays in charge.",
|
|
6
6
|
"keywords": [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "somi",
|
|
3
3
|
"displayName": "SoMi",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.1.1",
|
|
5
5
|
"description": "A workflow plugin for coding agents: say what you want or pass a ticket, and it picks the right workflow and keeps the cost down, while your agent stays in charge.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"workflow",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"name": "somi",
|
|
12
12
|
"source": "github:skathio/somi",
|
|
13
13
|
"description": "A workflow plugin for coding agents: say what you want or pass a ticket, and it picks the right workflow and keeps the cost down, while your agent stays in charge.",
|
|
14
|
-
"version": "5.
|
|
14
|
+
"version": "5.1.1",
|
|
15
15
|
"tags": [
|
|
16
16
|
"workflow",
|
|
17
17
|
"agents",
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
5.
|
|
1
|
+
5.1.1
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skathio/somi",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"test": "node --test --test-reporter=spec tests/*.test.mjs",
|
|
6
6
|
"test:coverage": "node -e \"require('fs').mkdirSync('coverage',{recursive:true})\" && node --test --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=coverage/lcov.info tests/*.test.mjs",
|
package/scripts/lib/advisor.mjs
CHANGED
|
@@ -118,7 +118,7 @@ const LARGE = (request) => String(request ?? '').length > LONG_REQUEST;
|
|
|
118
118
|
// Everything here is done from the chat: the agent runs SoMi's own commands by their full path, because no somi command is on the PATH.
|
|
119
119
|
const QUALITY_CONFIG = `Relay this briefly. To change a quality limit, write it under quality in the file named by global_config, or under quality.commit or quality.pr for one scope, never in the project's .somi/config.json, where only a tighter value counts. Before you write a value looser than the current limit, ask the user and wait for a yes. quality_timeout_seconds is how long the gate may run before it counts as failed: to change it, write quality.timeout_seconds there, a whole number from ${QUALITY_TIMEOUT.min} to ${QUALITY_TIMEOUT.max}.`;
|
|
120
120
|
const SETUP = (host) => `To check SoMi's setup, run \`${somiCommand('doctor')}\` and relay what it finds. After tiers.main changes, run \`${somiCommand('setup')}\`. To connect another plugin to a step, run \`${somiCommand('slot <step> <plugin:component>')}\` with the step and component the user names, and \`${somiCommand('slot --list')}\` to show what is connected. To start sessions with SoMi's agent on its tier's model, \`${somiCommand('launch claude')}\` or \`${somiCommand('launch copilot')}\` does it, with anything after it passed to the host: give the user that command for an alias of their own.${host === 'claude' ? '' : ' SoMi registers the staged workflow, /somi-deliver, with Copilot for every project at session start, so there is nothing to run for it: a session that started before that gets it after /clear, and Copilot runs it only in experimental mode.'}`;
|
|
121
|
-
const STAGED_ADVICE = (host) => `The user typed /somi-deliver to run this work in stages. Start the workflow below by its name with its args unchanged${host === 'claude' ? ', using the Workflow tool: it is a saved workflow, so no script and no authoring guide are needed' : ', as Copilot runs workflows in experimental mode. If Copilot says no workflow is registered by that name, this session started before SoMi registered it: reload extensions with the extensions reload tool, which registers it without losing the conversation, then start the workflow again; failing that, tell the user that /clear or a new session loads it. /experimental must be on'}. Tell the user it is running and end your turn. When it returns, do not read or check the work again, because the workflow ran the checks: record its reviews with somi_review, passing
|
|
121
|
+
const STAGED_ADVICE = (host) => `The user typed /somi-deliver to run this work in stages. Start the workflow below by its name with its args unchanged${host === 'claude' ? ', using the Workflow tool: it is a saved workflow, so no script and no authoring guide are needed' : ', as Copilot runs workflows in experimental mode. If Copilot says no workflow is registered by that name, this session started before SoMi registered it: reload extensions with the extensions reload tool, which registers it without losing the conversation, then start the workflow again; failing that, tell the user that /clear or a new session loads it. /experimental must be on'}. Tell the user it is running and end your turn. When it returns, do not read or check the work again, because the workflow ran the checks: record its reviews with somi_review, passing its review_tree as tree. If reviews_missing names a reviewer, call somi_review with no reviews, run the reviewers it names, and record those reports with the workflow's; never record a set without them. Then tell the user its summary and status in a few lines. If you cannot start it, say why, and call somi_route again with the same request and without staged for the steps.`;
|
|
122
122
|
const SUGGEST_STAGED = 'This looks like large work. Tell the user once that typing /somi-deliver with it runs it in stages, each on its tier, and that only they can start that. Then follow steps.';
|
|
123
123
|
|
|
124
124
|
// With no rule to go on and the whole table to choose from, a request is new work. Asking the model to pick costs a turn and lets it
|
package/scripts/lib/policy.mjs
CHANGED
|
@@ -57,11 +57,35 @@ function normalizeFinding(raw, agent, i) {
|
|
|
57
57
|
return finding;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
// A report over the cap loses its least severe findings, last first, until it fits: a session cannot shorten a reviewer's report, and
|
|
61
|
+
// refusing it whole led a session to send no report at all. Each finding's size is counted once, so a long list costs no more than a pass.
|
|
62
|
+
// A Blocker or Major is never dropped; a report still over the cap without its Minors and Nits is refused, and that reviewer runs again.
|
|
63
|
+
const bytes = (v) => Buffer.byteLength(JSON.stringify(v) ?? '');
|
|
64
|
+
const TRIM_ORDER = ['Nit', 'Minor'];
|
|
65
|
+
function fitReview(review) {
|
|
66
|
+
if (bytes(review) <= MAX_REVIEW_BYTES) return { review, trimmed: 0 };
|
|
67
|
+
const agent = isText(review.agent, 64) && !CONTROL.test(review.agent) ? review.agent : 'a reviewer';
|
|
68
|
+
const over = () => new ReviewInputError(`the report from ${agent} is over ${MAX_REVIEW_BYTES} bytes even without its Minor and Nit findings; re-run that reviewer and ask it for fewer, shorter findings`);
|
|
69
|
+
if (!Array.isArray(review.findings)) throw over();
|
|
70
|
+
const kept = review.findings.map((f) => ({ f, size: bytes(f) + 1 }));
|
|
71
|
+
let total = bytes(review);
|
|
72
|
+
let trimmed = 0;
|
|
73
|
+
for (const severity of TRIM_ORDER) {
|
|
74
|
+
for (let i = kept.length - 1; i >= 0 && total > MAX_REVIEW_BYTES; i -= 1) {
|
|
75
|
+
if (kept[i].f?.severity !== severity) continue;
|
|
76
|
+
total -= kept[i].size;
|
|
77
|
+
kept.splice(i, 1);
|
|
78
|
+
trimmed += 1;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const fitted = { ...review, findings: kept.map((k) => k.f) };
|
|
82
|
+
if (bytes(fitted) > MAX_REVIEW_BYTES) throw over();
|
|
83
|
+
return { review: fitted, trimmed };
|
|
84
|
+
}
|
|
85
|
+
|
|
60
86
|
// The checks one review must pass, in this order. The reviewer is counted as seen before its verdict is read, so a second report from it
|
|
61
87
|
// is refused as a repeat, not read again.
|
|
62
88
|
function checkReview(review, dispatched, seen) {
|
|
63
|
-
if (review === null || typeof review !== 'object') throw new ReviewInputError('a review is not an object');
|
|
64
|
-
if (Buffer.byteLength(JSON.stringify(review)) > MAX_REVIEW_BYTES) throw new ReviewInputError(`a review is over ${MAX_REVIEW_BYTES} bytes; return fewer, shorter findings`);
|
|
65
89
|
const { agent } = review;
|
|
66
90
|
if (!dispatched.some((d) => d.agent === agent)) throw new ReviewInputError('a review names a reviewer that was not dispatched');
|
|
67
91
|
if (seen.has(agent)) throw new ReviewInputError(`${agent} returned twice`);
|
|
@@ -78,9 +102,11 @@ export function parseReviews(reviews, dispatched) {
|
|
|
78
102
|
const seen = new Set();
|
|
79
103
|
const findings = [];
|
|
80
104
|
const verdicts = [];
|
|
81
|
-
for (const
|
|
105
|
+
for (const raw of reviews) {
|
|
106
|
+
if (raw === null || typeof raw !== 'object') throw new ReviewInputError('a review is not an object');
|
|
107
|
+
const { review, trimmed } = fitReview(raw);
|
|
82
108
|
const agent = checkReview(review, dispatched, seen);
|
|
83
|
-
verdicts.push({ agent, verdict: review.verdict, model: isText(review.model, 64) && !CONTROL.test(review.model) ? review.model : null });
|
|
109
|
+
verdicts.push({ agent, verdict: review.verdict, model: isText(review.model, 64) && !CONTROL.test(review.model) ? review.model : null, ...(trimmed ? { trimmed } : {}) });
|
|
84
110
|
review.findings.forEach((f, i) => findings.push(normalizeFinding(f, agent, i)));
|
|
85
111
|
}
|
|
86
112
|
const missing = dispatched.filter((d) => !seen.has(d.agent)).map((d) => d.agent);
|
|
@@ -43,10 +43,17 @@ export function exemption(ctx, lines, unit, rule) {
|
|
|
43
43
|
return { reason: m[2], expires: m[3] };
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
// A function is paired with its old version by name and signature first, so a new overload added above an old one is new, not the
|
|
47
|
+
// old one got different. What is left is paired by name alone, so a function whose parameters changed is still the same function.
|
|
46
48
|
function pairUnits(before, after) {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
const taken = new Set();
|
|
50
|
+
const match = (u, key) => {
|
|
51
|
+
const old = before.find((b) => !taken.has(b) && key(b) === key(u));
|
|
52
|
+
if (old) taken.add(old);
|
|
53
|
+
return old ?? null;
|
|
54
|
+
};
|
|
55
|
+
const exact = after.map((u) => match(u, (x) => `${x.kind}:${x.name}:${x.signature}`));
|
|
56
|
+
return after.map((u, i) => ({ after: u, before: exact[i] ?? match(u, (x) => `${x.kind}:${x.name}`) }));
|
|
50
57
|
}
|
|
51
58
|
|
|
52
59
|
const inAdded = (added, line) => added.some(([a, b]) => line >= a && line <= b);
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
// quality/metrics.mjs: per-function structure of JavaScript and
|
|
1
|
+
// quality/metrics.mjs: per-function structure of JavaScript, TypeScript and C#, from a tree-sitter tree. SoMi-CC v1 follows SonarSource's
|
|
2
2
|
// cognitive complexity: +1 for each break in linear flow, plus the nesting level for one that is nested, +1 per sequence of like
|
|
3
3
|
// boolean operators, +1 for recursion, and nothing for shorthand such as ?? or ?. . It deviates in one way, written down so nobody
|
|
4
4
|
// reads it as Sonar parity: a function nested in another is scored as its own unit, starting at the control-flow nesting around the
|
|
5
5
|
// point where it is defined. Sonar folds it into the outer function, which would score a test file's describe block as one function.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
const
|
|
7
|
+
// The C# grammar's node types sit beside the JavaScript ones. An else-if there is an if_statement held directly as the alternative.
|
|
8
|
+
const FUNCTIONS = new Set(['function_declaration', 'function_expression', 'function', 'arrow_function', 'method_definition', 'generator_function_declaration', 'generator_function',
|
|
9
|
+
'method_declaration', 'constructor_declaration', 'destructor_declaration', 'operator_declaration', 'conversion_operator_declaration', 'local_function_statement', 'lambda_expression', 'anonymous_method_expression']);
|
|
10
|
+
const LOOPS = new Set(['for_statement', 'for_in_statement', 'for_of_statement', 'while_statement', 'do_statement', 'foreach_statement']);
|
|
11
|
+
const TERNARY = new Set(['ternary_expression', 'conditional_expression', 'switch_expression']);
|
|
9
12
|
const DEPTH = new Set(['if_statement', 'switch_statement', 'try_statement', ...LOOPS]);
|
|
10
13
|
const BOOLEAN = new Set(['&&', '||']);
|
|
11
14
|
const JSX = new Set(['jsx_element', 'jsx_self_closing_element', 'jsx_fragment']);
|
|
12
15
|
|
|
13
16
|
const field = (node, name) => node.childForFieldName(name);
|
|
14
17
|
const same = (a, b) => Boolean(a && b) && a.startIndex === b.startIndex && a.endIndex === b.endIndex && a.type === b.type;
|
|
18
|
+
const isElseIf = (node) => node.type === 'if_statement' && (node.parent?.type === 'else_clause' || same(node, field(node.parent, 'alternative')));
|
|
15
19
|
const operator = (node) => field(node, 'operator')?.type ?? node.children.find((c) => !c.isNamed && BOOLEAN.has(c.type))?.type;
|
|
16
20
|
|
|
17
21
|
function nameOf(node) {
|
|
@@ -28,6 +32,7 @@ function nameOf(node) {
|
|
|
28
32
|
function paramCount(node) {
|
|
29
33
|
if (field(node, 'parameter')) return 1;
|
|
30
34
|
const params = field(node, 'parameters');
|
|
35
|
+
if (params?.type === 'implicit_parameter') return 1;
|
|
31
36
|
return params ? params.namedChildren.filter((c) => c.type !== 'comment').length : 0;
|
|
32
37
|
}
|
|
33
38
|
|
|
@@ -52,12 +57,13 @@ function hasJsx(node) {
|
|
|
52
57
|
// What each structure that breaks linear flow adds, and which of its parts sit one nesting level deeper. An else-if adds one and keeps
|
|
53
58
|
// the nesting of the if it continues; an else adds one.
|
|
54
59
|
function ifStatement(node, nesting, ctx) {
|
|
55
|
-
const elseIf = node
|
|
60
|
+
const elseIf = isElseIf(node);
|
|
56
61
|
ctx.score += elseIf ? 1 : 1 + nesting;
|
|
57
62
|
const base = elseIf ? nesting - 1 : nesting;
|
|
58
63
|
ctx.walk(field(node, 'condition'), base);
|
|
59
64
|
ctx.walk(field(node, 'consequence'), base + 1);
|
|
60
|
-
const
|
|
65
|
+
const alternative = field(node, 'alternative');
|
|
66
|
+
const inner = alternative?.type === 'else_clause' ? alternative.namedChildren.find((c) => c.type !== 'comment') : alternative;
|
|
61
67
|
if (inner && inner.type !== 'if_statement') ctx.score += 1;
|
|
62
68
|
ctx.walk(inner, base + 1);
|
|
63
69
|
}
|
|
@@ -71,6 +77,11 @@ const nestsIn = (fields) => (node, nesting, ctx) => {
|
|
|
71
77
|
const STRUCTURES = {
|
|
72
78
|
if_statement: ifStatement,
|
|
73
79
|
ternary_expression: nestsIn(['consequence', 'alternative']),
|
|
80
|
+
conditional_expression: nestsIn(['consequence', 'alternative']),
|
|
81
|
+
switch_expression: (node, nesting, ctx) => {
|
|
82
|
+
ctx.score += 1 + nesting;
|
|
83
|
+
for (const c of node.namedChildren) ctx.walk(c, c.type === 'switch_expression_arm' ? nesting + 1 : nesting);
|
|
84
|
+
},
|
|
74
85
|
switch_statement: nestsIn(['body']),
|
|
75
86
|
catch_clause: nestsIn(['body']),
|
|
76
87
|
...Object.fromEntries([...LOOPS].map((type) => [type, nestsIn(['body'])])),
|
|
@@ -86,7 +97,7 @@ const recursion = (node, ctx) => {
|
|
|
86
97
|
const callee = field(node, 'function');
|
|
87
98
|
return ctx.name && callee?.type === 'identifier' && callee.text === ctx.name ? 1 : 0;
|
|
88
99
|
};
|
|
89
|
-
const FLAT = { break_statement: labelled, continue_statement: labelled, binary_expression: sequence, call_expression: recursion };
|
|
100
|
+
const FLAT = { break_statement: labelled, continue_statement: labelled, goto_statement: () => 1, binary_expression: sequence, call_expression: recursion, invocation_expression: recursion };
|
|
90
101
|
|
|
91
102
|
// Cognitive complexity of one unit. Nested functions are left out here and scored as their own units by unitsOf.
|
|
92
103
|
function cognitive(unit, name, startNesting) {
|
|
@@ -107,7 +118,7 @@ function maxDepth(unit) {
|
|
|
107
118
|
let max = 0;
|
|
108
119
|
const walk = (node, depth) => {
|
|
109
120
|
if (node !== unit && FUNCTIONS.has(node.type)) return;
|
|
110
|
-
const counts = DEPTH.has(node.type) && !(node
|
|
121
|
+
const counts = DEPTH.has(node.type) && !isElseIf(node);
|
|
111
122
|
const d = counts ? depth + 1 : depth;
|
|
112
123
|
if (d > max) max = d;
|
|
113
124
|
for (const c of node.namedChildren) walk(c, d);
|
|
@@ -120,7 +131,7 @@ function maxDepth(unit) {
|
|
|
120
131
|
function nestingAt(node) {
|
|
121
132
|
let n = 0;
|
|
122
133
|
for (let p = node.parent, child = node; p && !FUNCTIONS.has(p.type); child = p, p = p.parent) {
|
|
123
|
-
if (LOOPS.has(p.type) || p.type === 'switch_statement' || p.type === 'catch_clause' || p.type
|
|
134
|
+
if (LOOPS.has(p.type) || p.type === 'switch_statement' || p.type === 'catch_clause' || TERNARY.has(p.type)) n += 1;
|
|
124
135
|
if (p.type === 'if_statement' && !same(child, field(p, 'condition'))) n += 1;
|
|
125
136
|
}
|
|
126
137
|
return n;
|
|
@@ -143,6 +154,8 @@ export function unitsOf(tree, { file = '', isTest = false } = {}) {
|
|
|
143
154
|
cognitive: cognitive(node, name, start),
|
|
144
155
|
depth: maxDepth(node),
|
|
145
156
|
params: paramCount(node),
|
|
157
|
+
// C# overloads, and a constructor beside its destructor, share a name: the gate tells them apart by this.
|
|
158
|
+
signature: `${node.type}(${(field(node, 'parameters') ?? field(node, 'parameter'))?.text.replace(/\s+/g, ' ') ?? ''})`,
|
|
146
159
|
});
|
|
147
160
|
for (const c of node.namedChildren) visit(c, start);
|
|
148
161
|
return;
|
|
@@ -10,7 +10,7 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
|
10
10
|
const DIR = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', '..', 'vendor', 'tree-sitter');
|
|
11
11
|
export const MAX_FILE_BYTES = 512 * 1024;
|
|
12
12
|
export const PARSE_TIMEOUT_MS = 5000;
|
|
13
|
-
const LANGUAGES = { '.js': 'javascript', '.mjs': 'javascript', '.cjs': 'javascript', '.jsx': 'javascript', '.ts': 'typescript', '.mts': 'typescript', '.cts': 'typescript', '.tsx': 'tsx', '.css': 'css' };
|
|
13
|
+
const LANGUAGES = { '.js': 'javascript', '.mjs': 'javascript', '.cjs': 'javascript', '.jsx': 'javascript', '.ts': 'typescript', '.mts': 'typescript', '.cts': 'typescript', '.tsx': 'tsx', '.css': 'css', '.cs': 'c-sharp' };
|
|
14
14
|
|
|
15
15
|
/** The grammar a file is parsed with, or null when the gate does not cover its language yet. */
|
|
16
16
|
export const languageOf = (file) => LANGUAGES[path.extname(file).toLowerCase()] ?? null;
|
package/scripts/lib/reviews.mjs
CHANGED
|
@@ -98,6 +98,7 @@ export function recordReviews(ctx, { reviews, base, tree: reviewed, always = fal
|
|
|
98
98
|
const record = { v: 1, at: ctx.now(), base: plan.base, tree, pass, verdicts, findings, blocking: blocking.map((f) => f.fingerprint) };
|
|
99
99
|
appendStateFile(ctx.root, statePaths(ctx.root, ctx.env).reviews, `${JSON.stringify(record)}\n`, ctx.env);
|
|
100
100
|
const logged = findings.filter((f) => !isBlocking(f));
|
|
101
|
+
const trimmed = verdicts.filter((v) => v.trimmed).map((v) => ({ agent: v.agent, dropped: v.trimmed }));
|
|
101
102
|
return {
|
|
102
103
|
verdict: decision.next === 'close' ? 'clear' : decision.next === 'fix' ? 'fix' : 'ask-user',
|
|
103
104
|
pass,
|
|
@@ -105,6 +106,7 @@ export function recordReviews(ctx, { reviews, base, tree: reviewed, always = fal
|
|
|
105
106
|
logged,
|
|
106
107
|
advice: decision.next === 'fix' && securityFired ? ADVICE.fixHere : ADVICE[decision.next],
|
|
107
108
|
...(decision.stop ? { stop: decision.stop } : {}),
|
|
109
|
+
...(trimmed.length ? { trimmed, trimmed_note: 'These reports were over the size cap, so their least severe findings were dropped to fit. Tell the user how many.' } : {}),
|
|
108
110
|
};
|
|
109
111
|
}
|
|
110
112
|
|
|
@@ -54,6 +54,15 @@
|
|
|
54
54
|
"license": "MIT",
|
|
55
55
|
"bytes": 128668,
|
|
56
56
|
"sha256": "8a23977fe271357cce6f254ef88c9bebf3854602d8046605aef6a45c02135c59"
|
|
57
|
+
},
|
|
58
|
+
"tree-sitter-c-sharp.wasm": {
|
|
59
|
+
"package": "@vscode/tree-sitter-wasm",
|
|
60
|
+
"version": "0.3.1",
|
|
61
|
+
"tarball_integrity": "sha512-RJFoomET6FajjG511fmQxeBQfU6M24a0aFZPqpid+ttIxanWf1VGytBG0UmsGjt07qmIPJS8U31D+aecuCucsQ==",
|
|
62
|
+
"repository": "https://github.com/microsoft/vscode-tree-sitter-wasm",
|
|
63
|
+
"license": "MIT",
|
|
64
|
+
"bytes": 5103332,
|
|
65
|
+
"sha256": "d12d85996c25957b4c1b71e26db2d7cc8a294997b60642e9c2a3b031b2c66dd3"
|
|
57
66
|
}
|
|
58
67
|
}
|
|
59
68
|
}
|
|
Binary file
|
|
@@ -28,6 +28,9 @@ const SCOUT = { type: 'object', required: ['files', 'test_command'], properties:
|
|
|
28
28
|
const RAN = { type: 'object', required: ['failed'], properties: { failed: { type: 'boolean' }, output: { type: 'string' } } };
|
|
29
29
|
const BUILT = { type: 'object', required: ['status', 'summary'], properties: { status: { type: 'string', enum: ['done', 'blocked'] }, summary: { type: 'string' } } };
|
|
30
30
|
const GATE = { type: 'object', required: ['ok'], properties: { ok: { type: 'boolean' }, failures: { type: 'array', items: { type: 'string' } } } };
|
|
31
|
+
// somi_review takes a reviewer's report as an object. Asked without a schema, a host returns the reviewer's text instead.
|
|
32
|
+
const FINDING = { type: 'object', required: ['severity', 'file', 'claim'], properties: { id: { type: 'string' }, severity: { type: 'string', enum: ['Blocker', 'Major', 'Minor', 'Nit'] }, boundary: { type: 'boolean' }, file: { type: 'string' }, line: { type: 'integer' }, claim: { type: 'string' }, evidence: { type: 'string' } } };
|
|
33
|
+
const REVIEW = { type: 'object', required: ['verdict', 'findings'], properties: { verdict: { type: 'string', enum: ['approve', 'approve-with-comments', 'request-changes'] }, tests_run: { type: 'array', items: { type: 'string' } }, findings: { type: 'array', items: FINDING } } };
|
|
31
34
|
const PLAN = { type: 'object', required: ['needed'], properties: { needed: { type: 'boolean' }, tree: { type: 'string' }, reviewers: { type: 'array', items: { type: 'object', properties: { agent: { type: 'string' }, model: { type: 'string' }, brief: { type: 'string' } } } } } };
|
|
32
35
|
|
|
33
36
|
await runShards('work-item.start');
|
|
@@ -74,8 +77,17 @@ for (const tier of ladder) {
|
|
|
74
77
|
|
|
75
78
|
phase('Review');
|
|
76
79
|
const plan = await agent(`Run \`${cli} review\` and return what it prints, unchanged, as the fields asked for. Change nothing.`, onTier('low', { label: 'review plan', schema: PLAN }));
|
|
77
|
-
// A first stage gets the item itself on one host and (previous, item) on another, so it reads the item from either.
|
|
78
|
-
|
|
80
|
+
// A first stage gets the item itself on one host and (previous, item) on another, so it reads the item from either. A report is filed
|
|
81
|
+
// under the name it was dispatched as, not the one it gives itself. A reviewer that returns nothing is named, never dropped: somi_review
|
|
82
|
+
// refuses a set without it, because a missing security review must not read as a clean one.
|
|
83
|
+
const seats = plan?.needed ? plan.reviewers ?? [] : [];
|
|
84
|
+
const returned = await pipeline(seats, (prev, item) => {
|
|
85
|
+
const r = item ?? prev;
|
|
86
|
+
return agent(r.brief, { label: r.agent, agentType: r.agent, schema: REVIEW, ...(r.model ? { model: r.model } : {}) }).then((v) => (v && typeof v === 'object' ? { ...v, agent: r.agent } : null));
|
|
87
|
+
});
|
|
88
|
+
const reviews = seats.map((_, i) => returned?.[i]).filter(Boolean);
|
|
89
|
+
const reviewsMissing = seats.filter((s) => !reviews.some((v) => v.agent === s.agent)).map((s) => s.agent);
|
|
79
90
|
await runShards('review.done');
|
|
80
91
|
|
|
81
|
-
|
|
92
|
+
const done = built?.status === 'done' && gate?.ok && reviewsMissing.length === 0;
|
|
93
|
+
return { status: done ? 'done' : 'needs-attention', summary: built?.summary ?? null, checks: gate, rules: rules?.rules ?? [], rules_file: rules?.file ?? null, review_tree: plan?.tree ?? null, reviews, reviews_missing: reviewsMissing, handoff_kept_repro: Boolean(repro) };
|