@coderifts/agent-guard 9.3.0 → 9.5.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/README.md +33 -16
- package/dist/cjs/adapters/anthropic.d.ts +3 -0
- package/dist/cjs/adapters/anthropic.d.ts.map +1 -1
- package/dist/cjs/adapters/anthropic.js +5 -23
- package/dist/cjs/adapters/anthropic.js.map +1 -1
- package/dist/cjs/adapters/gemini.d.ts +3 -0
- package/dist/cjs/adapters/gemini.d.ts.map +1 -1
- package/dist/cjs/adapters/gemini.js +5 -24
- package/dist/cjs/adapters/gemini.js.map +1 -1
- package/dist/cjs/adapters/langgraph.d.ts +40 -6
- package/dist/cjs/adapters/langgraph.d.ts.map +1 -1
- package/dist/cjs/adapters/langgraph.js +75 -30
- package/dist/cjs/adapters/langgraph.js.map +1 -1
- package/dist/cjs/adapters/openai.d.ts +3 -0
- package/dist/cjs/adapters/openai.d.ts.map +1 -1
- package/dist/cjs/adapters/openai.js +5 -22
- package/dist/cjs/adapters/openai.js.map +1 -1
- package/dist/cjs/cas-adapters/fs-default-wire.d.ts +15 -0
- package/dist/cjs/cas-adapters/fs-default-wire.d.ts.map +1 -0
- package/dist/cjs/cas-adapters/fs-default-wire.js +76 -0
- package/dist/cjs/cas-adapters/fs-default-wire.js.map +1 -0
- package/dist/cjs/coverage-observed.d.ts +45 -0
- package/dist/cjs/coverage-observed.d.ts.map +1 -0
- package/dist/cjs/coverage-observed.js +140 -0
- package/dist/cjs/coverage-observed.js.map +1 -0
- package/dist/cjs/execution-proof.d.ts +7 -0
- package/dist/cjs/execution-proof.d.ts.map +1 -1
- package/dist/cjs/execution-proof.js +4 -0
- package/dist/cjs/execution-proof.js.map +1 -1
- package/dist/cjs/final-answer-proof.d.ts.map +1 -1
- package/dist/cjs/final-answer-proof.js +8 -0
- package/dist/cjs/final-answer-proof.js.map +1 -1
- package/dist/cjs/gate-refusal.d.ts +14 -0
- package/dist/cjs/gate-refusal.d.ts.map +1 -0
- package/dist/cjs/gate-refusal.js +85 -0
- package/dist/cjs/gate-refusal.js.map +1 -0
- package/dist/cjs/guard.d.ts.map +1 -1
- package/dist/cjs/guard.js +15 -0
- package/dist/cjs/guard.js.map +1 -1
- package/dist/cjs/index.d.ts +5 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +18 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/tool-registry.d.ts.map +1 -1
- package/dist/cjs/tool-registry.js +5 -1
- package/dist/cjs/tool-registry.js.map +1 -1
- package/dist/cjs/types.d.ts +11 -0
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/cjs/with-coderifts.d.ts +14 -2
- package/dist/cjs/with-coderifts.d.ts.map +1 -1
- package/dist/cjs/with-coderifts.js +37 -4
- package/dist/cjs/with-coderifts.js.map +1 -1
- package/dist/esm/adapters/anthropic.d.ts +3 -0
- package/dist/esm/adapters/anthropic.d.ts.map +1 -1
- package/dist/esm/adapters/anthropic.js +3 -21
- package/dist/esm/adapters/anthropic.js.map +1 -1
- package/dist/esm/adapters/gemini.d.ts +3 -0
- package/dist/esm/adapters/gemini.d.ts.map +1 -1
- package/dist/esm/adapters/gemini.js +3 -22
- package/dist/esm/adapters/gemini.js.map +1 -1
- package/dist/esm/adapters/langgraph.d.ts +40 -6
- package/dist/esm/adapters/langgraph.d.ts.map +1 -1
- package/dist/esm/adapters/langgraph.js +69 -28
- package/dist/esm/adapters/langgraph.js.map +1 -1
- package/dist/esm/adapters/openai.d.ts +3 -0
- package/dist/esm/adapters/openai.d.ts.map +1 -1
- package/dist/esm/adapters/openai.js +4 -21
- package/dist/esm/adapters/openai.js.map +1 -1
- package/dist/esm/cas-adapters/fs-default-wire.d.ts +15 -0
- package/dist/esm/cas-adapters/fs-default-wire.d.ts.map +1 -0
- package/dist/esm/cas-adapters/fs-default-wire.js +72 -0
- package/dist/esm/cas-adapters/fs-default-wire.js.map +1 -0
- package/dist/esm/coverage-observed.d.ts +45 -0
- package/dist/esm/coverage-observed.d.ts.map +1 -0
- package/dist/esm/coverage-observed.js +136 -0
- package/dist/esm/coverage-observed.js.map +1 -0
- package/dist/esm/execution-proof.d.ts +7 -0
- package/dist/esm/execution-proof.d.ts.map +1 -1
- package/dist/esm/execution-proof.js +4 -0
- package/dist/esm/execution-proof.js.map +1 -1
- package/dist/esm/final-answer-proof.d.ts.map +1 -1
- package/dist/esm/final-answer-proof.js +8 -0
- package/dist/esm/final-answer-proof.js.map +1 -1
- package/dist/esm/gate-refusal.d.ts +14 -0
- package/dist/esm/gate-refusal.d.ts.map +1 -0
- package/dist/esm/gate-refusal.js +78 -0
- package/dist/esm/gate-refusal.js.map +1 -0
- package/dist/esm/guard.d.ts.map +1 -1
- package/dist/esm/guard.js +15 -0
- package/dist/esm/guard.js.map +1 -1
- package/dist/esm/index.d.ts +5 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +5 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/tool-registry.d.ts.map +1 -1
- package/dist/esm/tool-registry.js +5 -1
- package/dist/esm/tool-registry.js.map +1 -1
- package/dist/esm/types.d.ts +11 -0
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/with-coderifts.d.ts +14 -2
- package/dist/esm/with-coderifts.d.ts.map +1 -1
- package/dist/esm/with-coderifts.js +37 -4
- package/dist/esm/with-coderifts.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -377,29 +377,30 @@ const {
|
|
|
377
377
|
|
|
378
378
|
See also `examples/anthropic-adapter.mjs` (not published in the npm tarball).
|
|
379
379
|
|
|
380
|
-
**LangChain / LangGraph (ID632 slice 3).** Same thin pattern; emits **dependency-free**
|
|
381
|
-
descriptors
|
|
382
|
-
|
|
383
|
-
|
|
380
|
+
**LangChain / LangGraph (ID632 slice 3).** Same thin pattern; emits **dependency-free**
|
|
381
|
+
StructuredTool-compatible descriptors (`name`, `description`, `schema`, `func`/`invoke`,
|
|
382
|
+
`lc_runnable: true`) that `createReactAgent` / `ToolNode` can consume. Measured against
|
|
383
|
+
`@langchain/langgraph` `createReactAgent` (`tools: ToolNode | (StructuredToolInterface |
|
|
384
|
+
DynamicTool | RunnableToolLike)[]` — 0.2.74 d.ts; current npm 1.4.12). This package does
|
|
385
|
+
**not** depend on langchain or langgraph. A tool that would still fail that check throws
|
|
386
|
+
`LangGraphToolsNotStructuredError` (wrap with `tool()` from `@langchain/core/tools`) — never a
|
|
387
|
+
model-visible `"Tool not found"`. Assurance still unflattened:
|
|
384
388
|
|
|
385
389
|
```typescript
|
|
386
390
|
import { withCodeRiftsLangGraph } from '@coderifts/agent-guard';
|
|
387
391
|
// host-owned (not a dependency of this package):
|
|
388
|
-
// import {
|
|
389
|
-
// import { ToolNode } from '@langchain/langgraph/prebuilt';
|
|
392
|
+
// import { createReactAgent } from '@langchain/langgraph/prebuilt';
|
|
390
393
|
|
|
391
394
|
const {
|
|
392
|
-
tools, //
|
|
395
|
+
tools, // createReactAgent-consumable; guarded execute bound
|
|
393
396
|
protected_tools,
|
|
394
397
|
registry_report,
|
|
395
398
|
composition_assurance, // still may be incomplete (inescapable_runtime:false) — do not drop
|
|
396
399
|
receipt_thread,
|
|
397
400
|
} = withCodeRiftsLangGraph({ tools: rawTools, client, operation: 'merge' });
|
|
398
401
|
|
|
399
|
-
// const
|
|
400
|
-
//
|
|
401
|
-
// );
|
|
402
|
-
// const toolNode = new ToolNode(lcTools); // StateGraph … .addNode('tools', toolNode)
|
|
402
|
+
// const agent = createReactAgent({ llm, tools });
|
|
403
|
+
// optional still-supported wrap: tool(d.func, { name: d.name, description: d.description, schema: d.schema })
|
|
403
404
|
// system: withPolicy(yourPrompt) — adapters do not see the outbound request
|
|
404
405
|
// Host boundary: only `tools` / `protected_tools` enter the graph — raw tools stay out.
|
|
405
406
|
```
|
|
@@ -465,11 +466,14 @@ different questions. Captured output from a real call against the current build
|
|
|
465
466
|
mutating tools):
|
|
466
467
|
|
|
467
468
|
```jsonc
|
|
468
|
-
// composition_assurance — shown WHOLE
|
|
469
|
+
// composition_assurance — shown WHOLE (coverage / inescapable_runtime / residuals
|
|
470
|
+
// are byte-identical to 9.4.0; observed_class is the live measured class):
|
|
469
471
|
{
|
|
470
472
|
"coverage": "PARTIAL",
|
|
471
473
|
"inescapable_runtime": false,
|
|
472
|
-
"residuals": ["composition_call_policy_incomplete"]
|
|
474
|
+
"residuals": ["composition_call_policy_incomplete"],
|
|
475
|
+
"freshness_resolver_wired": false,
|
|
476
|
+
"observed_class": "UNKNOWN_OUTSIDE_SCOPE"
|
|
473
477
|
}
|
|
474
478
|
|
|
475
479
|
// registry_report — abbreviated (… marks fields elided here, NOT trimmed to read cleaner):
|
|
@@ -484,8 +488,10 @@ mutating tools):
|
|
|
484
488
|
```
|
|
485
489
|
|
|
486
490
|
- **`registry_report`** is the truth about the tool table that was wrapped. It may legitimately say
|
|
487
|
-
`COMPLETE` with `inescapable_runtime: true` — every mutator wrapped, none reachable raw
|
|
488
|
-
`withCodeRifts` passes it through **untouched**.
|
|
491
|
+
`COMPLETE` with `inescapable_runtime: true` — every mutator wrapped, none reachable raw **in that
|
|
492
|
+
table**. `withCodeRifts` passes it through **untouched**. That is **not** a claim that the agent
|
|
493
|
+
cannot invoke a tool outside the table (demonstrated on LangGraph, OpenAI Agents, and the
|
|
494
|
+
Anthropic SDK).
|
|
489
495
|
- **`composition_assurance`** is the narrower, product-level statement — what `withCodeRifts` itself
|
|
490
496
|
claims. Today it reports `PARTIAL` with `inescapable_runtime: false` and the residual
|
|
491
497
|
`composition_call_policy_incomplete`, because **composition-call-policy completeness**
|
|
@@ -495,8 +501,19 @@ mutating tools):
|
|
|
495
501
|
What still blocks the product-level claim includes a **freshness-safe prior for write-style calls**
|
|
496
502
|
(path + new content only) wired into enforce, among other policy gates — carry-forward alone does
|
|
497
503
|
not flip this residual off.
|
|
504
|
+
- **`observed_class` / `coverage_observed` (9.5.0) — what was MEASURED this run**, not what was
|
|
505
|
+
assumed at registration. The run is one `withCodeRifts` instance (same lifetime as
|
|
506
|
+
`receipt_thread`). Half A always counts `execute()` through the returned table
|
|
507
|
+
(`governed_calls`, `tools`). Half B is optional: the host reports the total dispatch stream it
|
|
508
|
+
saw (`reportToolDispatch` / `reportToolDispatchBatch`, e.g. from AgentHooks / `onToolStart`).
|
|
509
|
+
When Half B is supplied, the snapshot gains `total_calls`, `ungoverned_calls`, `ungoverned_tools`
|
|
510
|
+
and the class is `INCOMPLETE_OBSERVED` (names outside the table) or `COMPLETE_OBSERVED` (host
|
|
511
|
+
reported, none outside). When Half B is **absent**, those fields are **omitted** (never zero) and
|
|
512
|
+
the class is `UNKNOWN_OUTSIDE_SCOPE` — **not** `COMPLETE`. Direct `guardToolCall` without a
|
|
513
|
+
composition observer has no `coverage_observed` field (byte-identical to 9.4.0). Observation
|
|
514
|
+
only; nothing in any preimage.
|
|
498
515
|
- **This is deliberate, not a defect.** The composition will not claim runtime inescapability it cannot
|
|
499
|
-
yet deliver.
|
|
516
|
+
yet deliver, and it will not read table-wrapping as agent-inescapability.
|
|
500
517
|
|
|
501
518
|
Reconciling with the `guardToolRegistry` note above (`coverage === 'COMPLETE' ⇒ no mutator is reachable
|
|
502
519
|
raw`): that claim is exactly what `registry_report` states, and it **remains true** — `withCodeRifts`
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
* Mirrors src/adapters/openai.ts — only the target tool shape differs.
|
|
23
23
|
*/
|
|
24
24
|
import type { WithCodeRiftsInput, WithCodeRiftsResult, CompositionAssurance, ReceiptThreadHandle } from '../with-coderifts.js';
|
|
25
|
+
import type { CoverageObservedHandle } from '../coverage-observed.js';
|
|
25
26
|
import type { ProtectedTool, RegistryCoverageReport } from '../tool-registry.js';
|
|
26
27
|
import type { GuardOutcome } from '../types.js';
|
|
27
28
|
/**
|
|
@@ -58,6 +59,8 @@ export type WithCodeRiftsAnthropicResult = {
|
|
|
58
59
|
composition_assurance: CompositionAssurance;
|
|
59
60
|
/** Per-composition receipt cursor — NOT product-truth chain evidence. */
|
|
60
61
|
receipt_thread: ReceiptThreadHandle;
|
|
62
|
+
/** Observed coverage for this withCodeRifts run. Half A always; Half B via reportToolDispatch. */
|
|
63
|
+
coverage_observed: CoverageObservedHandle;
|
|
61
64
|
repository?: string;
|
|
62
65
|
};
|
|
63
66
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../../src/adapters/anthropic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../../src/adapters/anthropic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQhD;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,4BAA4B,GAAG;I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,wBAAgB,mCAAmC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAgBxE;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,EACzC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EACxB,IAAI,EAAE,6BAA6B,CAAC,CAAC,CAAC,GACrC,6BAA6B,CAyB/B"}
|
|
@@ -31,6 +31,7 @@ exports.defaultSerializeAnthropicToolResult = defaultSerializeAnthropicToolResul
|
|
|
31
31
|
exports.bindAnthropicGuardOutcome = bindAnthropicGuardOutcome;
|
|
32
32
|
const with_coderifts_js_1 = require("../with-coderifts.js");
|
|
33
33
|
const final_answer_proof_js_1 = require("../final-answer-proof.js");
|
|
34
|
+
const gate_refusal_js_1 = require("../gate-refusal.js");
|
|
34
35
|
/** Empty JSON Schema object — used when a ProtectedTool has no inputSchema. */
|
|
35
36
|
const EMPTY_INPUT_SCHEMA = Object.freeze({
|
|
36
37
|
type: 'object',
|
|
@@ -91,6 +92,7 @@ function anthropicToolAdapter(result) {
|
|
|
91
92
|
registry_report: result.registry_report,
|
|
92
93
|
composition_assurance: result.composition_assurance,
|
|
93
94
|
receipt_thread: result.receipt_thread,
|
|
95
|
+
coverage_observed: result.coverage_observed,
|
|
94
96
|
};
|
|
95
97
|
if (result.repository !== undefined) {
|
|
96
98
|
out.repository = result.repository;
|
|
@@ -126,16 +128,13 @@ function bindAnthropicGuardOutcome(outcome, args) {
|
|
|
126
128
|
body = serialize(outcome.result);
|
|
127
129
|
}
|
|
128
130
|
else if (outcome.executionAttempted === false) {
|
|
129
|
-
|
|
130
|
-
body =
|
|
131
|
-
`CodeRifts gate did not permit execution (verdict: ${kind}). `
|
|
132
|
-
+ 'No tool result was produced.';
|
|
131
|
+
body = (0, gate_refusal_js_1.formatGateRefusalBody)(outcome);
|
|
133
132
|
}
|
|
134
133
|
else {
|
|
135
134
|
const err = 'error' in outcome ? outcome.error : undefined;
|
|
136
|
-
const kind = verdictKind(outcome);
|
|
135
|
+
const kind = (0, gate_refusal_js_1.verdictKind)(outcome);
|
|
137
136
|
body =
|
|
138
|
-
`Tool execution failed after gate decision (verdict: ${kind}): ${formatGuardError(err)}`;
|
|
137
|
+
`Tool execution failed after gate decision (verdict: ${kind}): ${(0, gate_refusal_js_1.formatGuardError)(err)}`;
|
|
139
138
|
}
|
|
140
139
|
const content = args.attachProof === false
|
|
141
140
|
? body
|
|
@@ -147,21 +146,4 @@ function bindAnthropicGuardOutcome(outcome, args) {
|
|
|
147
146
|
};
|
|
148
147
|
return block;
|
|
149
148
|
}
|
|
150
|
-
function verdictKind(outcome) {
|
|
151
|
-
return outcome.verdict && typeof outcome.verdict === 'object' && 'kind' in outcome.verdict
|
|
152
|
-
? String(outcome.verdict.kind)
|
|
153
|
-
: 'UNKNOWN';
|
|
154
|
-
}
|
|
155
|
-
function formatGuardError(err) {
|
|
156
|
-
if (err instanceof Error)
|
|
157
|
-
return err.message || err.name || 'Error';
|
|
158
|
-
if (typeof err === 'string')
|
|
159
|
-
return err;
|
|
160
|
-
try {
|
|
161
|
-
return JSON.stringify(err);
|
|
162
|
-
}
|
|
163
|
-
catch {
|
|
164
|
-
return String(err);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
149
|
//# sourceMappingURL=anthropic.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../../src/adapters/anthropic.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;
|
|
1
|
+
{"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../../src/adapters/anthropic.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;AAqEH,4DAgBC;AAMD,4CAEC;AAYD,wDAGC;AAQD,oDAeC;AA8BD,kFAgBC;AAMD,8DA4BC;AAjND,4DAAqD;AAUrD,oEAAsE;AACtE,wDAI4B;AA0C5B,+EAA+E;AAC/E,MAAM,kBAAk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AC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QAC3D,MAAM,IAAI,GAAG,IAAA,6BAAW,EAAC,OAAO,CAAC,CAAC;QAClC,IAAI;YACF,uDAAuD,IAAI,MAAM,IAAA,kCAAgB,EAAC,GAAG,CAAC,EAAE,CAAC;IAC7F,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,KAAK,KAAK;QACxC,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,IAAA,kDAA0B,EAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAW,CAAC;IAC9D,MAAM,KAAK,GAAwB;QACjC,IAAI,EAAE,aAAa;QACnB,WAAW;QACX,OAAO;KACR,CAAC;IACF,OAAO,KAAsC,CAAC;AAChD,CAAC"}
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
* Mirrors src/adapters/openai.ts — only the target tool shape differs.
|
|
29
29
|
*/
|
|
30
30
|
import type { WithCodeRiftsInput, WithCodeRiftsResult, CompositionAssurance, ReceiptThreadHandle } from '../with-coderifts.js';
|
|
31
|
+
import type { CoverageObservedHandle } from '../coverage-observed.js';
|
|
31
32
|
import type { ProtectedTool, RegistryCoverageReport } from '../tool-registry.js';
|
|
32
33
|
import type { GuardOutcome } from '../types.js';
|
|
33
34
|
/**
|
|
@@ -79,6 +80,8 @@ export type WithCodeRiftsGeminiResult = {
|
|
|
79
80
|
composition_assurance: CompositionAssurance;
|
|
80
81
|
/** Per-composition receipt cursor — NOT product-truth chain evidence. */
|
|
81
82
|
receipt_thread: ReceiptThreadHandle;
|
|
83
|
+
/** Observed coverage for this withCodeRifts run. Half A always; Half B via reportToolDispatch. */
|
|
84
|
+
coverage_observed: CoverageObservedHandle;
|
|
82
85
|
repository?: string;
|
|
83
86
|
};
|
|
84
87
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini.d.ts","sourceRoot":"","sources":["../../../src/adapters/gemini.ts"],"names":[],"mappings":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O,EAAE,YAAY,CAAC,CAAC,CAAC,EACxB,IAAI,EAAE,0BAA0B,CAAC,CAAC,CAAC,GAClC,gCAAgC,CAiClC"}
|
|
@@ -37,6 +37,7 @@ exports.defaultSerializeGeminiToolResult = defaultSerializeGeminiToolResult;
|
|
|
37
37
|
exports.bindGeminiGuardOutcome = bindGeminiGuardOutcome;
|
|
38
38
|
const with_coderifts_js_1 = require("../with-coderifts.js");
|
|
39
39
|
const final_answer_proof_js_1 = require("../final-answer-proof.js");
|
|
40
|
+
const gate_refusal_js_1 = require("../gate-refusal.js");
|
|
40
41
|
/** Empty OpenAPI-like JSON Schema — used when a ProtectedTool has no inputSchema. */
|
|
41
42
|
const EMPTY_PARAMETERS = Object.freeze({
|
|
42
43
|
type: 'object',
|
|
@@ -104,6 +105,7 @@ function geminiToolAdapter(result) {
|
|
|
104
105
|
registry_report: result.registry_report,
|
|
105
106
|
composition_assurance: result.composition_assurance,
|
|
106
107
|
receipt_thread: result.receipt_thread,
|
|
108
|
+
coverage_observed: result.coverage_observed,
|
|
107
109
|
};
|
|
108
110
|
if (result.repository !== undefined) {
|
|
109
111
|
out.repository = result.repository;
|
|
@@ -150,17 +152,13 @@ function bindGeminiGuardOutcome(outcome, args) {
|
|
|
150
152
|
base = { result: serialize(outcome.result) };
|
|
151
153
|
}
|
|
152
154
|
else if (outcome.executionAttempted === false) {
|
|
153
|
-
|
|
154
|
-
base = {
|
|
155
|
-
gate_message: `CodeRifts gate did not permit execution (verdict: ${kind}). `
|
|
156
|
-
+ 'No tool result was produced.',
|
|
157
|
-
};
|
|
155
|
+
base = { gate_message: (0, gate_refusal_js_1.formatGateRefusalBody)(outcome) };
|
|
158
156
|
}
|
|
159
157
|
else {
|
|
160
158
|
const err = 'error' in outcome ? outcome.error : undefined;
|
|
161
|
-
const kind = verdictKind(outcome);
|
|
159
|
+
const kind = (0, gate_refusal_js_1.verdictKind)(outcome);
|
|
162
160
|
base = {
|
|
163
|
-
gate_message: `Tool execution failed after gate decision (verdict: ${kind}): ${formatGuardError(err)}`,
|
|
161
|
+
gate_message: `Tool execution failed after gate decision (verdict: ${kind}): ${(0, gate_refusal_js_1.formatGuardError)(err)}`,
|
|
164
162
|
};
|
|
165
163
|
}
|
|
166
164
|
// Default ON (S4). attachProof:false skips proof fields.
|
|
@@ -175,21 +173,4 @@ function bindGeminiGuardOutcome(outcome, args) {
|
|
|
175
173
|
};
|
|
176
174
|
return part;
|
|
177
175
|
}
|
|
178
|
-
function verdictKind(outcome) {
|
|
179
|
-
return outcome.verdict && typeof outcome.verdict === 'object' && 'kind' in outcome.verdict
|
|
180
|
-
? String(outcome.verdict.kind)
|
|
181
|
-
: 'UNKNOWN';
|
|
182
|
-
}
|
|
183
|
-
function formatGuardError(err) {
|
|
184
|
-
if (err instanceof Error)
|
|
185
|
-
return err.message || err.name || 'Error';
|
|
186
|
-
if (typeof err === 'string')
|
|
187
|
-
return err;
|
|
188
|
-
try {
|
|
189
|
-
return JSON.stringify(err);
|
|
190
|
-
}
|
|
191
|
-
catch {
|
|
192
|
-
return String(err);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
176
|
//# sourceMappingURL=gemini.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini.js","sourceRoot":"","sources":["../../../src/adapters/gemini.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;
|
|
1
|
+
{"version":3,"file":"gemini.js","sourceRoot":"","sources":["../../../src/adapters/gemini.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;AAqFH,gFAgBC;AASD,sCAKC;AAYD,kDAGC;AAQD,8CAeC;AAwCD,4EAqBC;AASD,wDAoCC;AAjQD,4DAAqD;AAUrD,oEAAsE;AACtE,wDAI4B;AA0D5B,qFAAqF;AACrF,MAAM,gBAAgB,GAA4B,MAAM,CAAC,MAAM,CAAC;IAC9D,IAAI,EAAE,QAAQ;IACd,UAAU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,EAAE,CAAC;IAC/C,CAAC;SAAM,IAAI,OAAO,CAAC,kBAAkB,KAAK,KAAK,EAAE,CAAC;QAChD,IAAI,GAAG,EAAE,YAAY,EAAE,IAAA,uCAAqB,EAAC,OAAO,CAAC,EAAE,CAAC;IAC1D,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,GAAG,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QAC3D,MAAM,IAAI,GAAG,IAAA,6BAAW,EAAC,OAAO,CAAC,CAAC;QAClC,IAAI,GAAG;YACL,YAAY,EACV,uDAAuD,IAAI,MAAM,IAAA,kCAAgB,EAAC,GAAG,CAAC,EAAE;SAC3F,CAAC;IACJ,CAAC;IAED,yDAAyD;IACzD,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,KAAK,KAAK;QACtC,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,IAAA,kDAA0B,EAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAG/C,CAAC;IAEJ,MAAM,IAAI,GAA2B;QACnC,gBAAgB,EAAE;YAChB,IAAI;YACJ,QAAQ,EAAE,KAAK;SAChB;KACF,CAAC;IACF,OAAO,IAAwC,CAAC;AAClD,CAAC"}
|
|
@@ -13,10 +13,18 @@
|
|
|
13
13
|
* owns the framework import and wires descriptors into tool() / ToolNode /
|
|
14
14
|
* bind_tools / StateGraph themselves.
|
|
15
15
|
*
|
|
16
|
-
* Descriptor shape (dependency-free
|
|
17
|
-
* { name, description
|
|
16
|
+
* Descriptor shape (dependency-free, StructuredTool-compatible for createReactAgent):
|
|
17
|
+
* { name, description, schema, func, invoke, lc_runnable: true }
|
|
18
|
+
* Measured against @langchain/langgraph createReactAgent tools:
|
|
19
|
+
* ToolNode | (StructuredToolInterface | DynamicTool | RunnableToolLike)[]
|
|
20
|
+
* (@langchain/langgraph@0.2.74 d.ts; current npm 1.4.12). Runtime isRunnable
|
|
21
|
+
* requires lc_runnable === true; ToolNode drops non-matching tools and the
|
|
22
|
+
* model sees "Tool not found" — NEVER return that silent shape.
|
|
18
23
|
* - schema = JSON Schema from ProtectedTool.inputSchema (or empty object schema)
|
|
19
24
|
* - func / invoke = the GUARDED execute (same function reference) — never the raw tool
|
|
25
|
+
* - description always set (fallback to name) — StructuredToolInterface requires it
|
|
26
|
+
* NO hard @langchain/* dependency: duck-type the measured surface. If a tool would
|
|
27
|
+
* still fail that check, throw LangGraphToolsNotStructuredError (named, with the fix).
|
|
20
28
|
*
|
|
21
29
|
* Honesty (do not "upgrade" assurance):
|
|
22
30
|
* - composition_assurance is passed through EXACTLY as the core reported it
|
|
@@ -33,6 +41,7 @@
|
|
|
33
41
|
* Mirrors src/adapters/openai.ts and anthropic.ts — only the target tool shape differs.
|
|
34
42
|
*/
|
|
35
43
|
import type { WithCodeRiftsInput, WithCodeRiftsResult, CompositionAssurance, ReceiptThreadHandle } from '../with-coderifts.js';
|
|
44
|
+
import type { CoverageObservedHandle } from '../coverage-observed.js';
|
|
36
45
|
import type { ProtectedTool, RegistryCoverageReport } from '../tool-registry.js';
|
|
37
46
|
import type { GuardOutcome } from '../types.js';
|
|
38
47
|
/**
|
|
@@ -46,7 +55,8 @@ import type { GuardOutcome } from '../types.js';
|
|
|
46
55
|
*/
|
|
47
56
|
export type LangGraphToolDescriptor = {
|
|
48
57
|
name: string;
|
|
49
|
-
description
|
|
58
|
+
/** Always set (fallback to name). StructuredToolInterface requires description. */
|
|
59
|
+
description: string;
|
|
50
60
|
/** JSON Schema for tool args (LangChain `schema` / StructuredTool args). */
|
|
51
61
|
schema: Record<string, unknown>;
|
|
52
62
|
/**
|
|
@@ -56,10 +66,27 @@ export type LangGraphToolDescriptor = {
|
|
|
56
66
|
func: (args: unknown) => Promise<unknown>;
|
|
57
67
|
/**
|
|
58
68
|
* Alias of `func` for invoke-style APIs (StructuredTool.invoke / ToolNode).
|
|
59
|
-
* Same guarded execute reference as `func`.
|
|
69
|
+
* Same guarded execute reference as `func`. Runnable.invoke also accepts a config arg.
|
|
60
70
|
*/
|
|
61
|
-
invoke: (args: unknown) => Promise<unknown>;
|
|
71
|
+
invoke: (args: unknown, _config?: unknown) => Promise<unknown>;
|
|
72
|
+
/**
|
|
73
|
+
* Measured isRunnable / isStructuredTool check (@langchain/core).
|
|
74
|
+
* Without this, createReactAgent's ToolNode drops the tool → model-visible "Tool not found".
|
|
75
|
+
*/
|
|
76
|
+
lc_runnable: true;
|
|
62
77
|
};
|
|
78
|
+
/**
|
|
79
|
+
* Named error — thrown instead of returning tools createReactAgent would silently drop.
|
|
80
|
+
* Never a model-visible "Tool not found".
|
|
81
|
+
*/
|
|
82
|
+
export declare class LangGraphToolsNotStructuredError extends Error {
|
|
83
|
+
constructor(message?: string);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* True iff `t` matches the measured createReactAgent tool surface
|
|
87
|
+
* (StructuredToolInterface | DynamicTool | RunnableToolLike).
|
|
88
|
+
*/
|
|
89
|
+
export declare function isLangGraphReactAgentTool(t: unknown): t is LangGraphToolDescriptor;
|
|
63
90
|
/**
|
|
64
91
|
* Result of withCodeRiftsLangGraph — descriptors + core assurance, unflattened.
|
|
65
92
|
*
|
|
@@ -84,6 +111,8 @@ export type WithCodeRiftsLangGraphResult = {
|
|
|
84
111
|
composition_assurance: CompositionAssurance;
|
|
85
112
|
/** Per-composition receipt cursor — NOT product-truth chain evidence. */
|
|
86
113
|
receipt_thread: ReceiptThreadHandle;
|
|
114
|
+
/** Observed coverage for this withCodeRifts run. Half A always; Half B via reportToolDispatch. */
|
|
115
|
+
coverage_observed: CoverageObservedHandle;
|
|
87
116
|
repository?: string;
|
|
88
117
|
};
|
|
89
118
|
/**
|
|
@@ -97,11 +126,16 @@ export declare function protectedToolToLangGraph(tool: ProtectedTool): LangGraph
|
|
|
97
126
|
* Does NOT call the guard — pure map over an already-protected list.
|
|
98
127
|
*/
|
|
99
128
|
export declare function toLangGraphTools(protectedTools: readonly ProtectedTool[]): LangGraphToolDescriptor[];
|
|
129
|
+
/**
|
|
130
|
+
* Assert (and return) tools that createReactAgent can consume.
|
|
131
|
+
* Throws LangGraphToolsNotStructuredError — never a silent "Tool not found".
|
|
132
|
+
*/
|
|
133
|
+
export declare function bindLangGraphTools(tools: readonly unknown[]): LangGraphToolDescriptor[];
|
|
100
134
|
/**
|
|
101
135
|
* Build LangGraph/LangChain-ready guarded tool descriptors from raw tools + client + operation.
|
|
102
136
|
*
|
|
103
137
|
* Calls withCodeRifts internally (guard logic stays in the core). Returns:
|
|
104
|
-
* - `tools` —
|
|
138
|
+
* - `tools` — StructuredTool-compatible descriptors { name, description, schema, func, invoke, lc_runnable }
|
|
105
139
|
* - `protected_tools` — same guarded tools
|
|
106
140
|
* - assurance objects from the core, passed through untouched
|
|
107
141
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"langgraph.d.ts","sourceRoot":"","sources":["../../../src/adapters/langgraph.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"langgraph.d.ts","sourceRoot":"","sources":["../../../src/adapters/langgraph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAGH,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQhD;;;;;;;;GAQG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,mFAAmF;IACnF,WAAW,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,O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ED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,mBAAmB,GAAG,4BAA4B,CAe9F;AAID;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,OAAO,CAAC,MAAM,0BAA0B,EAAE,OAAO,MAAM,CAAC;AACxD,MAAM,MAAM,8BAA8B,GAAG,oBAAoB,GAAG;IAClE,QAAQ,CAAC,YAAY,EAAE,OAAO,0BAA0B,CAAC;CAC1D,CAAC;AAEF,MAAM,MAAM,6BAA6B,CAAC,CAAC,IAAI;IAC7C,iEAAiE;IACjE,YAAY,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,MAAM,CAAC;IAClC;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,wBAAgB,mCAAmC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAgBxE;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,EACzC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EACxB,IAAI,EAAE,6BAA6B,CAAC,CAAC,CAAC,GACrC,8BAA8B,CA2BhC"}
|
|
@@ -14,10 +14,18 @@
|
|
|
14
14
|
* owns the framework import and wires descriptors into tool() / ToolNode /
|
|
15
15
|
* bind_tools / StateGraph themselves.
|
|
16
16
|
*
|
|
17
|
-
* Descriptor shape (dependency-free
|
|
18
|
-
* { name, description
|
|
17
|
+
* Descriptor shape (dependency-free, StructuredTool-compatible for createReactAgent):
|
|
18
|
+
* { name, description, schema, func, invoke, lc_runnable: true }
|
|
19
|
+
* Measured against @langchain/langgraph createReactAgent tools:
|
|
20
|
+
* ToolNode | (StructuredToolInterface | DynamicTool | RunnableToolLike)[]
|
|
21
|
+
* (@langchain/langgraph@0.2.74 d.ts; current npm 1.4.12). Runtime isRunnable
|
|
22
|
+
* requires lc_runnable === true; ToolNode drops non-matching tools and the
|
|
23
|
+
* model sees "Tool not found" — NEVER return that silent shape.
|
|
19
24
|
* - schema = JSON Schema from ProtectedTool.inputSchema (or empty object schema)
|
|
20
25
|
* - func / invoke = the GUARDED execute (same function reference) — never the raw tool
|
|
26
|
+
* - description always set (fallback to name) — StructuredToolInterface requires it
|
|
27
|
+
* NO hard @langchain/* dependency: duck-type the measured surface. If a tool would
|
|
28
|
+
* still fail that check, throw LangGraphToolsNotStructuredError (named, with the fix).
|
|
21
29
|
*
|
|
22
30
|
* Honesty (do not "upgrade" assurance):
|
|
23
31
|
* - composition_assurance is passed through EXACTLY as the core reported it
|
|
@@ -34,14 +42,48 @@
|
|
|
34
42
|
* Mirrors src/adapters/openai.ts and anthropic.ts — only the target tool shape differs.
|
|
35
43
|
*/
|
|
36
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.LangGraphToolsNotStructuredError = void 0;
|
|
46
|
+
exports.isLangGraphReactAgentTool = isLangGraphReactAgentTool;
|
|
37
47
|
exports.protectedToolToLangGraph = protectedToolToLangGraph;
|
|
38
48
|
exports.toLangGraphTools = toLangGraphTools;
|
|
49
|
+
exports.bindLangGraphTools = bindLangGraphTools;
|
|
39
50
|
exports.withCodeRiftsLangGraph = withCodeRiftsLangGraph;
|
|
40
51
|
exports.langGraphToolAdapter = langGraphToolAdapter;
|
|
41
52
|
exports.defaultSerializeLangGraphToolResult = defaultSerializeLangGraphToolResult;
|
|
42
53
|
exports.bindLangGraphGuardOutcome = bindLangGraphGuardOutcome;
|
|
43
54
|
const with_coderifts_js_1 = require("../with-coderifts.js");
|
|
44
55
|
const final_answer_proof_js_1 = require("../final-answer-proof.js");
|
|
56
|
+
const gate_refusal_js_1 = require("../gate-refusal.js");
|
|
57
|
+
/**
|
|
58
|
+
* Named error — thrown instead of returning tools createReactAgent would silently drop.
|
|
59
|
+
* Never a model-visible "Tool not found".
|
|
60
|
+
*/
|
|
61
|
+
class LangGraphToolsNotStructuredError extends Error {
|
|
62
|
+
constructor(message) {
|
|
63
|
+
super(message
|
|
64
|
+
?? 'withCodeRiftsLangGraph() tools are not StructuredTool-compatible for createReactAgent. '
|
|
65
|
+
+ 'createReactAgent (@langchain/langgraph) requires StructuredToolInterface | DynamicTool | '
|
|
66
|
+
+ 'RunnableToolLike (name, description, schema, invoke, lc_runnable). '
|
|
67
|
+
+ 'Fix: wrap with tool() from @langchain/core/tools — see README (LangChain / LangGraph).');
|
|
68
|
+
this.name = 'LangGraphToolsNotStructuredError';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.LangGraphToolsNotStructuredError = LangGraphToolsNotStructuredError;
|
|
72
|
+
/**
|
|
73
|
+
* True iff `t` matches the measured createReactAgent tool surface
|
|
74
|
+
* (StructuredToolInterface | DynamicTool | RunnableToolLike).
|
|
75
|
+
*/
|
|
76
|
+
function isLangGraphReactAgentTool(t) {
|
|
77
|
+
if (!t || typeof t !== 'object')
|
|
78
|
+
return false;
|
|
79
|
+
const o = t;
|
|
80
|
+
return typeof o.name === 'string' && o.name.length > 0
|
|
81
|
+
&& typeof o.description === 'string'
|
|
82
|
+
&& o.schema != null && typeof o.schema === 'object' && !Array.isArray(o.schema)
|
|
83
|
+
&& typeof o.invoke === 'function'
|
|
84
|
+
&& typeof o.func === 'function'
|
|
85
|
+
&& o.lc_runnable === true;
|
|
86
|
+
}
|
|
45
87
|
/** Empty JSON Schema object — used when a ProtectedTool has no inputSchema. */
|
|
46
88
|
const EMPTY_SCHEMA = Object.freeze({
|
|
47
89
|
type: 'object',
|
|
@@ -59,15 +101,21 @@ function protectedToolToLangGraph(tool) {
|
|
|
59
101
|
? tool.inputSchema
|
|
60
102
|
: { ...EMPTY_SCHEMA };
|
|
61
103
|
// Guarded execute only — never a raw unwrapped executor.
|
|
62
|
-
const guarded = (args) => Promise.resolve(tool.execute(args));
|
|
104
|
+
const guarded = (args, _config) => Promise.resolve().then(() => tool.execute(args));
|
|
105
|
+
const description = tool.description != null && tool.description !== ''
|
|
106
|
+
? tool.description
|
|
107
|
+
: tool.name;
|
|
63
108
|
const out = {
|
|
64
109
|
name: tool.name,
|
|
110
|
+
description,
|
|
65
111
|
schema,
|
|
66
112
|
func: guarded,
|
|
67
113
|
invoke: guarded,
|
|
114
|
+
lc_runnable: true,
|
|
68
115
|
};
|
|
69
|
-
if (
|
|
70
|
-
|
|
116
|
+
if (!isLangGraphReactAgentTool(out)) {
|
|
117
|
+
throw new LangGraphToolsNotStructuredError(`protectedToolToLangGraph(${JSON.stringify(tool.name)}): tool is not createReactAgent-consumable. `
|
|
118
|
+
+ 'Fix: wrap with tool() from @langchain/core/tools — see README (LangChain / LangGraph).');
|
|
71
119
|
}
|
|
72
120
|
return out;
|
|
73
121
|
}
|
|
@@ -76,13 +124,29 @@ function protectedToolToLangGraph(tool) {
|
|
|
76
124
|
* Does NOT call the guard — pure map over an already-protected list.
|
|
77
125
|
*/
|
|
78
126
|
function toLangGraphTools(protectedTools) {
|
|
79
|
-
return protectedTools.map(protectedToolToLangGraph);
|
|
127
|
+
return bindLangGraphTools(protectedTools.map(protectedToolToLangGraph));
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Assert (and return) tools that createReactAgent can consume.
|
|
131
|
+
* Throws LangGraphToolsNotStructuredError — never a silent "Tool not found".
|
|
132
|
+
*/
|
|
133
|
+
function bindLangGraphTools(tools) {
|
|
134
|
+
const out = [];
|
|
135
|
+
for (const t of tools) {
|
|
136
|
+
if (!isLangGraphReactAgentTool(t)) {
|
|
137
|
+
const n = t && typeof t === 'object' && 'name' in t ? String(t.name) : '?';
|
|
138
|
+
throw new LangGraphToolsNotStructuredError(`bindLangGraphTools: ${JSON.stringify(n)} is not StructuredTool-compatible for createReactAgent. `
|
|
139
|
+
+ 'Fix: wrap with tool() from @langchain/core/tools — see README (LangChain / LangGraph).');
|
|
140
|
+
}
|
|
141
|
+
out.push(t);
|
|
142
|
+
}
|
|
143
|
+
return out;
|
|
80
144
|
}
|
|
81
145
|
/**
|
|
82
146
|
* Build LangGraph/LangChain-ready guarded tool descriptors from raw tools + client + operation.
|
|
83
147
|
*
|
|
84
148
|
* Calls withCodeRifts internally (guard logic stays in the core). Returns:
|
|
85
|
-
* - `tools` —
|
|
149
|
+
* - `tools` — StructuredTool-compatible descriptors { name, description, schema, func, invoke, lc_runnable }
|
|
86
150
|
* - `protected_tools` — same guarded tools
|
|
87
151
|
* - assurance objects from the core, passed through untouched
|
|
88
152
|
*
|
|
@@ -107,6 +171,7 @@ function langGraphToolAdapter(result) {
|
|
|
107
171
|
registry_report: result.registry_report,
|
|
108
172
|
composition_assurance: result.composition_assurance,
|
|
109
173
|
receipt_thread: result.receipt_thread,
|
|
174
|
+
coverage_observed: result.coverage_observed,
|
|
110
175
|
};
|
|
111
176
|
if (result.repository !== undefined) {
|
|
112
177
|
out.repository = result.repository;
|
|
@@ -142,16 +207,13 @@ function bindLangGraphGuardOutcome(outcome, args) {
|
|
|
142
207
|
body = serialize(outcome.result);
|
|
143
208
|
}
|
|
144
209
|
else if (outcome.executionAttempted === false) {
|
|
145
|
-
|
|
146
|
-
body =
|
|
147
|
-
`CodeRifts gate did not permit execution (verdict: ${kind}). `
|
|
148
|
-
+ 'No tool result was produced.';
|
|
210
|
+
body = (0, gate_refusal_js_1.formatGateRefusalBody)(outcome);
|
|
149
211
|
}
|
|
150
212
|
else {
|
|
151
213
|
const err = 'error' in outcome ? outcome.error : undefined;
|
|
152
|
-
const kind = verdictKind(outcome);
|
|
214
|
+
const kind = (0, gate_refusal_js_1.verdictKind)(outcome);
|
|
153
215
|
body =
|
|
154
|
-
`Tool execution failed after gate decision (verdict: ${kind}): ${formatGuardError(err)}`;
|
|
216
|
+
`Tool execution failed after gate decision (verdict: ${kind}): ${(0, gate_refusal_js_1.formatGuardError)(err)}`;
|
|
155
217
|
}
|
|
156
218
|
const content = args.attachProof === false
|
|
157
219
|
? body
|
|
@@ -165,21 +227,4 @@ function bindLangGraphGuardOutcome(outcome, args) {
|
|
|
165
227
|
}
|
|
166
228
|
return msg;
|
|
167
229
|
}
|
|
168
|
-
function verdictKind(outcome) {
|
|
169
|
-
return outcome.verdict && typeof outcome.verdict === 'object' && 'kind' in outcome.verdict
|
|
170
|
-
? String(outcome.verdict.kind)
|
|
171
|
-
: 'UNKNOWN';
|
|
172
|
-
}
|
|
173
|
-
function formatGuardError(err) {
|
|
174
|
-
if (err instanceof Error)
|
|
175
|
-
return err.message || err.name || 'Error';
|
|
176
|
-
if (typeof err === 'string')
|
|
177
|
-
return err;
|
|
178
|
-
try {
|
|
179
|
-
return JSON.stringify(err);
|
|
180
|
-
}
|
|
181
|
-
catch {
|
|
182
|
-
return String(err);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
230
|
//# sourceMappingURL=langgraph.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"langgraph.js","sourceRoot":"","sources":["../../../src/adapters/langgraph.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"langgraph.js","sourceRoot":"","sources":["../../../src/adapters/langgraph.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;;;AAwEH,8DASC;AA0CD,4DA+BC;AAMD,4CAEC;AAMD,gDAeC;AAYD,wDAGC;AAQD,oDAeC;AAiCD,kFAgBC;AAMD,8DA8BC;AAhTD,4DAAqD;AAUrD,oEAAsE;AACtE,wDAI4B;AAkC5B;;;GAGG;AACH,MAAa,gCAAiC,SAAQ,KAAK;IACzD,YAAY,OAAgB;QAC1B,KAAK,CACH,OAAO;eACJ,yFAAyF;kBACxF,2FAA2F;kBAC3F,qEAAqE;kBACrE,wFAAwF,CAC7F,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,kCAAkC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
import type { WithCodeRiftsInput, WithCodeRiftsResult, CompositionAssurance, ReceiptThreadHandle } from '../with-coderifts.js';
|
|
25
|
+
import type { CoverageObservedHandle } from '../coverage-observed.js';
|
|
25
26
|
import type { ProtectedTool, RegistryCoverageReport } from '../tool-registry.js';
|
|
26
27
|
import type { GuardOutcome } from '../types.js';
|
|
27
28
|
/**
|
|
@@ -61,6 +62,8 @@ export type WithCodeRiftsOpenAIResult = {
|
|
|
61
62
|
composition_assurance: CompositionAssurance;
|
|
62
63
|
/** Per-composition receipt cursor — NOT product-truth chain evidence. */
|
|
63
64
|
receipt_thread: ReceiptThreadHandle;
|
|
65
|
+
/** Observed coverage for this withCodeRifts run. Half A always; Half B via reportToolDispatch. */
|
|
66
|
+
coverage_observed: CoverageObservedHandle;
|
|
64
67
|
repository?: string;
|
|
65
68
|
};
|
|
66
69
|
/**
|