@alisio/sdk 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +181 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -792,6 +792,19 @@ export interface RunEventDataMap {
|
|
|
792
792
|
latencyMs: number;
|
|
793
793
|
reason: DecisionFallbackReason;
|
|
794
794
|
};
|
|
795
|
+
/** A Proof criterion changed derived status or gained evidence. */
|
|
796
|
+
proof_updated: {
|
|
797
|
+
criterionId: string;
|
|
798
|
+
status: ProofStatus;
|
|
799
|
+
stale: boolean;
|
|
800
|
+
evidenceId?: string;
|
|
801
|
+
};
|
|
802
|
+
/** The final text claims something the Proof ledger does not back (display only). */
|
|
803
|
+
proof_divergence: {
|
|
804
|
+
claim: string;
|
|
805
|
+
criterionId?: string;
|
|
806
|
+
actual: ProofStatus;
|
|
807
|
+
};
|
|
795
808
|
}
|
|
796
809
|
/** Every `RunEvent.type` the core emits today. `RunEvent.type` itself stays `string`. */
|
|
797
810
|
export type RunEventType = keyof RunEventDataMap;
|
|
@@ -1155,6 +1168,11 @@ export interface PlanReview {
|
|
|
1155
1168
|
artifact?: ArtifactRef;
|
|
1156
1169
|
/** The diagrams that were accepted for this revision (absent without diagrams). */
|
|
1157
1170
|
diagrams?: PlanDiagramInfo[];
|
|
1171
|
+
/**
|
|
1172
|
+
* Acceptance criteria the model proposed (drafts). Approving the plan activates exactly these;
|
|
1173
|
+
* any other decision discards them (absent when none were proposed).
|
|
1174
|
+
*/
|
|
1175
|
+
acceptanceCriteria?: PlanCriterionDraft[];
|
|
1158
1176
|
}
|
|
1159
1177
|
/** What a diagram illustrates: a purpose, not a Mermaid syntax. */
|
|
1160
1178
|
export type PlanDiagramType = "overview" | "flow" | "components" | "architecture" | "sequence" | "data" | "state" | "other";
|
|
@@ -1218,6 +1236,8 @@ export interface PlanManifest {
|
|
|
1218
1236
|
id: string;
|
|
1219
1237
|
title: string;
|
|
1220
1238
|
}>;
|
|
1239
|
+
/** The acceptance-criteria drafts of this revision (absent when none were proposed). */
|
|
1240
|
+
acceptanceCriteria?: PlanCriterionDraft[];
|
|
1221
1241
|
}
|
|
1222
1242
|
/** Lifecycle of a background task (`bg_run`); a terminal state is never left. */
|
|
1223
1243
|
export type BackgroundTaskStatus = "queued" | "running" | "stopping" | "succeeded" | "failed" | "cancelled" | "lost";
|
|
@@ -1270,7 +1290,9 @@ export interface BackgroundTaskOutput {
|
|
|
1270
1290
|
/** The state of a session goal (`/goal`); `complete` and `budget_limited` are final unless re-armed. */
|
|
1271
1291
|
export type GoalStatus = "active" | "paused" | "blocked" | "budget_limited" | "complete";
|
|
1272
1292
|
/** Why a goal is in its state: a closed set of codes (the UIs translate them). */
|
|
1273
|
-
export type GoalReason = "created" | "resumed" | "edited" | "user_paused" | "user_interrupt" | "model_complete" | "model_blocked" | "policy_denied" | "run_error" | "token_budget" | "max_turns" | "max_wall" | "no_progress" | "restart"
|
|
1293
|
+
export type GoalReason = "created" | "resumed" | "edited" | "user_paused" | "user_interrupt" | "model_complete" | "model_blocked" | "policy_denied" | "run_error" | "token_budget" | "max_turns" | "max_wall" | "no_progress" | "restart"
|
|
1294
|
+
/** The user completed the goal over unmet required criteria (Proof override). */
|
|
1295
|
+
| "user_override";
|
|
1274
1296
|
/** What an active goal is waiting for before its next continuation (never stored: computed). */
|
|
1275
1297
|
export type GoalWaiting = "approval" | "question" | "user_input" | "plan_mode" | "background_tasks";
|
|
1276
1298
|
/** What the user can do to a goal (the actions the UIs offer per state). */
|
|
@@ -1279,6 +1301,151 @@ export type GoalAction = "pause" | "resume" | "edit" | "clear" | "budget";
|
|
|
1279
1301
|
export interface GoalEvidence {
|
|
1280
1302
|
kind: "file" | "test" | "log" | "command" | "denied" | "other";
|
|
1281
1303
|
detail: string;
|
|
1304
|
+
/** Links this declaration to captured Proof evidence; without it the text is a free claim. */
|
|
1305
|
+
evidenceId?: string;
|
|
1306
|
+
}
|
|
1307
|
+
/** Derived state of an acceptance criterion (never stored as an independent truth). */
|
|
1308
|
+
export type ProofStatus = "verified" | "failed" | "not_checked" | "manual_review" | "not_applicable";
|
|
1309
|
+
/** How a criterion is checked. Consumers must ignore verifier kinds they do not know. */
|
|
1310
|
+
export type ProofVerifierSpec = {
|
|
1311
|
+
kind: "command";
|
|
1312
|
+
command: string;
|
|
1313
|
+
cwd?: string;
|
|
1314
|
+
successExitCodes?: number[];
|
|
1315
|
+
outputPattern?: string;
|
|
1316
|
+
} | {
|
|
1317
|
+
kind: "file";
|
|
1318
|
+
path: string;
|
|
1319
|
+
sha256?: string;
|
|
1320
|
+
pattern?: string;
|
|
1321
|
+
} | {
|
|
1322
|
+
kind: "data-check";
|
|
1323
|
+
datasetId: string;
|
|
1324
|
+
check: "row_count" | "sum" | "equals";
|
|
1325
|
+
column?: string;
|
|
1326
|
+
expected: number | string;
|
|
1327
|
+
/** Table to query; `data` (CSV/TSV/JSON/JSONL) when absent, `s_<sheet>` for XLSX. */
|
|
1328
|
+
table?: string;
|
|
1329
|
+
} | {
|
|
1330
|
+
kind: "coverage";
|
|
1331
|
+
command: string;
|
|
1332
|
+
minPercent: number;
|
|
1333
|
+
} | {
|
|
1334
|
+
kind: "manual";
|
|
1335
|
+
} | {
|
|
1336
|
+
kind: "plugin";
|
|
1337
|
+
verifierId: string;
|
|
1338
|
+
input?: unknown;
|
|
1339
|
+
};
|
|
1340
|
+
/**
|
|
1341
|
+
* What a plugin verifier returns. The evidence is the `outputHash` (sha256 hex of the output the
|
|
1342
|
+
* verdict rests on) and, when the verifier made core tool calls, the `callId` of the one that
|
|
1343
|
+
* backs the verdict. A result without a valid `outputHash`, or naming a call the session never
|
|
1344
|
+
* made, is degraded to `manual_review`: a verdict nobody can trace is not a verification.
|
|
1345
|
+
*/
|
|
1346
|
+
export interface ProofResult {
|
|
1347
|
+
ok: boolean;
|
|
1348
|
+
outputHash: string;
|
|
1349
|
+
callId?: string;
|
|
1350
|
+
/** Short human-readable summary; redacted and bounded by the host. */
|
|
1351
|
+
excerpt?: string;
|
|
1352
|
+
}
|
|
1353
|
+
/** What the host hands a plugin verifier. It carries no permission of its own. */
|
|
1354
|
+
export interface ProofVerifierContext {
|
|
1355
|
+
sessionId: string;
|
|
1356
|
+
criterionId: string;
|
|
1357
|
+
workspace: string;
|
|
1358
|
+
signal: AbortSignal;
|
|
1359
|
+
/**
|
|
1360
|
+
* Runs a core tool through the same gate as a model call (permission mode, `--read-only`,
|
|
1361
|
+
* path policy). A refused or failed call resolves with `result.isError` set and nothing ran.
|
|
1362
|
+
* `callId` is what a `ProofResult` may reference.
|
|
1363
|
+
*/
|
|
1364
|
+
callTool(name: string, input: Record<string, unknown>): Promise<{
|
|
1365
|
+
callId: string;
|
|
1366
|
+
result: ToolResult;
|
|
1367
|
+
}>;
|
|
1368
|
+
}
|
|
1369
|
+
/** A verifier a plugin contributes to Proof; criteria bind to it as `<pluginId>:<id>`. */
|
|
1370
|
+
export interface ProofVerifierRegistration {
|
|
1371
|
+
/** Lowercase letters, digits, `.`, `_` and `-` (max 64). */
|
|
1372
|
+
id: string;
|
|
1373
|
+
describe: string;
|
|
1374
|
+
run(input: unknown, ctx: ProofVerifierContext): Promise<ProofResult>;
|
|
1375
|
+
}
|
|
1376
|
+
/** One acceptance criterion with its derived status. */
|
|
1377
|
+
export interface ProofCriterion {
|
|
1378
|
+
criterionId: string;
|
|
1379
|
+
sessionId: string;
|
|
1380
|
+
goalId?: string;
|
|
1381
|
+
text: string;
|
|
1382
|
+
required: boolean;
|
|
1383
|
+
origin: "plan" | "goal" | "user" | "inferred" | "cli";
|
|
1384
|
+
verifier?: ProofVerifierSpec;
|
|
1385
|
+
/** Globs of the files the criterion covers; absent means the whole workspace. */
|
|
1386
|
+
scope?: string[];
|
|
1387
|
+
status: ProofStatus;
|
|
1388
|
+
/** True when the criterion had successful evidence that a later edit in its scope invalidated. */
|
|
1389
|
+
stale?: boolean;
|
|
1390
|
+
evidenceIds: string[];
|
|
1391
|
+
notApplicableReason?: string;
|
|
1392
|
+
}
|
|
1393
|
+
/** Immutable record that a verifier ran. A new run creates a new evidence, never an edit. */
|
|
1394
|
+
export interface ProofEvidence {
|
|
1395
|
+
evidenceId: string;
|
|
1396
|
+
criterionId: string;
|
|
1397
|
+
verifierKind: ProofVerifierSpec["kind"];
|
|
1398
|
+
runId: string;
|
|
1399
|
+
callId: string;
|
|
1400
|
+
ok: boolean;
|
|
1401
|
+
commandFingerprint?: string;
|
|
1402
|
+
exitCode?: number;
|
|
1403
|
+
durationMs: number;
|
|
1404
|
+
outputHash: string;
|
|
1405
|
+
excerpt?: string;
|
|
1406
|
+
treeFingerprint: string;
|
|
1407
|
+
filesTouched: string[];
|
|
1408
|
+
capturedAt: string;
|
|
1409
|
+
}
|
|
1410
|
+
/** The criteria and evidence of one session, as shown by every surface. */
|
|
1411
|
+
export interface ProofLedger {
|
|
1412
|
+
sessionId: string;
|
|
1413
|
+
criteria: ProofCriterion[];
|
|
1414
|
+
evidence: ProofEvidence[];
|
|
1415
|
+
divergences: {
|
|
1416
|
+
claim: string;
|
|
1417
|
+
criterionId?: string;
|
|
1418
|
+
actual: ProofStatus;
|
|
1419
|
+
}[];
|
|
1420
|
+
generatedAt: string;
|
|
1421
|
+
}
|
|
1422
|
+
/**
|
|
1423
|
+
* What a completed goal records about its Proof criteria: a compact snapshot taken inside the
|
|
1424
|
+
* completing transaction (never a second source of truth: the ledger derives statuses on read).
|
|
1425
|
+
*/
|
|
1426
|
+
export interface GoalProofInfo {
|
|
1427
|
+
criteria: {
|
|
1428
|
+
criterionId: string;
|
|
1429
|
+
required: boolean;
|
|
1430
|
+
status: ProofStatus;
|
|
1431
|
+
}[];
|
|
1432
|
+
/** Required criteria that were `failed` or `not_checked` at completion. */
|
|
1433
|
+
unmet: string[];
|
|
1434
|
+
/** Evidence ids the model declared that resolved to captured evidence of the session. */
|
|
1435
|
+
linkedEvidence: string[];
|
|
1436
|
+
/** Present only when the USER completed the goal over unmet criteria. */
|
|
1437
|
+
override?: {
|
|
1438
|
+
reason: string;
|
|
1439
|
+
at: number;
|
|
1440
|
+
};
|
|
1441
|
+
}
|
|
1442
|
+
/** A criterion the model proposed in `exit_plan`: a draft until the user approves the plan. */
|
|
1443
|
+
export interface PlanCriterionDraft {
|
|
1444
|
+
text: string;
|
|
1445
|
+
required: boolean;
|
|
1446
|
+
verifier?: ProofVerifierSpec;
|
|
1447
|
+
scope?: string[];
|
|
1448
|
+
origin: "inferred";
|
|
1282
1449
|
}
|
|
1283
1450
|
/** A session goal as shown by routes and UIs. */
|
|
1284
1451
|
export interface GoalInfo {
|
|
@@ -1303,6 +1470,8 @@ export interface GoalInfo {
|
|
|
1303
1470
|
/** The model's last `update_goal` report. */
|
|
1304
1471
|
summary?: string;
|
|
1305
1472
|
evidence?: GoalEvidence[];
|
|
1473
|
+
/** The Proof snapshot of a completed goal that had criteria (absent without criteria). */
|
|
1474
|
+
proof?: GoalProofInfo;
|
|
1306
1475
|
/** What the next continuation waits for (set by the host: it knows the live state). */
|
|
1307
1476
|
waiting?: GoalWaiting;
|
|
1308
1477
|
/** The user actions allowed in this state. */
|
|
@@ -1689,6 +1858,13 @@ export interface PluginAPI {
|
|
|
1689
1858
|
views?: {
|
|
1690
1859
|
register(view: ViewDefinition): () => void;
|
|
1691
1860
|
};
|
|
1861
|
+
/**
|
|
1862
|
+
* Proof verifiers (specs/011). Absent on a core that predates Proof: feature-detect with
|
|
1863
|
+
* `api.proof?.registerVerifier(...)` so the plugin keeps working there.
|
|
1864
|
+
*/
|
|
1865
|
+
proof?: {
|
|
1866
|
+
registerVerifier(verifier: ProofVerifierRegistration): () => void;
|
|
1867
|
+
};
|
|
1692
1868
|
/**
|
|
1693
1869
|
* Decision Intelligence: register a `DecisionProvider` or consume decisions. Absent on a core
|
|
1694
1870
|
* that predates it: feature-detect with `api.decisions?.registerProvider(...)`.
|
|
@@ -1937,6 +2113,10 @@ export type ServerFrame = {
|
|
|
1937
2113
|
};
|
|
1938
2114
|
/** The session's goal, when it has one (so a reload shows the goal bar at once). */
|
|
1939
2115
|
goal?: GoalInfo;
|
|
2116
|
+
/** How many Proof criteria the session has; absent without any (the card loads on demand). */
|
|
2117
|
+
proof?: {
|
|
2118
|
+
criteria: number;
|
|
2119
|
+
};
|
|
1940
2120
|
}
|
|
1941
2121
|
/** Durable event; its SSE `id` is `event.eventId`. */
|
|
1942
2122
|
| {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alisio/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Typed plugin SDK for Alisio: the stable contract for tools, commands, context, compaction and session hooks, model completions and storage. Types only plus tiny helpers; zero runtime dependencies.",
|
|
5
5
|
"author": "Gustavo Gutiérrez",
|
|
6
6
|
"license": "MIT",
|