@affiant/core 0.1.0-alpha.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/LICENSE +202 -0
- package/README.md +354 -0
- package/dist/context.d.ts +136 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +30 -0
- package/dist/context.js.map +1 -0
- package/dist/docket/entry.d.ts +421 -0
- package/dist/docket/entry.d.ts.map +1 -0
- package/dist/docket/entry.js +155 -0
- package/dist/docket/entry.js.map +1 -0
- package/dist/docket/expiry.d.ts +82 -0
- package/dist/docket/expiry.d.ts.map +1 -0
- package/dist/docket/expiry.js +106 -0
- package/dist/docket/expiry.js.map +1 -0
- package/dist/docket/memory.d.ts +163 -0
- package/dist/docket/memory.d.ts.map +1 -0
- package/dist/docket/memory.js +528 -0
- package/dist/docket/memory.js.map +1 -0
- package/dist/docket/store.d.ts +387 -0
- package/dist/docket/store.d.ts.map +1 -0
- package/dist/docket/store.js +51 -0
- package/dist/docket/store.js.map +1 -0
- package/dist/errors.d.ts +153 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +164 -0
- package/dist/errors.js.map +1 -0
- package/dist/gate/coverage.d.ts +152 -0
- package/dist/gate/coverage.d.ts.map +1 -0
- package/dist/gate/coverage.js +114 -0
- package/dist/gate/coverage.js.map +1 -0
- package/dist/gate/decide.d.ts +207 -0
- package/dist/gate/decide.d.ts.map +1 -0
- package/dist/gate/decide.js +559 -0
- package/dist/gate/decide.js.map +1 -0
- package/dist/gate/gate.d.ts +212 -0
- package/dist/gate/gate.d.ts.map +1 -0
- package/dist/gate/gate.js +175 -0
- package/dist/gate/gate.js.map +1 -0
- package/dist/gate/pipeline.d.ts +285 -0
- package/dist/gate/pipeline.d.ts.map +1 -0
- package/dist/gate/pipeline.js +515 -0
- package/dist/gate/pipeline.js.map +1 -0
- package/dist/gate/policy.d.ts +272 -0
- package/dist/gate/policy.d.ts.map +1 -0
- package/dist/gate/policy.js +396 -0
- package/dist/gate/policy.js.map +1 -0
- package/dist/gate/wrap.d.ts +107 -0
- package/dist/gate/wrap.d.ts.map +1 -0
- package/dist/gate/wrap.js +164 -0
- package/dist/gate/wrap.js.map +1 -0
- package/dist/index.d.ts +95 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +111 -0
- package/dist/index.js.map +1 -0
- package/dist/model/affidavit.d.ts +354 -0
- package/dist/model/affidavit.d.ts.map +1 -0
- package/dist/model/affidavit.js +417 -0
- package/dist/model/affidavit.js.map +1 -0
- package/dist/model/amendments.d.ts +160 -0
- package/dist/model/amendments.d.ts.map +1 -0
- package/dist/model/amendments.js +183 -0
- package/dist/model/amendments.js.map +1 -0
- package/dist/model/canonical.d.ts +311 -0
- package/dist/model/canonical.d.ts.map +1 -0
- package/dist/model/canonical.js +665 -0
- package/dist/model/canonical.js.map +1 -0
- package/dist/model/money.d.ts +127 -0
- package/dist/model/money.d.ts.map +1 -0
- package/dist/model/money.js +177 -0
- package/dist/model/money.js.map +1 -0
- package/dist/model/provenance.d.ts +315 -0
- package/dist/model/provenance.d.ts.map +1 -0
- package/dist/model/provenance.js +223 -0
- package/dist/model/provenance.js.map +1 -0
- package/dist/ports.d.ts +269 -0
- package/dist/ports.d.ts.map +1 -0
- package/dist/ports.js +34 -0
- package/dist/ports.js.map +1 -0
- package/dist/store-memory.d.ts +21 -0
- package/dist/store-memory.d.ts.map +1 -0
- package/dist/store-memory.js +20 -0
- package/dist/store-memory.js.map +1 -0
- package/dist/telemetry-keys.d.ts +65 -0
- package/dist/telemetry-keys.d.ts.map +1 -0
- package/dist/telemetry-keys.js +72 -0
- package/dist/telemetry-keys.js.map +1 -0
- package/dist/telemetry.d.ts +77 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +43 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/testing.d.ts +574 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +1291 -0
- package/dist/testing.js.map +1 -0
- package/package.json +75 -0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,MAAM;YACrB,kBAAkB,EAAE,MAAM,CAAC,KAAK,IAAI,IAAI;YACxC,mBAAmB,EAAE,MAAM,CAAC,MAAM,IAAI,IAAI;YAC1C,qEAAqE;YACrE,qDAAqD;YACrD,kCAAkC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI;YACrE,YAAY,EAAE,MAAM,CAAC,KAAK,IAAI,IAAI;YAClC,gBAAgB,EAAE,MAAM,CAAC,SAAS,IAAI,IAAI;SAC3C;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The interception seam: what a host wraps a tool with, and what the model gets back.
|
|
3
|
+
*
|
|
4
|
+
* **Rules served: GT-6** (a write tool can only produce a proposal — the gate never
|
|
5
|
+
* calls its `execute`), **CV-4** (a write-capable tool in an uncovered category is
|
|
6
|
+
* refused here, at wire-up, unless the host declared it), **CV-1** (the refusal is at
|
|
7
|
+
* wire-up and there is no option that turns the gate off), **GT-2** (the turn context
|
|
8
|
+
* is a parameter of `wrap` and of every `execute` call path; nothing is ambient),
|
|
9
|
+
* **AF-5** (a tool call returns one of three things: a proposal, a read result, or an
|
|
10
|
+
* error).
|
|
11
|
+
*
|
|
12
|
+
* ## Why the write path never calls `execute`
|
|
13
|
+
*
|
|
14
|
+
* The gated `execute` for a write-capable tool does not hold a reference to the
|
|
15
|
+
* original function at all: it builds the {@link Operation} from
|
|
16
|
+
* {@link ToolDefinition.operation}, runs the pipeline, and returns the entry and its
|
|
17
|
+
* card. There is no branch in which the host's write runs, no option that restores
|
|
18
|
+
* it, and nothing for a mistake to fall through to. That is GT-6 made structural
|
|
19
|
+
* rather than documentary — a spy on the original `execute` records nothing, and a
|
|
20
|
+
* fixture can prove it.
|
|
21
|
+
*
|
|
22
|
+
* What this cannot cover is a tool that opens its own connection and writes inside
|
|
23
|
+
* its body: no wire-up check can see that, and GT-6 states the limit rather than
|
|
24
|
+
* pretending to enforce it.
|
|
25
|
+
*
|
|
26
|
+
* ## Why the context is bound at `wrap`
|
|
27
|
+
*
|
|
28
|
+
* `wrap(tool, ctx)` returns a gated tool for *that turn*. The context is a parameter,
|
|
29
|
+
* captured in this closure, and two turns wrapping the same tool definition get two
|
|
30
|
+
* independent gated tools that share nothing (GT-2). A read tool's own `execute` is
|
|
31
|
+
* then called with the same context as its second argument, so the explicitness
|
|
32
|
+
* survives to the bottom of the call path rather than stopping at the seam.
|
|
33
|
+
*
|
|
34
|
+
* @packageDocumentation
|
|
35
|
+
*/
|
|
36
|
+
import type { TurnContext } from "../context.js";
|
|
37
|
+
import type { DocketStatus } from "../docket/entry.js";
|
|
38
|
+
import type { ErrorCode } from "../errors.js";
|
|
39
|
+
import type { ToolDefinition } from "./coverage.js";
|
|
40
|
+
import type { EvidenceCardRequest, PipelineDeps } from "./pipeline.js";
|
|
41
|
+
/**
|
|
42
|
+
* The three things a gated tool call can produce (AF-5).
|
|
43
|
+
*
|
|
44
|
+
* A `"write"` is a **proposal**, never a completed write: an entry id, the status the
|
|
45
|
+
* row reads at, and the card a person is shown. A model reading this result learns
|
|
46
|
+
* that the write is pending or that a Standing Order approved it — never that it
|
|
47
|
+
* happened, because the gate does not execute (AZ-7).
|
|
48
|
+
*
|
|
49
|
+
* An `"error"` carries the refusal in a form a model can act on: a substance refusal
|
|
50
|
+
* (GT-3) says the proposal swore to nothing, and a coverage refusal (CV-4) says the
|
|
51
|
+
* tool is not one the gate can stand in front of.
|
|
52
|
+
*/
|
|
53
|
+
export type GatedToolResult<TResult> = {
|
|
54
|
+
/** A write proposal was filed. */
|
|
55
|
+
readonly kind: "write";
|
|
56
|
+
/** The Docket entry the proposal was filed under. */
|
|
57
|
+
readonly entryId: string;
|
|
58
|
+
/** What the row reads at — `"pending"` unless a Standing Order fired (AZ-1). */
|
|
59
|
+
readonly status: DocketStatus;
|
|
60
|
+
/** The Evidence Card the host delivers to a reviewer. */
|
|
61
|
+
readonly card: EvidenceCardRequest;
|
|
62
|
+
} | {
|
|
63
|
+
/** A read tool ran and returned its own result. */
|
|
64
|
+
readonly kind: "read";
|
|
65
|
+
/** Whatever the tool returned, untouched. */
|
|
66
|
+
readonly result: TResult;
|
|
67
|
+
} | {
|
|
68
|
+
/** The call did not produce a proposal or a result. */
|
|
69
|
+
readonly kind: "error";
|
|
70
|
+
/** The refusal's code, or `"tool-error"` when a read tool's own body threw. */
|
|
71
|
+
readonly code: ErrorCode | "tool-error";
|
|
72
|
+
/** What went wrong, in one line. */
|
|
73
|
+
readonly message: string;
|
|
74
|
+
};
|
|
75
|
+
/** A tool with the gate in front of it, bound to one turn (GT-2). */
|
|
76
|
+
export interface GatedTool<TArgs, TResult> {
|
|
77
|
+
/** The wrapped tool's name, unchanged — a model sees the same tool it always did. */
|
|
78
|
+
readonly name: string;
|
|
79
|
+
/** The wrapped tool's description, unchanged. */
|
|
80
|
+
readonly description: string;
|
|
81
|
+
/** Whether a call to this tool would write. */
|
|
82
|
+
readonly writeCapable: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Call the tool. A write-capable tool produces a proposal and **never** runs the
|
|
85
|
+
* host's `execute` (GT-6); a read tool passes straight through to its own.
|
|
86
|
+
*/
|
|
87
|
+
execute(args: TArgs): Promise<GatedToolResult<TResult>>;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Put the gate in front of `tool` for the turn `ctx` describes.
|
|
91
|
+
*
|
|
92
|
+
* Wire-up refuses three things, all before a single call is made (CV-1):
|
|
93
|
+
*
|
|
94
|
+
* - a **write-capable** tool the gate cannot intercept and the host has not declared
|
|
95
|
+
* uncovered — `AffiantError("coverage-refused")`, naming the category (CV-4);
|
|
96
|
+
* - a write-capable tool with no {@link ToolDefinition.operation}, because nothing
|
|
97
|
+
* else in this package can know what its arguments propose;
|
|
98
|
+
* - a read tool with no `execute`, which is a tool that cannot be called at all.
|
|
99
|
+
*
|
|
100
|
+
* A write tool the host *has* declared uncovered is wrapped and returns proposals like
|
|
101
|
+
* any other; the pipeline files each one `blocked` (CV-4). The declaration converts a
|
|
102
|
+
* start-up refusal into a Docket record — it never turns the gate off.
|
|
103
|
+
*
|
|
104
|
+
* @throws AffiantError `"coverage-refused"` or `"wireup-invalid"`.
|
|
105
|
+
*/
|
|
106
|
+
export declare function wrapTool<TArgs, TResult>(tool: ToolDefinition<TArgs, TResult>, ctx: TurnContext, deps: PipelineDeps): GatedTool<TArgs, TResult>;
|
|
107
|
+
//# sourceMappingURL=wrap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrap.d.ts","sourceRoot":"","sources":["../../src/gate/wrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAOvE;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,CAAC,OAAO,IAC/B;IACE,kCAAkC;IAClC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,qDAAqD;IACrD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,gFAAgF;IAChF,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,yDAAyD;IACzD,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;CACpC,GACD;IACE,mDAAmD;IACnD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,6CAA6C;IAC7C,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B,GACD;IACE,uDAAuD;IACvD,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,+EAA+E;IAC/E,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,YAAY,CAAC;IACxC,oCAAoC;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEN,qEAAqE;AACrE,MAAM,WAAW,SAAS,CAAC,KAAK,EAAE,OAAO;IACvC,qFAAqF;IACrF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iDAAiD;IACjD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,+CAA+C;IAC/C,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B;;;OAGG;IACH,OAAO,CAAC,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;CACzD;AAMD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,EACrC,IAAI,EAAE,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,EACpC,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,YAAY,GACjB,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAkH3B"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The interception seam: what a host wraps a tool with, and what the model gets back.
|
|
3
|
+
*
|
|
4
|
+
* **Rules served: GT-6** (a write tool can only produce a proposal — the gate never
|
|
5
|
+
* calls its `execute`), **CV-4** (a write-capable tool in an uncovered category is
|
|
6
|
+
* refused here, at wire-up, unless the host declared it), **CV-1** (the refusal is at
|
|
7
|
+
* wire-up and there is no option that turns the gate off), **GT-2** (the turn context
|
|
8
|
+
* is a parameter of `wrap` and of every `execute` call path; nothing is ambient),
|
|
9
|
+
* **AF-5** (a tool call returns one of three things: a proposal, a read result, or an
|
|
10
|
+
* error).
|
|
11
|
+
*
|
|
12
|
+
* ## Why the write path never calls `execute`
|
|
13
|
+
*
|
|
14
|
+
* The gated `execute` for a write-capable tool does not hold a reference to the
|
|
15
|
+
* original function at all: it builds the {@link Operation} from
|
|
16
|
+
* {@link ToolDefinition.operation}, runs the pipeline, and returns the entry and its
|
|
17
|
+
* card. There is no branch in which the host's write runs, no option that restores
|
|
18
|
+
* it, and nothing for a mistake to fall through to. That is GT-6 made structural
|
|
19
|
+
* rather than documentary — a spy on the original `execute` records nothing, and a
|
|
20
|
+
* fixture can prove it.
|
|
21
|
+
*
|
|
22
|
+
* What this cannot cover is a tool that opens its own connection and writes inside
|
|
23
|
+
* its body: no wire-up check can see that, and GT-6 states the limit rather than
|
|
24
|
+
* pretending to enforce it.
|
|
25
|
+
*
|
|
26
|
+
* ## Why the context is bound at `wrap`
|
|
27
|
+
*
|
|
28
|
+
* `wrap(tool, ctx)` returns a gated tool for *that turn*. The context is a parameter,
|
|
29
|
+
* captured in this closure, and two turns wrapping the same tool definition get two
|
|
30
|
+
* independent gated tools that share nothing (GT-2). A read tool's own `execute` is
|
|
31
|
+
* then called with the same context as its second argument, so the explicitness
|
|
32
|
+
* survives to the bottom of the call path rather than stopping at the seam.
|
|
33
|
+
*
|
|
34
|
+
* @packageDocumentation
|
|
35
|
+
*/
|
|
36
|
+
import { AffiantError, isAffiantError } from "../errors.js";
|
|
37
|
+
import { assessCoverage } from "./coverage.js";
|
|
38
|
+
import { runPipeline } from "./pipeline.js";
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
// Wire-up
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
/**
|
|
43
|
+
* Put the gate in front of `tool` for the turn `ctx` describes.
|
|
44
|
+
*
|
|
45
|
+
* Wire-up refuses three things, all before a single call is made (CV-1):
|
|
46
|
+
*
|
|
47
|
+
* - a **write-capable** tool the gate cannot intercept and the host has not declared
|
|
48
|
+
* uncovered — `AffiantError("coverage-refused")`, naming the category (CV-4);
|
|
49
|
+
* - a write-capable tool with no {@link ToolDefinition.operation}, because nothing
|
|
50
|
+
* else in this package can know what its arguments propose;
|
|
51
|
+
* - a read tool with no `execute`, which is a tool that cannot be called at all.
|
|
52
|
+
*
|
|
53
|
+
* A write tool the host *has* declared uncovered is wrapped and returns proposals like
|
|
54
|
+
* any other; the pipeline files each one `blocked` (CV-4). The declaration converts a
|
|
55
|
+
* start-up refusal into a Docket record — it never turns the gate off.
|
|
56
|
+
*
|
|
57
|
+
* @throws AffiantError `"coverage-refused"` or `"wireup-invalid"`.
|
|
58
|
+
*/
|
|
59
|
+
export function wrapTool(tool, ctx, deps) {
|
|
60
|
+
// Captured once, per wrap. Read from nowhere else, ever (GT-2).
|
|
61
|
+
const turn = ctx;
|
|
62
|
+
if (!tool.writeCapable) {
|
|
63
|
+
const run = tool.execute;
|
|
64
|
+
if (typeof run !== "function") {
|
|
65
|
+
throw new AffiantError("wireup-invalid", `CV-1: read tool ${JSON.stringify(tool.name)} declares no \`execute\`; there is ` +
|
|
66
|
+
`nothing to call.`, { toolName: tool.name });
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
name: tool.name,
|
|
70
|
+
description: tool.description,
|
|
71
|
+
writeCapable: false,
|
|
72
|
+
async execute(args) {
|
|
73
|
+
// The only place a host's own function is called, and it is called with the
|
|
74
|
+
// same explicit context the seam was given (GT-2).
|
|
75
|
+
try {
|
|
76
|
+
return { kind: "read", result: await run(args, turn) };
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
return { kind: "error", code: codeOf(error), message: messageOf(error) };
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
const assessment = assessCoverage(tool);
|
|
85
|
+
if (!assessment.covered && deps.coverage.lookup(tool.name) === null) {
|
|
86
|
+
deps.telemetry.emit({
|
|
87
|
+
key: "coverage.refused",
|
|
88
|
+
at: deps.clock.now(),
|
|
89
|
+
attributes: {
|
|
90
|
+
"gen_ai.tool.name": tool.name,
|
|
91
|
+
"coverage.category": assessment.category,
|
|
92
|
+
phase: "wire-up",
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
throw new AffiantError("coverage-refused", `CV-4: write-capable tool ${JSON.stringify(tool.name)} is in an uncovered category ` +
|
|
96
|
+
`(${assessment.category}) — there is nothing for the gate to intercept, so a write ` +
|
|
97
|
+
`through it would not be filed. Either make it interceptable, or call ` +
|
|
98
|
+
`gate.declareUncovered(tool, ${JSON.stringify(assessment.category)}) so every ` +
|
|
99
|
+
`proposal from it is filed blocked on the Docket. There is no option that turns the ` +
|
|
100
|
+
`gate off for a tool it covers (CV-1).`, { toolName: tool.name, category: assessment.category });
|
|
101
|
+
}
|
|
102
|
+
const toOperation = tool.operation;
|
|
103
|
+
if (typeof toOperation !== "function") {
|
|
104
|
+
throw new AffiantError("wireup-invalid", `CV-1: write-capable tool ${JSON.stringify(tool.name)} declares no \`operation\`; a ` +
|
|
105
|
+
`write tool must say how its arguments become the write being proposed, because ` +
|
|
106
|
+
`nothing else can know which entity a call is about.`, { toolName: tool.name });
|
|
107
|
+
}
|
|
108
|
+
const operationLabel = tool.operationLabel ?? null;
|
|
109
|
+
return {
|
|
110
|
+
name: tool.name,
|
|
111
|
+
description: tool.description,
|
|
112
|
+
writeCapable: true,
|
|
113
|
+
// GT-6: the host's own `execute` is not captured on this path and is not
|
|
114
|
+
// reachable from the closure below. There is no branch that runs the write.
|
|
115
|
+
async execute(args) {
|
|
116
|
+
try {
|
|
117
|
+
const filed = await runPipeline({
|
|
118
|
+
operation: toOperation(args),
|
|
119
|
+
toolName: tool.name,
|
|
120
|
+
schema: tool.inputSchema,
|
|
121
|
+
// A model's tool arguments are JSON — that is what a tool call is on
|
|
122
|
+
// every transport this gate sits behind. `TArgs` is the tool author's
|
|
123
|
+
// own type and `wrap` does not constrain it (an interface would not
|
|
124
|
+
// satisfy `JsonValue`'s index signature, and refusing those tools would
|
|
125
|
+
// buy nothing), so the value is admitted here. `deriveEntryId` still
|
|
126
|
+
// raises a TypeError naming the offending path if a host hands the gate
|
|
127
|
+
// something with no canonical form.
|
|
128
|
+
args: args,
|
|
129
|
+
preparedFields: null,
|
|
130
|
+
operationLabel,
|
|
131
|
+
supersedes: null,
|
|
132
|
+
priorAmendments: null,
|
|
133
|
+
}, turn, deps);
|
|
134
|
+
return {
|
|
135
|
+
kind: "write",
|
|
136
|
+
entryId: filed.entry.entryId,
|
|
137
|
+
status: filed.entry.status,
|
|
138
|
+
card: filed.card,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
// A refusal is an answer: the model is told the proposal swore to nothing, or
|
|
143
|
+
// that the tool is uncovered, and can say so. A `RangeError` from a port
|
|
144
|
+
// contract violation is *not* an answer — it is a host bug, and swallowing it
|
|
145
|
+
// into a tool result would hide it from the host and leave the model guessing.
|
|
146
|
+
if (isAffiantError(error)) {
|
|
147
|
+
return { kind: "error", code: error.code, message: error.message };
|
|
148
|
+
}
|
|
149
|
+
throw error;
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/** The code to report for a throw from a read tool's own body. */
|
|
155
|
+
function codeOf(error) {
|
|
156
|
+
return isAffiantError(error) ? error.code : "tool-error";
|
|
157
|
+
}
|
|
158
|
+
/** The message to report for a throw, without assuming it was an `Error`. */
|
|
159
|
+
function messageOf(error) {
|
|
160
|
+
if (error instanceof Error)
|
|
161
|
+
return error.message;
|
|
162
|
+
return String(error);
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=wrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrap.js","sourceRoot":"","sources":["../../src/gate/wrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAKH,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAI5D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,e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,CAAC;IACjD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@affiant/core` — the Affiant gate for TypeScript.
|
|
3
|
+
*
|
|
4
|
+
* Affiant turns every database write an LLM agent proposes into an **Affidavit**:
|
|
5
|
+
* a per-field evidence record carrying the proposed value, the value it replaces,
|
|
6
|
+
* where each value came from and how confident the producer is. An Affidavit is
|
|
7
|
+
* filed as a **Docket** entry and shown to a person as an **Evidence Card**, which
|
|
8
|
+
* they approve, amend or reject before the host commits anything. A **Standing
|
|
9
|
+
* Order** is a policy verdict that approves a write with no person present.
|
|
10
|
+
*
|
|
11
|
+
* This package is the gate itself. It is held equivalent to the .NET
|
|
12
|
+
* implementation by the rulebook at
|
|
13
|
+
* {@link https://github.com/Sakwala/affiant-protocol}: numbered invariants and a
|
|
14
|
+
* shared conformance fixture suite that both implementations run.
|
|
15
|
+
*
|
|
16
|
+
* **What this package does not contain, by rule:** a model client, a risk-scoring
|
|
17
|
+
* formula, an executor, a transport and a production store. Each is a port the host
|
|
18
|
+
* supplies (see `ports.ts`), which is what lets one gate sit in front of any model,
|
|
19
|
+
* any database and any approval surface.
|
|
20
|
+
*
|
|
21
|
+
* **What is here at `0.1.0-alpha.0`:** the turn context (GT-2), the port
|
|
22
|
+
* interfaces, the error-code registry (CV-1), the telemetry-key registry (TL-1) and
|
|
23
|
+
* the Affidavit model — the provenance ladder with its bindings and merge rule
|
|
24
|
+
* (PV-1..PV-3, PV-5), the Affidavit and its three confidence numbers (AF-1..AF-3),
|
|
25
|
+
* and amendment semantics with the recompute they force (DK-2, AF-4); the Docket —
|
|
26
|
+
* the entry, the store contract and the in-memory reference stores (DK-1, DK-3,
|
|
27
|
+
* DK-4, DK-5), the last of these behind `@affiant/core/store-memory`; the canonical
|
|
28
|
+
* form and its SHA-256 (SR-1, SR-2); and **the gate pipeline** — `createGate`,
|
|
29
|
+
* `wrap`, the interceptor and inference steps, projection, the substance refusal,
|
|
30
|
+
* the policy chain with Standing Orders, TTL after policy and filing with the
|
|
31
|
+
* Standing Order attestation (GT-1, GT-3..GT-6, AZ-1, AZ-4, PV-4, CV-1, CV-4, SR-4);
|
|
32
|
+
* and **the decision path** — `decide`, `markExecuted`, `resubmit` and `rehydrate` on
|
|
33
|
+
* the gate: fail-closed tenant-scoped authorization, the three attestation kinds with
|
|
34
|
+
* a relay's identity mapped to `member-via-relay`, amendments with the recompute they
|
|
35
|
+
* force, the execution outcome a host reports, resubmission lineage and rehydration
|
|
36
|
+
* order (AZ-1..AZ-3, AZ-5..AZ-7, DK-1, DK-2, DK-5, AF-4, PV-2).
|
|
37
|
+
*
|
|
38
|
+
* Three checks stand between a policy's verdict and a write with no person present, and
|
|
39
|
+
* each degrades to asking a person rather than refusing: a proposed field marked
|
|
40
|
+
* mandatory that reads `Empty` (GT-5), a declared provenance input above `Conversation`
|
|
41
|
+
* pointing at nothing (PV-4), and a host risk score above the policy's threshold (GT-5).
|
|
42
|
+
*
|
|
43
|
+
* The fixtures for both v0.1 sequences and the runner that executes them are behind
|
|
44
|
+
* `@affiant/core/testing`, which a host can point at its own ports.
|
|
45
|
+
*
|
|
46
|
+
* **Not on npm.** The version string exists so the conformance driver can pin it.
|
|
47
|
+
* Publishing waits on two things — a public parity report naming what each
|
|
48
|
+
* implementation does not yet pass, and a green, merge-blocking TypeScript conformance
|
|
49
|
+
* driver — and a `prepack` guard enforces the wait rather than documenting it. See the
|
|
50
|
+
* package README.
|
|
51
|
+
*
|
|
52
|
+
* @packageDocumentation
|
|
53
|
+
*/
|
|
54
|
+
/** The version of this package. Not published to npm at this version. */
|
|
55
|
+
export declare const CORE_VERSION = "0.1.0-alpha.0";
|
|
56
|
+
/**
|
|
57
|
+
* The protocol tag the wire types are pinned to, re-exported from
|
|
58
|
+
* `@affiant/contract` so a host that only depends on the gate can still assert
|
|
59
|
+
* which rulebook tag it is speaking.
|
|
60
|
+
*/
|
|
61
|
+
export { PROTOCOL_VERSION } from "@affiant/contract";
|
|
62
|
+
export type { ChannelIdentity, Principal, RelayAssertion, Turn, TurnContext } from "./context.js";
|
|
63
|
+
export { AffiantError, ERROR_CODES, ErrorCode, isAffiantError, isErrorCode } from "./errors.js";
|
|
64
|
+
export type { AffiantErrorDetails } from "./errors.js";
|
|
65
|
+
export { isTelemetryKey, noopTelemetry, TELEMETRY_KEYS, TELEMETRY_REGISTRY_VERSION, } from "./telemetry.js";
|
|
66
|
+
export type { TelemetryAttributes, TelemetryEvent, TelemetryKey, TelemetryKeyEntry, TelemetryPort, } from "./telemetry.js";
|
|
67
|
+
export { AFFIDAVIT_FIELD_KINDS, buildAffidavit, computeConfidence, fromWire, isJsonValue, isMoney, toWire, wireCarryOf, withConfidence, } from "./model/affidavit.js";
|
|
68
|
+
export type { Affidavit, AffidavitField, AffidavitFieldInput, AffidavitFieldKind, AffidavitMeta, ConfidenceNumbers, FromWireStamp, JsonValue, Money, WireCarry, } from "./model/affidavit.js";
|
|
69
|
+
export { amendmentTag, applyAmendments, hasAmendment, resolveAmendments, } from "./model/amendments.js";
|
|
70
|
+
export type { Amendment, AmendmentMap, ResolvedAmendment, ReviewerAct, } from "./model/amendments.js";
|
|
71
|
+
export { BINDING_KINDS, chainOf, determinismRank, emptyTag, isBound, isHonourable, merge, mintConversation, mintInference, mintInferred, mintTag, PROVENANCE_LADDER, requiresBinding, supersede, tagsOf, } from "./model/provenance.js";
|
|
72
|
+
export type { Binding, BindingKind, ComputationConstantRef, ComputationRef, ExternalRef, FormInputRef, InferenceSource, MintInferenceOptions, MintTagOptions, ProvenanceChain, ProvenanceSource, ProvenanceTag, RelayRef, ReviewerActRef, UtteranceSpanRef, } from "./model/provenance.js";
|
|
73
|
+
export { defaultClock } from "./ports.js";
|
|
74
|
+
export type { AuthorizationPort, Clock, FieldInterceptor, FieldSchema, FieldSchemaEntry, InferencePort, InterceptedField, InterceptedFields, InterceptorBinding, Operation, ProjectionPort, RiskScorer, StructuredField, StructuredResult, UtteranceSpan, } from "./ports.js";
|
|
75
|
+
export { BLOCKED_CODES, DOCKET_STATUSES, EXECUTION_OUTCOMES, isTerminal, newEntry, readStatus, REQUIREMENT_KINDS, } from "./docket/entry.js";
|
|
76
|
+
export type { Attestation, AttestationRelay, Attestor, BlockedCode, BlockedMarker, DecisionRecord, DocketEntry, DocketStatus, ExecutionOutcome, Lineage, NewEntryInit, PreservedAmendments, RequirementKind, } from "./docket/entry.js";
|
|
77
|
+
export { compareFilingOrder, instantMs, isDue, remainingMs, requireInstant, } from "./docket/expiry.js";
|
|
78
|
+
export type { Expirable } from "./docket/expiry.js";
|
|
79
|
+
export type { DocketStore, Page, PageResult, PreservedAct, PreserveAmendmentsResult, RecordExecutionResult, RecordSupersessionResult, RetentionPolicy, Scope, SessionStore, TransitionPatch, TransitionResult, } from "./docket/store.js";
|
|
80
|
+
export { applyAmendmentsForCanonical, canonicalHash, canonicalHashEntry, canonicalize, canonicalizeEntry, canonicalJson, canonicalString, canonicalStringEntry, sha256Hex, swornAffidavitOf, } from "./model/canonical.js";
|
|
81
|
+
export type { CanonicalField, CanonicalInput, CanonicalizeOptions } from "./model/canonical.js";
|
|
82
|
+
export { assertMoney, MONEY_AMOUNT_PATTERN, MONEY_CURRENCY_PATTERN, moneyScaleOk, parseMoney, } from "./model/money.js";
|
|
83
|
+
export { createGate } from "./gate/gate.js";
|
|
84
|
+
export type { Gate, GateOptions, WriteProposal } from "./gate/gate.js";
|
|
85
|
+
export { attestorOf, decide, markExecuted, resubmit } from "./gate/decide.js";
|
|
86
|
+
export type { DecideDeps, Decision, ExecutionReport, MemberAttestation, RelayAttestation, } from "./gate/decide.js";
|
|
87
|
+
export { emptyMandatoryFields, evaluatePolicies, unboundDeclaredInput } from "./gate/policy.js";
|
|
88
|
+
export type { ApprovalPolicy, PolicyChainDeps, PolicyOutcome, StandingOrderBlockedReason, UnboundInput, Verdict, } from "./gate/policy.js";
|
|
89
|
+
export { assessCoverage, coverageRefusedMarker, createCoverageRegistry, declareUncovered, isUncoveredCategory, UNCOVERED_CATEGORIES, } from "./gate/coverage.js";
|
|
90
|
+
export type { CoverageAssessment, CoverageRegistry, ToolDefinition, UncoveredCategory, UncoveredDeclaration, } from "./gate/coverage.js";
|
|
91
|
+
export { deriveEntryId, runPipeline } from "./gate/pipeline.js";
|
|
92
|
+
export type { EvidenceCardRequest, FiledEntry, PipelineDeps, PipelineProposal, PreparedField, } from "./gate/pipeline.js";
|
|
93
|
+
export { wrapTool } from "./gate/wrap.js";
|
|
94
|
+
export type { GatedTool, GatedToolResult } from "./gate/wrap.js";
|
|
95
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,yEAAyE;AACzE,eAAO,MAAM,YAAY,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAIrD,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAIlG,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAChG,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAIvD,OAAO,EACL,cAAc,EACd,aAAa,EACb,cAAc,EACd,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,aAAa,GACd,MAAM,gBAAgB,CAAC;AAOxB,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,QAAQ,EACR,WAAW,EAC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E,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAChG,YAAY,EACV,cAAc,EACd,eAAe,EACf,aAAa,EACb,0BAA0B,EAC1B,YAAY,EACZ,OAAO,GACR,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAChE,YAAY,EACV,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,aAAa,GACd,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@affiant/core` — the Affiant gate for TypeScript.
|
|
3
|
+
*
|
|
4
|
+
* Affiant turns every database write an LLM agent proposes into an **Affidavit**:
|
|
5
|
+
* a per-field evidence record carrying the proposed value, the value it replaces,
|
|
6
|
+
* where each value came from and how confident the producer is. An Affidavit is
|
|
7
|
+
* filed as a **Docket** entry and shown to a person as an **Evidence Card**, which
|
|
8
|
+
* they approve, amend or reject before the host commits anything. A **Standing
|
|
9
|
+
* Order** is a policy verdict that approves a write with no person present.
|
|
10
|
+
*
|
|
11
|
+
* This package is the gate itself. It is held equivalent to the .NET
|
|
12
|
+
* implementation by the rulebook at
|
|
13
|
+
* {@link https://github.com/Sakwala/affiant-protocol}: numbered invariants and a
|
|
14
|
+
* shared conformance fixture suite that both implementations run.
|
|
15
|
+
*
|
|
16
|
+
* **What this package does not contain, by rule:** a model client, a risk-scoring
|
|
17
|
+
* formula, an executor, a transport and a production store. Each is a port the host
|
|
18
|
+
* supplies (see `ports.ts`), which is what lets one gate sit in front of any model,
|
|
19
|
+
* any database and any approval surface.
|
|
20
|
+
*
|
|
21
|
+
* **What is here at `0.1.0-alpha.0`:** the turn context (GT-2), the port
|
|
22
|
+
* interfaces, the error-code registry (CV-1), the telemetry-key registry (TL-1) and
|
|
23
|
+
* the Affidavit model — the provenance ladder with its bindings and merge rule
|
|
24
|
+
* (PV-1..PV-3, PV-5), the Affidavit and its three confidence numbers (AF-1..AF-3),
|
|
25
|
+
* and amendment semantics with the recompute they force (DK-2, AF-4); the Docket —
|
|
26
|
+
* the entry, the store contract and the in-memory reference stores (DK-1, DK-3,
|
|
27
|
+
* DK-4, DK-5), the last of these behind `@affiant/core/store-memory`; the canonical
|
|
28
|
+
* form and its SHA-256 (SR-1, SR-2); and **the gate pipeline** — `createGate`,
|
|
29
|
+
* `wrap`, the interceptor and inference steps, projection, the substance refusal,
|
|
30
|
+
* the policy chain with Standing Orders, TTL after policy and filing with the
|
|
31
|
+
* Standing Order attestation (GT-1, GT-3..GT-6, AZ-1, AZ-4, PV-4, CV-1, CV-4, SR-4);
|
|
32
|
+
* and **the decision path** — `decide`, `markExecuted`, `resubmit` and `rehydrate` on
|
|
33
|
+
* the gate: fail-closed tenant-scoped authorization, the three attestation kinds with
|
|
34
|
+
* a relay's identity mapped to `member-via-relay`, amendments with the recompute they
|
|
35
|
+
* force, the execution outcome a host reports, resubmission lineage and rehydration
|
|
36
|
+
* order (AZ-1..AZ-3, AZ-5..AZ-7, DK-1, DK-2, DK-5, AF-4, PV-2).
|
|
37
|
+
*
|
|
38
|
+
* Three checks stand between a policy's verdict and a write with no person present, and
|
|
39
|
+
* each degrades to asking a person rather than refusing: a proposed field marked
|
|
40
|
+
* mandatory that reads `Empty` (GT-5), a declared provenance input above `Conversation`
|
|
41
|
+
* pointing at nothing (PV-4), and a host risk score above the policy's threshold (GT-5).
|
|
42
|
+
*
|
|
43
|
+
* The fixtures for both v0.1 sequences and the runner that executes them are behind
|
|
44
|
+
* `@affiant/core/testing`, which a host can point at its own ports.
|
|
45
|
+
*
|
|
46
|
+
* **Not on npm.** The version string exists so the conformance driver can pin it.
|
|
47
|
+
* Publishing waits on two things — a public parity report naming what each
|
|
48
|
+
* implementation does not yet pass, and a green, merge-blocking TypeScript conformance
|
|
49
|
+
* driver — and a `prepack` guard enforces the wait rather than documenting it. See the
|
|
50
|
+
* package README.
|
|
51
|
+
*
|
|
52
|
+
* @packageDocumentation
|
|
53
|
+
*/
|
|
54
|
+
/** The version of this package. Not published to npm at this version. */
|
|
55
|
+
export const CORE_VERSION = "0.1.0-alpha.0";
|
|
56
|
+
/**
|
|
57
|
+
* The protocol tag the wire types are pinned to, re-exported from
|
|
58
|
+
* `@affiant/contract` so a host that only depends on the gate can still assert
|
|
59
|
+
* which rulebook tag it is speaking.
|
|
60
|
+
*/
|
|
61
|
+
export { PROTOCOL_VERSION } from "@affiant/contract";
|
|
62
|
+
// -------------------------------------------------------------------- errors
|
|
63
|
+
export { AffiantError, ERROR_CODES, ErrorCode, isAffiantError, isErrorCode } from "./errors.js";
|
|
64
|
+
// ----------------------------------------------------------------- telemetry
|
|
65
|
+
export { isTelemetryKey, noopTelemetry, TELEMETRY_KEYS, TELEMETRY_REGISTRY_VERSION, } from "./telemetry.js";
|
|
66
|
+
// model
|
|
67
|
+
// ---------------------------------------------------------------------------
|
|
68
|
+
// Added by pull request C2 (`core/model`). Kept as one block so the pull requests
|
|
69
|
+
// that follow can append their own without fighting over this file.
|
|
70
|
+
export { AFFIDAVIT_FIELD_KINDS, buildAffidavit, computeConfidence, fromWire, isJsonValue, isMoney, toWire, wireCarryOf, withConfidence, } from "./model/affidavit.js";
|
|
71
|
+
export { amendmentTag, applyAmendments, hasAmendment, resolveAmendments, } from "./model/amendments.js";
|
|
72
|
+
export { BINDING_KINDS, chainOf, determinismRank, emptyTag, isBound, isHonourable, merge, mintConversation, mintInference, mintInferred, mintTag, PROVENANCE_LADDER, requiresBinding, supersede, tagsOf, } from "./model/provenance.js";
|
|
73
|
+
// end model
|
|
74
|
+
// ---------------------------------------------------------------------------
|
|
75
|
+
// --------------------------------------------------------------------- ports
|
|
76
|
+
export { defaultClock } from "./ports.js";
|
|
77
|
+
// --------------------------------------------------------------------- docket
|
|
78
|
+
export { BLOCKED_CODES, DOCKET_STATUSES, EXECUTION_OUTCOMES, isTerminal, newEntry, readStatus, REQUIREMENT_KINDS, } from "./docket/entry.js";
|
|
79
|
+
export { compareFilingOrder, instantMs, isDue, remainingMs, requireInstant, } from "./docket/expiry.js";
|
|
80
|
+
// canonical
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
// Added by pull request C3 (`core/canonical`). `Money` and `isMoney` are exported
|
|
83
|
+
// from the model block above, which sources them from `./model/money.js` — one
|
|
84
|
+
// definition, reachable by the path a caller expects.
|
|
85
|
+
export { applyAmendmentsForCanonical, canonicalHash, canonicalHashEntry, canonicalize, canonicalizeEntry, canonicalJson, canonicalString, canonicalStringEntry, sha256Hex, swornAffidavitOf, } from "./model/canonical.js";
|
|
86
|
+
export { assertMoney, MONEY_AMOUNT_PATTERN, MONEY_CURRENCY_PATTERN, moneyScaleOk, parseMoney, } from "./model/money.js";
|
|
87
|
+
// end canonical
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
// ---------------------------------------------------------------------------
|
|
90
|
+
// gate
|
|
91
|
+
// ---------------------------------------------------------------------------
|
|
92
|
+
// Added by pull request C5 (`core/pipeline`). `createGate` is the whole of the
|
|
93
|
+
// host-facing surface; everything else here is a type a host needs to write a
|
|
94
|
+
// policy, a tool definition or a card renderer against.
|
|
95
|
+
export { createGate } from "./gate/gate.js";
|
|
96
|
+
// decisions
|
|
97
|
+
// ---------------------------------------------------------------------------
|
|
98
|
+
// Added by pull request C6 (`core/decide`). The three functions are the same ones
|
|
99
|
+
// `Gate` exposes as methods; they are exported so a host can call the decision path
|
|
100
|
+
// with its own assembled dependencies, and so a conformance driver can reach them
|
|
101
|
+
// without building a gate.
|
|
102
|
+
export { attestorOf, decide, markExecuted, resubmit } from "./gate/decide.js";
|
|
103
|
+
// end decisions
|
|
104
|
+
// ---------------------------------------------------------------------------
|
|
105
|
+
export { emptyMandatoryFields, evaluatePolicies, unboundDeclaredInput } from "./gate/policy.js";
|
|
106
|
+
export { assessCoverage, coverageRefusedMarker, createCoverageRegistry, declareUncovered, isUncoveredCategory, UNCOVERED_CATEGORIES, } from "./gate/coverage.js";
|
|
107
|
+
export { deriveEntryId, runPipeline } from "./gate/pipeline.js";
|
|
108
|
+
export { wrapTool } from "./gate/wrap.js";
|
|
109
|
+
// end gate
|
|
110
|
+
// ---------------------------------------------------------------------------
|
|
111
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,yEAAyE;AACzE,MAAM,CAAC,MAAM,YAAY,GAAG,eAAe,CAAC;AAE5C;;;;GAIG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAMrD,8EAA8E;AAE9E,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGhG,8EAA8E;AAE9E,OAAO,EACL,cAAc,EACd,aAAa,EACb,cAAc,EACd,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AASxB,QAAQ;AACR,8EAA8E;AAC9E,kFAAkF;AAClF,oEAAoE;AAEpE,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,OAAO,EACP,MAAM,EACN,WAAW,EACX,cAAc,GACf,MAAM,sBAAsB,CAAC;AA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