@sponsio/sdk 0.1.0-alpha.3 → 0.2.0-alpha.10
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/bin/sponsio.cjs +11 -0
- package/contracts/benchmark/agentdojo.yaml +551 -0
- package/contracts/benchmark/odcv_bench.yaml +393 -0
- package/contracts/benchmark/redcode_exec.yaml +488 -0
- package/contracts/benchmark/swebench.yaml +176 -0
- package/contracts/benchmark/tau2_bench.yaml +984 -0
- package/contracts/capability/credentials.yaml +8 -8
- package/contracts/capability/database.yaml +6 -6
- package/contracts/capability/destructive.yaml +213 -0
- package/contracts/capability/factual-claims.yaml +79 -0
- package/contracts/capability/filesystem-strict.yaml +4 -4
- package/contracts/capability/filesystem.yaml +9 -9
- package/contracts/capability/host-config-integrity.yaml +318 -0
- package/contracts/capability/self-modify.yaml +260 -9
- package/contracts/capability/shell.yaml +43 -41
- package/contracts/capability/subagent.yaml +5 -5
- package/contracts/incident/claude-code-secret-bypass.yaml +57 -26
- package/contracts/incident/cursor-railway-wipe.yaml +63 -7
- package/contracts/incident/mcp-composition.yaml +12 -12
- package/contracts/incident/openclaw.yaml +47 -92
- package/contracts/incident/subagent-escape.yaml +4 -4
- package/contracts/premium/.gitkeep +5 -6
- package/dist/cli/check.d.ts +2 -0
- package/dist/cli/check.d.ts.map +1 -0
- package/dist/cli/check.js +283 -0
- package/dist/cli/check.js.map +1 -0
- package/dist/cli/cli.d.ts +25 -0
- package/dist/cli/cli.d.ts.map +1 -0
- package/dist/cli/cli.js +491 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/config.d.ts +88 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/config.js +243 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/demo.d.ts +12 -0
- package/dist/cli/demo.d.ts.map +1 -0
- package/dist/cli/demo.js +350 -0
- package/dist/cli/demo.js.map +1 -0
- package/dist/cli/doctor.d.ts +11 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +201 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/eval.d.ts +2 -0
- package/dist/cli/eval.d.ts.map +1 -0
- package/dist/cli/eval.js +361 -0
- package/dist/cli/eval.js.map +1 -0
- package/dist/cli/explain.d.ts +2 -0
- package/dist/cli/explain.d.ts.map +1 -0
- package/dist/cli/explain.js +266 -0
- package/dist/cli/explain.js.map +1 -0
- package/dist/cli/export-sessions.d.ts +2 -0
- package/dist/cli/export-sessions.d.ts.map +1 -0
- package/dist/cli/export-sessions.js +182 -0
- package/dist/cli/export-sessions.js.map +1 -0
- package/dist/cli/export.d.ts +2 -0
- package/dist/cli/export.d.ts.map +1 -0
- package/dist/cli/export.js +222 -0
- package/dist/cli/export.js.map +1 -0
- package/dist/cli/extractors/common.d.ts +27 -0
- package/dist/cli/extractors/common.d.ts.map +1 -0
- package/dist/cli/extractors/common.js +107 -0
- package/dist/cli/extractors/common.js.map +1 -0
- package/dist/cli/extractors/generic.d.ts +37 -0
- package/dist/cli/extractors/generic.d.ts.map +1 -0
- package/dist/cli/extractors/generic.js +185 -0
- package/dist/cli/extractors/generic.js.map +1 -0
- package/dist/cli/extractors/langchain.d.ts +18 -0
- package/dist/cli/extractors/langchain.d.ts.map +1 -0
- package/dist/cli/extractors/langchain.js +86 -0
- package/dist/cli/extractors/langchain.js.map +1 -0
- package/dist/cli/extractors/vercel.d.ts +17 -0
- package/dist/cli/extractors/vercel.d.ts.map +1 -0
- package/dist/cli/extractors/vercel.js +46 -0
- package/dist/cli/extractors/vercel.js.map +1 -0
- package/dist/cli/index.d.ts +38 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +146 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/init.d.ts +2 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +177 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/mode.d.ts +2 -0
- package/dist/cli/mode.d.ts.map +1 -0
- package/dist/cli/mode.js +71 -0
- package/dist/cli/mode.js.map +1 -0
- package/dist/cli/onboard.d.ts +88 -0
- package/dist/cli/onboard.d.ts.map +1 -0
- package/dist/cli/onboard.js +758 -0
- package/dist/cli/onboard.js.map +1 -0
- package/dist/cli/otlp.d.ts +27 -0
- package/dist/cli/otlp.d.ts.map +1 -0
- package/dist/cli/otlp.js +79 -0
- package/dist/cli/otlp.js.map +1 -0
- package/dist/cli/package.json +1 -0
- package/dist/cli/packs.d.ts +16 -0
- package/dist/cli/packs.d.ts.map +1 -0
- package/dist/cli/packs.js +190 -0
- package/dist/cli/packs.js.map +1 -0
- package/dist/cli/patterns.d.ts +16 -0
- package/dist/cli/patterns.d.ts.map +1 -0
- package/dist/cli/patterns.js +136 -0
- package/dist/cli/patterns.js.map +1 -0
- package/dist/cli/prompt.d.ts +2 -0
- package/dist/cli/prompt.d.ts.map +1 -0
- package/dist/cli/prompt.js +54 -0
- package/dist/cli/prompt.js.map +1 -0
- package/dist/cli/replay.d.ts +2 -0
- package/dist/cli/replay.d.ts.map +1 -0
- package/dist/cli/replay.js +196 -0
- package/dist/cli/replay.js.map +1 -0
- package/dist/cli/report.d.ts +57 -0
- package/dist/cli/report.d.ts.map +1 -0
- package/dist/cli/report.js +298 -0
- package/dist/cli/report.js.map +1 -0
- package/dist/cli/scan.d.ts +2 -0
- package/dist/cli/scan.d.ts.map +1 -0
- package/dist/cli/scan.js +172 -0
- package/dist/cli/scan.js.map +1 -0
- package/dist/cli/skill.d.ts +15 -0
- package/dist/cli/skill.d.ts.map +1 -0
- package/dist/cli/skill.js +131 -0
- package/dist/cli/skill.js.map +1 -0
- package/dist/cli/tokens.d.ts +31 -0
- package/dist/cli/tokens.d.ts.map +1 -0
- package/dist/cli/tokens.js +73 -0
- package/dist/cli/tokens.js.map +1 -0
- package/dist/cli/types.d.ts +46 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/types.js +3 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli/validate.d.ts +19 -0
- package/dist/cli/validate.d.ts.map +1 -0
- package/dist/cli/validate.js +205 -0
- package/dist/cli/validate.js.map +1 -0
- package/dist/cli/zod.d.ts +36 -0
- package/dist/cli/zod.d.ts.map +1 -0
- package/dist/cli/zod.js +226 -0
- package/dist/cli/zod.js.map +1 -0
- package/dist/cloud/client.d.ts +76 -0
- package/dist/cloud/client.d.ts.map +1 -0
- package/dist/cloud/client.js +204 -0
- package/dist/cloud/client.js.map +1 -0
- package/dist/cloud/evidence.d.ts +108 -0
- package/dist/cloud/evidence.d.ts.map +1 -0
- package/dist/cloud/evidence.js +184 -0
- package/dist/cloud/evidence.js.map +1 -0
- package/dist/cloud/privacy.d.ts +67 -0
- package/dist/cloud/privacy.d.ts.map +1 -0
- package/dist/cloud/privacy.js +170 -0
- package/dist/cloud/privacy.js.map +1 -0
- package/dist/cloud/view-model.d.ts +49 -0
- package/dist/cloud/view-model.d.ts.map +1 -0
- package/dist/cloud/view-model.js +172 -0
- package/dist/cloud/view-model.js.map +1 -0
- package/dist/contract.d.ts +13 -13
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +21 -21
- package/dist/contract.js.map +1 -1
- package/dist/core/config-loader.d.ts +1 -1
- package/dist/core/config-loader.d.ts.map +1 -1
- package/dist/core/config-loader.js +116 -26
- package/dist/core/config-loader.js.map +1 -1
- package/dist/core/evaluator.d.ts +11 -1
- package/dist/core/evaluator.d.ts.map +1 -1
- package/dist/core/evaluator.js +275 -13
- package/dist/core/evaluator.js.map +1 -1
- package/dist/core/formula.d.ts +76 -17
- package/dist/core/formula.d.ts.map +1 -1
- package/dist/core/formula.js +95 -1
- package/dist/core/formula.js.map +1 -1
- package/dist/core/grounding.d.ts +86 -3
- package/dist/core/grounding.d.ts.map +1 -1
- package/dist/core/grounding.js +485 -143
- package/dist/core/grounding.js.map +1 -1
- package/dist/core/nl-parser.d.ts +2 -2
- package/dist/core/nl-parser.d.ts.map +1 -1
- package/dist/core/nl-parser.js +690 -42
- package/dist/core/nl-parser.js.map +1 -1
- package/dist/core/pack-loader.d.ts.map +1 -1
- package/dist/core/pack-loader.js +14 -2
- package/dist/core/pack-loader.js.map +1 -1
- package/dist/core/parser.d.ts.map +1 -1
- package/dist/core/parser.js +30 -1
- package/dist/core/parser.js.map +1 -1
- package/dist/core/pattern-factory.d.ts +4 -4
- package/dist/core/pattern-factory.d.ts.map +1 -1
- package/dist/core/pattern-factory.js +59 -4
- package/dist/core/pattern-factory.js.map +1 -1
- package/dist/core/patterns.d.ts +196 -5
- package/dist/core/patterns.d.ts.map +1 -1
- package/dist/core/patterns.js +400 -13
- package/dist/core/patterns.js.map +1 -1
- package/dist/core/session-log.d.ts.map +1 -1
- package/dist/core/session-log.js +20 -1
- package/dist/core/session-log.js.map +1 -1
- package/dist/core/spans.d.ts +1 -1
- package/dist/core/spans.d.ts.map +1 -1
- package/dist/core/spans.js.map +1 -1
- package/dist/core/sto.d.ts +30 -66
- package/dist/core/sto.d.ts.map +1 -1
- package/dist/core/sto.js +39 -100
- package/dist/core/sto.js.map +1 -1
- package/dist/core/tool-names.d.ts +59 -0
- package/dist/core/tool-names.d.ts.map +1 -0
- package/dist/core/tool-names.js +128 -0
- package/dist/core/tool-names.js.map +1 -0
- package/dist/index.d.ts +227 -33
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +539 -152
- package/dist/index.js.map +1 -1
- package/dist/integrations/claude-agent.d.ts +5 -0
- package/dist/integrations/claude-agent.d.ts.map +1 -1
- package/dist/integrations/claude-agent.js +42 -13
- package/dist/integrations/claude-agent.js.map +1 -1
- package/dist/integrations/google-adk.d.ts +5 -3
- package/dist/integrations/google-adk.d.ts.map +1 -1
- package/dist/integrations/google-adk.js +9 -5
- package/dist/integrations/google-adk.js.map +1 -1
- package/dist/integrations/langchain.d.ts +7 -0
- package/dist/integrations/langchain.d.ts.map +1 -1
- package/dist/integrations/langchain.js +21 -3
- package/dist/integrations/langchain.js.map +1 -1
- package/dist/integrations/openai-agents.d.ts +22 -10
- package/dist/integrations/openai-agents.d.ts.map +1 -1
- package/dist/integrations/openai-agents.js +57 -16
- package/dist/integrations/openai-agents.js.map +1 -1
- package/dist/integrations/openai.d.ts +11 -0
- package/dist/integrations/openai.d.ts.map +1 -1
- package/dist/integrations/openai.js +130 -48
- package/dist/integrations/openai.js.map +1 -1
- package/dist/integrations/vercel-ai.d.ts +20 -9
- package/dist/integrations/vercel-ai.d.ts.map +1 -1
- package/dist/integrations/vercel-ai.js +131 -32
- package/dist/integrations/vercel-ai.js.map +1 -1
- package/dist/render/tokens.d.ts.map +1 -1
- package/dist/render/tokens.js +1 -0
- package/dist/render/tokens.js.map +1 -1
- package/package.json +41 -9
- package/prompts/onboard.md +259 -0
- package/prompts/scan.md +123 -0
- package/skills/SKILL.md +432 -0
- package/contracts/core/llm_safety.yaml +0 -130
package/dist/core/patterns.d.ts
CHANGED
|
@@ -17,19 +17,79 @@
|
|
|
17
17
|
* Workflow hygiene (6): dryRunBeforeCommit, backupBeforeDestructive,
|
|
18
18
|
* auditAfter, approvalFreshness, sanitizedBeforeSink, duplicateCallLimit
|
|
19
19
|
*/
|
|
20
|
-
import { Formula } from "./formula.js";
|
|
20
|
+
import { Formula, Atom } from "./formula.js";
|
|
21
21
|
export interface DetFormula {
|
|
22
22
|
formula: Formula;
|
|
23
23
|
desc: string;
|
|
24
24
|
patternName: string;
|
|
25
|
+
/**
|
|
26
|
+
* What this rule was built from, mirroring Python's ``DetFormula.args``.
|
|
27
|
+
*
|
|
28
|
+
* The name alone does not identify a rule: two customers can both hold
|
|
29
|
+
* `rate_limit` and mean different limits on different tools. The cloud
|
|
30
|
+
* groups findings by (pattern, args) and derives a stable finding id
|
|
31
|
+
* from them, so a violation uploaded without these carries only its
|
|
32
|
+
* English sentence — and a rule reworded loses its own history.
|
|
33
|
+
* Undefined only on formulas built by hand rather than by a factory.
|
|
34
|
+
*
|
|
35
|
+
* ``Atom`` is in the union because ``workflowStep`` takes two of them,
|
|
36
|
+
* as it does in Python. That one is not reachable from the DSL and its
|
|
37
|
+
* args do not serialise to anything a reader wants; every other factory
|
|
38
|
+
* stores the strings and numbers it was called with.
|
|
39
|
+
*/
|
|
40
|
+
args?: (string | number | string[] | Atom | undefined)[];
|
|
25
41
|
liveness: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Per-contract enforcement mode: `enforce` | `observe`.
|
|
44
|
+
*
|
|
45
|
+
* Overrides the engine's global mode for this contract alone —
|
|
46
|
+
* mirrors Python's `ContractEntry.mode`. `undefined` means "no
|
|
47
|
+
* opinion" and the global mode applies; that distinction matters,
|
|
48
|
+
* since defaulting to `observe` here would silently downgrade every
|
|
49
|
+
* contract that simply did not mention a mode.
|
|
50
|
+
*/
|
|
51
|
+
mode?: "enforce" | "observe";
|
|
52
|
+
/**
|
|
53
|
+
* What the runtime does when this formula is violated, mirroring the
|
|
54
|
+
* strategy Python bundles onto its own `DetFormula`.
|
|
55
|
+
*
|
|
56
|
+
* `undefined` means `block`, which is what every pattern but one
|
|
57
|
+
* wants. `redirect` names a substitute in `safeName`: the original
|
|
58
|
+
* call must not run, and an adapter that can dispatch the substitute
|
|
59
|
+
* should. `escalate` hands the decision to a human.
|
|
60
|
+
*
|
|
61
|
+
* The formula alone cannot carry this. `redirect_to_safe` compiles to
|
|
62
|
+
* `G(!called(unsafe))`, which is indistinguishable from a plain ban,
|
|
63
|
+
* so a runtime reading only the formula turns every redirect into a
|
|
64
|
+
* block and loses the substitute.
|
|
65
|
+
*/
|
|
66
|
+
strategy?: "block" | "redirect" | "escalate";
|
|
67
|
+
/** The tool to call instead, when `strategy` is `redirect`. */
|
|
68
|
+
safeName?: string;
|
|
26
69
|
}
|
|
27
|
-
export interface
|
|
70
|
+
export interface AssumeGuaranteePair {
|
|
28
71
|
assumption: DetFormula;
|
|
29
|
-
|
|
72
|
+
guarantee: DetFormula;
|
|
30
73
|
}
|
|
31
74
|
export declare function mustPrecede(before: string, after: string): DetFormula;
|
|
32
75
|
export declare function alwaysFollowedBy(trigger: string, response: string): DetFormula;
|
|
76
|
+
/**
|
|
77
|
+
* Prescriptive next-step obligation: ``G(trigger -> X(next_action))``.
|
|
78
|
+
*
|
|
79
|
+
* When ``trigger`` holds at the current event, the agent must satisfy
|
|
80
|
+
* ``next_action`` at the very next event. Prescriptive counterpart to
|
|
81
|
+
* the block-style patterns (``never_together``, ``arg_blacklist``):
|
|
82
|
+
* instead of "you must not do X", a workflow_step says "you must do X
|
|
83
|
+
* next".
|
|
84
|
+
*
|
|
85
|
+
* Both arguments are arbitrary atoms (called(...), ctx(k, v),
|
|
86
|
+
* arg_field_has(...), etc.), so the same factory covers tool ordering,
|
|
87
|
+
* ctx-driven remediation, and arg-conditional follow-ups.
|
|
88
|
+
*
|
|
89
|
+
* NOT marked liveness: X is one-step bounded and the runtime can decide
|
|
90
|
+
* the obligation after a single event, unlike F.
|
|
91
|
+
*/
|
|
92
|
+
export declare function workflowStep(trigger: Atom, nextAction: Atom, desc?: string): DetFormula;
|
|
33
93
|
export declare function noReversal(commitment: string, contradiction: string): DetFormula;
|
|
34
94
|
export declare function requiresPermission(tool: string, permission: string): DetFormula;
|
|
35
95
|
export declare function noDataLeak(source: string, external: string): DetFormula;
|
|
@@ -54,14 +114,145 @@ export declare function scopeLimit(tool: string, allowedPaths: string[]): DetFor
|
|
|
54
114
|
export declare function argLengthLimit(tool: string, param: string, maxChars: number): DetFormula;
|
|
55
115
|
export declare function dataIntact(boundTool: string, originalPaths: string[]): DetFormula;
|
|
56
116
|
export declare function destructiveActionGate(tool: string, approverRole?: string): DetFormula;
|
|
57
|
-
export declare function untrustedSourceGate(source: string, sink: string, confirm?: string):
|
|
117
|
+
export declare function untrustedSourceGate(source: string, sink: string, confirm?: string): AssumeGuaranteePair;
|
|
58
118
|
export declare function requiredStepsCompletion(trigger: string, steps: string[]): DetFormula;
|
|
59
119
|
export declare function toolAllowlist(allowedTools: string[]): DetFormula;
|
|
120
|
+
/**
|
|
121
|
+
* Substitute a forbidden tool call with a pre-approved safe one.
|
|
122
|
+
*
|
|
123
|
+
* Parity with Python ``sponsio.patterns.library.redirect_to_safe``:
|
|
124
|
+
* compiles to ``G(Not(called(unsafe)))``, so any call to ``unsafe`` is
|
|
125
|
+
* a violation.
|
|
126
|
+
*
|
|
127
|
+
* **Important runtime caveat.** The TS SDK is currently det-only and
|
|
128
|
+
* has no strategy / dispatch system. The formula side of
|
|
129
|
+
* ``redirectToSafe`` works here (a violation IS surfaced), but the TS
|
|
130
|
+
* SDK does NOT yet do the Python-side trick of bundling a
|
|
131
|
+
* ``RedirectToSafe`` strategy on the formula and having adapter
|
|
132
|
+
* ``wrap()`` paths substitute the call. The runtime outcome on TS is
|
|
133
|
+
* functionally a block: the unsafe tool is rejected, and the user's
|
|
134
|
+
* application loop has to decide whether to dispatch the safe
|
|
135
|
+
* substitute manually. Full strategy / dispatch parity is tracked as
|
|
136
|
+
* a separate work item. Users wiring redirect-style contracts who
|
|
137
|
+
* need transparent substitution should stay on the Python SDK
|
|
138
|
+
* (LangGraph adapter) until the TS strategy port lands.
|
|
139
|
+
*/
|
|
140
|
+
/**
|
|
141
|
+
* Every emitted claim of this predicate must verify as PASS.
|
|
142
|
+
*
|
|
143
|
+
* Compiles to `G(claim_emitted(pred) -> evidence_verdict(pred, PASS))`.
|
|
144
|
+
* Both atoms are grounded from the same `evidence` event, so the
|
|
145
|
+
* implication is decided at the timestep the verdict lands: a claim
|
|
146
|
+
* whose verdict is anything but PASS (MISMATCH, UNDERDETERMINED,
|
|
147
|
+
* NO_EVIDENCE, STALE, SOURCE_UNAVAILABLE, EXTRACTION_AMBIGUOUS)
|
|
148
|
+
* violates immediately.
|
|
149
|
+
*
|
|
150
|
+
* Parity with `sponsio.patterns.library.claim_requires_evidence`.
|
|
151
|
+
*/
|
|
152
|
+
export declare function claimRequiresEvidence(pred: string, desc?: string): DetFormula;
|
|
153
|
+
/**
|
|
154
|
+
* An UNDERDETERMINED verdict must resolve to a clarify action.
|
|
155
|
+
*
|
|
156
|
+
* Compiles to `G(evidence_verdict(pred, UNDERDETERMINED) ->
|
|
157
|
+
* evidence_action(pred, clarify))`.
|
|
158
|
+
*
|
|
159
|
+
* Guards the policy wiring rather than the claim itself: when the
|
|
160
|
+
* evidence was ambiguous, the recorded action on that same event must be
|
|
161
|
+
* `clarify`. A project override that quietly releases or hard-blocks an
|
|
162
|
+
* ambiguous claim trips this contract.
|
|
163
|
+
*
|
|
164
|
+
* Parity with `sponsio.patterns.library.underdetermined_must_clarify`.
|
|
165
|
+
*/
|
|
166
|
+
export declare function underdeterminedMustClarify(pred: string, desc?: string): DetFormula;
|
|
167
|
+
export declare function redirectToSafe(unsafe: string, safe: string): DetFormula;
|
|
168
|
+
/**
|
|
169
|
+
* Recursive ``rm`` in any spelling: ``rm -rf``, ``rm -fr``, ``rm -Rf``,
|
|
170
|
+
* ``rm -r``, ``rm -f -r``, ``rm --recursive --force``, ``rm -v --recursive``.
|
|
171
|
+
* ``count_with`` is a regex over the serialized args, so a literal
|
|
172
|
+
* ``"rm -rf"`` only caught that one spelling. Mirrors
|
|
173
|
+
* ``RM_RECURSIVE_PATTERN`` in ``sponsio/patterns/library.py``; keep the
|
|
174
|
+
* two in sync.
|
|
175
|
+
*/
|
|
176
|
+
export declare const RM_RECURSIVE_PATTERN = "\\brm(?:\\s+(?:-[a-zA-Z]+|--[a-z-]+))*\\s+(?:-[a-zA-Z]*[rR][a-zA-Z]*|--recursive)(?=\\s|$)";
|
|
60
177
|
export declare function dangerousBashCommands(forbidden?: string[]): DetFormula;
|
|
61
178
|
export declare function dangerousSqlVerbs(tool?: string, forbidden?: string[]): DetFormula;
|
|
62
179
|
export declare function irreversibleOnce(action: string): DetFormula;
|
|
63
|
-
export declare function confirmAfterSource(source: string, action: string):
|
|
180
|
+
export declare function confirmAfterSource(source: string, action: string): AssumeGuaranteePair;
|
|
64
181
|
export declare function tokenBudget(maxTokens: number, scope?: string): DetFormula;
|
|
65
182
|
export declare function argValueRange(tool: string, field: string, minVal?: number, maxVal?: number): DetFormula;
|
|
66
183
|
export declare function delegationDepthLimit(maxDepth: number): DetFormula;
|
|
184
|
+
/**
|
|
185
|
+
* Response length must stay within the given word / character budget.
|
|
186
|
+
*
|
|
187
|
+
* Grounded against ``response_words`` / ``response_chars`` populated on
|
|
188
|
+
* ``llm_response`` events with content. At non-response events both
|
|
189
|
+
* default to 0, so the constraint is vacuously satisfied.
|
|
190
|
+
*/
|
|
191
|
+
export declare function maxLength(opts: {
|
|
192
|
+
maxWords?: number;
|
|
193
|
+
maxChars?: number;
|
|
194
|
+
desc?: string;
|
|
195
|
+
}): DetFormula;
|
|
196
|
+
/**
|
|
197
|
+
* Response must not contain regex-detectable PII (SSN, CC, email, phone).
|
|
198
|
+
*
|
|
199
|
+
* Uses the ``llm_said`` grounding atom — the selected default patterns
|
|
200
|
+
* are joined with ``|`` and matched against each ``llm_response`` event.
|
|
201
|
+
* For semantic PII detection (names, contextual identifiers) use a sto
|
|
202
|
+
* atom; this pattern only covers syntactic PII.
|
|
203
|
+
*/
|
|
204
|
+
export declare function noPii(fields?: string[]): DetFormula;
|
|
205
|
+
/**
|
|
206
|
+
* Response must not contain any of the given keywords. Keywords are
|
|
207
|
+
* escaped and joined into a word-boundary-anchored regex checked
|
|
208
|
+
* against each ``llm_response`` event via ``llm_said``.
|
|
209
|
+
*
|
|
210
|
+
* JS regex doesn't support inline ``(?i)`` flags — we lower-case the
|
|
211
|
+
* regex by expanding letters to ``[aA]``-style char classes, matching
|
|
212
|
+
* Python's ``(?i)`` semantics.
|
|
213
|
+
*/
|
|
214
|
+
export declare function noKeywords(words: string[]): DetFormula;
|
|
215
|
+
/**
|
|
216
|
+
* When ``tool`` is called, ``ctx[key]`` must be one of ``allowedValues``.
|
|
217
|
+
* Fail-closed: missing context evaluates to violation, so forgetting
|
|
218
|
+
* to wire ``observeContext`` is loud rather than silent.
|
|
219
|
+
*/
|
|
220
|
+
export declare function ctxRequired(tool: string, key: string, allowedValues: string[]): DetFormula;
|
|
221
|
+
/**
|
|
222
|
+
* When ``tool`` is called, ``ctx[key]`` must match the regex ``pattern``.
|
|
223
|
+
* Regex variant of :func:`ctxRequired` for cases where the allowed set
|
|
224
|
+
* is better expressed as a pattern than an exhaustive list.
|
|
225
|
+
*/
|
|
226
|
+
export declare function ctxMatchesRequired(tool: string, key: string, pattern: string): DetFormula;
|
|
227
|
+
/**
|
|
228
|
+
* Constrain how recently a predicate was last true. The argument is the
|
|
229
|
+
* grounded predicate key string (e.g. ``"called(refund)"`` or
|
|
230
|
+
* ``"ctx(approval.role, alice)"``) — same convention as Python's
|
|
231
|
+
* ``time_since`` factory.
|
|
232
|
+
*/
|
|
233
|
+
export declare function timeSince(predicateKey: string, maxSeconds: number): DetFormula;
|
|
234
|
+
/**
|
|
235
|
+
* Gate ``action`` on a recent allow-decision approval from ``role``.
|
|
236
|
+
*
|
|
237
|
+
* Compiles to::
|
|
238
|
+
* G(called(action) → (
|
|
239
|
+
* ctx_matches("approval.role", role)
|
|
240
|
+
* ∧ ctx_matches("approval.decision", "allow")
|
|
241
|
+
* ∧ time_since("ctx(approval.role, role)") ≤ maxSeconds
|
|
242
|
+
* ))
|
|
243
|
+
*
|
|
244
|
+
* Pairs with ``observeApproval({role, decision})`` on the integration
|
|
245
|
+
* side.
|
|
246
|
+
*/
|
|
247
|
+
export declare function approvalActive(action: string, role: string, maxSeconds: number): DetFormula;
|
|
248
|
+
/**
|
|
249
|
+
* @deprecated — use :func:`mutualExclusion` instead.
|
|
250
|
+
*
|
|
251
|
+
* In sequential traces, two tool calls are always at different
|
|
252
|
+
* timesteps, so the formula ``G(¬(called(A) ∧ called(B)))`` is
|
|
253
|
+
* trivially satisfied and can never detect violations. Delegates to
|
|
254
|
+
* ``mutualExclusion`` for correct behavior; kept so yaml authored
|
|
255
|
+
* against Python's deprecated entry still loads.
|
|
256
|
+
*/
|
|
257
|
+
export declare function neverTogether(a: string, b: string): DetFormula;
|
|
67
258
|
//# sourceMappingURL=patterns.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patterns.d.ts","sourceRoot":"","sources":["../../src/core/patterns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACL,OAAO,
|
|
1
|
+
{"version":3,"file":"patterns.d.ts","sourceRoot":"","sources":["../../src/core/patterns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACL,OAAO,EAAE,IAAI,EAGd,MAAM,cAAc,CAAC;AAGtB,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;;;;;;;;;;OAcG;IACH,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,CAAC;IACzD,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC7B;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,UAAU,CAAC;IAC7C,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,EAAE,UAAU,CAAC;CACvB;AAmHD,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,CAarE;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,CAU9E;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,IAAI,EACb,UAAU,EAAE,IAAI,EAChB,IAAI,CAAC,EAAE,MAAM,GACZ,UAAU,CA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