@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
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.runCheckCli = runCheckCli;
|
|
37
|
+
/**
|
|
38
|
+
* ``sponsio check`` — replay a trace file through the SDK and report
|
|
39
|
+
* which contracts would have blocked.
|
|
40
|
+
*
|
|
41
|
+
* Mirrors the Python ``sponsio check`` command. Loads a trace from
|
|
42
|
+
* disk, builds a ``Sponsio`` guard from inline NL contracts or a
|
|
43
|
+
* sponsio.yaml config, replays each event through ``guardBefore``,
|
|
44
|
+
* and prints a per-contract pass/fail summary.
|
|
45
|
+
*
|
|
46
|
+
* Supported trace formats (sniffed from content, like Python):
|
|
47
|
+
* - Native single-file JSON: ``{"events": [{"action": "...", "args": {...}}, ...]}``
|
|
48
|
+
* - Native event JSONL: one ``{"action": "...", "args": {...}}`` per line
|
|
49
|
+
* - Session-log JSONL: one MonitorEvent per line (decisions, not raw
|
|
50
|
+
* events — used to extract the underlying tool calls)
|
|
51
|
+
*
|
|
52
|
+
* OTLP/JSON is not yet supported; pipe through Python's
|
|
53
|
+
* ``sponsio export`` if you have OTLP traces.
|
|
54
|
+
*/
|
|
55
|
+
const node_fs_1 = require("node:fs");
|
|
56
|
+
const node_path_1 = require("node:path");
|
|
57
|
+
const yaml = __importStar(require("js-yaml"));
|
|
58
|
+
const otlp_1 = require("./otlp");
|
|
59
|
+
const HELP = "sponsio check — replay a trace file through the engine, report violations\n" +
|
|
60
|
+
"\n" +
|
|
61
|
+
"USAGE:\n" +
|
|
62
|
+
" sponsio check --trace <file> [contracts...] [options]\n" +
|
|
63
|
+
"\n" +
|
|
64
|
+
"OPTIONS:\n" +
|
|
65
|
+
" -t, --trace <file> Trace file (.json or .jsonl) — required\n" +
|
|
66
|
+
" -c, --config <file> sponsio.yaml; loads contracts + agent id\n" +
|
|
67
|
+
" -a, --agent <id> Agent id (with --config); defaults to single-agent\n" +
|
|
68
|
+
" --json Output as JSON\n" +
|
|
69
|
+
" -h, --help Show this help\n" +
|
|
70
|
+
"\n" +
|
|
71
|
+
"Pass either positional NL contract strings or --config, not both.\n" +
|
|
72
|
+
"\n" +
|
|
73
|
+
"EXAMPLES:\n" +
|
|
74
|
+
" sponsio check -t trace.json \"tool `A` must precede `B`\"\n" +
|
|
75
|
+
" sponsio check -t run.jsonl --config sponsio.yaml --agent bot\n" +
|
|
76
|
+
" sponsio check -t trace.json --config sponsio.yaml --json\n";
|
|
77
|
+
function sniffEvents(text, path) {
|
|
78
|
+
const trimmed = text.trimStart();
|
|
79
|
+
if (trimmed.startsWith("{")) {
|
|
80
|
+
let data;
|
|
81
|
+
try {
|
|
82
|
+
data = JSON.parse(text);
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
throw new Error(`[check] cannot parse ${path} as JSON: ${e.message}`);
|
|
86
|
+
}
|
|
87
|
+
if ((0, otlp_1.isOtlpPayload)(data)) {
|
|
88
|
+
return (0, otlp_1.extractOtlpEvents)(data);
|
|
89
|
+
}
|
|
90
|
+
if (data && typeof data === "object" && Array.isArray(data.events)) {
|
|
91
|
+
return (data.events).map(coerceEvent).filter(Boolean);
|
|
92
|
+
}
|
|
93
|
+
throw new Error(`[check] ${path}: expected {"events": [...]} or {"resourceSpans": [...]}`);
|
|
94
|
+
}
|
|
95
|
+
if (trimmed.startsWith("[")) {
|
|
96
|
+
let data;
|
|
97
|
+
try {
|
|
98
|
+
data = JSON.parse(text);
|
|
99
|
+
}
|
|
100
|
+
catch (e) {
|
|
101
|
+
throw new Error(`[check] cannot parse ${path} as JSON array: ${e.message}`);
|
|
102
|
+
}
|
|
103
|
+
if (!Array.isArray(data))
|
|
104
|
+
throw new Error(`[check] ${path}: expected JSON array`);
|
|
105
|
+
return data.map(coerceEvent).filter(Boolean);
|
|
106
|
+
}
|
|
107
|
+
// JSONL
|
|
108
|
+
const out = [];
|
|
109
|
+
for (const line of text.split(/\r?\n/)) {
|
|
110
|
+
if (!line.trim())
|
|
111
|
+
continue;
|
|
112
|
+
try {
|
|
113
|
+
const obj = JSON.parse(line);
|
|
114
|
+
const ev = coerceEvent(obj);
|
|
115
|
+
if (ev)
|
|
116
|
+
out.push(ev);
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
// skip malformed line
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return out;
|
|
123
|
+
}
|
|
124
|
+
function coerceEvent(raw) {
|
|
125
|
+
if (!raw || typeof raw !== "object")
|
|
126
|
+
return null;
|
|
127
|
+
const r = raw;
|
|
128
|
+
// Session-log shape: pipeline + result + action — extract tool from action.
|
|
129
|
+
// Native shape: action: <tool>, args: {...}
|
|
130
|
+
// ToolEvent (TS SDK) shape: tool: <name>, args: {...}
|
|
131
|
+
const tool = r.tool ?? r.action;
|
|
132
|
+
if (typeof tool !== "string")
|
|
133
|
+
return null;
|
|
134
|
+
const args = r.args ?? {};
|
|
135
|
+
return { tool, args };
|
|
136
|
+
}
|
|
137
|
+
async function loadGuard(opts) {
|
|
138
|
+
// Lazy require so the scanner CLI works even when @sponsio/sdk isn't
|
|
139
|
+
// installed in the user's project for non-check commands.
|
|
140
|
+
const mod = await Promise.resolve().then(() => __importStar(require("@sponsio/sdk")));
|
|
141
|
+
const Sponsio = mod.Sponsio;
|
|
142
|
+
if (!Sponsio)
|
|
143
|
+
throw new Error("[check] @sponsio/sdk does not export Sponsio — upgrade the SDK.");
|
|
144
|
+
const ctorOpts = {
|
|
145
|
+
mode: "enforce",
|
|
146
|
+
sessionLog: false,
|
|
147
|
+
};
|
|
148
|
+
if (opts.configPath) {
|
|
149
|
+
const cfgAbs = (0, node_path_1.resolve)(opts.configPath);
|
|
150
|
+
ctorOpts.config = cfgAbs;
|
|
151
|
+
if (opts.agentId) {
|
|
152
|
+
ctorOpts.agentId = opts.agentId;
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
// Auto-select when the yaml has exactly one agent — matches the
|
|
156
|
+
// Python `sponsio check` UX. Falls back to the SDK's default
|
|
157
|
+
// ("agent") if the yaml is missing or malformed.
|
|
158
|
+
try {
|
|
159
|
+
const data = yaml.load((0, node_fs_1.readFileSync)(cfgAbs, "utf-8"));
|
|
160
|
+
const agents = data?.agents;
|
|
161
|
+
const ids = agents ? Object.keys(agents) : [];
|
|
162
|
+
if (ids.length === 1)
|
|
163
|
+
ctorOpts.agentId = ids[0];
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
// ignore — let the SDK ctor surface the real error
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
ctorOpts.agentId = "check";
|
|
172
|
+
ctorOpts.contracts = opts.inline;
|
|
173
|
+
}
|
|
174
|
+
const guard = new Sponsio(ctorOpts);
|
|
175
|
+
return { guard, contractDescs: guard.contractDescs() };
|
|
176
|
+
}
|
|
177
|
+
async function runCheckCli(argv) {
|
|
178
|
+
let tracePath;
|
|
179
|
+
let configPath;
|
|
180
|
+
let agentId;
|
|
181
|
+
let asJson = false;
|
|
182
|
+
const inline = [];
|
|
183
|
+
for (let i = 0; i < argv.length; i++) {
|
|
184
|
+
const a = argv[i];
|
|
185
|
+
if (a === "-h" || a === "--help") {
|
|
186
|
+
process.stdout.write(HELP);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
if (a === "-t" || a === "--trace") {
|
|
190
|
+
tracePath = argv[++i];
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
if (a === "-c" || a === "--config") {
|
|
194
|
+
configPath = argv[++i];
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
if (a === "-a" || a === "--agent") {
|
|
198
|
+
agentId = argv[++i];
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
if (a === "--json") {
|
|
202
|
+
asJson = true;
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
if (a.startsWith("-")) {
|
|
206
|
+
process.stderr.write(`unknown flag: ${a}\n${HELP}`);
|
|
207
|
+
process.exit(2);
|
|
208
|
+
}
|
|
209
|
+
inline.push(a);
|
|
210
|
+
}
|
|
211
|
+
if (!tracePath) {
|
|
212
|
+
process.stderr.write(`Error: --trace is required\n\n${HELP}`);
|
|
213
|
+
process.exit(2);
|
|
214
|
+
}
|
|
215
|
+
if (configPath && inline.length > 0) {
|
|
216
|
+
process.stderr.write(`Error: cannot use both --config and positional contracts\n`);
|
|
217
|
+
process.exit(2);
|
|
218
|
+
}
|
|
219
|
+
if (!configPath && inline.length === 0) {
|
|
220
|
+
process.stderr.write(`Error: pass --config or at least one positional contract\n\n${HELP}`);
|
|
221
|
+
process.exit(2);
|
|
222
|
+
}
|
|
223
|
+
if (agentId && !configPath) {
|
|
224
|
+
process.stderr.write(`Error: --agent requires --config\n`);
|
|
225
|
+
process.exit(2);
|
|
226
|
+
}
|
|
227
|
+
if (!(0, node_fs_1.existsSync)((0, node_path_1.resolve)(tracePath))) {
|
|
228
|
+
process.stderr.write(`Error: trace file ${tracePath} does not exist\n`);
|
|
229
|
+
process.exit(1);
|
|
230
|
+
}
|
|
231
|
+
const text = (0, node_fs_1.readFileSync)((0, node_path_1.resolve)(tracePath), "utf-8");
|
|
232
|
+
const events = sniffEvents(text, tracePath);
|
|
233
|
+
if (events.length === 0) {
|
|
234
|
+
process.stderr.write(`Warning: trace is empty (no events extracted)\n`);
|
|
235
|
+
process.exit(0);
|
|
236
|
+
}
|
|
237
|
+
const { guard, contractDescs } = await loadGuard({ inline, configPath, agentId });
|
|
238
|
+
const stats = new Map();
|
|
239
|
+
for (const d of contractDescs)
|
|
240
|
+
stats.set(d, { desc: d, blockedCount: 0 });
|
|
241
|
+
let totalBlocks = 0;
|
|
242
|
+
for (let i = 0; i < events.length; i++) {
|
|
243
|
+
const ev = events[i];
|
|
244
|
+
const r = guard.guardBefore(ev.tool, ev.args ?? {});
|
|
245
|
+
if (r.blocked) {
|
|
246
|
+
totalBlocks++;
|
|
247
|
+
const descs = (r.violatedDescs ?? r.detViolations?.map((v) => v.desc) ?? []);
|
|
248
|
+
for (const d of descs) {
|
|
249
|
+
const s = stats.get(d) ?? { desc: d, blockedCount: 0 };
|
|
250
|
+
if (s.blockedCount === 0)
|
|
251
|
+
s.firstBlockAt = i;
|
|
252
|
+
s.blockedCount += 1;
|
|
253
|
+
stats.set(d, s);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
if (asJson) {
|
|
258
|
+
process.stdout.write(JSON.stringify({
|
|
259
|
+
trace: tracePath,
|
|
260
|
+
events: events.length,
|
|
261
|
+
totalBlocks,
|
|
262
|
+
perContract: Array.from(stats.values()),
|
|
263
|
+
}, null, 2) + "\n");
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
process.stdout.write(`Trace: ${tracePath}\n`);
|
|
267
|
+
process.stdout.write(`Events: ${events.length}\n`);
|
|
268
|
+
process.stdout.write(`Contracts: ${contractDescs.length}\n`);
|
|
269
|
+
process.stdout.write(`Blocks: ${totalBlocks}\n\n`);
|
|
270
|
+
if (stats.size === 0) {
|
|
271
|
+
process.stdout.write("(no contracts compiled)\n");
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
process.stdout.write(`Per-contract:\n`);
|
|
275
|
+
for (const s of stats.values()) {
|
|
276
|
+
const tag = s.blockedCount === 0 ? "\x1b[32mPASS\x1b[0m" : "\x1b[31mFAIL\x1b[0m";
|
|
277
|
+
process.stdout.write(` ${tag} ${s.desc.split("\n")[0]}\n`);
|
|
278
|
+
if (s.blockedCount > 0) {
|
|
279
|
+
process.stdout.write(` first block at event #${s.firstBlockAt}, total ${s.blockedCount}\n`);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
//# sourceMappingURL=check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/cli/check.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6JA,kCAoHC;AAjRD;;;;;;;;;;;;;;;;;GAiBG;AACH,qCAAmD;AACnD,yCAAoC;AACpC,8CAAgC;AAChC,iCAA0D;AAE1D,MAAM,IAAI,GACR,6EAA6E;IAC7E,IAAI;IACJ,UAAU;IACV,2DAA2D;IAC3D,IAAI;IACJ,YAAY;IACZ,oEAAoE;IACpE,qEAAqE;IACrE,+EAA+E;IAC/E,2CAA2C;IAC3C,2CAA2C;IAC3C,IAAI;IACJ,qEAAqE;IACrE,IAAI;IACJ,aAAa;IACb,+DAA+D;IAC/D,kEAAkE;IAClE,8DAA8D,CAAC;AAejE,SAAS,WAAW,CAAC,IAAY,EAAE,IAAY;IAC7C,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IACjC,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5B,IAAI,IAAa,CAAC;QAClB,IAAI,CAAC;YACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,wBAAwB,IAAI,aAAc,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;QACnF,CAAC;QACD,IAAI,IAAA,oBAAa,EAAC,IAAI,CAAC,EAAE,CAAC;YACxB,OAAO,IAAA,wBAAiB,EAAC,IAAI,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.json
|
|
9
|
+
* npx @sponsio/sdk --config sponsio.yaml
|
|
10
|
+
* npx @sponsio/sdk ./src --pretty
|
|
11
|
+
*
|
|
12
|
+
* Writes the OpenAI function-calling JSON inventory to stdout (or to
|
|
13
|
+
* ``--out <file>``) so you can pipe into ``sponsio scan`` on the
|
|
14
|
+
* Python side:
|
|
15
|
+
*
|
|
16
|
+
* npx @sponsio/sdk ./src > tools.json
|
|
17
|
+
* sponsio scan tools.json --out sponsio.yaml
|
|
18
|
+
*
|
|
19
|
+
* When ``--config sponsio.yaml`` is passed, the CLI also reads the
|
|
20
|
+
* ``scan:`` section (for defaults) and ``extractor:`` (for LLM
|
|
21
|
+
* passthrough in the output JSON, so the Python-side scan doesn't
|
|
22
|
+
* need ``--config`` a second time). CLI flags always win over YAML.
|
|
23
|
+
*/
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;GAqBG"}
|