@atbash/sdk 0.9.1 → 0.9.2
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/browser.d.mts +23 -13
- package/dist/browser.mjs +96 -206
- package/dist/index.d.mts +23 -13
- package/dist/index.d.ts +23 -13
- package/dist/index.js +173 -73
- package/dist/index.mjs +177 -74
- package/package.json +6 -6
package/dist/browser.d.mts
CHANGED
|
@@ -1111,6 +1111,8 @@ interface GuardMemoryWriteInput extends ClassifyMemoryWriteOptions {
|
|
|
1111
1111
|
verifyPubKey?: string;
|
|
1112
1112
|
/** Org name for chain resolution (public vs org-private chain). */
|
|
1113
1113
|
orgName?: string;
|
|
1114
|
+
/** Explicit chain target when the host already resolved and verified it. */
|
|
1115
|
+
chainOpts?: ChainOpts;
|
|
1114
1116
|
/** LLM confidence threshold for yellow escalation. Default 0.6. */
|
|
1115
1117
|
threshold?: number;
|
|
1116
1118
|
/** When false, red verdicts log but don't block. Default true. */
|
|
@@ -1133,7 +1135,7 @@ interface GuardMemoryWriteResult {
|
|
|
1133
1135
|
decision?: GuardMemoryDecision;
|
|
1134
1136
|
/** Present when handled and scan ran. Absent when scan threw. */
|
|
1135
1137
|
scanResult?: MemoryScanResult;
|
|
1136
|
-
/** Present when handled. True
|
|
1138
|
+
/** Present when handled. True only after the chain transaction confirms. */
|
|
1137
1139
|
committed?: boolean;
|
|
1138
1140
|
}
|
|
1139
1141
|
/**
|
|
@@ -1143,12 +1145,13 @@ interface GuardMemoryWriteResult {
|
|
|
1143
1145
|
*
|
|
1144
1146
|
* Verdict handling:
|
|
1145
1147
|
* - `red` → not persisted to chain; decision blocks (unless `enforce: false`)
|
|
1146
|
-
* - `yellow` → persisted with LLM score; decision allows
|
|
1147
|
-
* - `green` → persisted with LLM score; decision allows
|
|
1148
|
+
* - `yellow` → persisted with its LLM score; decision allows once the chain confirms
|
|
1149
|
+
* - `green` → persisted with its LLM score; decision allows once the chain confirms
|
|
1150
|
+
* - anything else → not persisted; decision blocks (unless `enforce: false`)
|
|
1148
1151
|
*
|
|
1149
|
-
*
|
|
1150
|
-
*
|
|
1151
|
-
*
|
|
1152
|
+
* A write is acknowledged only after the chain transaction confirms, for
|
|
1153
|
+
* yellow exactly as for green. An unconfirmed write blocks in enforce mode
|
|
1154
|
+
* and remains unaudited in observe mode.
|
|
1152
1155
|
*/
|
|
1153
1156
|
declare function guardMemoryWrite(input: GuardMemoryWriteInput): Promise<GuardMemoryWriteResult>;
|
|
1154
1157
|
|
|
@@ -1178,6 +1181,8 @@ interface SyncMemoryOptions {
|
|
|
1178
1181
|
/** Skip the TTL gate and force a chain check this call. Default false. */
|
|
1179
1182
|
force?: boolean;
|
|
1180
1183
|
chainOpts?: ChainOpts;
|
|
1184
|
+
/** Exact chain slot for the managed file; omission keeps the cross-file API behavior. */
|
|
1185
|
+
filePath?: string;
|
|
1181
1186
|
}
|
|
1182
1187
|
/**
|
|
1183
1188
|
* `drifted: false` — pointer is still valid; caller can keep serving the local copy.
|
|
@@ -1226,6 +1231,8 @@ declare function defaultPointerPath(workspaceDir?: string): string;
|
|
|
1226
1231
|
interface WrappedLogger {
|
|
1227
1232
|
info(message: string, meta?: Record<string, unknown>): void;
|
|
1228
1233
|
warn(message: string, meta?: Record<string, unknown>): void;
|
|
1234
|
+
/** Wait for queued writes and surface any lost log entry. */
|
|
1235
|
+
flush(): Promise<void>;
|
|
1229
1236
|
}
|
|
1230
1237
|
interface UpstreamLogger {
|
|
1231
1238
|
info: (...args: unknown[]) => void;
|
|
@@ -1285,10 +1292,10 @@ interface HookDecision {
|
|
|
1285
1292
|
* failure, a rolled-back version), and a host must never re-judge its way past
|
|
1286
1293
|
* one.
|
|
1287
1294
|
*
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1295
|
+
* Absent or false means the guard reached no decision — for example, the scan
|
|
1296
|
+
* never ran or this manager does not own the requested file. In enforce mode,
|
|
1297
|
+
* failed chain verification of the managed file is a block, never an unaudited
|
|
1298
|
+
* allow. In observe mode unverified calls remain unaudited.
|
|
1292
1299
|
*
|
|
1293
1300
|
* So the host rule is:
|
|
1294
1301
|
* `if (d.block) deny; else if (d.audited) allow; else judge it yourself;`
|
|
@@ -1388,9 +1395,9 @@ declare class MemoryGuardManager {
|
|
|
1388
1395
|
runBootProbe(): Promise<void>;
|
|
1389
1396
|
/**
|
|
1390
1397
|
* Returns a `HookDecision` when the guard reached a decision about this event.
|
|
1391
|
-
* Returns `null`
|
|
1392
|
-
*
|
|
1393
|
-
*
|
|
1398
|
+
* Returns `null` for non-memory events, other files this manager does not
|
|
1399
|
+
* own, or unverified observe-mode reads. An enforced read of the managed
|
|
1400
|
+
* file blocks when verification cannot complete.
|
|
1394
1401
|
*
|
|
1395
1402
|
* A returned decision carries `audited` (see `HookDecision`). Only
|
|
1396
1403
|
* `{ allow: true, audited: true }` means "checked and cleared"; anything else
|
|
@@ -1415,6 +1422,9 @@ declare class MemoryGuardManager {
|
|
|
1415
1422
|
*/
|
|
1416
1423
|
private vouchesForTarget;
|
|
1417
1424
|
private handleMemoryRead;
|
|
1425
|
+
/** Complete queued audit-log writes before a host shuts down or removes its workspace. */
|
|
1426
|
+
flushLogs(): Promise<void>;
|
|
1427
|
+
private unverifiedRead;
|
|
1418
1428
|
private writeMemoryAtomic;
|
|
1419
1429
|
}
|
|
1420
1430
|
declare function createMemoryGuardManager(opts: MemoryGuardManagerOptions): MemoryGuardManager;
|