sibyl-system 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/index.js +74 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@ A standalone [opencode](https://opencode.ai) plugin:
|
|
|
12
12
|
the result is aggregated into a verdict.
|
|
13
13
|
- **`sibyl_review` / `sibyl-chamber`** (v1.1) — a general review chamber with
|
|
14
14
|
isolated role sessions and one conclusion spoken in one voice (see below).
|
|
15
|
+
- **`sibyl_audit`** — the outside lane as a product organ: completion-state ballots convene themselves from a fresh root session (see Tools).
|
|
15
16
|
- **`sibyl_status` + audit primitives** (`sibyl_anchor_check`, `sibyl_time_probe`,
|
|
16
17
|
`sibyl_attribute`) — read-only verification tools: run-store view, human-message
|
|
17
18
|
anchor re-verification, clock integrity, ref-move attribution.
|
|
@@ -98,6 +99,7 @@ stderr, registers nothing, and returns empty hooks.
|
|
|
98
99
|
| Tool | Arguments | Behavior |
|
|
99
100
|
|------|-----------|----------|
|
|
100
101
|
| `sibyl_consult` | `{ artifact, goal }` | `artifact` is a file path or inline multi-line text (≤ 256 KiB). The three councilors audit it in parallel; each reply is parsed into a verdict (one in-session JSON-only repair shot per voter). Returns the tally, merged reasons/must-fix, run id, and per-voter reply file paths. |
|
|
102
|
+
| `sibyl_audit` | `{ artifact, goal }` | Independent audit lane: the council is convened by a FRESH engine-provisioned root session (structurally non-kin to any drafting chain), so the ballot enters the effective path without the caller's identity touching it. Receipt: auditor session id (retained, DB-reconcilable), artifact sha256 bound at start and end (mid-flight drift => VOID), verdict face; anything but INDEPENDENT on the fresh convener => REFUSED, no receipt. |
|
|
101
103
|
| `sibyl_swarm` | `{ artifact, goal, judge? }` | ARCHITECT decomposes goal + artifact into a strict-JSON workflow schema; workers are minted deterministically and dispatched in dependency waves; drafts land in the run's space dir. Verdict: `APPROVE` / `REJECT` / `EXHAUSTED`, forced to `CANNOT_ANSWER` when a declared worker left no terminal row (W2) or zero drafts were produced. With `judge: true`, one extra judge pass may replace the derived verdict — an unrecognized or failed judge reply keeps the derived one. |
|
|
102
104
|
| `sibyl_status` | `{ runId? }` | Read-only. Lists all recorded runs (newest last) + the last chamber-ledger rows, or shows one run's full record and space dir. |
|
|
103
105
|
| `sibyl_review` | `{ target, goal, seed?, maxRounds? }` | v1.1 general democratic-centralism chamber: launches the isolated evidence→clash→judge pipeline detached and returns a receipt (explicitly NOT a verdict); the single voice lands in the run record at terminal state. CLI twin: `sibyl-chamber`. |
|
|
@@ -211,7 +213,7 @@ Dependencies point downward only:
|
|
|
211
213
|
|
|
212
214
|
```
|
|
213
215
|
index.ts plugin entry: parse options → share one RunStore + client
|
|
214
|
-
adapter → register the
|
|
216
|
+
adapter → register the eight sibyl_* tools
|
|
215
217
|
├── engine/ runPersona(): create + prompt one child session through a
|
|
216
218
|
│ structural client seam; per-stage timeouts; never throws —
|
|
217
219
|
│ every failure is a structured PersonaRunResult
|
package/dist/index.js
CHANGED
|
@@ -33031,6 +33031,79 @@ function buildAnchorTool(deps) {
|
|
|
33031
33031
|
});
|
|
33032
33032
|
}
|
|
33033
33033
|
|
|
33034
|
+
// src/tools/audit.ts
|
|
33035
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
33036
|
+
var AUDIT_TOOL_NAME = "sibyl_audit";
|
|
33037
|
+
var RUN_ID_RE = /run (sibyl-[0-9TZ-]+-[0-9a-f]+)/;
|
|
33038
|
+
function sha2562(text) {
|
|
33039
|
+
return createHash3("sha256").update(text, "utf8").digest("hex");
|
|
33040
|
+
}
|
|
33041
|
+
async function artifactHash(raw, dir) {
|
|
33042
|
+
const art = await readArtifact(raw, dir);
|
|
33043
|
+
return art.ok ? sha2562(art.text) : null;
|
|
33044
|
+
}
|
|
33045
|
+
function buildAuditTool(deps) {
|
|
33046
|
+
return tool({
|
|
33047
|
+
description: "SIBYL independent audit lane: convenes the three-councilor consult from a FRESH engine-provisioned root session (structurally non-kin to any drafting chain), so the ballot enters the effective path without the caller's identity touching it. Emits an audit receipt \u2014 auditor session id (retained, DB-reconcilable), artifact sha256 bound at start and end, verdict face. REFUSES (no receipt) if the fresh convener resolves to anything but INDEPENDENT, or the artifact drifts mid-ballot (VOID).",
|
|
33048
|
+
args: {
|
|
33049
|
+
artifact: tool.schema.string().min(1).describe("Path to the artifact, or its inline content (multi-line)."),
|
|
33050
|
+
goal: tool.schema.string().min(1).describe("The question the audit must answer.")
|
|
33051
|
+
},
|
|
33052
|
+
execute: async (args, context) => {
|
|
33053
|
+
try {
|
|
33054
|
+
return await auditExecute(deps, args, context);
|
|
33055
|
+
} catch (err) {
|
|
33056
|
+
return internalError(AUDIT_TOOL_NAME, err);
|
|
33057
|
+
}
|
|
33058
|
+
}
|
|
33059
|
+
});
|
|
33060
|
+
}
|
|
33061
|
+
async function auditExecute(deps, args, ctx) {
|
|
33062
|
+
const start = await readArtifact(args.artifact, ctx.directory);
|
|
33063
|
+
if (!start.ok) {
|
|
33064
|
+
return `SIBYL AUDIT: refused \u2014 artifact unreadable: ${start.error}`;
|
|
33065
|
+
}
|
|
33066
|
+
const shaStart = sha2562(start.text);
|
|
33067
|
+
const created = await deps.client.session.create({
|
|
33068
|
+
body: { title: `sibyl:audit ${(/* @__PURE__ */ new Date()).toISOString()}` },
|
|
33069
|
+
query: { directory: ctx.directory }
|
|
33070
|
+
});
|
|
33071
|
+
const auditor = created.data?.id ?? "";
|
|
33072
|
+
if (auditor.length === 0) {
|
|
33073
|
+
const why = created.error === void 0 ? "no id in response" : JSON.stringify(created.error).slice(0, 140);
|
|
33074
|
+
return `SIBYL AUDIT: refused \u2014 engine did not provision the fresh root convener (${why}); an audit without a resolvable auditor session is not an audit`;
|
|
33075
|
+
}
|
|
33076
|
+
const caller = ctx.sessionID.length > 0 ? ctx.sessionID : "headless";
|
|
33077
|
+
const ballot = await consultExecute(deps, args, { ...ctx, sessionID: auditor });
|
|
33078
|
+
const runId = RUN_ID_RE.exec(ballot)?.[1] ?? "";
|
|
33079
|
+
const runs = await deps.store.load();
|
|
33080
|
+
const rec = runs.find((r) => r.runId === runId);
|
|
33081
|
+
const ind = rec?.independence;
|
|
33082
|
+
const independence = ind?.status ?? "MISSING-RECORD";
|
|
33083
|
+
if (independence !== "INDEPENDENT") {
|
|
33084
|
+
const ev = ind?.evidence ?? `run ${runId.length > 0 ? runId : "(unresolvable)"} not found in the store`;
|
|
33085
|
+
return `SIBYL AUDIT: REFUSED \u2014 the fresh convener ${auditor} resolved to independence=${independence}: ${ev}
|
|
33086
|
+
the ballot ${runId.length > 0 ? runId : "(no run id)"} is archived as DATA and carries no audit receipt; requested-by=` + caller + " (DATA only)";
|
|
33087
|
+
}
|
|
33088
|
+
const shaEnd = await artifactHash(args.artifact, ctx.directory);
|
|
33089
|
+
if (shaEnd !== shaStart) {
|
|
33090
|
+
return `SIBYL AUDIT: VOID \u2014 artifact bytes moved while the ballot was in flight (start sha256 ${shaStart.slice(0, 16)}\u2026, end ${shaEnd === null ? "unreadable" : `${shaEnd.slice(0, 16)}\u2026`}); run ${runId} archived as DATA; re-audit the current bytes`;
|
|
33091
|
+
}
|
|
33092
|
+
const v = rec?.verdict;
|
|
33093
|
+
const counts = v === void 0 ? "no verdict" : `${String(v.approvals)}A/${String(v.rejects)}R/${String(v.errors)}E/${String(v.missing)}M`;
|
|
33094
|
+
const rules = rec?.instrument?.rulesHash.slice(0, 12) ?? "no-instrument-face";
|
|
33095
|
+
return [
|
|
33096
|
+
`SIBYL AUDIT RECEIPT run=${runId}`,
|
|
33097
|
+
` verdict=${v?.verdict ?? "unknown"} (${counts}) rules=${rules}`,
|
|
33098
|
+
` auditor-convener=${auditor} (fresh engine-provisioned root; session row RETAINED for DB reconciliation)`,
|
|
33099
|
+
` requested-by=${caller} \u2014 recorded as ledger data only; it neither convenes nor votes`,
|
|
33100
|
+
` artifact-sha256=${shaStart} (re-hashed after the ballot, identical \u2014 the receipt binds to these bytes)`,
|
|
33101
|
+
"",
|
|
33102
|
+
"--- ballot face ---",
|
|
33103
|
+
ballot
|
|
33104
|
+
].join("\n");
|
|
33105
|
+
}
|
|
33106
|
+
|
|
33034
33107
|
// src/tools/probes.ts
|
|
33035
33108
|
var DEFAULT_TIME_POOL = [
|
|
33036
33109
|
{ url: "https://www.cloudflare.com", ownerDept: "cloudflare" },
|
|
@@ -33991,6 +34064,7 @@ async function SibylPlugin(input2, options) {
|
|
|
33991
34064
|
return {
|
|
33992
34065
|
tool: {
|
|
33993
34066
|
sibyl_consult: buildConsultTool(deps),
|
|
34067
|
+
sibyl_audit: buildAuditTool(deps),
|
|
33994
34068
|
sibyl_swarm: buildSwarmTool(deps),
|
|
33995
34069
|
sibyl_status: buildStatusTool(deps),
|
|
33996
34070
|
sibyl_review: buildReviewTool(deps),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sibyl-system",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Sibyl-System: democratic-centralism review chamber (one conclusion, one voice) + fail-closed council voting + dynamic swarm plugin for OpenCode",
|