@coderifts/agent-guard 4.2.0 → 4.3.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 +162 -35
- package/dist/cjs/adapters/anthropic.d.ts +90 -0
- package/dist/cjs/adapters/anthropic.d.ts.map +1 -0
- package/dist/cjs/adapters/anthropic.js +97 -0
- package/dist/cjs/adapters/anthropic.js.map +1 -0
- package/dist/cjs/adapters/gemini.d.ts +114 -0
- package/dist/cjs/adapters/gemini.d.ts.map +1 -0
- package/dist/cjs/adapters/gemini.js +110 -0
- package/dist/cjs/adapters/gemini.js.map +1 -0
- package/dist/cjs/adapters/langgraph.d.ts +117 -0
- package/dist/cjs/adapters/langgraph.d.ts.map +1 -0
- package/dist/cjs/adapters/langgraph.js +113 -0
- package/dist/cjs/adapters/langgraph.js.map +1 -0
- package/dist/cjs/adapters/openai.d.ts +93 -0
- package/dist/cjs/adapters/openai.d.ts.map +1 -0
- package/dist/cjs/adapters/openai.js +97 -0
- package/dist/cjs/adapters/openai.js.map +1 -0
- package/dist/cjs/index.d.ts +8 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +26 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/adapters/anthropic.d.ts +90 -0
- package/dist/esm/adapters/anthropic.d.ts.map +1 -0
- package/dist/esm/adapters/anthropic.js +91 -0
- package/dist/esm/adapters/anthropic.js.map +1 -0
- package/dist/esm/adapters/gemini.d.ts +114 -0
- package/dist/esm/adapters/gemini.d.ts.map +1 -0
- package/dist/esm/adapters/gemini.js +104 -0
- package/dist/esm/adapters/gemini.js.map +1 -0
- package/dist/esm/adapters/langgraph.d.ts +117 -0
- package/dist/esm/adapters/langgraph.d.ts.map +1 -0
- package/dist/esm/adapters/langgraph.js +107 -0
- package/dist/esm/adapters/langgraph.js.map +1 -0
- package/dist/esm/adapters/openai.d.ts +93 -0
- package/dist/esm/adapters/openai.d.ts.map +1 -0
- package/dist/esm/adapters/openai.js +91 -0
- package/dist/esm/adapters/openai.js.map +1 -0
- package/dist/esm/index.d.ts +8 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +9 -0
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Google Gemini function-calling adapter over withCodeRifts (ID632 slice 4 —
|
|
4
|
+
* same thin pattern as OpenAI / Anthropic / LangGraph).
|
|
5
|
+
*
|
|
6
|
+
* Thin SHAPE converter only. Guard logic stays in withCodeRifts; this module:
|
|
7
|
+
* 1. calls withCodeRifts with the same input shape,
|
|
8
|
+
* 2. maps ProtectedTool[] → Gemini generateContent tools shape,
|
|
9
|
+
* 3. returns Gemini-shaped tools PLUS the untouched assurance objects
|
|
10
|
+
* (registry_report, composition_assurance, receipt_thread).
|
|
11
|
+
*
|
|
12
|
+
* Gemini nesting (differs from OpenAI):
|
|
13
|
+
* tools: [ { functionDeclarations: [ { name, description?, parameters }, … ] } ]
|
|
14
|
+
* One tools entry wraps ALL declarations in a single functionDeclarations array —
|
|
15
|
+
* not one { type: 'function' } object per tool.
|
|
16
|
+
*
|
|
17
|
+
* Honesty (do not "upgrade" assurance):
|
|
18
|
+
* - composition_assurance is passed through EXACTLY as the core reported it
|
|
19
|
+
* (COMPOSITION_CALL_POLICY_COMPLETE may still be false; inescapable_runtime may be false).
|
|
20
|
+
* - The adapter converts tool SHAPE for the model API; it does not claim product-level
|
|
21
|
+
* inescapability the core does not claim.
|
|
22
|
+
*
|
|
23
|
+
* Only-protected-tools (6/D at the adapter surface):
|
|
24
|
+
* - `tools` is derived ONLY from the frozen registry's ProtectedTool list.
|
|
25
|
+
* - Raw tools never appear in the returned Gemini table. The host may still hold a raw
|
|
26
|
+
* reference outside this table; that boundary stays the host's responsibility.
|
|
27
|
+
*
|
|
28
|
+
* Ergonomics (5–10 lines): pass raw tools + client + operation → Gemini-ready tools.
|
|
29
|
+
* Mirrors src/adapters/openai.ts — only the target tool shape differs.
|
|
30
|
+
*/
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.protectedToolToFunctionDeclaration = protectedToolToFunctionDeclaration;
|
|
33
|
+
exports.toGeminiTools = toGeminiTools;
|
|
34
|
+
exports.withCodeRiftsGemini = withCodeRiftsGemini;
|
|
35
|
+
exports.geminiToolAdapter = geminiToolAdapter;
|
|
36
|
+
const with_coderifts_js_1 = require("../with-coderifts.js");
|
|
37
|
+
/** Empty OpenAPI-like JSON Schema — used when a ProtectedTool has no inputSchema. */
|
|
38
|
+
const EMPTY_PARAMETERS = Object.freeze({
|
|
39
|
+
type: 'object',
|
|
40
|
+
properties: {},
|
|
41
|
+
});
|
|
42
|
+
/**
|
|
43
|
+
* Map one ProtectedTool → Gemini functionDeclaration (shape only; no execute).
|
|
44
|
+
* Prefer tool.inputSchema when it is a plain object; otherwise empty object schema.
|
|
45
|
+
*/
|
|
46
|
+
function protectedToolToFunctionDeclaration(tool) {
|
|
47
|
+
const parameters = tool.inputSchema != null
|
|
48
|
+
&& typeof tool.inputSchema === 'object'
|
|
49
|
+
&& !Array.isArray(tool.inputSchema)
|
|
50
|
+
? tool.inputSchema
|
|
51
|
+
: { ...EMPTY_PARAMETERS };
|
|
52
|
+
const out = {
|
|
53
|
+
name: tool.name,
|
|
54
|
+
parameters,
|
|
55
|
+
};
|
|
56
|
+
if (tool.description != null && tool.description !== '') {
|
|
57
|
+
out.description = tool.description;
|
|
58
|
+
}
|
|
59
|
+
return out;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Convert ProtectedTool[] into Gemini `tools` array:
|
|
63
|
+
* [ { functionDeclarations: [ … ] } ]
|
|
64
|
+
*
|
|
65
|
+
* Empty protected list → empty tools array (no empty wrapper).
|
|
66
|
+
* Does NOT call the guard — pure shape map over an already-protected list.
|
|
67
|
+
*/
|
|
68
|
+
function toGeminiTools(protectedTools) {
|
|
69
|
+
if (protectedTools.length === 0)
|
|
70
|
+
return [];
|
|
71
|
+
return [{
|
|
72
|
+
functionDeclarations: protectedTools.map(protectedToolToFunctionDeclaration),
|
|
73
|
+
}];
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Build Gemini-ready guarded tools from raw tools + client + operation.
|
|
77
|
+
*
|
|
78
|
+
* Calls withCodeRifts internally (guard logic stays in the core). Returns:
|
|
79
|
+
* - `tools` — Gemini shape [ { functionDeclarations: […] } ]
|
|
80
|
+
* - `protected_tools` — same guarded tools for host execute dispatch
|
|
81
|
+
* - assurance objects from the core, passed through untouched
|
|
82
|
+
*
|
|
83
|
+
* @param input Same shape as withCodeRifts (WithCodeRiftsInput).
|
|
84
|
+
*/
|
|
85
|
+
function withCodeRiftsGemini(input) {
|
|
86
|
+
const core = (0, with_coderifts_js_1.withCodeRifts)(input);
|
|
87
|
+
return geminiToolAdapter(core);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Shape-only adapter over an existing WithCodeRiftsResult (composition style).
|
|
91
|
+
* Prefer withCodeRiftsGemini when starting from raw tools.
|
|
92
|
+
*
|
|
93
|
+
* Does not re-run the guard; does not invent assurance.
|
|
94
|
+
*/
|
|
95
|
+
function geminiToolAdapter(result) {
|
|
96
|
+
const protected_tools = result.tools;
|
|
97
|
+
const tools = toGeminiTools(protected_tools);
|
|
98
|
+
const out = {
|
|
99
|
+
tools,
|
|
100
|
+
protected_tools,
|
|
101
|
+
registry_report: result.registry_report,
|
|
102
|
+
composition_assurance: result.composition_assurance,
|
|
103
|
+
receipt_thread: result.receipt_thread,
|
|
104
|
+
};
|
|
105
|
+
if (result.repository !== undefined) {
|
|
106
|
+
out.repository = result.repository;
|
|
107
|
+
}
|
|
108
|
+
return out;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=gemini.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gemini.js","sourceRoot":"","sources":["../../../src/adapters/g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C;AAED;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,MAA2B;IAC3D,MAAM,eAAe,GAAG,MAAM,CAAC,KAAK,CAAC;IACrC,MAAM,KAAK,GAAG,aAAa,CAAC,eAAe,CAAC,CAAC;IAC7C,MAAM,GAAG,GAA8B;QACrC,KAAK;QACL,eAAe;QACf,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,qBAAqB,EAAE,MAAM,CAAC,qBAAqB;QACnD,cAAc,EAAE,MAAM,CAAC,cAAc;KACtC,CAAC;IACF,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACpC,GAAG,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IACrC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LangChain / LangGraph tool adapter over withCodeRifts (ID632 slice 3 — same thin
|
|
3
|
+
* pattern as OpenAI / Anthropic).
|
|
4
|
+
*
|
|
5
|
+
* Thin converter only. Guard logic stays in withCodeRifts; this module:
|
|
6
|
+
* 1. calls withCodeRifts with the same input shape,
|
|
7
|
+
* 2. maps each ProtectedTool → a framework-agnostic tool descriptor that
|
|
8
|
+
* LangChain's tool()/StructuredTool and LangGraph's ToolNode can accept,
|
|
9
|
+
* 3. returns those descriptors PLUS the untouched assurance objects
|
|
10
|
+
* (registry_report, composition_assurance, receipt_thread).
|
|
11
|
+
*
|
|
12
|
+
* NO hard dependency on langchain / @langchain/* / langgraph packages. The host
|
|
13
|
+
* owns the framework import and wires descriptors into tool() / ToolNode /
|
|
14
|
+
* bind_tools / StateGraph themselves.
|
|
15
|
+
*
|
|
16
|
+
* Descriptor shape (dependency-free plain object):
|
|
17
|
+
* { name, description?, schema, func, invoke }
|
|
18
|
+
* - schema = JSON Schema from ProtectedTool.inputSchema (or empty object schema)
|
|
19
|
+
* - func / invoke = the GUARDED execute (same function reference) — never the raw tool
|
|
20
|
+
*
|
|
21
|
+
* Honesty (do not "upgrade" assurance):
|
|
22
|
+
* - composition_assurance is passed through EXACTLY as the core reported it
|
|
23
|
+
* (COMPOSITION_CALL_POLICY_COMPLETE may still be false; inescapable_runtime may be false).
|
|
24
|
+
* - The adapter converts tool shape + binds guarded execute; it does not claim product-level
|
|
25
|
+
* inescapability the core does not claim.
|
|
26
|
+
*
|
|
27
|
+
* Only-protected-tools (6/D at the adapter surface):
|
|
28
|
+
* - `tools` is derived ONLY from the frozen registry's ProtectedTool list.
|
|
29
|
+
* - Raw tools never appear in the returned table. The host may still hold a raw
|
|
30
|
+
* reference outside this table; that boundary stays the host's responsibility.
|
|
31
|
+
*
|
|
32
|
+
* Ergonomics (5–10 lines): pass raw tools + client + operation → LangGraph-ready descriptors.
|
|
33
|
+
* Mirrors src/adapters/openai.ts and anthropic.ts — only the target tool shape differs.
|
|
34
|
+
*/
|
|
35
|
+
import type { WithCodeRiftsInput, WithCodeRiftsResult, CompositionAssurance, ReceiptThreadHandle } from '../with-coderifts.js';
|
|
36
|
+
import type { ProtectedTool, RegistryCoverageReport } from '../tool-registry.js';
|
|
37
|
+
/**
|
|
38
|
+
* Framework-agnostic LangChain/LangGraph tool descriptor (no package import).
|
|
39
|
+
*
|
|
40
|
+
* Host wiring (illustrative — host supplies the framework packages, e.g.
|
|
41
|
+
* @langchain/core tools + @langchain/langgraph ToolNode):
|
|
42
|
+
* const lcTools = tools.map((d) =>
|
|
43
|
+
* hostTool(d.func, { name: d.name, description: d.description, schema: d.schema }));
|
|
44
|
+
* // then hostToolNode(lcTools) / hostLlm.bindTools(lcTools)
|
|
45
|
+
*/
|
|
46
|
+
export type LangGraphToolDescriptor = {
|
|
47
|
+
name: string;
|
|
48
|
+
description?: string;
|
|
49
|
+
/** JSON Schema for tool args (LangChain `schema` / StructuredTool args). */
|
|
50
|
+
schema: Record<string, unknown>;
|
|
51
|
+
/**
|
|
52
|
+
* Guarded execute — same as ProtectedTool.execute.
|
|
53
|
+
* Pass to LangChain `tool(func, …)` or StructuredTool-style runners.
|
|
54
|
+
*/
|
|
55
|
+
func: (args: unknown) => Promise<unknown>;
|
|
56
|
+
/**
|
|
57
|
+
* Alias of `func` for invoke-style APIs (StructuredTool.invoke / ToolNode).
|
|
58
|
+
* Same guarded execute reference as `func`.
|
|
59
|
+
*/
|
|
60
|
+
invoke: (args: unknown) => Promise<unknown>;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Result of withCodeRiftsLangGraph — descriptors + core assurance, unflattened.
|
|
64
|
+
*
|
|
65
|
+
* `tools` is the ONLY list intended for the model/runtime tool table. `protected_tools` is the
|
|
66
|
+
* same guarded list for host inspection — never the raw tools.
|
|
67
|
+
*/
|
|
68
|
+
export type WithCodeRiftsLangGraphResult = {
|
|
69
|
+
/** LangGraph/LangChain-compatible descriptors — only protected/guarded tools. */
|
|
70
|
+
tools: LangGraphToolDescriptor[];
|
|
71
|
+
/**
|
|
72
|
+
* Guarded ProtectedTool list from withCodeRifts (same tools as `tools`).
|
|
73
|
+
* Host may use these for dispatch; never raw tools.
|
|
74
|
+
*/
|
|
75
|
+
protected_tools: ProtectedTool[];
|
|
76
|
+
/** Untouched registry report — registry's own truth. */
|
|
77
|
+
registry_report: RegistryCoverageReport;
|
|
78
|
+
/**
|
|
79
|
+
* Product-level assurance — deliberately narrower than the registry.
|
|
80
|
+
* Passed through untouched; may still show inescapable_runtime:false and
|
|
81
|
+
* residual composition_call_policy_incomplete.
|
|
82
|
+
*/
|
|
83
|
+
composition_assurance: CompositionAssurance;
|
|
84
|
+
/** Per-composition receipt cursor — NOT product-truth chain evidence. */
|
|
85
|
+
receipt_thread: ReceiptThreadHandle;
|
|
86
|
+
repository?: string;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Map one ProtectedTool → LangGraph/LangChain tool descriptor.
|
|
90
|
+
* Binds guarded execute to both `func` and `invoke` (same reference).
|
|
91
|
+
* Prefer tool.inputSchema when it is a plain object; otherwise empty object schema.
|
|
92
|
+
*/
|
|
93
|
+
export declare function protectedToolToLangGraph(tool: ProtectedTool): LangGraphToolDescriptor;
|
|
94
|
+
/**
|
|
95
|
+
* Convert a list of ProtectedTool into LangGraph/LangChain descriptors.
|
|
96
|
+
* Does NOT call the guard — pure map over an already-protected list.
|
|
97
|
+
*/
|
|
98
|
+
export declare function toLangGraphTools(protectedTools: readonly ProtectedTool[]): LangGraphToolDescriptor[];
|
|
99
|
+
/**
|
|
100
|
+
* Build LangGraph/LangChain-ready guarded tool descriptors from raw tools + client + operation.
|
|
101
|
+
*
|
|
102
|
+
* Calls withCodeRifts internally (guard logic stays in the core). Returns:
|
|
103
|
+
* - `tools` — plain descriptors { name, description?, schema, func, invoke }
|
|
104
|
+
* - `protected_tools` — same guarded tools
|
|
105
|
+
* - assurance objects from the core, passed through untouched
|
|
106
|
+
*
|
|
107
|
+
* @param input Same shape as withCodeRifts (WithCodeRiftsInput).
|
|
108
|
+
*/
|
|
109
|
+
export declare function withCodeRiftsLangGraph(input: WithCodeRiftsInput): WithCodeRiftsLangGraphResult;
|
|
110
|
+
/**
|
|
111
|
+
* Shape adapter over an existing WithCodeRiftsResult (composition style).
|
|
112
|
+
* Prefer withCodeRiftsLangGraph when starting from raw tools.
|
|
113
|
+
*
|
|
114
|
+
* Does not re-run the guard; does not invent assurance.
|
|
115
|
+
*/
|
|
116
|
+
export declare function langGraphToolAdapter(result: WithCodeRiftsResult): WithCodeRiftsLangGraphResult;
|
|
117
|
+
//# sourceMappingURL=langgraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"langgraph.d.ts","sourceRoot":"","sources":["../../../src/adapters/langgraph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAGH,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,a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over withCodeRifts (ID632 slice 3 — same thin
|
|
4
|
+
* pattern as OpenAI / Anthropic).
|
|
5
|
+
*
|
|
6
|
+
* Thin converter only. Guard logic stays in withCodeRifts; this module:
|
|
7
|
+
* 1. calls withCodeRifts with the same input shape,
|
|
8
|
+
* 2. maps each ProtectedTool → a framework-agnostic tool descriptor that
|
|
9
|
+
* LangChain's tool()/StructuredTool and LangGraph's ToolNode can accept,
|
|
10
|
+
* 3. returns those descriptors PLUS the untouched assurance objects
|
|
11
|
+
* (registry_report, composition_assurance, receipt_thread).
|
|
12
|
+
*
|
|
13
|
+
* NO hard dependency on langchain / @langchain/* / langgraph packages. The host
|
|
14
|
+
* owns the framework import and wires descriptors into tool() / ToolNode /
|
|
15
|
+
* bind_tools / StateGraph themselves.
|
|
16
|
+
*
|
|
17
|
+
* Descriptor shape (dependency-free plain object):
|
|
18
|
+
* { name, description?, schema, func, invoke }
|
|
19
|
+
* - schema = JSON Schema from ProtectedTool.inputSchema (or empty object schema)
|
|
20
|
+
* - func / invoke = the GUARDED execute (same function reference) — never the raw tool
|
|
21
|
+
*
|
|
22
|
+
* Honesty (do not "upgrade" assurance):
|
|
23
|
+
* - composition_assurance is passed through EXACTLY as the core reported it
|
|
24
|
+
* (COMPOSITION_CALL_POLICY_COMPLETE may still be false; inescapable_runtime may be false).
|
|
25
|
+
* - The adapter converts tool shape + binds guarded execute; it does not claim product-level
|
|
26
|
+
* inescapability the core does not claim.
|
|
27
|
+
*
|
|
28
|
+
* Only-protected-tools (6/D at the adapter surface):
|
|
29
|
+
* - `tools` is derived ONLY from the frozen registry's ProtectedTool list.
|
|
30
|
+
* - Raw tools never appear in the returned table. The host may still hold a raw
|
|
31
|
+
* reference outside this table; that boundary stays the host's responsibility.
|
|
32
|
+
*
|
|
33
|
+
* Ergonomics (5–10 lines): pass raw tools + client + operation → LangGraph-ready descriptors.
|
|
34
|
+
* Mirrors src/adapters/openai.ts and anthropic.ts — only the target tool shape differs.
|
|
35
|
+
*/
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.protectedToolToLangGraph = protectedToolToLangGraph;
|
|
38
|
+
exports.toLangGraphTools = toLangGraphTools;
|
|
39
|
+
exports.withCodeRiftsLangGraph = withCodeRiftsLangGraph;
|
|
40
|
+
exports.langGraphToolAdapter = langGraphToolAdapter;
|
|
41
|
+
const with_coderifts_js_1 = require("../with-coderifts.js");
|
|
42
|
+
/** Empty JSON Schema object — used when a ProtectedTool has no inputSchema. */
|
|
43
|
+
const EMPTY_SCHEMA = Object.freeze({
|
|
44
|
+
type: 'object',
|
|
45
|
+
properties: {},
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* Map one ProtectedTool → LangGraph/LangChain tool descriptor.
|
|
49
|
+
* Binds guarded execute to both `func` and `invoke` (same reference).
|
|
50
|
+
* Prefer tool.inputSchema when it is a plain object; otherwise empty object schema.
|
|
51
|
+
*/
|
|
52
|
+
function protectedToolToLangGraph(tool) {
|
|
53
|
+
const schema = tool.inputSchema != null
|
|
54
|
+
&& typeof tool.inputSchema === 'object'
|
|
55
|
+
&& !Array.isArray(tool.inputSchema)
|
|
56
|
+
? tool.inputSchema
|
|
57
|
+
: { ...EMPTY_SCHEMA };
|
|
58
|
+
// Guarded execute only — never a raw unwrapped executor.
|
|
59
|
+
const guarded = (args) => Promise.resolve(tool.execute(args));
|
|
60
|
+
const out = {
|
|
61
|
+
name: tool.name,
|
|
62
|
+
schema,
|
|
63
|
+
func: guarded,
|
|
64
|
+
invoke: guarded,
|
|
65
|
+
};
|
|
66
|
+
if (tool.description != null && tool.description !== '') {
|
|
67
|
+
out.description = tool.description;
|
|
68
|
+
}
|
|
69
|
+
return out;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Convert a list of ProtectedTool into LangGraph/LangChain descriptors.
|
|
73
|
+
* Does NOT call the guard — pure map over an already-protected list.
|
|
74
|
+
*/
|
|
75
|
+
function toLangGraphTools(protectedTools) {
|
|
76
|
+
return protectedTools.map(protectedToolToLangGraph);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Build LangGraph/LangChain-ready guarded tool descriptors from raw tools + client + operation.
|
|
80
|
+
*
|
|
81
|
+
* Calls withCodeRifts internally (guard logic stays in the core). Returns:
|
|
82
|
+
* - `tools` — plain descriptors { name, description?, schema, func, invoke }
|
|
83
|
+
* - `protected_tools` — same guarded tools
|
|
84
|
+
* - assurance objects from the core, passed through untouched
|
|
85
|
+
*
|
|
86
|
+
* @param input Same shape as withCodeRifts (WithCodeRiftsInput).
|
|
87
|
+
*/
|
|
88
|
+
function withCodeRiftsLangGraph(input) {
|
|
89
|
+
const core = (0, with_coderifts_js_1.withCodeRifts)(input);
|
|
90
|
+
return langGraphToolAdapter(core);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Shape adapter over an existing WithCodeRiftsResult (composition style).
|
|
94
|
+
* Prefer withCodeRiftsLangGraph when starting from raw tools.
|
|
95
|
+
*
|
|
96
|
+
* Does not re-run the guard; does not invent assurance.
|
|
97
|
+
*/
|
|
98
|
+
function langGraphToolAdapter(result) {
|
|
99
|
+
const protected_tools = result.tools;
|
|
100
|
+
const tools = toLangGraphTools(protected_tools);
|
|
101
|
+
const out = {
|
|
102
|
+
tools,
|
|
103
|
+
protected_tools,
|
|
104
|
+
registry_report: result.registry_report,
|
|
105
|
+
composition_assurance: result.composition_assurance,
|
|
106
|
+
receipt_thread: result.receipt_thread,
|
|
107
|
+
};
|
|
108
|
+
if (result.repository !== undefined) {
|
|
109
|
+
out.repository = result.repository;
|
|
110
|
+
}
|
|
111
|
+
return out;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=langgraph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"langgraph.js","sourceRoot":"","sources":["../../../src/adapters/langgraph.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;;AA2EH,4DAq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AAC;AAED;;;;;GAKG;AACH,SAAgB,oBAAoB,CAAC,MAA2B;IAC9D,MAAM,eAAe,GAAG,MAAM,CAAC,KAAK,CAAC;IACrC,MAAM,KAAK,GAAG,gBAAgB,CAAC,eAAe,CAAC,CAAC;IAChD,MAAM,GAAG,GAAiC;QACxC,KAAK;QACL,eAAe;QACf,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,qBAAqB,EAAE,MAAM,CAAC,qBAAqB;QACnD,cAAc,EAAE,MAAM,CAAC,cAAc;KACtC,CAAC;IACF,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACpC,GAAG,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IACrC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAI tool-calling adapter over withCodeRifts (ID632 slice 1 — reference adapter).
|
|
3
|
+
*
|
|
4
|
+
* Thin SHAPE converter only. Guard logic stays in withCodeRifts; this module:
|
|
5
|
+
* 1. calls withCodeRifts with the same input shape,
|
|
6
|
+
* 2. maps each ProtectedTool → OpenAI chat.completions tool definition,
|
|
7
|
+
* 3. returns OpenAI-shaped tools PLUS the untouched assurance objects
|
|
8
|
+
* (registry_report, composition_assurance, receipt_thread).
|
|
9
|
+
*
|
|
10
|
+
* Honesty (do not "upgrade" assurance):
|
|
11
|
+
* - composition_assurance is passed through EXACTLY as the core reported it
|
|
12
|
+
* (COMPOSITION_CALL_POLICY_COMPLETE may still be false; inescapable_runtime may be false).
|
|
13
|
+
* - The adapter converts tool SHAPE for the model API; it does not claim product-level
|
|
14
|
+
* inescapability the core does not claim.
|
|
15
|
+
*
|
|
16
|
+
* Only-protected-tools (6/D at the adapter surface):
|
|
17
|
+
* - `tools` is derived ONLY from the frozen registry's ProtectedTool list.
|
|
18
|
+
* - Raw tools never appear in the returned OpenAI table. The host may still hold a raw
|
|
19
|
+
* reference outside this table; that boundary stays the host's responsibility.
|
|
20
|
+
*
|
|
21
|
+
* Ergonomics (5–10 lines): pass raw tools + client + operation → OpenAI-ready guarded tools.
|
|
22
|
+
* LangGraph / Anthropic adapters follow the same thin-converter pattern later.
|
|
23
|
+
*/
|
|
24
|
+
import type { WithCodeRiftsInput, WithCodeRiftsResult, CompositionAssurance, ReceiptThreadHandle } from '../with-coderifts.js';
|
|
25
|
+
import type { ProtectedTool, RegistryCoverageReport } from '../tool-registry.js';
|
|
26
|
+
/**
|
|
27
|
+
* OpenAI chat.completions `tools[]` element (function tool).
|
|
28
|
+
* @see https://platform.openai.com/docs/guides/function-calling
|
|
29
|
+
*/
|
|
30
|
+
export type OpenAIFunctionTool = {
|
|
31
|
+
type: 'function';
|
|
32
|
+
function: {
|
|
33
|
+
name: string;
|
|
34
|
+
description?: string;
|
|
35
|
+
/** JSON Schema object for the function arguments (OpenAI `parameters`). */
|
|
36
|
+
parameters: Record<string, unknown>;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Result of withCodeRiftsOpenAI — OpenAI tool definitions + core assurance, unflattened.
|
|
41
|
+
*
|
|
42
|
+
* `tools` is the ONLY list intended for the model/runtime tool table. `protected_tools` is the
|
|
43
|
+
* same guarded list (with execute) for host dispatch after tool_calls — never the raw tools.
|
|
44
|
+
*/
|
|
45
|
+
export type WithCodeRiftsOpenAIResult = {
|
|
46
|
+
/** OpenAI-shaped tools for chat.completions — only protected/guarded tools. */
|
|
47
|
+
tools: OpenAIFunctionTool[];
|
|
48
|
+
/**
|
|
49
|
+
* Guarded ProtectedTool list from withCodeRifts (same tools as `tools`, with execute).
|
|
50
|
+
* Host dispatches model tool_calls through these only. Never raw tools.
|
|
51
|
+
*/
|
|
52
|
+
protected_tools: ProtectedTool[];
|
|
53
|
+
/** Untouched registry report — registry's own truth. */
|
|
54
|
+
registry_report: RegistryCoverageReport;
|
|
55
|
+
/**
|
|
56
|
+
* Product-level assurance — deliberately narrower than the registry.
|
|
57
|
+
* Passed through untouched; may still show inescapable_runtime:false and
|
|
58
|
+
* residual composition_call_policy_incomplete.
|
|
59
|
+
*/
|
|
60
|
+
composition_assurance: CompositionAssurance;
|
|
61
|
+
/** Per-composition receipt cursor — NOT product-truth chain evidence. */
|
|
62
|
+
receipt_thread: ReceiptThreadHandle;
|
|
63
|
+
repository?: string;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Map one ProtectedTool → OpenAI function tool definition (shape only; no execute).
|
|
67
|
+
* Prefer tool.inputSchema when it is a plain object; otherwise empty object schema.
|
|
68
|
+
*/
|
|
69
|
+
export declare function protectedToolToOpenAI(tool: ProtectedTool): OpenAIFunctionTool;
|
|
70
|
+
/**
|
|
71
|
+
* Convert a list of ProtectedTool into OpenAI tool definitions.
|
|
72
|
+
* Does NOT call the guard — pure shape map over an already-protected list.
|
|
73
|
+
*/
|
|
74
|
+
export declare function toOpenAITools(protectedTools: readonly ProtectedTool[]): OpenAIFunctionTool[];
|
|
75
|
+
/**
|
|
76
|
+
* Build OpenAI-ready guarded tools from raw tools + client + operation.
|
|
77
|
+
*
|
|
78
|
+
* Calls withCodeRifts internally (guard logic stays in the core). Returns:
|
|
79
|
+
* - `tools` — OpenAI chat.completions shape (function tools only)
|
|
80
|
+
* - `protected_tools` — same guarded tools for host execute dispatch
|
|
81
|
+
* - assurance objects from the core, passed through untouched
|
|
82
|
+
*
|
|
83
|
+
* @param input Same shape as withCodeRifts (WithCodeRiftsInput).
|
|
84
|
+
*/
|
|
85
|
+
export declare function withCodeRiftsOpenAI(input: WithCodeRiftsInput): WithCodeRiftsOpenAIResult;
|
|
86
|
+
/**
|
|
87
|
+
* Shape-only adapter over an existing WithCodeRiftsResult (composition style).
|
|
88
|
+
* Prefer withCodeRiftsOpenAI when starting from raw tools.
|
|
89
|
+
*
|
|
90
|
+
* Does not re-run the guard; does not invent assurance.
|
|
91
|
+
*/
|
|
92
|
+
export declare function openAIToolAdapter(result: WithCodeRiftsResult): WithCodeRiftsOpenAIResult;
|
|
93
|
+
//# sourceMappingURL=openai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../src/adapters/openai.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;AAEjF;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,2EAA2E;QAC3E,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACrC,CAAC;CACH,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,+EAA+E;IAC/E,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B;;;OAGG;IACH,eAAe,EAAE,aAAa,EAAE,CAAC;IACjC,wDAAwD;IACxD,eAAe,EAAE,sBAAsB,CAAC;IACxC;;;;OAIG;IACH,qBAAqB,EAAE,oBAAoB,CAAC;IAC5C,yEAAyE;IACzE,cAAc,EAAE,mBAAmB,CAAC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAQF;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,aAAa,GAAG,kBAAkB,CAgB7E;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,cAAc,EAAE,SAAS,aAAa,EAAE,GAAG,kBAAkB,EAAE,CAE5F;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,kBAAkB,GAAG,yBAAyB,CAGxF;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,mBAAmB,GAAG,yBAAyB,CAcxF"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* OpenAI tool-calling adapter over withCodeRifts (ID632 slice 1 — reference adapter).
|
|
4
|
+
*
|
|
5
|
+
* Thin SHAPE converter only. Guard logic stays in withCodeRifts; this module:
|
|
6
|
+
* 1. calls withCodeRifts with the same input shape,
|
|
7
|
+
* 2. maps each ProtectedTool → OpenAI chat.completions tool definition,
|
|
8
|
+
* 3. returns OpenAI-shaped tools PLUS the untouched assurance objects
|
|
9
|
+
* (registry_report, composition_assurance, receipt_thread).
|
|
10
|
+
*
|
|
11
|
+
* Honesty (do not "upgrade" assurance):
|
|
12
|
+
* - composition_assurance is passed through EXACTLY as the core reported it
|
|
13
|
+
* (COMPOSITION_CALL_POLICY_COMPLETE may still be false; inescapable_runtime may be false).
|
|
14
|
+
* - The adapter converts tool SHAPE for the model API; it does not claim product-level
|
|
15
|
+
* inescapability the core does not claim.
|
|
16
|
+
*
|
|
17
|
+
* Only-protected-tools (6/D at the adapter surface):
|
|
18
|
+
* - `tools` is derived ONLY from the frozen registry's ProtectedTool list.
|
|
19
|
+
* - Raw tools never appear in the returned OpenAI table. The host may still hold a raw
|
|
20
|
+
* reference outside this table; that boundary stays the host's responsibility.
|
|
21
|
+
*
|
|
22
|
+
* Ergonomics (5–10 lines): pass raw tools + client + operation → OpenAI-ready guarded tools.
|
|
23
|
+
* LangGraph / Anthropic adapters follow the same thin-converter pattern later.
|
|
24
|
+
*/
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.protectedToolToOpenAI = protectedToolToOpenAI;
|
|
27
|
+
exports.toOpenAITools = toOpenAITools;
|
|
28
|
+
exports.withCodeRiftsOpenAI = withCodeRiftsOpenAI;
|
|
29
|
+
exports.openAIToolAdapter = openAIToolAdapter;
|
|
30
|
+
const with_coderifts_js_1 = require("../with-coderifts.js");
|
|
31
|
+
/** Empty JSON Schema object — used when a ProtectedTool has no inputSchema. */
|
|
32
|
+
const EMPTY_PARAMETERS = Object.freeze({
|
|
33
|
+
type: 'object',
|
|
34
|
+
properties: {},
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* Map one ProtectedTool → OpenAI function tool definition (shape only; no execute).
|
|
38
|
+
* Prefer tool.inputSchema when it is a plain object; otherwise empty object schema.
|
|
39
|
+
*/
|
|
40
|
+
function protectedToolToOpenAI(tool) {
|
|
41
|
+
const parameters = tool.inputSchema != null
|
|
42
|
+
&& typeof tool.inputSchema === 'object'
|
|
43
|
+
&& !Array.isArray(tool.inputSchema)
|
|
44
|
+
? tool.inputSchema
|
|
45
|
+
: { ...EMPTY_PARAMETERS };
|
|
46
|
+
const fn = {
|
|
47
|
+
name: tool.name,
|
|
48
|
+
parameters,
|
|
49
|
+
};
|
|
50
|
+
if (tool.description != null && tool.description !== '') {
|
|
51
|
+
fn.description = tool.description;
|
|
52
|
+
}
|
|
53
|
+
return { type: 'function', function: fn };
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Convert a list of ProtectedTool into OpenAI tool definitions.
|
|
57
|
+
* Does NOT call the guard — pure shape map over an already-protected list.
|
|
58
|
+
*/
|
|
59
|
+
function toOpenAITools(protectedTools) {
|
|
60
|
+
return protectedTools.map(protectedToolToOpenAI);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Build OpenAI-ready guarded tools from raw tools + client + operation.
|
|
64
|
+
*
|
|
65
|
+
* Calls withCodeRifts internally (guard logic stays in the core). Returns:
|
|
66
|
+
* - `tools` — OpenAI chat.completions shape (function tools only)
|
|
67
|
+
* - `protected_tools` — same guarded tools for host execute dispatch
|
|
68
|
+
* - assurance objects from the core, passed through untouched
|
|
69
|
+
*
|
|
70
|
+
* @param input Same shape as withCodeRifts (WithCodeRiftsInput).
|
|
71
|
+
*/
|
|
72
|
+
function withCodeRiftsOpenAI(input) {
|
|
73
|
+
const core = (0, with_coderifts_js_1.withCodeRifts)(input);
|
|
74
|
+
return openAIToolAdapter(core);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Shape-only adapter over an existing WithCodeRiftsResult (composition style).
|
|
78
|
+
* Prefer withCodeRiftsOpenAI when starting from raw tools.
|
|
79
|
+
*
|
|
80
|
+
* Does not re-run the guard; does not invent assurance.
|
|
81
|
+
*/
|
|
82
|
+
function openAIToolAdapter(result) {
|
|
83
|
+
const protected_tools = result.tools;
|
|
84
|
+
const tools = toOpenAITools(protected_tools);
|
|
85
|
+
const out = {
|
|
86
|
+
tools,
|
|
87
|
+
protected_tools,
|
|
88
|
+
registry_report: result.registry_report,
|
|
89
|
+
composition_assurance: result.composition_assurance,
|
|
90
|
+
receipt_thread: result.receipt_thread,
|
|
91
|
+
};
|
|
92
|
+
if (result.repository !== undefined) {
|
|
93
|
+
out.repository = result.repository;
|
|
94
|
+
}
|
|
95
|
+
return out;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=openai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.js","sourceRoot":"","sources":["../../../src/adapters/openai.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;AA8DH,sDAgBC;AAMD,sCAEC;AAYD,kDAGC;AAQD,8CAcC;AAzHD,4DAAqD;AAkDrD,+EAA+E;AAC/E,MAAM,gBAAgB,GAA4B,MAAM,CAAC,MAAM,CAAC;IAC9D,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,EAAE;CACf,CAAC,CAAC;AAEH;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,IAAmB;IACvD,MAAM,UAAU,GACd,IAAI,CAAC,WAAW,IAAI,IAAI;WACrB,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ;WACpC,CAAC,KAAK,CAAC,OAAO,CAAC,I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
|
@@ -54,4 +54,12 @@ export { coverageReport } from './coverage-report.js';
|
|
|
54
54
|
export type { CoverageReportInput, CoverageReport, Applicability, PlacementId, PlacementStrength, OverallCoverage, HonestClaimKey, PerPlacementRow, RuntimePlacementInput, MergePlacementInput, DeployPlacementInput, ContentPlacementInput, } from './coverage-report.js';
|
|
55
55
|
export { withCodeRifts, foldTableSettledCalls, guardedFractionAmongRoutes, } from './with-coderifts.js';
|
|
56
56
|
export type { WithCodeRiftsInput, WithCodeRiftsResult, WithCodeRiftsRegistryConfig, CompositionAssurance, SettledCallObservation, CallRoute, CallTerminal, TableSettledCallRouteCounts, ReceiptThreadHandle, ReceiptCursorSkipReason, } from './with-coderifts.js';
|
|
57
|
+
export { withCodeRiftsOpenAI, openAIToolAdapter, toOpenAITools, protectedToolToOpenAI, } from './adapters/openai.js';
|
|
58
|
+
export type { OpenAIFunctionTool, WithCodeRiftsOpenAIResult, } from './adapters/openai.js';
|
|
59
|
+
export { withCodeRiftsAnthropic, anthropicToolAdapter, toAnthropicTools, protectedToolToAnthropic, } from './adapters/anthropic.js';
|
|
60
|
+
export type { AnthropicTool, WithCodeRiftsAnthropicResult, } from './adapters/anthropic.js';
|
|
61
|
+
export { withCodeRiftsLangGraph, langGraphToolAdapter, toLangGraphTools, protectedToolToLangGraph, } from './adapters/langgraph.js';
|
|
62
|
+
export type { LangGraphToolDescriptor, WithCodeRiftsLangGraphResult, } from './adapters/langgraph.js';
|
|
63
|
+
export { withCodeRiftsGemini, geminiToolAdapter, toGeminiTools, protectedToolToFunctionDeclaration, } from './adapters/gemini.js';
|
|
64
|
+
export type { GeminiFunctionDeclaration, GeminiTool, WithCodeRiftsGeminiResult, } from './adapters/gemini.js';
|
|
57
65
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;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9B,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,aAAa,EACb,4BAA4B,GAC7B,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,uBAAuB,EACvB,4BAA4B,GAC7B,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,kCAAkC,GACnC,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,yBAAyB,EACzB,UAAU,EACV,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*/
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.deployGate = exports.gateDecision = exports.RegistryConstructionError = exports.guardToolRegistry = exports.globToRegExp = exports.matchGlob = exports.blobMapKey = exports.classifyByName = exports.resolveArtifacts = exports.RESIDUAL_UNCONDITIONAL_WRITE = exports.conditionalWriteResidual = exports.tokensEqual = exports.buildConditionalWriteBasis = exports.buildFreshnessBasis = exports.collectFreshnessCallContext = exports.artifactIdsForResolve = exports.isWriteStyleCall = exports.freshnessAllowsEnforce = exports.computePathSetTreeHash = exports.contentByteIdentical = exports.assessWriteStylePrior = exports.assessFreshness = exports.EXECUTION_PROOF_SPEC = exports.assertEnforcedReceiptInvariant = exports.hashExecutionResult = exports.buildExecutionProof = exports.deriveKeySignal = exports.pathClass = exports.classifyCommand = exports.projectState = exports.emptySessionState = exports.computeTainted = exports.evaluate = exports.updateSession = exports.SESSION_TAINT_VERSION = exports.SessionTaintTracker = exports.readDecision = exports.computeBundleFingerprint = exports.computeArtifactDigest = exports.evaluateEnvelope = exports.RECEIPT_PREV_NULL = exports.decodeReceiptBodyPrev = exports.previousReceiptCommitment = exports.verifyReceiptChainLinkage = exports.canonicalJson = exports.computeBodyHash = exports.bindReceiptToEnvelope = exports.DETECTOR_VERSION = exports.builtinDetector = exports.guardToolCall = void 0;
|
|
27
|
-
exports.guardedFractionAmongRoutes = exports.foldTableSettledCalls = exports.withCodeRifts = exports.coverageReport = exports.DEPLOY_REPAIRABLE_REASONS = exports.bindDeploy = void 0;
|
|
27
|
+
exports.protectedToolToFunctionDeclaration = exports.toGeminiTools = exports.geminiToolAdapter = exports.withCodeRiftsGemini = exports.protectedToolToLangGraph = exports.toLangGraphTools = exports.langGraphToolAdapter = exports.withCodeRiftsLangGraph = exports.protectedToolToAnthropic = exports.toAnthropicTools = exports.anthropicToolAdapter = exports.withCodeRiftsAnthropic = exports.protectedToolToOpenAI = exports.toOpenAITools = exports.openAIToolAdapter = exports.withCodeRiftsOpenAI = exports.guardedFractionAmongRoutes = exports.foldTableSettledCalls = exports.withCodeRifts = exports.coverageReport = exports.DEPLOY_REPAIRABLE_REASONS = exports.bindDeploy = void 0;
|
|
28
28
|
var guard_js_1 = require("./guard.js");
|
|
29
29
|
Object.defineProperty(exports, "guardToolCall", { enumerable: true, get: function () { return guard_js_1.guardToolCall; } });
|
|
30
30
|
var detector_js_1 = require("./detector.js");
|
|
@@ -119,4 +119,29 @@ var with_coderifts_js_1 = require("./with-coderifts.js");
|
|
|
119
119
|
Object.defineProperty(exports, "withCodeRifts", { enumerable: true, get: function () { return with_coderifts_js_1.withCodeRifts; } });
|
|
120
120
|
Object.defineProperty(exports, "foldTableSettledCalls", { enumerable: true, get: function () { return with_coderifts_js_1.foldTableSettledCalls; } });
|
|
121
121
|
Object.defineProperty(exports, "guardedFractionAmongRoutes", { enumerable: true, get: function () { return with_coderifts_js_1.guardedFractionAmongRoutes; } });
|
|
122
|
+
// ID632 slice 1 — thin OpenAI tool-calling adapter over withCodeRifts (reference adapter).
|
|
123
|
+
// Shape converter only; assurance objects pass through untouched.
|
|
124
|
+
var openai_js_1 = require("./adapters/openai.js");
|
|
125
|
+
Object.defineProperty(exports, "withCodeRiftsOpenAI", { enumerable: true, get: function () { return openai_js_1.withCodeRiftsOpenAI; } });
|
|
126
|
+
Object.defineProperty(exports, "openAIToolAdapter", { enumerable: true, get: function () { return openai_js_1.openAIToolAdapter; } });
|
|
127
|
+
Object.defineProperty(exports, "toOpenAITools", { enumerable: true, get: function () { return openai_js_1.toOpenAITools; } });
|
|
128
|
+
Object.defineProperty(exports, "protectedToolToOpenAI", { enumerable: true, get: function () { return openai_js_1.protectedToolToOpenAI; } });
|
|
129
|
+
// ID632 slice 2 — thin Anthropic tool_use adapter (same pattern; only the tool shape differs).
|
|
130
|
+
var anthropic_js_1 = require("./adapters/anthropic.js");
|
|
131
|
+
Object.defineProperty(exports, "withCodeRiftsAnthropic", { enumerable: true, get: function () { return anthropic_js_1.withCodeRiftsAnthropic; } });
|
|
132
|
+
Object.defineProperty(exports, "anthropicToolAdapter", { enumerable: true, get: function () { return anthropic_js_1.anthropicToolAdapter; } });
|
|
133
|
+
Object.defineProperty(exports, "toAnthropicTools", { enumerable: true, get: function () { return anthropic_js_1.toAnthropicTools; } });
|
|
134
|
+
Object.defineProperty(exports, "protectedToolToAnthropic", { enumerable: true, get: function () { return anthropic_js_1.protectedToolToAnthropic; } });
|
|
135
|
+
// ID632 slice 3 — thin LangChain/LangGraph tool adapter (plain descriptors; no framework dep).
|
|
136
|
+
var langgraph_js_1 = require("./adapters/langgraph.js");
|
|
137
|
+
Object.defineProperty(exports, "withCodeRiftsLangGraph", { enumerable: true, get: function () { return langgraph_js_1.withCodeRiftsLangGraph; } });
|
|
138
|
+
Object.defineProperty(exports, "langGraphToolAdapter", { enumerable: true, get: function () { return langgraph_js_1.langGraphToolAdapter; } });
|
|
139
|
+
Object.defineProperty(exports, "toLangGraphTools", { enumerable: true, get: function () { return langgraph_js_1.toLangGraphTools; } });
|
|
140
|
+
Object.defineProperty(exports, "protectedToolToLangGraph", { enumerable: true, get: function () { return langgraph_js_1.protectedToolToLangGraph; } });
|
|
141
|
+
// ID632 slice 4 — thin Google Gemini function-calling adapter (functionDeclarations wrapper).
|
|
142
|
+
var gemini_js_1 = require("./adapters/gemini.js");
|
|
143
|
+
Object.defineProperty(exports, "withCodeRiftsGemini", { enumerable: true, get: function () { return gemini_js_1.withCodeRiftsGemini; } });
|
|
144
|
+
Object.defineProperty(exports, "geminiToolAdapter", { enumerable: true, get: function () { return gemini_js_1.geminiToolAdapter; } });
|
|
145
|
+
Object.defineProperty(exports, "toGeminiTools", { enumerable: true, get: function () { return gemini_js_1.toGeminiTools; } });
|
|
146
|
+
Object.defineProperty(exports, "protectedToolToFunctionDeclaration", { enumerable: true, get: function () { return gemini_js_1.protectedToolToFunctionDeclaration; } });
|
|
122
147
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;;AAEH,uCAA2C;AAAlC,yGAAA,aAAa,OAAA;AACtB,6CAAkE;AAAzD,8GAAA,eAAe,OAAA;AAAE,+GAAA,gBAAgB,OAAA;AAC1C,2FAA2F;AAC3F,2DAA6F;AAApF,2HAAA,qBAAqB,OAAA;AAAE,qHAAA,eAAe,OAAA;AAAE,mHAAA,aAAa,OAAA;AAE9D,wGAAwG;AACxG,uDAK4B;AAJ1B,6HAAA,yBAAyB,OAAA;AACzB,6HAAA,yBAAyB,OAAA;AACzB,yHAAA,qBAAqB,OAAA;AACrB,qHAAA,iBAAiB,OAAA;AAMnB,sGAAsG;AACtG,+DAA+D;AAC/D,6DAA0G;AAAjG,uHAAA,gBAAgB,OAAA;AAAE,4HAAA,qBAAqB,OAAA;AAAE,+HAAA,wBAAwB,OAAA;AAE1E,+FAA+F;AAC/F,6FAA6F;AAC7F,uDAAkD;AAAzC,gHAAA,YAAY,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