raytrace-cli 0.11.1__py3-none-win_amd64.whl
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.
- raytrace/__init__.py +1 -0
- raytrace/__main__.py +33 -0
- raytrace/app/LICENSE +21 -0
- raytrace/app/README.md +599 -0
- raytrace/app/bin/raytrace.mjs +297 -0
- raytrace/app/dist/dashboard/assets/dm-sans-latin-400-normal-BwCSEQnW.woff +0 -0
- raytrace/app/dist/dashboard/assets/dm-sans-latin-400-normal-CW0RaeGs.woff2 +0 -0
- raytrace/app/dist/dashboard/assets/dm-sans-latin-500-normal-B9HHJjqV.woff2 +0 -0
- raytrace/app/dist/dashboard/assets/dm-sans-latin-500-normal-Dr3UlScf.woff +0 -0
- raytrace/app/dist/dashboard/assets/dm-sans-latin-600-normal-Aqo67rzb.woff2 +0 -0
- raytrace/app/dist/dashboard/assets/dm-sans-latin-600-normal-BmdmIIQ2.woff +0 -0
- raytrace/app/dist/dashboard/assets/dm-sans-latin-700-normal-CUSSCpQX.woff +0 -0
- raytrace/app/dist/dashboard/assets/dm-sans-latin-700-normal-DvUfVpUG.woff2 +0 -0
- raytrace/app/dist/dashboard/assets/dm-sans-latin-ext-400-normal-BjWJ59Pq.woff +0 -0
- raytrace/app/dist/dashboard/assets/dm-sans-latin-ext-400-normal-BtiwyxMk.woff2 +0 -0
- raytrace/app/dist/dashboard/assets/dm-sans-latin-ext-500-normal-BJfUCQsA.woff2 +0 -0
- raytrace/app/dist/dashboard/assets/dm-sans-latin-ext-500-normal-DR84L5F-.woff +0 -0
- raytrace/app/dist/dashboard/assets/dm-sans-latin-ext-600-normal-4vooXBpG.woff2 +0 -0
- raytrace/app/dist/dashboard/assets/dm-sans-latin-ext-600-normal-DRtaDpgU.woff +0 -0
- raytrace/app/dist/dashboard/assets/dm-sans-latin-ext-700-normal-BLI3TTWz.woff +0 -0
- raytrace/app/dist/dashboard/assets/dm-sans-latin-ext-700-normal-CJIcxD6K.woff2 +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-cyrillic-600-normal-CTOM6hUh.woff2 +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-cyrillic-600-normal-fLZuRloM.woff +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-cyrillic-ext-600-normal-9HEixskS.woff +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-cyrillic-ext-600-normal-V-xxqcpd.woff2 +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-latin-600-normal-DWFSQ4vo.woff +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-latin-ext-600-normal-D38SheWl.woff2 +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-latin-ext-600-normal-DmB0ttJJ.woff +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-vietnamese-600-normal-D2EvbN8M.woff2 +0 -0
- raytrace/app/dist/dashboard/assets/ibm-plex-mono-vietnamese-600-normal-iLQfcSjf.woff +0 -0
- raytrace/app/dist/dashboard/assets/index-DepcI8Fi.js +38 -0
- raytrace/app/dist/dashboard/assets/index-H97VLD5l.css +1 -0
- raytrace/app/dist/dashboard/favicon.svg +6 -0
- raytrace/app/dist/dashboard/index.html +15 -0
- raytrace/app/package.json +48 -0
- raytrace/app/proxy/agent-intent-schema.test.mjs +142 -0
- raytrace/app/proxy/call-assessment.mjs +385 -0
- raytrace/app/proxy/call-assessment.test.mjs +167 -0
- raytrace/app/proxy/call-category.mjs +461 -0
- raytrace/app/proxy/capture-health.mjs +30 -0
- raytrace/app/proxy/capture-health.test.mjs +44 -0
- raytrace/app/proxy/capture.mjs +38 -0
- raytrace/app/proxy/capture.test.mjs +49 -0
- raytrace/app/proxy/claude-code-adapter.mjs +301 -0
- raytrace/app/proxy/claude-code-hook.mjs +22 -0
- raytrace/app/proxy/codex-config.mjs +36 -0
- raytrace/app/proxy/codex.mjs +14 -0
- raytrace/app/proxy/evidence-schema.test.mjs +240 -0
- raytrace/app/proxy/evidence-store.mjs +993 -0
- raytrace/app/proxy/evidence-store.test.mjs +301 -0
- raytrace/app/proxy/exec-narrative.mjs +625 -0
- raytrace/app/proxy/exec-narrative.test.mjs +262 -0
- raytrace/app/proxy/execution-correlation.mjs +185 -0
- raytrace/app/proxy/execution-correlation.test.mjs +146 -0
- raytrace/app/proxy/execution-runner.mjs +89 -0
- raytrace/app/proxy/execution-runner.test.mjs +38 -0
- raytrace/app/proxy/experiment-engine.mjs +195 -0
- raytrace/app/proxy/experiment-engine.test.mjs +93 -0
- raytrace/app/proxy/explanations.mjs +36 -0
- raytrace/app/proxy/explanations.test.mjs +20 -0
- raytrace/app/proxy/failure-signature.mjs +56 -0
- raytrace/app/proxy/gvisor-forwarder.mjs +493 -0
- raytrace/app/proxy/gvisor-forwarder.test.mjs +433 -0
- raytrace/app/proxy/init-evidence-db.mjs +227 -0
- raytrace/app/proxy/local-sandboxes.mjs +94 -0
- raytrace/app/proxy/local-token.mjs +30 -0
- raytrace/app/proxy/playground-recovery.test.mjs +130 -0
- raytrace/app/proxy/playground.mjs +439 -0
- raytrace/app/proxy/prompt-context.mjs +278 -0
- raytrace/app/proxy/prompt-traces.mjs +40 -0
- raytrace/app/proxy/prompt-traces.test.mjs +32 -0
- raytrace/app/proxy/providers.mjs +65 -0
- raytrace/app/proxy/providers.test.mjs +76 -0
- raytrace/app/proxy/proxy.integration.test.mjs +135 -0
- raytrace/app/proxy/raytace-proxy.mjs +941 -0
- raytrace/app/proxy/request-metrics.mjs +13 -0
- raytrace/app/proxy/request-metrics.test.mjs +19 -0
- raytrace/app/proxy/request-policy.mjs +45 -0
- raytrace/app/proxy/request-policy.test.mjs +47 -0
- raytrace/app/proxy/run-recap.mjs +139 -0
- raytrace/app/proxy/runtime-attribution.mjs +110 -0
- raytrace/app/proxy/sandbox-bridge.mjs +49 -0
- raytrace/app/proxy/schema/EVIDENCE_DATABASE.md +276 -0
- raytrace/app/proxy/schema/agent_intent.sql +101 -0
- raytrace/app/proxy/schema/auxiliary.sql +90 -0
- raytrace/app/proxy/schema/capture_health.sql +14 -0
- raytrace/app/proxy/schema/classification.sql +89 -0
- raytrace/app/proxy/schema/file_context.sql +53 -0
- raytrace/app/proxy/schema/runtime_evidence.sql +201 -0
- raytrace/app/proxy/schema/search.sql +66 -0
- raytrace/app/proxy/schema/shared_storage.sql +21 -0
- raytrace/app/proxy/search.mjs +418 -0
- raytrace/app/proxy/search.test.mjs +161 -0
- raytrace/app/proxy/smoke.test.mjs +93 -0
- raytrace/app/proxy/step-attribution.mjs +380 -0
- raytrace/app/proxy/step-lab.mjs +78 -0
- raytrace/app/proxy/step-lab.test.mjs +38 -0
- raytrace/app/proxy/summaries.mjs +151 -0
- raytrace/app/proxy/summaries.test.mjs +69 -0
- raytrace/app/proxy/tool-metadata.mjs +111 -0
- raytrace/app/proxy/tool-metadata.test.mjs +38 -0
- raytrace/app/proxy/trace-view.mjs +324 -0
- raytrace/app/proxy/trace-view.test.mjs +92 -0
- raytrace/app/proxy/typesafe.mjs +63 -0
- raytrace/app/proxy/typesafe.test.mjs +39 -0
- raytrace/app/src/agents.mjs +7 -0
- raytrace/app/src/api.mjs +57 -0
- raytrace/app/src/auth.mjs +205 -0
- raytrace/app/src/beta.mjs +96 -0
- raytrace/app/src/claude-code.mjs +93 -0
- raytrace/app/src/commands.mjs +285 -0
- raytrace/app/src/config.mjs +49 -0
- raytrace/app/src/export.mjs +200 -0
- raytrace/app/src/lima.mjs +176 -0
- raytrace/app/src/local-sandbox.mjs +358 -0
- raytrace/app/src/mcp.mjs +688 -0
- raytrace/app/src/paths.mjs +33 -0
- raytrace/app/src/prompt.mjs +42 -0
- raytrace/app/src/proxy-process.mjs +143 -0
- raytrace/app/src/sandbox.mjs +306 -0
- raytrace/app/src/share.mjs +86 -0
- raytrace/app/src/terminal.mjs +68 -0
- raytrace/app/src/upload.mjs +198 -0
- raytrace/app/worker/sandbox/Dockerfile +8 -0
- raytrace/app/worker/sandbox/SYSCALL_CATALOG.md +197 -0
- raytrace/app/worker/sandbox/claude-hook.mjs +364 -0
- raytrace/app/worker/sandbox/collector.py +405 -0
- raytrace/app/worker/sandbox/dns_forwarder.py +255 -0
- raytrace/app/worker/sandbox/engine.py +940 -0
- raytrace/app/worker/sandbox/file_scan.py +491 -0
- raytrace/app/worker/sandbox/lima.yaml +29 -0
- raytrace/app/worker/sandbox/network.py +90 -0
- raytrace/app/worker/sandbox/projects.py +702 -0
- raytrace/app/worker/sandbox/setup.py +159 -0
- raytrace/app/worker/sandbox/syscall_catalog.sql +985 -0
- raytrace/app/worker/sandbox/transcript-delivery.test.mjs +153 -0
- raytrace/app/worker/sandbox/viewer.py +195 -0
- raytrace/node/LICENSE +2946 -0
- raytrace/node/node.exe +4 -0
- raytrace_cli-0.11.1.dist-info/LICENSE +21 -0
- raytrace_cli-0.11.1.dist-info/METADATA +42 -0
- raytrace_cli-0.11.1.dist-info/RECORD +165 -0
- raytrace_cli-0.11.1.dist-info/WHEEL +4 -0
- raytrace_cli-0.11.1.dist-info/entry_points.txt +2 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
-- Runtime evidence: schema definitions only. Load through init-evidence-db.mjs.
|
|
2
|
+
CREATE TABLE runtime_sandboxes (
|
|
3
|
+
id TEXT NOT NULL PRIMARY KEY,
|
|
4
|
+
external_container_id TEXT NOT NULL,
|
|
5
|
+
-- The sandbox manager's rtp-<id>: the same id the agent's session carries
|
|
6
|
+
-- (agent_sessions.external_session_id), which is how the two domains join.
|
|
7
|
+
project_id TEXT,
|
|
8
|
+
runtime_name TEXT NOT NULL,
|
|
9
|
+
-- Unknown until the runtime reports them; null rather than guessed.
|
|
10
|
+
runtime_version TEXT,
|
|
11
|
+
runtime_build_digest TEXT,
|
|
12
|
+
architecture TEXT CHECK (architecture IS NULL OR architecture IN ('aarch64','x86_64')),
|
|
13
|
+
started_at_ms INTEGER CHECK (started_at_ms IS NULL OR (typeof(started_at_ms) = 'integer')),
|
|
14
|
+
ended_at_ms INTEGER CHECK (ended_at_ms IS NULL OR (typeof(ended_at_ms) = 'integer')),
|
|
15
|
+
capture_config_json TEXT CHECK (capture_config_json IS NULL OR json_valid(capture_config_json)),
|
|
16
|
+
CHECK (started_at_ms IS NULL OR ended_at_ms IS NULL OR ended_at_ms >= started_at_ms)
|
|
17
|
+
);
|
|
18
|
+
CREATE TABLE runtime_processes (
|
|
19
|
+
id TEXT NOT NULL PRIMARY KEY,
|
|
20
|
+
sandbox_id TEXT NOT NULL REFERENCES runtime_sandboxes(id),
|
|
21
|
+
pid INTEGER NOT NULL CHECK (pid IS NULL OR (typeof(pid) = 'integer' AND pid >= 1)),
|
|
22
|
+
start_time_ns TEXT CHECK (start_time_ns IS NULL OR (start_time_ns = '0' OR (start_time_ns GLOB '[1-9]*' AND start_time_ns NOT GLOB '*[^0-9]*'))),
|
|
23
|
+
parent_process_id TEXT,
|
|
24
|
+
observed_ppid INTEGER CHECK (observed_ppid IS NULL OR (typeof(observed_ppid) = 'integer' AND observed_ppid >= 0)),
|
|
25
|
+
first_seen_ns TEXT NOT NULL CHECK (first_seen_ns IS NULL OR (first_seen_ns = '0' OR (first_seen_ns GLOB '[1-9]*' AND first_seen_ns NOT GLOB '*[^0-9]*'))),
|
|
26
|
+
exited_at_ns TEXT CHECK (exited_at_ns IS NULL OR (exited_at_ns = '0' OR (exited_at_ns GLOB '[1-9]*' AND exited_at_ns NOT GLOB '*[^0-9]*'))),
|
|
27
|
+
exit_code INTEGER CHECK (exit_code IS NULL OR (typeof(exit_code) = 'integer' AND exit_code >= 0)),
|
|
28
|
+
exit_signal INTEGER CHECK (exit_signal IS NULL OR (typeof(exit_signal) = 'integer' AND exit_signal >= 1)),
|
|
29
|
+
identity_basis TEXT NOT NULL CHECK (length(trim(identity_basis)) > 0),
|
|
30
|
+
-- first_seen_ns/exited_at_ns are the sandbox clock; these are the same
|
|
31
|
+
-- instants on the proxy's clock (offset measured when observed), so they
|
|
32
|
+
-- compare directly with agent_exchanges times.
|
|
33
|
+
first_seen_ms INTEGER CHECK (first_seen_ms IS NULL OR typeof(first_seen_ms) = 'integer'),
|
|
34
|
+
exited_at_ms INTEGER CHECK (exited_at_ms IS NULL OR typeof(exited_at_ms) = 'integer'),
|
|
35
|
+
-- Set when the evidence that would report this process's exit can no
|
|
36
|
+
-- longer arrive (collector disconnected, sandbox removed). Cleared if a
|
|
37
|
+
-- real exit arrives after all. Never implies failure.
|
|
38
|
+
evidence_lost TEXT,
|
|
39
|
+
UNIQUE(id, sandbox_id),
|
|
40
|
+
FOREIGN KEY(parent_process_id, sandbox_id) REFERENCES runtime_processes(id, sandbox_id),
|
|
41
|
+
CHECK (parent_process_id IS NULL OR parent_process_id != id),
|
|
42
|
+
CHECK (start_time_ns IS NULL OR (length(first_seen_ns) > length(start_time_ns) OR (length(first_seen_ns) = length(start_time_ns) AND first_seen_ns COLLATE BINARY >= start_time_ns COLLATE BINARY))),
|
|
43
|
+
CHECK (exited_at_ns IS NULL OR (length(exited_at_ns) > length(first_seen_ns) OR (length(exited_at_ns) = length(first_seen_ns) AND exited_at_ns COLLATE BINARY >= first_seen_ns COLLATE BINARY))),
|
|
44
|
+
CHECK (exit_code IS NULL OR exit_signal IS NULL),
|
|
45
|
+
CHECK ((exit_code IS NULL AND exit_signal IS NULL) OR exited_at_ns IS NOT NULL)
|
|
46
|
+
);
|
|
47
|
+
CREATE TABLE runtime_events (
|
|
48
|
+
id TEXT NOT NULL PRIMARY KEY,
|
|
49
|
+
sandbox_id TEXT REFERENCES runtime_sandboxes(id),
|
|
50
|
+
process_id TEXT,
|
|
51
|
+
stream_id TEXT NOT NULL,
|
|
52
|
+
stream_sequence INTEGER NOT NULL CHECK (stream_sequence IS NULL OR (typeof(stream_sequence) = 'integer' AND stream_sequence >= 0)),
|
|
53
|
+
event_kind TEXT NOT NULL CHECK (length(trim(event_kind)) > 0),
|
|
54
|
+
observed_at_ns TEXT CHECK (observed_at_ns IS NULL OR (observed_at_ns = '0' OR (observed_at_ns GLOB '[1-9]*' AND observed_at_ns NOT GLOB '*[^0-9]*'))),
|
|
55
|
+
received_at_ms INTEGER NOT NULL CHECK (received_at_ms IS NULL OR (typeof(received_at_ms) = 'integer')),
|
|
56
|
+
tid INTEGER CHECK (tid IS NULL OR (typeof(tid) = 'integer' AND tid >= 1)),
|
|
57
|
+
payload_json TEXT NOT NULL CHECK (payload_json IS NULL OR json_valid(payload_json)),
|
|
58
|
+
retained_packet BLOB CHECK (retained_packet IS NULL OR typeof(retained_packet) = 'blob'),
|
|
59
|
+
decoder_version TEXT NOT NULL,
|
|
60
|
+
UNIQUE(stream_id, stream_sequence),
|
|
61
|
+
UNIQUE(id, sandbox_id),
|
|
62
|
+
FOREIGN KEY(process_id, sandbox_id) REFERENCES runtime_processes(id, sandbox_id),
|
|
63
|
+
CHECK (process_id IS NULL OR sandbox_id IS NOT NULL),
|
|
64
|
+
CHECK (json_type(payload_json) = 'object')
|
|
65
|
+
);
|
|
66
|
+
CREATE TABLE runtime_syscall_calls (
|
|
67
|
+
id TEXT NOT NULL PRIMARY KEY,
|
|
68
|
+
sandbox_id TEXT NOT NULL REFERENCES runtime_sandboxes(id),
|
|
69
|
+
process_id TEXT,
|
|
70
|
+
tid INTEGER CHECK (tid IS NULL OR (typeof(tid) = 'integer' AND tid >= 1)),
|
|
71
|
+
syscall_name TEXT,
|
|
72
|
+
syscall_number INTEGER NOT NULL CHECK (syscall_number IS NULL OR (typeof(syscall_number) = 'integer' AND syscall_number >= 0)),
|
|
73
|
+
entry_event_id TEXT,
|
|
74
|
+
exit_event_id TEXT,
|
|
75
|
+
arguments_json TEXT NOT NULL CHECK (arguments_json IS NULL OR json_valid(arguments_json)),
|
|
76
|
+
return_value TEXT CHECK (return_value IS NULL OR ((return_value = '0' OR (return_value GLOB '[1-9]*' AND return_value NOT GLOB '*[^0-9]*')) OR (return_value GLOB '-[1-9]*' AND substr(return_value, 2) NOT GLOB '*[^0-9]*'))),
|
|
77
|
+
errno INTEGER CHECK (errno IS NULL OR (typeof(errno) = 'integer' AND errno >= 0)),
|
|
78
|
+
outcome TEXT NOT NULL DEFAULT 'unknown' CHECK (outcome IN ('succeeded','failed','unknown')),
|
|
79
|
+
correlation_status TEXT NOT NULL CHECK (correlation_status IN ('paired','entry_only','exit_only','uncertain')),
|
|
80
|
+
normalizer_version TEXT NOT NULL,
|
|
81
|
+
UNIQUE(id, sandbox_id),
|
|
82
|
+
FOREIGN KEY(process_id, sandbox_id) REFERENCES runtime_processes(id, sandbox_id),
|
|
83
|
+
FOREIGN KEY(entry_event_id, sandbox_id) REFERENCES runtime_events(id, sandbox_id),
|
|
84
|
+
FOREIGN KEY(exit_event_id, sandbox_id) REFERENCES runtime_events(id, sandbox_id),
|
|
85
|
+
CHECK (entry_event_id IS NOT NULL OR exit_event_id IS NOT NULL),
|
|
86
|
+
CHECK (entry_event_id IS NULL OR exit_event_id IS NULL OR entry_event_id != exit_event_id),
|
|
87
|
+
CHECK (json_type(arguments_json) = 'object'),
|
|
88
|
+
CHECK ((correlation_status = 'paired' AND entry_event_id IS NOT NULL AND exit_event_id IS NOT NULL)
|
|
89
|
+
OR (correlation_status = 'entry_only' AND entry_event_id IS NOT NULL AND exit_event_id IS NULL)
|
|
90
|
+
OR (correlation_status = 'exit_only' AND entry_event_id IS NULL AND exit_event_id IS NOT NULL)
|
|
91
|
+
OR correlation_status = 'uncertain'),
|
|
92
|
+
CHECK (outcome = 'unknown' OR (exit_event_id IS NOT NULL AND return_value IS NOT NULL AND errno IS NOT NULL)),
|
|
93
|
+
CHECK (outcome != 'succeeded' OR errno = 0),
|
|
94
|
+
CHECK (outcome != 'failed' OR errno > 0),
|
|
95
|
+
CHECK (correlation_status NOT IN ('entry_only','uncertain') OR outcome = 'unknown'),
|
|
96
|
+
CHECK (exit_event_id IS NOT NULL OR (return_value IS NULL AND errno IS NULL))
|
|
97
|
+
);
|
|
98
|
+
CREATE TABLE runtime_attributions (
|
|
99
|
+
id TEXT NOT NULL PRIMARY KEY,
|
|
100
|
+
tool_call_id TEXT NOT NULL REFERENCES agent_tool_calls(id),
|
|
101
|
+
-- The exec event of the attributed process.
|
|
102
|
+
event_id TEXT NOT NULL REFERENCES runtime_events(id),
|
|
103
|
+
-- marker: the call id travelled with the process (RAYTRACE_CALL_ID)
|
|
104
|
+
-- window: command text matched inside the call's causal window
|
|
105
|
+
-- text: command text matched within a fixed window (no causal bounds)
|
|
106
|
+
-- inherited: started by a process already attributed to the call
|
|
107
|
+
method TEXT NOT NULL CHECK (length(trim(method)) > 0),
|
|
108
|
+
score REAL CHECK (score IS NULL OR (score >= 0 AND score <= 1)),
|
|
109
|
+
-- The causal window that justified a 'window' match, proxy-clock ms;
|
|
110
|
+
-- window_end_ms is null when no result had been sent yet.
|
|
111
|
+
window_start_ms INTEGER CHECK (window_start_ms IS NULL OR typeof(window_start_ms) = 'integer'),
|
|
112
|
+
window_end_ms INTEGER CHECK (window_end_ms IS NULL OR typeof(window_end_ms) = 'integer'),
|
|
113
|
+
-- The agent's own report of the call's result (exit code, wall time from
|
|
114
|
+
-- agent_tool_calls.reported_result_sha) against this process's observed
|
|
115
|
+
-- exit. Null until both exist and are comparable.
|
|
116
|
+
reported_check TEXT CHECK (reported_check IS NULL OR reported_check IN ('agrees','exit_code_differs','duration_differs')),
|
|
117
|
+
confidence TEXT NOT NULL CHECK (confidence IN ('exact','corroborated','inferred')),
|
|
118
|
+
status TEXT NOT NULL CHECK (status IN ('candidate','accepted','rejected')),
|
|
119
|
+
basis_json TEXT NOT NULL CHECK (basis_json IS NULL OR json_valid(basis_json)),
|
|
120
|
+
attributor_version TEXT NOT NULL,
|
|
121
|
+
created_at_ms INTEGER NOT NULL CHECK (created_at_ms IS NULL OR (typeof(created_at_ms) = 'integer'))
|
|
122
|
+
);
|
|
123
|
+
CREATE INDEX runtime_processes_identity ON runtime_processes(sandbox_id, pid, start_time_ns);
|
|
124
|
+
CREATE INDEX runtime_processes_parent ON runtime_processes(parent_process_id);
|
|
125
|
+
CREATE INDEX runtime_events_time ON runtime_events(sandbox_id, received_at_ms, id);
|
|
126
|
+
CREATE INDEX runtime_events_process ON runtime_events(process_id, received_at_ms, id);
|
|
127
|
+
CREATE INDEX runtime_syscalls_process ON runtime_syscall_calls(sandbox_id, process_id, id);
|
|
128
|
+
CREATE INDEX runtime_syscalls_entry ON runtime_syscall_calls(entry_event_id);
|
|
129
|
+
CREATE INDEX runtime_syscalls_exit ON runtime_syscall_calls(exit_event_id);
|
|
130
|
+
CREATE INDEX runtime_attributions_call ON runtime_attributions(tool_call_id, status);
|
|
131
|
+
CREATE INDEX runtime_attributions_event ON runtime_attributions(event_id, status);
|
|
132
|
+
CREATE INDEX runtime_sandboxes_project ON runtime_sandboxes(project_id);
|
|
133
|
+
CREATE TRIGGER runtime_sandbox_config_fixed BEFORE UPDATE OF capture_config_json ON runtime_sandboxes
|
|
134
|
+
WHEN NEW.capture_config_json IS NOT OLD.capture_config_json
|
|
135
|
+
BEGIN SELECT RAISE(ABORT, 'capture configuration is fixed for a sandbox lifetime'); END;
|
|
136
|
+
CREATE TRIGGER runtime_process_identity_fixed BEFORE UPDATE OF id, sandbox_id, pid, start_time_ns ON runtime_processes
|
|
137
|
+
WHEN NEW.id IS NOT OLD.id OR NEW.sandbox_id IS NOT OLD.sandbox_id OR NEW.pid IS NOT OLD.pid OR NEW.start_time_ns IS NOT OLD.start_time_ns
|
|
138
|
+
BEGIN SELECT RAISE(ABORT, 'process identity is immutable; retain unresolved identity when unknown'); END;
|
|
139
|
+
CREATE TRIGGER runtime_syscall_evidence BEFORE INSERT ON runtime_syscall_calls
|
|
140
|
+
BEGIN
|
|
141
|
+
SELECT CASE WHEN EXISTS (
|
|
142
|
+
SELECT 1 FROM runtime_events e WHERE e.id=NEW.exit_event_id AND (
|
|
143
|
+
(NEW.return_value IS NOT NULL AND json_type(e.payload_json, '$.return_value') IS NOT NULL AND
|
|
144
|
+
(json_type(e.payload_json, '$.return_value') != 'text' OR json_extract(e.payload_json, '$.return_value') != NEW.return_value))
|
|
145
|
+
OR (NEW.errno IS NOT NULL AND json_type(e.payload_json, '$.errno') IS NOT NULL AND
|
|
146
|
+
(json_type(e.payload_json, '$.errno') != 'integer' OR json_extract(e.payload_json, '$.errno') != NEW.errno))
|
|
147
|
+
)
|
|
148
|
+
) THEN RAISE(ABORT, 'decoded result disagrees with exit evidence') END;
|
|
149
|
+
SELECT CASE WHEN EXISTS (
|
|
150
|
+
SELECT 1 FROM runtime_events e WHERE e.id IN (NEW.entry_event_id, NEW.exit_event_id)
|
|
151
|
+
AND (
|
|
152
|
+
(e.id = NEW.entry_event_id AND e.event_kind != 'syscall_enter')
|
|
153
|
+
OR (e.id = NEW.exit_event_id AND e.event_kind != 'syscall_exit')
|
|
154
|
+
OR (e.process_id IS NOT NULL AND NEW.process_id IS NOT NULL AND e.process_id != NEW.process_id)
|
|
155
|
+
OR (e.tid IS NOT NULL AND NEW.tid IS NOT NULL AND e.tid != NEW.tid)
|
|
156
|
+
OR (json_type(e.payload_json, '$.syscall_number') IS NOT NULL AND
|
|
157
|
+
(json_type(e.payload_json, '$.syscall_number') != 'integer' OR json_extract(e.payload_json, '$.syscall_number') != NEW.syscall_number))
|
|
158
|
+
OR (json_type(e.payload_json, '$.syscall_name') IS NOT NULL AND json_type(e.payload_json, '$.syscall_name') != 'null' AND
|
|
159
|
+
(json_type(e.payload_json, '$.syscall_name') != 'text' OR
|
|
160
|
+
(NEW.syscall_name IS NOT NULL AND json_extract(e.payload_json, '$.syscall_name') != NEW.syscall_name)))
|
|
161
|
+
)
|
|
162
|
+
) THEN RAISE(ABORT, 'syscall phase or identity disagrees with evidence') END;
|
|
163
|
+
SELECT CASE WHEN EXISTS (
|
|
164
|
+
SELECT 1 FROM runtime_events a JOIN runtime_events b
|
|
165
|
+
ON a.id = NEW.entry_event_id AND b.id = NEW.exit_event_id
|
|
166
|
+
WHERE (a.process_id IS NOT NULL AND b.process_id IS NOT NULL AND a.process_id != b.process_id)
|
|
167
|
+
OR (a.tid IS NOT NULL AND b.tid IS NOT NULL AND a.tid != b.tid)
|
|
168
|
+
OR (json_extract(a.payload_json, '$.syscall_name') IS NOT NULL AND
|
|
169
|
+
json_extract(b.payload_json, '$.syscall_name') IS NOT NULL AND
|
|
170
|
+
json_extract(a.payload_json, '$.syscall_name') != json_extract(b.payload_json, '$.syscall_name'))
|
|
171
|
+
OR (a.observed_at_ns IS NOT NULL AND b.observed_at_ns IS NOT NULL AND NOT (length(b.observed_at_ns) > length(a.observed_at_ns) OR (length(b.observed_at_ns) = length(a.observed_at_ns) AND b.observed_at_ns COLLATE BINARY >= a.observed_at_ns COLLATE BINARY)))
|
|
172
|
+
) THEN RAISE(ABORT, 'entry and exit observations disagree') END;
|
|
173
|
+
SELECT CASE WHEN NEW.outcome != 'unknown' AND NOT EXISTS (
|
|
174
|
+
SELECT 1 FROM runtime_events e WHERE e.id = NEW.exit_event_id
|
|
175
|
+
AND json_type(e.payload_json, '$.return_value') = 'text'
|
|
176
|
+
AND json_extract(e.payload_json, '$.return_value') = NEW.return_value
|
|
177
|
+
AND json_type(e.payload_json, '$.errno') = 'integer'
|
|
178
|
+
AND json_extract(e.payload_json, '$.errno') = NEW.errno
|
|
179
|
+
) THEN RAISE(ABORT, 'known outcome requires matching decoded exit result') END;
|
|
180
|
+
END;
|
|
181
|
+
CREATE TRIGGER runtime_events_no_update BEFORE UPDATE ON runtime_events
|
|
182
|
+
BEGIN SELECT RAISE(ABORT, 'runtime_events is append-only'); END;
|
|
183
|
+
CREATE TRIGGER runtime_events_no_delete BEFORE DELETE ON runtime_events
|
|
184
|
+
BEGIN SELECT RAISE(ABORT, 'runtime_events is append-only'); END;
|
|
185
|
+
CREATE TRIGGER runtime_syscall_calls_no_update BEFORE UPDATE ON runtime_syscall_calls
|
|
186
|
+
BEGIN SELECT RAISE(ABORT, 'runtime_syscall_calls is append-only'); END;
|
|
187
|
+
CREATE TRIGGER runtime_syscall_calls_no_delete BEFORE DELETE ON runtime_syscall_calls
|
|
188
|
+
BEGIN SELECT RAISE(ABORT, 'runtime_syscall_calls is append-only'); END;
|
|
189
|
+
CREATE TRIGGER runtime_events_no_replace BEFORE INSERT ON runtime_events
|
|
190
|
+
WHEN EXISTS (SELECT 1 FROM runtime_events WHERE id=NEW.id OR
|
|
191
|
+
(stream_id=NEW.stream_id AND stream_sequence=NEW.stream_sequence))
|
|
192
|
+
BEGIN SELECT RAISE(ABORT, 'runtime event identity cannot be replaced'); END;
|
|
193
|
+
CREATE TRIGGER runtime_syscalls_no_replace BEFORE INSERT ON runtime_syscall_calls
|
|
194
|
+
WHEN EXISTS (SELECT 1 FROM runtime_syscall_calls WHERE id=NEW.id)
|
|
195
|
+
BEGIN SELECT RAISE(ABORT, 'syscall identity cannot be replaced'); END;
|
|
196
|
+
CREATE TRIGGER runtime_sandboxes_no_replace BEFORE INSERT ON runtime_sandboxes
|
|
197
|
+
WHEN EXISTS (SELECT 1 FROM runtime_sandboxes WHERE id=NEW.id)
|
|
198
|
+
BEGIN SELECT RAISE(ABORT, 'sandbox lifetime cannot be replaced'); END;
|
|
199
|
+
CREATE TRIGGER runtime_processes_no_replace BEFORE INSERT ON runtime_processes
|
|
200
|
+
WHEN EXISTS (SELECT 1 FROM runtime_processes WHERE id=NEW.id)
|
|
201
|
+
BEGIN SELECT RAISE(ABORT, 'process lifetime cannot be replaced'); END;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
-- Derived search index (schema version 6): one denormalized, searchable
|
|
2
|
+
-- event per tool call, per turn and per proxy error, with the failure
|
|
3
|
+
-- outcome decided at index time (proxy/search.mjs) from the agent's own
|
|
4
|
+
-- report and, when present, the sandbox-observed process exit. These rows
|
|
5
|
+
-- are derived, never evidence: they can be dropped and rebuilt from the
|
|
6
|
+
-- agent-intent and runtime tables at any time (evidence-store reindex).
|
|
7
|
+
-- No foreign keys, so a rebuild never fights the evidence it derives from.
|
|
8
|
+
-- Only post-redaction payload text is indexed, capped per event.
|
|
9
|
+
CREATE TABLE search_events (
|
|
10
|
+
id TEXT NOT NULL PRIMARY KEY,
|
|
11
|
+
kind TEXT NOT NULL CHECK (kind IN ('call','turn','proxy_error')),
|
|
12
|
+
ts_ms INTEGER NOT NULL CHECK (typeof(ts_ms)='integer'),
|
|
13
|
+
session_id TEXT,
|
|
14
|
+
session_external TEXT,
|
|
15
|
+
turn_id TEXT,
|
|
16
|
+
exchange_id TEXT,
|
|
17
|
+
call_id TEXT,
|
|
18
|
+
external_call_id TEXT,
|
|
19
|
+
output_index INTEGER CHECK (output_index IS NULL OR typeof(output_index)='integer'),
|
|
20
|
+
agent TEXT,
|
|
21
|
+
model TEXT,
|
|
22
|
+
provider TEXT,
|
|
23
|
+
tool_name TEXT,
|
|
24
|
+
category TEXT,
|
|
25
|
+
outcome TEXT NOT NULL CHECK (outcome IN ('failed','ok','unknown')),
|
|
26
|
+
outcome_reported TEXT NOT NULL CHECK (outcome_reported IN ('failed','ok','unknown')),
|
|
27
|
+
outcome_observed TEXT NOT NULL CHECK (outcome_observed IN ('failed','ok','unknown')),
|
|
28
|
+
reported_check TEXT,
|
|
29
|
+
exit_code INTEGER CHECK (exit_code IS NULL OR typeof(exit_code)='integer'),
|
|
30
|
+
http_status INTEGER CHECK (http_status IS NULL OR typeof(http_status)='integer'),
|
|
31
|
+
error_text TEXT,
|
|
32
|
+
failure_signature TEXT,
|
|
33
|
+
signature_label TEXT,
|
|
34
|
+
command_text TEXT,
|
|
35
|
+
file_paths TEXT,
|
|
36
|
+
prompt_text TEXT,
|
|
37
|
+
args_text TEXT,
|
|
38
|
+
result_text TEXT,
|
|
39
|
+
duration_ms INTEGER CHECK (duration_ms IS NULL OR typeof(duration_ms)='integer'),
|
|
40
|
+
indexed_at_ms INTEGER NOT NULL CHECK (typeof(indexed_at_ms)='integer')
|
|
41
|
+
);
|
|
42
|
+
CREATE INDEX search_events_time ON search_events(ts_ms DESC);
|
|
43
|
+
CREATE INDEX search_events_outcome_time ON search_events(outcome, ts_ms DESC);
|
|
44
|
+
CREATE INDEX search_events_tool_time ON search_events(tool_name, ts_ms DESC);
|
|
45
|
+
CREATE INDEX search_events_signature ON search_events(failure_signature, ts_ms DESC);
|
|
46
|
+
CREATE INDEX search_events_turn ON search_events(turn_id, ts_ms);
|
|
47
|
+
CREATE INDEX search_events_exchange ON search_events(exchange_id);
|
|
48
|
+
CREATE INDEX search_events_call ON search_events(call_id);
|
|
49
|
+
CREATE VIRTUAL TABLE search_fts USING fts5(
|
|
50
|
+
prompt_text, command_text, error_text, args_text, result_text, file_paths, tool_name,
|
|
51
|
+
content='search_events', content_rowid='rowid', tokenize='porter unicode61 remove_diacritics 2'
|
|
52
|
+
);
|
|
53
|
+
CREATE TRIGGER search_events_ai AFTER INSERT ON search_events BEGIN
|
|
54
|
+
INSERT INTO search_fts(rowid, prompt_text, command_text, error_text, args_text, result_text, file_paths, tool_name)
|
|
55
|
+
VALUES (new.rowid, new.prompt_text, new.command_text, new.error_text, new.args_text, new.result_text, new.file_paths, new.tool_name);
|
|
56
|
+
END;
|
|
57
|
+
CREATE TRIGGER search_events_ad AFTER DELETE ON search_events BEGIN
|
|
58
|
+
INSERT INTO search_fts(search_fts, rowid, prompt_text, command_text, error_text, args_text, result_text, file_paths, tool_name)
|
|
59
|
+
VALUES ('delete', old.rowid, old.prompt_text, old.command_text, old.error_text, old.args_text, old.result_text, old.file_paths, old.tool_name);
|
|
60
|
+
END;
|
|
61
|
+
CREATE TRIGGER search_events_au AFTER UPDATE ON search_events BEGIN
|
|
62
|
+
INSERT INTO search_fts(search_fts, rowid, prompt_text, command_text, error_text, args_text, result_text, file_paths, tool_name)
|
|
63
|
+
VALUES ('delete', old.rowid, old.prompt_text, old.command_text, old.error_text, old.args_text, old.result_text, old.file_paths, old.tool_name);
|
|
64
|
+
INSERT INTO search_fts(rowid, prompt_text, command_text, error_text, args_text, result_text, file_paths, tool_name)
|
|
65
|
+
VALUES (new.rowid, new.prompt_text, new.command_text, new.error_text, new.args_text, new.result_text, new.file_paths, new.tool_name);
|
|
66
|
+
END;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-- agent_payloads is created by agent_intent.sql and is shared across domains.
|
|
2
|
+
CREATE TABLE agent_context_items (
|
|
3
|
+
exchange_id TEXT NOT NULL REFERENCES agent_exchanges(id),
|
|
4
|
+
position INTEGER NOT NULL CHECK (typeof(position)='integer' AND position>=0),
|
|
5
|
+
role TEXT,
|
|
6
|
+
kind TEXT,
|
|
7
|
+
external_call_id TEXT,
|
|
8
|
+
payload_sha TEXT NOT NULL REFERENCES agent_payloads(sha),
|
|
9
|
+
preview TEXT,
|
|
10
|
+
PRIMARY KEY(exchange_id, position)
|
|
11
|
+
);
|
|
12
|
+
CREATE INDEX agent_context_payload ON agent_context_items(payload_sha);
|
|
13
|
+
CREATE INDEX agent_context_external ON agent_context_items(exchange_id, external_call_id);
|
|
14
|
+
-- Finding the request that carried a call's result back (its causal window's end).
|
|
15
|
+
CREATE INDEX agent_context_call ON agent_context_items(external_call_id, kind);
|
|
16
|
+
CREATE INDEX agent_turn_prompt_payload ON agent_turns(user_prompt_sha);
|
|
17
|
+
CREATE INDEX agent_turn_response_payload ON agent_turns(final_response_sha);
|
|
18
|
+
CREATE INDEX agent_exchange_request_payload ON agent_exchanges(request_sha);
|
|
19
|
+
CREATE INDEX agent_exchange_response_payload ON agent_exchanges(response_sha);
|
|
20
|
+
CREATE INDEX agent_call_arguments_payload ON agent_tool_calls(arguments_sha);
|
|
21
|
+
CREATE INDEX agent_call_result_payload ON agent_tool_calls(reported_result_sha);
|