paracosm 0.4.237 → 0.4.238
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.
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classify a forge rejection's `errorReason` string into one of five
|
|
3
|
+
* categories. Pure string matching against observed AgentOS judge
|
|
4
|
+
* verdict text + paracosm's local shape-check messages.
|
|
5
|
+
*
|
|
6
|
+
* Why this exists: sub-project C exposed a `forges.rejected` counter
|
|
7
|
+
* but the reason text was only visible via SSH'ing pm2 logs. Aggregating
|
|
8
|
+
* by category lets the dashboard and /retry-stats answer
|
|
9
|
+
* "is the LLM's output-schema discipline improving after the forge
|
|
10
|
+
* guidance prompt fix" without a human reading error messages.
|
|
11
|
+
*
|
|
12
|
+
* Categories are deliberately narrow — we only split out patterns that
|
|
13
|
+
* appeared clearly in the 2026-04-18 production log sample (where
|
|
14
|
+
* ~92% of rejections were schema-extra-field) and leave anything
|
|
15
|
+
* unrecognized in the `other` bucket.
|
|
16
|
+
*
|
|
17
|
+
* @module paracosm/runtime/forge-rejection-classifier
|
|
18
|
+
*/
|
|
19
|
+
/** Rejection-reason category. */
|
|
20
|
+
export type ForgeRejectionCategory =
|
|
21
|
+
/** Implementation returned output fields not declared in outputSchema
|
|
22
|
+
* (violates additionalProperties:false). #1 production failure; the
|
|
23
|
+
* target the 2026-04-18 forge-guidance prompt fix is trying to cut. */
|
|
24
|
+
'schema_extra_field'
|
|
25
|
+
/** Paracosm's pre-judge shape check caught a malformed request
|
|
26
|
+
* (empty testCases, empty schema properties, empty-input testCases). */
|
|
27
|
+
| 'shape_check'
|
|
28
|
+
/** Judge LLM returned malformed JSON the engine could not parse. */
|
|
29
|
+
| 'parse_error'
|
|
30
|
+
/** Judge flagged logic / correctness / safety concerns in the code
|
|
31
|
+
* itself (division bugs, threshold inversions, unbounded outputs). */
|
|
32
|
+
| 'judge_correctness'
|
|
33
|
+
/** Everything else. A non-zero `other` bucket is a signal to read
|
|
34
|
+
* the raw text and consider adding a new category. */
|
|
35
|
+
| 'other';
|
|
36
|
+
/**
|
|
37
|
+
* Classify a rejection reason string. Case-insensitive substring match
|
|
38
|
+
* against pattern lists, evaluated in order: schema_extra_field first
|
|
39
|
+
* (most common), then shape_check (local pre-validator), then
|
|
40
|
+
* parse_error, then judge_correctness, then `other`.
|
|
41
|
+
*
|
|
42
|
+
* Order matters: "violates the declared output schema by returning an
|
|
43
|
+
* additional field due to a logic error" matches BOTH schema_extra_field
|
|
44
|
+
* and judge_correctness; the former wins because it is the more specific
|
|
45
|
+
* and more actionable signal.
|
|
46
|
+
*/
|
|
47
|
+
export declare function classifyForgeRejection(errorReason: string | undefined): ForgeRejectionCategory;
|
|
48
|
+
//# sourceMappingURL=forge-rejection-classifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forge-rejection-classifier.d.ts","sourceRoot":"","sources":["../../../src/runtime/forge-rejection-classifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,iCAAiC;AACjC,MAAM,MAAM,sBAAsB;AAChC;;wEAEwE;AACtE,oBAAoB;AACtB;yEACyE;GACvE,aAAa;AACf,oEAAoE;GAClE,aAAa;AACf;uEACuE;GACrE,mBAAmB;AACrB;uDACuD;GACrD,OAAO,CAAC;AAuEZ;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,sBAAsB,CAoB9F"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classify a forge rejection's `errorReason` string into one of five
|
|
3
|
+
* categories. Pure string matching against observed AgentOS judge
|
|
4
|
+
* verdict text + paracosm's local shape-check messages.
|
|
5
|
+
*
|
|
6
|
+
* Why this exists: sub-project C exposed a `forges.rejected` counter
|
|
7
|
+
* but the reason text was only visible via SSH'ing pm2 logs. Aggregating
|
|
8
|
+
* by category lets the dashboard and /retry-stats answer
|
|
9
|
+
* "is the LLM's output-schema discipline improving after the forge
|
|
10
|
+
* guidance prompt fix" without a human reading error messages.
|
|
11
|
+
*
|
|
12
|
+
* Categories are deliberately narrow — we only split out patterns that
|
|
13
|
+
* appeared clearly in the 2026-04-18 production log sample (where
|
|
14
|
+
* ~92% of rejections were schema-extra-field) and leave anything
|
|
15
|
+
* unrecognized in the `other` bucket.
|
|
16
|
+
*
|
|
17
|
+
* @module paracosm/runtime/forge-rejection-classifier
|
|
18
|
+
*/
|
|
19
|
+
const SCHEMA_EXTRA_FIELD_PATTERNS = [
|
|
20
|
+
'additional properties',
|
|
21
|
+
'additional property',
|
|
22
|
+
'additionalproperties',
|
|
23
|
+
'extra field',
|
|
24
|
+
'extra fields',
|
|
25
|
+
'extra property',
|
|
26
|
+
'extra properties',
|
|
27
|
+
'undeclared extra field',
|
|
28
|
+
'undeclared field',
|
|
29
|
+
'emits an additional',
|
|
30
|
+
'emits extra',
|
|
31
|
+
'returning an additional',
|
|
32
|
+
'returning extra',
|
|
33
|
+
'returns an additional',
|
|
34
|
+
'returns extra',
|
|
35
|
+
'returns additional',
|
|
36
|
+
'returning an undeclared',
|
|
37
|
+
];
|
|
38
|
+
/**
|
|
39
|
+
* Regex-based patterns for "extra <modifier> field" phrasings that
|
|
40
|
+
* substring matching misses. Example: "extra recommendations field"
|
|
41
|
+
* is clearly a schema-extra-field rejection but the string "extra field"
|
|
42
|
+
* is not contiguous. This regex catches the general form.
|
|
43
|
+
*/
|
|
44
|
+
const SCHEMA_EXTRA_FIELD_REGEXES = [
|
|
45
|
+
/\bextra\s+\w+\s+field\b/,
|
|
46
|
+
/\badditional\s+\w+\s+field\b/,
|
|
47
|
+
/\bextra\s+\w+\s+property\b/,
|
|
48
|
+
/\badditional\s+\w+\s+property\b/,
|
|
49
|
+
];
|
|
50
|
+
const SHAPE_CHECK_PATTERNS = [
|
|
51
|
+
'shape check failed',
|
|
52
|
+
'inputschema has no declared properties',
|
|
53
|
+
'outputschema has no declared properties',
|
|
54
|
+
'testcases use empty input',
|
|
55
|
+
'testcase use empty input',
|
|
56
|
+
'need at least 2 testcases',
|
|
57
|
+
'every test needs real field values',
|
|
58
|
+
];
|
|
59
|
+
const PARSE_ERROR_PATTERNS = [
|
|
60
|
+
'failed to parse llm response',
|
|
61
|
+
'could not parse judge response',
|
|
62
|
+
'judge response was not valid json',
|
|
63
|
+
];
|
|
64
|
+
const JUDGE_CORRECTNESS_PATTERNS = [
|
|
65
|
+
'logic error',
|
|
66
|
+
'threshold ordering',
|
|
67
|
+
'clamped',
|
|
68
|
+
'unclamped',
|
|
69
|
+
'inconsistent risk grading',
|
|
70
|
+
'division by zero',
|
|
71
|
+
'unbounded output',
|
|
72
|
+
'unbounded',
|
|
73
|
+
'returns nan',
|
|
74
|
+
'returns infinity',
|
|
75
|
+
'infinite loop',
|
|
76
|
+
'not deterministic',
|
|
77
|
+
'nondeterministic',
|
|
78
|
+
'correctness is questionable',
|
|
79
|
+
'correctness concern',
|
|
80
|
+
'fails safety',
|
|
81
|
+
'safety concern',
|
|
82
|
+
];
|
|
83
|
+
/**
|
|
84
|
+
* Classify a rejection reason string. Case-insensitive substring match
|
|
85
|
+
* against pattern lists, evaluated in order: schema_extra_field first
|
|
86
|
+
* (most common), then shape_check (local pre-validator), then
|
|
87
|
+
* parse_error, then judge_correctness, then `other`.
|
|
88
|
+
*
|
|
89
|
+
* Order matters: "violates the declared output schema by returning an
|
|
90
|
+
* additional field due to a logic error" matches BOTH schema_extra_field
|
|
91
|
+
* and judge_correctness; the former wins because it is the more specific
|
|
92
|
+
* and more actionable signal.
|
|
93
|
+
*/
|
|
94
|
+
export function classifyForgeRejection(errorReason) {
|
|
95
|
+
if (!errorReason)
|
|
96
|
+
return 'other';
|
|
97
|
+
const lower = errorReason.toLowerCase();
|
|
98
|
+
for (const p of SCHEMA_EXTRA_FIELD_PATTERNS) {
|
|
99
|
+
if (lower.includes(p))
|
|
100
|
+
return 'schema_extra_field';
|
|
101
|
+
}
|
|
102
|
+
for (const rx of SCHEMA_EXTRA_FIELD_REGEXES) {
|
|
103
|
+
if (rx.test(lower))
|
|
104
|
+
return 'schema_extra_field';
|
|
105
|
+
}
|
|
106
|
+
for (const p of SHAPE_CHECK_PATTERNS) {
|
|
107
|
+
if (lower.includes(p))
|
|
108
|
+
return 'shape_check';
|
|
109
|
+
}
|
|
110
|
+
for (const p of PARSE_ERROR_PATTERNS) {
|
|
111
|
+
if (lower.includes(p))
|
|
112
|
+
return 'parse_error';
|
|
113
|
+
}
|
|
114
|
+
for (const p of JUDGE_CORRECTNESS_PATTERNS) {
|
|
115
|
+
if (lower.includes(p))
|
|
116
|
+
return 'judge_correctness';
|
|
117
|
+
}
|
|
118
|
+
return 'other';
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=forge-rejection-classifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forge-rejection-classifier.js","sourceRoot":"","sources":["../../../src/runtime/forge-rejection-classifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAoBH,MAAM,2BAA2B,GAAG;IAClC,uBAAuB;IACvB,qBAAqB;IACrB,sBAAsB;IACtB,aAAa;IACb,cAAc;IACd,gBAAgB;IAChB,kBAAkB;IAClB,wBAAwB;IACxB,kBAAkB;IAClB,qBAAqB;IACrB,aAAa;IACb,yBAAyB;IACzB,iBAAiB;IACjB,uBAAuB;IACvB,eAAe;IACf,oBAAoB;IACpB,yBAAyB;CAC1B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,0BAA0B,GAAa;IAC3C,yBAAyB;IACzB,8BAA8B;IAC9B,4BAA4B;IAC5B,iCAAiC;CAClC,CAAC;AAEF,MAAM,oBAAoB,GAAG;IAC3B,oBAAoB;IACpB,wCAAwC;IACxC,yCAAyC;IACzC,2BAA2B;IAC3B,0BAA0B;IAC1B,2BAA2B;IAC3B,oCAAoC;CACrC,CAAC;AAEF,MAAM,oBAAoB,G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@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paracosm",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.238",
|
|
4
4
|
"description": "AI agent swarm simulation engine with emergent crises, runtime tool forging, HEXACO personality drift, and deterministic kernels. Built on AgentOS.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/engine/index.js",
|