@sweny-ai/core 0.1.201 → 0.1.202
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/journal.d.ts +53 -0
- package/dist/journal.js +40 -8
- package/package.json +1 -1
package/dist/journal.d.ts
CHANGED
|
@@ -653,4 +653,57 @@ export declare class RunJournal implements ExecutionJournal {
|
|
|
653
653
|
private probe;
|
|
654
654
|
private wrapTool;
|
|
655
655
|
}
|
|
656
|
+
/**
|
|
657
|
+
* How the journal treats each `NodeResult` field (#581). `Record<keyof NodeResult, ...>` makes a
|
|
658
|
+
* field added to the type fail the build until it is listed here as journaled or excluded, so a
|
|
659
|
+
* new field cannot silently vanish on resume replay.
|
|
660
|
+
*
|
|
661
|
+
* - `verbatim`: copied as is when present (secrets are redacted by `clean` on append).
|
|
662
|
+
* - `reduced`: journaled in a smaller form, see {@link journalResult}.
|
|
663
|
+
* - `excluded`: never journaled; the reason is part of the schema.
|
|
664
|
+
*
|
|
665
|
+
* Fields stay optional on read: a journal written before a field was journaled just replays
|
|
666
|
+
* without it. Adding a journaled field needs no record version bump.
|
|
667
|
+
*/
|
|
668
|
+
export declare const NODE_RESULT_JOURNAL: {
|
|
669
|
+
readonly status: {
|
|
670
|
+
readonly journal: "verbatim";
|
|
671
|
+
};
|
|
672
|
+
readonly data: {
|
|
673
|
+
readonly journal: "verbatim";
|
|
674
|
+
};
|
|
675
|
+
readonly toolCalls: {
|
|
676
|
+
readonly journal: "reduced";
|
|
677
|
+
};
|
|
678
|
+
readonly evals: {
|
|
679
|
+
readonly journal: "verbatim";
|
|
680
|
+
};
|
|
681
|
+
readonly usage: {
|
|
682
|
+
readonly journal: "verbatim";
|
|
683
|
+
};
|
|
684
|
+
readonly skippedWrites: {
|
|
685
|
+
readonly journal: "verbatim";
|
|
686
|
+
};
|
|
687
|
+
readonly harness: {
|
|
688
|
+
readonly journal: "verbatim";
|
|
689
|
+
};
|
|
690
|
+
readonly degraded: {
|
|
691
|
+
readonly journal: "verbatim";
|
|
692
|
+
};
|
|
693
|
+
readonly policy: {
|
|
694
|
+
readonly journal: "verbatim";
|
|
695
|
+
};
|
|
696
|
+
readonly outputs: {
|
|
697
|
+
readonly journal: "verbatim";
|
|
698
|
+
};
|
|
699
|
+
readonly budget: {
|
|
700
|
+
readonly journal: "verbatim";
|
|
701
|
+
};
|
|
702
|
+
readonly contained: {
|
|
703
|
+
readonly journal: "excluded";
|
|
704
|
+
readonly reason: string;
|
|
705
|
+
};
|
|
706
|
+
};
|
|
707
|
+
/** What a node result needs to continue a run. Tool call inputs and outputs are dropped. */
|
|
708
|
+
export declare function journalResult(r: NodeResult): NodeResult;
|
|
656
709
|
export {};
|
package/dist/journal.js
CHANGED
|
@@ -2108,9 +2108,39 @@ function namesProduced(o, depth = 0) {
|
|
|
2108
2108
|
return o.some((v) => namesProduced(v, depth + 1));
|
|
2109
2109
|
return Object.entries(o).some(([k, v]) => (PRODUCED_KEYS.has(k) && v !== undefined && v !== null) || namesProduced(v, depth + 1));
|
|
2110
2110
|
}
|
|
2111
|
+
/**
|
|
2112
|
+
* How the journal treats each `NodeResult` field (#581). `Record<keyof NodeResult, ...>` makes a
|
|
2113
|
+
* field added to the type fail the build until it is listed here as journaled or excluded, so a
|
|
2114
|
+
* new field cannot silently vanish on resume replay.
|
|
2115
|
+
*
|
|
2116
|
+
* - `verbatim`: copied as is when present (secrets are redacted by `clean` on append).
|
|
2117
|
+
* - `reduced`: journaled in a smaller form, see {@link journalResult}.
|
|
2118
|
+
* - `excluded`: never journaled; the reason is part of the schema.
|
|
2119
|
+
*
|
|
2120
|
+
* Fields stay optional on read: a journal written before a field was journaled just replays
|
|
2121
|
+
* without it. Adding a journaled field needs no record version bump.
|
|
2122
|
+
*/
|
|
2123
|
+
export const NODE_RESULT_JOURNAL = {
|
|
2124
|
+
status: { journal: "verbatim" },
|
|
2125
|
+
data: { journal: "verbatim" },
|
|
2126
|
+
toolCalls: { journal: "reduced" }, // tool names and statuses; inputs and outputs are large and may hold secrets
|
|
2127
|
+
evals: { journal: "verbatim" },
|
|
2128
|
+
usage: { journal: "verbatim" },
|
|
2129
|
+
skippedWrites: { journal: "verbatim" },
|
|
2130
|
+
harness: { journal: "verbatim" },
|
|
2131
|
+
degraded: { journal: "verbatim" },
|
|
2132
|
+
policy: { journal: "verbatim" }, // booleans and a mode; the run receipt reads it for replayed nodes
|
|
2133
|
+
outputs: { journal: "verbatim" },
|
|
2134
|
+
budget: { journal: "verbatim" }, // a replayed node that crossed a budget must still be the node that stopped the run
|
|
2135
|
+
contained: {
|
|
2136
|
+
journal: "excluded",
|
|
2137
|
+
reason: "containment is journaled per visit as an agent:unsandboxed record; a replayed result must not assert that " +
|
|
2138
|
+
"an earlier attempt was contained, and an absent flag already reads as not contained",
|
|
2139
|
+
},
|
|
2140
|
+
};
|
|
2111
2141
|
/** What a node result needs to continue a run. Tool call inputs and outputs are dropped. */
|
|
2112
|
-
function journalResult(r) {
|
|
2113
|
-
|
|
2142
|
+
export function journalResult(r) {
|
|
2143
|
+
const out = {
|
|
2114
2144
|
status: r.status,
|
|
2115
2145
|
data: r.data ?? {},
|
|
2116
2146
|
toolCalls: (r.toolCalls ?? []).map((t) => ({
|
|
@@ -2118,11 +2148,13 @@ function journalResult(r) {
|
|
|
2118
2148
|
input: null,
|
|
2119
2149
|
...(t.status ? { status: t.status } : {}),
|
|
2120
2150
|
})),
|
|
2121
|
-
...(r.evals ? { evals: r.evals } : {}),
|
|
2122
|
-
...(r.usage ? { usage: r.usage } : {}),
|
|
2123
|
-
...(r.skippedWrites ? { skippedWrites: r.skippedWrites } : {}),
|
|
2124
|
-
...(r.harness ? { harness: r.harness } : {}),
|
|
2125
|
-
...(r.degraded ? { degraded: r.degraded } : {}),
|
|
2126
|
-
...(r.outputs ? { outputs: r.outputs } : {}),
|
|
2127
2151
|
};
|
|
2152
|
+
const source = r;
|
|
2153
|
+
for (const [field, rule] of Object.entries(NODE_RESULT_JOURNAL)) {
|
|
2154
|
+
if (rule.journal !== "verbatim" || field in out)
|
|
2155
|
+
continue;
|
|
2156
|
+
if (source[field] !== undefined)
|
|
2157
|
+
out[field] = source[field];
|
|
2158
|
+
}
|
|
2159
|
+
return out;
|
|
2128
2160
|
}
|