@fungi.computer/approvals 0.2.5 → 0.2.7
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/ledger.d.ts +2 -0
- package/dist/ledger.js +16 -0
- package/package.json +2 -2
package/dist/ledger.d.ts
CHANGED
|
@@ -130,6 +130,8 @@ export declare class ApprovalLedger {
|
|
|
130
130
|
record: ApprovalRecord;
|
|
131
131
|
created: boolean;
|
|
132
132
|
}> | ApprovalRefusal>;
|
|
133
|
+
/** A fresh tool identity cannot authorize repeating an uncertain App write. */
|
|
134
|
+
private uncertainAppWrite;
|
|
133
135
|
/** Answering is revision-pinned and never changes the requester's underlying grants. */
|
|
134
136
|
answer(input: ApprovalAnswerInput, actor: ApprovalAnswerer | null): Readonly<{
|
|
135
137
|
kind: "answered";
|
package/dist/ledger.js
CHANGED
|
@@ -214,6 +214,9 @@ export class ApprovalLedger {
|
|
|
214
214
|
return { kind: "refused", reason: "identity-conflict" };
|
|
215
215
|
return { kind: "record", record: existing, created: false };
|
|
216
216
|
}
|
|
217
|
+
const uncertain = this.uncertainAppWrite(request, inputSha256);
|
|
218
|
+
if (uncertain !== null)
|
|
219
|
+
return { kind: "record", record: uncertain, created: false };
|
|
217
220
|
const now = this.options.now();
|
|
218
221
|
const autoApproved = request.prefixPolicyApproved === true ||
|
|
219
222
|
(!request.requireHumanApproval &&
|
|
@@ -255,6 +258,19 @@ export class ApprovalLedger {
|
|
|
255
258
|
return { kind: "record", record, created: true };
|
|
256
259
|
});
|
|
257
260
|
}
|
|
261
|
+
/** A fresh tool identity cannot authorize repeating an uncertain App write. */
|
|
262
|
+
uncertainAppWrite(request, inputSha256) {
|
|
263
|
+
if (this.options.home.kind !== "team" ||
|
|
264
|
+
request.app === undefined ||
|
|
265
|
+
request.requester.sessionId === null)
|
|
266
|
+
return null;
|
|
267
|
+
const previous = this.options.owner.sql
|
|
268
|
+
.exec("SELECT record_json FROM approval_records WHERE home_key = ? AND json_extract(record_json, '$.state') = 'outcome_unknown' AND json_extract(record_json, '$.requester.principalId') = ? AND json_extract(record_json, '$.requester.agentId') IS ? AND json_extract(record_json, '$.requester.sessionId') = ? AND json_extract(record_json, '$.module') = ? AND json_extract(record_json, '$.operation') = ? AND json_extract(record_json, '$.access') = ? AND json_extract(record_json, '$.authorityFence') = ? AND json_extract(record_json, '$.description.inputSha256') = ? LIMIT 1", this.homeKey, request.requester.principalId, request.requester.agentId, request.requester.sessionId, request.module, request.operation, request.access, request.authorityFence, inputSha256)
|
|
269
|
+
.toArray()[0];
|
|
270
|
+
return previous === undefined
|
|
271
|
+
? null
|
|
272
|
+
: decodeRecord(decodeRow(previous).record_json);
|
|
273
|
+
}
|
|
258
274
|
/** Answering is revision-pinned and never changes the requester's underlying grants. */
|
|
259
275
|
answer(input, actor) {
|
|
260
276
|
if (!this.eligible(actor))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/approvals",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"author": "Levi <levi@technomancy.dev>",
|
|
5
5
|
"description": "Durable principal-bound approval records and auto-approve policy",
|
|
6
6
|
"type": "module",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"effect": "4.0.2",
|
|
23
|
-
"@fungi.computer/watchdog": "0.1.
|
|
23
|
+
"@fungi.computer/watchdog": "0.1.6"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/node": "24.13.3",
|