@fungi.computer/approvals 0.2.6 → 0.2.8
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/contract.d.ts +13 -3
- package/dist/contract.js +7 -0
- package/dist/index.d.ts +1 -1
- package/dist/ledger.d.ts +16 -10
- package/dist/ledger.js +28 -12
- package/docs/api/README.md +172 -90
- package/package.json +2 -2
package/dist/contract.d.ts
CHANGED
|
@@ -48,9 +48,13 @@ export type PendingApproval = typeof PendingApprovalSchema.Type;
|
|
|
48
48
|
/** All renderers use these same durable lifecycle states. */
|
|
49
49
|
export declare const ApprovalStateSchema: Schema.Literals<readonly ["requested", "pending", "approved", "claimed", "applied", "denied", "expired", "outcome_unknown"]>;
|
|
50
50
|
/** Why a decision or apply was refused; unknown dispatch is never a denial. */
|
|
51
|
-
export declare const ApprovalRefusalReasonSchema: Schema.Literals<readonly ["not-found", "not-eligible", "already-answered", "stale-revision", "expired", "declined", "fenced", "not-granted", "read-only", "pending", "in-flight", "outcome-unknown", "identity-conflict"]>;
|
|
51
|
+
export declare const ApprovalRefusalReasonSchema: Schema.Literals<readonly ["not-found", "not-eligible", "already-answered", "stale-revision", "expired", "declined", "fenced", "not-granted", "read-only", "not-executed", "pending", "in-flight", "outcome-unknown", "identity-conflict"]>;
|
|
52
52
|
/** Human explanation for a denied approval; distinct from the typed refusal cause. */
|
|
53
53
|
export declare const MAX_APPROVAL_DENIAL_NOTE_LENGTH = 512;
|
|
54
|
+
/** Host-authored explanation of a refusal, distinct from a person's denial note. */
|
|
55
|
+
export declare const ApprovalRefusalDetailSchema: Schema.String;
|
|
56
|
+
/** The host's own typed cause for a not-executed refusal, when its detail alone is not enough. */
|
|
57
|
+
export declare const ApprovalRefusalCodeSchema: Schema.Literal<"too_large">;
|
|
54
58
|
/** Bounded nonempty human feedback; user text, never approval authority. */
|
|
55
59
|
export declare const ApprovalDenialNoteSchema: Schema.String;
|
|
56
60
|
/** Defensive display limits, not authority to fetch or interpret image content. */
|
|
@@ -103,7 +107,9 @@ export declare const ApprovalRecordSchema: Schema.Struct<{
|
|
|
103
107
|
}>, Schema.Struct<{
|
|
104
108
|
readonly kind: Schema.Literal<"policy">;
|
|
105
109
|
}>]>>;
|
|
106
|
-
readonly reason: Schema.NullOr<Schema.Literals<readonly ["not-found", "not-eligible", "already-answered", "stale-revision", "expired", "declined", "fenced", "not-granted", "read-only", "pending", "in-flight", "outcome-unknown", "identity-conflict"]>>;
|
|
110
|
+
readonly reason: Schema.NullOr<Schema.Literals<readonly ["not-found", "not-eligible", "already-answered", "stale-revision", "expired", "declined", "fenced", "not-granted", "read-only", "not-executed", "pending", "in-flight", "outcome-unknown", "identity-conflict"]>>;
|
|
111
|
+
readonly refusalDetail: Schema.optionalKey<Schema.String>;
|
|
112
|
+
readonly refusalCode: Schema.optionalKey<Schema.Literal<"too_large">>;
|
|
107
113
|
readonly denialNote: Schema.optionalKey<Schema.String>;
|
|
108
114
|
readonly requestedAt: Schema.Int;
|
|
109
115
|
readonly expiresAt: Schema.Int;
|
|
@@ -148,7 +154,9 @@ export declare const ApprovalViewSchema: Schema.Struct<{
|
|
|
148
154
|
}>, Schema.Struct<{
|
|
149
155
|
readonly kind: Schema.Literal<"policy">;
|
|
150
156
|
}>]>>;
|
|
151
|
-
readonly reason: Schema.NullOr<Schema.Literals<readonly ["not-found", "not-eligible", "already-answered", "stale-revision", "expired", "declined", "fenced", "not-granted", "read-only", "pending", "in-flight", "outcome-unknown", "identity-conflict"]>>;
|
|
157
|
+
readonly reason: Schema.NullOr<Schema.Literals<readonly ["not-found", "not-eligible", "already-answered", "stale-revision", "expired", "declined", "fenced", "not-granted", "read-only", "not-executed", "pending", "in-flight", "outcome-unknown", "identity-conflict"]>>;
|
|
158
|
+
readonly refusalDetail: Schema.optionalKey<Schema.String>;
|
|
159
|
+
readonly refusalCode: Schema.optionalKey<Schema.Literal<"too_large">>;
|
|
152
160
|
readonly denialNote: Schema.optionalKey<Schema.String>;
|
|
153
161
|
readonly requestedAt: Schema.Int;
|
|
154
162
|
readonly expiresAt: Schema.Int;
|
|
@@ -201,6 +209,8 @@ export type ApprovalRefusal = Readonly<{
|
|
|
201
209
|
kind: "refused";
|
|
202
210
|
reason: typeof ApprovalRefusalReasonSchema.Type;
|
|
203
211
|
denialNote?: typeof ApprovalDenialNoteSchema.Type;
|
|
212
|
+
refusalDetail?: typeof ApprovalRefusalDetailSchema.Type;
|
|
213
|
+
refusalCode?: typeof ApprovalRefusalCodeSchema.Type;
|
|
204
214
|
}>;
|
|
205
215
|
/** The member-bound capability. Host authentication supplies the actor. */
|
|
206
216
|
export type Approvals = Readonly<{
|
package/dist/contract.js
CHANGED
|
@@ -59,6 +59,7 @@ export const ApprovalRefusalReasonSchema = Schema.Literals([
|
|
|
59
59
|
"fenced",
|
|
60
60
|
"not-granted",
|
|
61
61
|
"read-only",
|
|
62
|
+
"not-executed",
|
|
62
63
|
"pending",
|
|
63
64
|
"in-flight",
|
|
64
65
|
"outcome-unknown",
|
|
@@ -66,6 +67,10 @@ export const ApprovalRefusalReasonSchema = Schema.Literals([
|
|
|
66
67
|
]);
|
|
67
68
|
/** Human explanation for a denied approval; distinct from the typed refusal cause. */
|
|
68
69
|
export const MAX_APPROVAL_DENIAL_NOTE_LENGTH = 512;
|
|
70
|
+
/** Host-authored explanation of a refusal, distinct from a person's denial note. */
|
|
71
|
+
export const ApprovalRefusalDetailSchema = Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(512));
|
|
72
|
+
/** The host's own typed cause for a not-executed refusal, when its detail alone is not enough. */
|
|
73
|
+
export const ApprovalRefusalCodeSchema = Schema.Literal("too_large");
|
|
69
74
|
/** Bounded nonempty human feedback; user text, never approval authority. */
|
|
70
75
|
export const ApprovalDenialNoteSchema = Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(MAX_APPROVAL_DENIAL_NOTE_LENGTH), Schema.isPattern(/^(?=.*\S)[^\p{Cc}\u2028\u2029]*$/u));
|
|
71
76
|
/** Defensive display limits, not authority to fetch or interpret image content. */
|
|
@@ -96,6 +101,8 @@ export const ApprovalRecordSchema = Schema.Struct({
|
|
|
96
101
|
Schema.Struct({ kind: Schema.Literal("policy") }),
|
|
97
102
|
])),
|
|
98
103
|
reason: Schema.NullOr(ApprovalRefusalReasonSchema),
|
|
104
|
+
refusalDetail: Schema.optionalKey(ApprovalRefusalDetailSchema),
|
|
105
|
+
refusalCode: Schema.optionalKey(ApprovalRefusalCodeSchema),
|
|
99
106
|
denialNote: Schema.optionalKey(ApprovalDenialNoteSchema),
|
|
100
107
|
requestedAt: Timestamp,
|
|
101
108
|
expiresAt: Timestamp,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from "./contract.js";
|
|
2
2
|
export { denialFeedbackOpening } from "./denial-message.js";
|
|
3
|
-
export { ApprovalLedger, ApprovalRefusalSchema, DEFAULT_APPROVAL_EXPIRY_MS, type AutoApproveQuery, type ApprovalHome, type ApprovalRequest, type ApprovalAnswerer, type ApprovalAdmission, type ApprovalRuleSetter, type ApprovalApplyHost, type ApprovalSubmitHost, type ApprovalDispatchCompletion, type ApprovalApplyResult, } from "./ledger.js";
|
|
3
|
+
export { ApprovalLedger, ApprovalRefusalSchema, DEFAULT_APPROVAL_EXPIRY_MS, type AutoApproveQuery, type ApprovalHome, type ApprovalRequest, type ApprovalAnswerer, type ApprovalAdmission, type ApprovalHostRefusal, type ApprovalRuleSetter, type ApprovalApplyHost, type ApprovalSubmitHost, type ApprovalDispatchCompletion, type ApprovalApplyResult, } from "./ledger.js";
|
package/dist/ledger.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as Schema from "effect/Schema";
|
|
2
2
|
import type { WatchdogSqliteOwner } from "@fungi.computer/watchdog";
|
|
3
|
-
import { type ApprovalEvidence, type ApprovalRecord, type Approvals, type ApprovalRefusal, type ApprovalAnswerInput, type AutoApproveInput, type PendingApproval } from "./contract.js";
|
|
3
|
+
import { type ApprovalEvidence, ApprovalRefusalCodeSchema, type ApprovalRecord, type Approvals, type ApprovalRefusal, type ApprovalAnswerInput, type AutoApproveInput, type PendingApproval } from "./contract.js";
|
|
4
4
|
/** Canonical zero-effect or lifecycle refusal at a tool result boundary. */
|
|
5
5
|
export declare const ApprovalRefusalSchema: Schema.Struct<{
|
|
6
6
|
readonly kind: Schema.Literal<"refused">;
|
|
7
|
-
readonly reason: Schema.Literals<readonly ["not-found", "not-eligible", "already-answered", "stale-revision", "expired", "declined", "fenced", "not-granted", "read-only", "pending", "in-flight", "outcome-unknown", "identity-conflict"]>;
|
|
7
|
+
readonly reason: Schema.Literals<readonly ["not-found", "not-eligible", "already-answered", "stale-revision", "expired", "declined", "fenced", "not-granted", "read-only", "not-executed", "pending", "in-flight", "outcome-unknown", "identity-conflict"]>;
|
|
8
8
|
readonly denialNote: Schema.optionalKey<Schema.String>;
|
|
9
|
+
readonly refusalDetail: Schema.optionalKey<Schema.String>;
|
|
10
|
+
readonly refusalCode: Schema.optionalKey<Schema.Literal<"too_large">>;
|
|
9
11
|
}>;
|
|
10
12
|
/** Native owner of this ledger; the Local runtime supplies its own SQLite owner. */
|
|
11
13
|
export type ApprovalHome = Readonly<{
|
|
@@ -60,22 +62,26 @@ export type ApprovalRuleSetter = ApprovalAnswerer | (Extract<ApprovalAnswerer, {
|
|
|
60
62
|
}> & Readonly<{
|
|
61
63
|
mayManageAgent: boolean;
|
|
62
64
|
}>);
|
|
65
|
+
/** Host-attested zero-effect refusals, whether found at recheck or dispatch. */
|
|
66
|
+
export type ApprovalHostRefusal = Readonly<{
|
|
67
|
+
kind: "refused";
|
|
68
|
+
reason: "not-granted" | "read-only";
|
|
69
|
+
}> | Readonly<{
|
|
70
|
+
kind: "refused";
|
|
71
|
+
reason: "not-executed";
|
|
72
|
+
refusalDetail: string;
|
|
73
|
+
refusalCode?: typeof ApprovalRefusalCodeSchema.Type;
|
|
74
|
+
}>;
|
|
63
75
|
/** Mycelium owns admission; the ledger compares its opaque fence, never grant grammar. */
|
|
64
76
|
export type ApprovalAdmission = Readonly<{
|
|
65
77
|
kind: "authorized";
|
|
66
78
|
authorityFence: string;
|
|
67
|
-
}> |
|
|
68
|
-
kind: "refused";
|
|
69
|
-
reason: "not-granted" | "read-only";
|
|
70
|
-
}>;
|
|
79
|
+
}> | ApprovalHostRefusal;
|
|
71
80
|
/** Host verdict outside App JSON: only an attested zero-effect refusal is denied. */
|
|
72
81
|
export type ApprovalDispatchCompletion = Readonly<{
|
|
73
82
|
kind: "completed";
|
|
74
83
|
output: typeof Schema.Json.Type;
|
|
75
|
-
}> |
|
|
76
|
-
kind: "refused";
|
|
77
|
-
reason: "not-granted" | "read-only";
|
|
78
|
-
}>;
|
|
84
|
+
}> | ApprovalHostRefusal;
|
|
79
85
|
/** Host-only adapter to the existing operation door; not an Agent continuation. */
|
|
80
86
|
export type ApprovalApplyHost = Readonly<{
|
|
81
87
|
/** Re-read requester grants and the operation fence immediately before dispatch. */
|
package/dist/ledger.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import * as Schema from "effect/Schema";
|
|
2
|
-
import { ApprovalRecordSchema, ApprovalEvidenceSchema, ApprovalRefusalReasonSchema, ApprovalDenialNoteSchema, ApprovalGetInputSchema, ApprovalListInputSchema, ApprovalAnswerInputSchema, AutoApproveInputSchema, } from "./contract.js";
|
|
2
|
+
import { ApprovalRecordSchema, ApprovalEvidenceSchema, ApprovalRefusalReasonSchema, ApprovalDenialNoteSchema, ApprovalRefusalCodeSchema, ApprovalRefusalDetailSchema, ApprovalGetInputSchema, ApprovalListInputSchema, ApprovalAnswerInputSchema, AutoApproveInputSchema, } from "./contract.js";
|
|
3
3
|
/** Canonical zero-effect or lifecycle refusal at a tool result boundary. */
|
|
4
4
|
export const ApprovalRefusalSchema = Schema.Struct({
|
|
5
5
|
kind: Schema.Literal("refused"),
|
|
6
6
|
reason: ApprovalRefusalReasonSchema,
|
|
7
7
|
denialNote: Schema.optionalKey(ApprovalDenialNoteSchema),
|
|
8
|
+
refusalDetail: Schema.optionalKey(ApprovalRefusalDetailSchema),
|
|
9
|
+
refusalCode: Schema.optionalKey(ApprovalRefusalCodeSchema),
|
|
8
10
|
});
|
|
9
11
|
const defaultAutoApprove = {
|
|
10
12
|
team: false,
|
|
@@ -459,19 +461,19 @@ export class ApprovalLedger {
|
|
|
459
461
|
return claim;
|
|
460
462
|
try {
|
|
461
463
|
const admission = await host.recheck(claim.record);
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
:
|
|
467
|
-
|
|
468
|
-
|
|
464
|
+
if (admission.kind === "refused")
|
|
465
|
+
return this.finishDenied(claim.record, admission);
|
|
466
|
+
if (admission.authorityFence !== claim.record.authorityFence)
|
|
467
|
+
return this.finishDenied(claim.record, {
|
|
468
|
+
kind: "refused",
|
|
469
|
+
reason: "fenced",
|
|
470
|
+
});
|
|
469
471
|
const completion = await host.dispatch({
|
|
470
472
|
record: claim.record,
|
|
471
473
|
input: claim.input,
|
|
472
474
|
});
|
|
473
475
|
if (completion.kind === "refused")
|
|
474
|
-
return this.finishDenied(claim.record, completion
|
|
476
|
+
return this.finishDenied(claim.record, completion);
|
|
475
477
|
const output = completion.output;
|
|
476
478
|
const outputJson = encodeJson(output);
|
|
477
479
|
return this.options.owner.transactionSync(() => {
|
|
@@ -508,19 +510,29 @@ export class ApprovalLedger {
|
|
|
508
510
|
});
|
|
509
511
|
}
|
|
510
512
|
}
|
|
511
|
-
finishDenied(claimed,
|
|
513
|
+
finishDenied(claimed, refusal) {
|
|
512
514
|
return this.options.owner.transactionSync(() => {
|
|
513
515
|
const current = this.get(claimed.recordId);
|
|
514
516
|
if (current?.state !== "claimed" || current.revision !== claimed.revision)
|
|
515
517
|
return { kind: "refused", reason: "outcome-unknown" };
|
|
518
|
+
const { reason } = refusal;
|
|
519
|
+
const detail = "refusalDetail" in refusal
|
|
520
|
+
? {
|
|
521
|
+
refusalDetail: refusal.refusalDetail,
|
|
522
|
+
...(refusal.refusalCode !== undefined && {
|
|
523
|
+
refusalCode: refusal.refusalCode,
|
|
524
|
+
}),
|
|
525
|
+
}
|
|
526
|
+
: {};
|
|
516
527
|
this.save({
|
|
517
528
|
...current,
|
|
518
529
|
state: "denied",
|
|
519
530
|
reason,
|
|
531
|
+
...detail,
|
|
520
532
|
updatedAt: this.options.now(),
|
|
521
533
|
revision: current.revision + 1,
|
|
522
534
|
});
|
|
523
|
-
return { kind: "refused", reason };
|
|
535
|
+
return { kind: "refused", reason, ...detail };
|
|
524
536
|
});
|
|
525
537
|
}
|
|
526
538
|
/** Native host boot only: orphaned durable claims must never be redispatched. */
|
|
@@ -544,10 +556,14 @@ export class ApprovalLedger {
|
|
|
544
556
|
});
|
|
545
557
|
}
|
|
546
558
|
deniedResult(record) {
|
|
547
|
-
|
|
559
|
+
let refusal = {
|
|
548
560
|
kind: "refused",
|
|
549
561
|
reason: record.reason ?? "declined",
|
|
550
562
|
};
|
|
563
|
+
if (record.refusalDetail !== undefined)
|
|
564
|
+
refusal = { ...refusal, refusalDetail: record.refusalDetail };
|
|
565
|
+
if (record.refusalCode !== undefined)
|
|
566
|
+
refusal = { ...refusal, refusalCode: record.refusalCode };
|
|
551
567
|
return record.denialNote === undefined
|
|
552
568
|
? refusal
|
|
553
569
|
: { ...refusal, denialNote: record.denialNote };
|
package/docs/api/README.md
CHANGED
|
@@ -113,36 +113,38 @@ A retried request's current outcome, without claiming any work.
|
|
|
113
113
|
|
|
114
114
|
###### Parameters
|
|
115
115
|
|
|
116
|
-
| Parameter | Type
|
|
117
|
-
| --------------------------------------- |
|
|
118
|
-
| `record` | \{ `recordId`: `string`; `requester`: \{ `principalId`: `string`; `agentId`: `string` \| `null`; `sessionId`: `string` \| `null`; `displayName`: `string`; \}; `module`: `string`; `operation`: `string`; `access`: `"write"` \| `"external"`; `description`: \{ `title`: `string`; `app?`: \{ `displayName`: `string`; `operationLabel`: `string`; \}; `inputBytes`: `number`; `inputSha256`: `string`; \}; `evidence?`: readonly `object`[]; `authorityFence`: `string`; `reversibility`: `"reversible"` \| `"irreversible-external"`; `state`: \| `"pending"` \| `"expired"` \| `"denied"` \| `"requested"` \| `"approved"` \| `"claimed"` \| `"applied"` \| `"outcome_unknown"`; `by`: \| \{ `kind`: `"human"`; `memberId`: `string`; \} \| \{ `kind`: `"policy"`; \} \| `null`; `reason`: \| `"pending"` \| `"expired"` \| `"not-found"` \| `"not-eligible"` \| `"already-answered"` \| `"stale-revision"` \| `"declined"` \| `"fenced"` \| `"not-granted"` \| `"read-only"` \| `"in-flight"` \| `"outcome-unknown"` \| `"identity-conflict"` \| `null`; `denialNote?`: `string`; `requestedAt`: `number`; `expiresAt`: `number`; `updatedAt`: `number`; `revision`: `number`; \} | - |
|
|
119
|
-
| `record.recordId` | `string`
|
|
120
|
-
| `record.requester` | \{ `principalId`: `string`; `agentId`: `string` \| `null`; `sessionId`: `string` \| `null`; `displayName`: `string`; \}
|
|
121
|
-
| `record.requester.principalId` | `string`
|
|
122
|
-
| `record.requester.agentId` | `string` \| `null`
|
|
123
|
-
| `record.requester.sessionId` | `string` \| `null`
|
|
124
|
-
| `record.requester.displayName` | `string`
|
|
125
|
-
| `record.module` | `string`
|
|
126
|
-
| `record.operation` | `string`
|
|
127
|
-
| `record.access` | `"write"` \| `"external"`
|
|
128
|
-
| `record.description` | \{ `title`: `string`; `app?`: \{ `displayName`: `string`; `operationLabel`: `string`; \}; `inputBytes`: `number`; `inputSha256`: `string`; \}
|
|
129
|
-
| `record.description.title` | `string`
|
|
130
|
-
| `record.description.app?` | \{ `displayName`: `string`; `operationLabel`: `string`; \}
|
|
131
|
-
| `record.description.app.displayName` | `string`
|
|
132
|
-
| `record.description.app.operationLabel` | `string`
|
|
133
|
-
| `record.description.inputBytes` | `number`
|
|
134
|
-
| `record.description.inputSha256` | `string`
|
|
135
|
-
| `record.evidence?` | readonly `object`[]
|
|
136
|
-
| `record.authorityFence` | `string`
|
|
137
|
-
| `record.reversibility` | `"reversible"` \| `"irreversible-external"`
|
|
138
|
-
| `record.state` | \| `"pending"` \| `"expired"` \| `"denied"` \| `"requested"` \| `"approved"` \| `"claimed"` \| `"applied"` \| `"outcome_unknown"`
|
|
139
|
-
| `record.by` | \| \{ `kind`: `"human"`; `memberId`: `string`; \} \| \{ `kind`: `"policy"`; \} \| `null`
|
|
140
|
-
| `record.reason` | \| `"pending"` \| `"expired"` \| `"not-found"` \| `"not-eligible"` \| `"already-answered"` \| `"stale-revision"` \| `"declined"` \| `"fenced"` \| `"not-granted"` \| `"read-only"` \| `"in-flight"` \| `"outcome-unknown"` \| `"identity-conflict"` \| `null`
|
|
141
|
-
| `record.
|
|
142
|
-
| `record.
|
|
143
|
-
| `record.
|
|
144
|
-
| `record.
|
|
145
|
-
| `record.
|
|
116
|
+
| Parameter | Type | Description |
|
|
117
|
+
| --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- |
|
|
118
|
+
| `record` | \{ `recordId`: `string`; `requester`: \{ `principalId`: `string`; `agentId`: `string` \| `null`; `sessionId`: `string` \| `null`; `displayName`: `string`; \}; `module`: `string`; `operation`: `string`; `access`: `"write"` \| `"external"`; `description`: \{ `title`: `string`; `app?`: \{ `displayName`: `string`; `operationLabel`: `string`; \}; `inputBytes`: `number`; `inputSha256`: `string`; \}; `evidence?`: readonly `object`[]; `authorityFence`: `string`; `reversibility`: `"reversible"` \| `"irreversible-external"`; `state`: \| `"pending"` \| `"expired"` \| `"denied"` \| `"requested"` \| `"approved"` \| `"claimed"` \| `"applied"` \| `"outcome_unknown"`; `by`: \| \{ `kind`: `"human"`; `memberId`: `string`; \} \| \{ `kind`: `"policy"`; \} \| `null`; `reason`: \| `"pending"` \| `"expired"` \| `"not-found"` \| `"not-eligible"` \| `"already-answered"` \| `"stale-revision"` \| `"declined"` \| `"fenced"` \| `"not-granted"` \| `"read-only"` \| `"not-executed"` \| `"in-flight"` \| `"outcome-unknown"` \| `"identity-conflict"` \| `null`; `refusalDetail?`: `string`; `refusalCode?`: `"too_large"`; `denialNote?`: `string`; `requestedAt`: `number`; `expiresAt`: `number`; `updatedAt`: `number`; `revision`: `number`; \} | - |
|
|
119
|
+
| `record.recordId` | `string` | - |
|
|
120
|
+
| `record.requester` | \{ `principalId`: `string`; `agentId`: `string` \| `null`; `sessionId`: `string` \| `null`; `displayName`: `string`; \} | - |
|
|
121
|
+
| `record.requester.principalId` | `string` | - |
|
|
122
|
+
| `record.requester.agentId` | `string` \| `null` | - |
|
|
123
|
+
| `record.requester.sessionId` | `string` \| `null` | - |
|
|
124
|
+
| `record.requester.displayName` | `string` | - |
|
|
125
|
+
| `record.module` | `string` | - |
|
|
126
|
+
| `record.operation` | `string` | - |
|
|
127
|
+
| `record.access` | `"write"` \| `"external"` | - |
|
|
128
|
+
| `record.description` | \{ `title`: `string`; `app?`: \{ `displayName`: `string`; `operationLabel`: `string`; \}; `inputBytes`: `number`; `inputSha256`: `string`; \} | - |
|
|
129
|
+
| `record.description.title` | `string` | - |
|
|
130
|
+
| `record.description.app?` | \{ `displayName`: `string`; `operationLabel`: `string`; \} | Catalog-authored App copy, not identity or authorization. |
|
|
131
|
+
| `record.description.app.displayName` | `string` | - |
|
|
132
|
+
| `record.description.app.operationLabel` | `string` | - |
|
|
133
|
+
| `record.description.inputBytes` | `number` | - |
|
|
134
|
+
| `record.description.inputSha256` | `string` | - |
|
|
135
|
+
| `record.evidence?` | readonly `object`[] | - |
|
|
136
|
+
| `record.authorityFence` | `string` | - |
|
|
137
|
+
| `record.reversibility` | `"reversible"` \| `"irreversible-external"` | - |
|
|
138
|
+
| `record.state` | \| `"pending"` \| `"expired"` \| `"denied"` \| `"requested"` \| `"approved"` \| `"claimed"` \| `"applied"` \| `"outcome_unknown"` | - |
|
|
139
|
+
| `record.by` | \| \{ `kind`: `"human"`; `memberId`: `string`; \} \| \{ `kind`: `"policy"`; \} \| `null` | - |
|
|
140
|
+
| `record.reason` | \| `"pending"` \| `"expired"` \| `"not-found"` \| `"not-eligible"` \| `"already-answered"` \| `"stale-revision"` \| `"declined"` \| `"fenced"` \| `"not-granted"` \| `"read-only"` \| `"not-executed"` \| `"in-flight"` \| `"outcome-unknown"` \| `"identity-conflict"` \| `null` | - |
|
|
141
|
+
| `record.refusalDetail?` | `string` | - |
|
|
142
|
+
| `record.refusalCode?` | `"too_large"` | - |
|
|
143
|
+
| `record.denialNote?` | `string` | - |
|
|
144
|
+
| `record.requestedAt` | `number` | - |
|
|
145
|
+
| `record.expiresAt` | `number` | - |
|
|
146
|
+
| `record.updatedAt` | `number` | - |
|
|
147
|
+
| `record.revision` | `number` | - |
|
|
146
148
|
|
|
147
149
|
###### Returns
|
|
148
150
|
|
|
@@ -167,10 +169,13 @@ request(input, evidence?): Promise<
|
|
|
167
169
|
| "fenced"
|
|
168
170
|
| "not-granted"
|
|
169
171
|
| "read-only"
|
|
172
|
+
| "not-executed"
|
|
170
173
|
| "in-flight"
|
|
171
174
|
| "outcome-unknown"
|
|
172
175
|
| "identity-conflict";
|
|
173
176
|
denialNote?: string;
|
|
177
|
+
refusalDetail?: string;
|
|
178
|
+
refusalCode?: "too_large";
|
|
174
179
|
}>
|
|
175
180
|
| Readonly<{
|
|
176
181
|
kind: "record";
|
|
@@ -223,10 +228,13 @@ request(input, evidence?): Promise<
|
|
|
223
228
|
| "fenced"
|
|
224
229
|
| "not-granted"
|
|
225
230
|
| "read-only"
|
|
231
|
+
| "not-executed"
|
|
226
232
|
| "in-flight"
|
|
227
233
|
| "outcome-unknown"
|
|
228
234
|
| "identity-conflict"
|
|
229
235
|
| null;
|
|
236
|
+
refusalDetail?: string;
|
|
237
|
+
refusalCode?: "too_large";
|
|
230
238
|
denialNote?: string;
|
|
231
239
|
requestedAt: number;
|
|
232
240
|
expiresAt: number;
|
|
@@ -252,11 +260,12 @@ action; created says whether this call staged the record.
|
|
|
252
260
|
`Promise`\< \| `Readonly`\<\{ `kind`: `"refused"`; `reason`: \| `"pending"` \|
|
|
253
261
|
`"expired"` \| `"not-found"` \| `"not-eligible"` \| `"already-answered"` \|
|
|
254
262
|
`"stale-revision"` \| `"declined"` \| `"fenced"` \| `"not-granted"` \|
|
|
255
|
-
`"read-only"` \| `"
|
|
256
|
-
`denialNote?`: `string`;
|
|
257
|
-
`
|
|
258
|
-
`
|
|
259
|
-
|
|
263
|
+
`"read-only"` \| `"not-executed"` \| `"in-flight"` \| `"outcome-unknown"` \|
|
|
264
|
+
`"identity-conflict"`; `denialNote?`: `string`; `refusalDetail?`: `string`;
|
|
265
|
+
`refusalCode?`: `"too_large"`; \}\> \| `Readonly`\<\{ `kind`: `"record"`;
|
|
266
|
+
`record`: \{ `recordId`: `string`; `requester`: \{ `principalId`: `string`;
|
|
267
|
+
`agentId`: `string` \| `null`; `sessionId`: `string` \| `null`; `displayName`:
|
|
268
|
+
`string`; \}; `module`: `string`; `operation`: `string`; `access`: `"write"` \|
|
|
260
269
|
`"external"`; `description`: \{ `title`: `string`; `app?`: \{ `displayName`:
|
|
261
270
|
`string`; `operationLabel`: `string`; \}; `inputBytes`: `number`; `inputSha256`:
|
|
262
271
|
`string`; \}; `evidence?`: readonly `object`[]; `authorityFence`: `string`;
|
|
@@ -266,8 +275,9 @@ action; created says whether this call staged the record.
|
|
|
266
275
|
`"human"`; `memberId`: `string`; \} \| \{ `kind`: `"policy"`; \} \| `null`;
|
|
267
276
|
`reason`: \| `"pending"` \| `"expired"` \| `"not-found"` \| `"not-eligible"` \|
|
|
268
277
|
`"already-answered"` \| `"stale-revision"` \| `"declined"` \| `"fenced"` \|
|
|
269
|
-
`"not-granted"` \| `"read-only"` \| `"
|
|
270
|
-
`"identity-conflict"` \| `null`; `
|
|
278
|
+
`"not-granted"` \| `"read-only"` \| `"not-executed"` \| `"in-flight"` \|
|
|
279
|
+
`"outcome-unknown"` \| `"identity-conflict"` \| `null`; `refusalDetail?`:
|
|
280
|
+
`string`; `refusalCode?`: `"too_large"`; `denialNote?`: `string`; `requestedAt`:
|
|
271
281
|
`number`; `expiresAt`: `number`; `updatedAt`: `number`; `revision`: `number`;
|
|
272
282
|
\}; `created`: `boolean`; \}\>\>
|
|
273
283
|
|
|
@@ -287,10 +297,13 @@ answer(input, actor):
|
|
|
287
297
|
| "fenced"
|
|
288
298
|
| "not-granted"
|
|
289
299
|
| "read-only"
|
|
300
|
+
| "not-executed"
|
|
290
301
|
| "in-flight"
|
|
291
302
|
| "outcome-unknown"
|
|
292
303
|
| "identity-conflict";
|
|
293
304
|
denialNote?: string;
|
|
305
|
+
refusalDetail?: string;
|
|
306
|
+
refusalCode?: "too_large";
|
|
294
307
|
}>
|
|
295
308
|
| Readonly<{
|
|
296
309
|
kind: "answered";
|
|
@@ -343,10 +356,13 @@ answer(input, actor):
|
|
|
343
356
|
| "fenced"
|
|
344
357
|
| "not-granted"
|
|
345
358
|
| "read-only"
|
|
359
|
+
| "not-executed"
|
|
346
360
|
| "in-flight"
|
|
347
361
|
| "outcome-unknown"
|
|
348
362
|
| "identity-conflict"
|
|
349
363
|
| null;
|
|
364
|
+
refusalDetail?: string;
|
|
365
|
+
refusalCode?: "too_large";
|
|
350
366
|
denialNote?: string;
|
|
351
367
|
requestedAt: number;
|
|
352
368
|
expiresAt: number;
|
|
@@ -375,11 +391,12 @@ grants.
|
|
|
375
391
|
\| `Readonly`\<\{ `kind`: `"refused"`; `reason`: \| `"pending"` \| `"expired"`
|
|
376
392
|
\| `"not-found"` \| `"not-eligible"` \| `"already-answered"` \|
|
|
377
393
|
`"stale-revision"` \| `"declined"` \| `"fenced"` \| `"not-granted"` \|
|
|
378
|
-
`"read-only"` \| `"
|
|
379
|
-
`denialNote?`: `string`;
|
|
380
|
-
|
|
381
|
-
`
|
|
382
|
-
|
|
394
|
+
`"read-only"` \| `"not-executed"` \| `"in-flight"` \| `"outcome-unknown"` \|
|
|
395
|
+
`"identity-conflict"`; `denialNote?`: `string`; `refusalDetail?`: `string`;
|
|
396
|
+
`refusalCode?`: `"too_large"`; \}\> \| `Readonly`\<\{ `kind`: `"answered"`;
|
|
397
|
+
`record`: \{ `recordId`: `string`; `requester`: \{ `principalId`: `string`;
|
|
398
|
+
`agentId`: `string` \| `null`; `sessionId`: `string` \| `null`; `displayName`:
|
|
399
|
+
`string`; \}; `module`: `string`; `operation`: `string`; `access`: `"write"` \|
|
|
383
400
|
`"external"`; `description`: \{ `title`: `string`; `app?`: \{ `displayName`:
|
|
384
401
|
`string`; `operationLabel`: `string`; \}; `inputBytes`: `number`; `inputSha256`:
|
|
385
402
|
`string`; \}; `evidence?`: readonly `object`[]; `authorityFence`: `string`;
|
|
@@ -389,8 +406,9 @@ grants.
|
|
|
389
406
|
`"human"`; `memberId`: `string`; \} \| \{ `kind`: `"policy"`; \} \| `null`;
|
|
390
407
|
`reason`: \| `"pending"` \| `"expired"` \| `"not-found"` \| `"not-eligible"` \|
|
|
391
408
|
`"already-answered"` \| `"stale-revision"` \| `"declined"` \| `"fenced"` \|
|
|
392
|
-
`"not-granted"` \| `"read-only"` \| `"
|
|
393
|
-
`"identity-conflict"` \| `null`; `
|
|
409
|
+
`"not-granted"` \| `"read-only"` \| `"not-executed"` \| `"in-flight"` \|
|
|
410
|
+
`"outcome-unknown"` \| `"identity-conflict"` \| `null`; `refusalDetail?`:
|
|
411
|
+
`string`; `refusalCode?`: `"too_large"`; `denialNote?`: `string`; `requestedAt`:
|
|
394
412
|
`number`; `expiresAt`: `number`; `updatedAt`: `number`; `revision`: `number`;
|
|
395
413
|
\}; \}\>
|
|
396
414
|
|
|
@@ -410,10 +428,13 @@ setAutoApprove(input, setter):
|
|
|
410
428
|
| "fenced"
|
|
411
429
|
| "not-granted"
|
|
412
430
|
| "read-only"
|
|
431
|
+
| "not-executed"
|
|
413
432
|
| "in-flight"
|
|
414
433
|
| "outcome-unknown"
|
|
415
434
|
| "identity-conflict";
|
|
416
435
|
denialNote?: string;
|
|
436
|
+
refusalDetail?: string;
|
|
437
|
+
refusalCode?: "too_large";
|
|
417
438
|
}>
|
|
418
439
|
| Readonly<{
|
|
419
440
|
kind: "updated";
|
|
@@ -450,11 +471,12 @@ Policy changes are attributed; an Agent can never enable its own writes.
|
|
|
450
471
|
\| `Readonly`\<\{ `kind`: `"refused"`; `reason`: \| `"pending"` \| `"expired"`
|
|
451
472
|
\| `"not-found"` \| `"not-eligible"` \| `"already-answered"` \|
|
|
452
473
|
`"stale-revision"` \| `"declined"` \| `"fenced"` \| `"not-granted"` \|
|
|
453
|
-
`"read-only"` \| `"
|
|
454
|
-
`denialNote?`: `string`;
|
|
455
|
-
`
|
|
456
|
-
|
|
457
|
-
\}
|
|
474
|
+
`"read-only"` \| `"not-executed"` \| `"in-flight"` \| `"outcome-unknown"` \|
|
|
475
|
+
`"identity-conflict"`; `denialNote?`: `string`; `refusalDetail?`: `string`;
|
|
476
|
+
`refusalCode?`: `"too_large"`; \}\> \| `Readonly`\<\{ `kind`: `"updated"`;
|
|
477
|
+
`rule`: \{ `scope`: \{ `agentId`: `string` \| `null`; \}; `family`: \{ `module`:
|
|
478
|
+
`string` \| `null`; `access`: `"write"` \| `"external"`; \}; `enabled`:
|
|
479
|
+
`boolean`; \}; \}\>
|
|
458
480
|
|
|
459
481
|
##### selectAutoApprove()
|
|
460
482
|
|
|
@@ -645,10 +667,13 @@ get(recordId):
|
|
|
645
667
|
| "fenced"
|
|
646
668
|
| "not-granted"
|
|
647
669
|
| "read-only"
|
|
670
|
+
| "not-executed"
|
|
648
671
|
| "in-flight"
|
|
649
672
|
| "outcome-unknown"
|
|
650
673
|
| "identity-conflict"
|
|
651
674
|
| null;
|
|
675
|
+
refusalDetail?: string;
|
|
676
|
+
refusalCode?: "too_large";
|
|
652
677
|
denialNote?: string;
|
|
653
678
|
requestedAt: number;
|
|
654
679
|
expiresAt: number;
|
|
@@ -680,8 +705,9 @@ Read a record from this home only; the maintained decoder owns stored JSON.
|
|
|
680
705
|
`"human"`; `memberId`: `string`; \} \| \{ `kind`: `"policy"`; \} \| `null`;
|
|
681
706
|
`reason`: \| `"pending"` \| `"expired"` \| `"not-found"` \| `"not-eligible"` \|
|
|
682
707
|
`"already-answered"` \| `"stale-revision"` \| `"declined"` \| `"fenced"` \|
|
|
683
|
-
`"not-granted"` \| `"read-only"` \| `"
|
|
684
|
-
`"identity-conflict"` \| `null`; `
|
|
708
|
+
`"not-granted"` \| `"read-only"` \| `"not-executed"` \| `"in-flight"` \|
|
|
709
|
+
`"outcome-unknown"` \| `"identity-conflict"` \| `null`; `refusalDetail?`:
|
|
710
|
+
`string`; `refusalCode?`: `"too_large"`; `denialNote?`: `string`; `requestedAt`:
|
|
685
711
|
`number`; `expiresAt`: `number`; `updatedAt`: `number`; `revision`: `number`; \}
|
|
686
712
|
\| `null`
|
|
687
713
|
|
|
@@ -764,6 +790,8 @@ type ApprovalRefusal = Readonly<{
|
|
|
764
790
|
kind: "refused";
|
|
765
791
|
reason: typeof ApprovalRefusalReasonSchema.Type;
|
|
766
792
|
denialNote?: typeof ApprovalDenialNoteSchema.Type;
|
|
793
|
+
refusalDetail?: typeof ApprovalRefusalDetailSchema.Type;
|
|
794
|
+
refusalCode?: typeof ApprovalRefusalCodeSchema.Type;
|
|
767
795
|
}>;
|
|
768
796
|
```
|
|
769
797
|
|
|
@@ -834,10 +862,13 @@ type Approvals = Readonly<{
|
|
|
834
862
|
| "fenced"
|
|
835
863
|
| "not-granted"
|
|
836
864
|
| "read-only"
|
|
865
|
+
| "not-executed"
|
|
837
866
|
| "in-flight"
|
|
838
867
|
| "outcome-unknown"
|
|
839
868
|
| "identity-conflict"
|
|
840
869
|
| null;
|
|
870
|
+
refusalDetail?: string;
|
|
871
|
+
refusalCode?: "too_large";
|
|
841
872
|
denialNote?: string;
|
|
842
873
|
requestedAt: number;
|
|
843
874
|
expiresAt: number;
|
|
@@ -852,6 +883,8 @@ type Approvals = Readonly<{
|
|
|
852
883
|
kind: "refused";
|
|
853
884
|
reason: typeof ApprovalRefusalReasonSchema.Type;
|
|
854
885
|
denialNote?: typeof ApprovalDenialNoteSchema.Type;
|
|
886
|
+
refusalDetail?: typeof ApprovalRefusalDetailSchema.Type;
|
|
887
|
+
refusalCode?: typeof ApprovalRefusalCodeSchema.Type;
|
|
855
888
|
}>
|
|
856
889
|
| Readonly<{
|
|
857
890
|
kind: "answered";
|
|
@@ -863,6 +896,8 @@ type Approvals = Readonly<{
|
|
|
863
896
|
kind: "refused";
|
|
864
897
|
reason: typeof ApprovalRefusalReasonSchema.Type;
|
|
865
898
|
denialNote?: typeof ApprovalDenialNoteSchema.Type;
|
|
899
|
+
refusalDetail?: typeof ApprovalRefusalDetailSchema.Type;
|
|
900
|
+
refusalCode?: typeof ApprovalRefusalCodeSchema.Type;
|
|
866
901
|
}>
|
|
867
902
|
| Readonly<{
|
|
868
903
|
kind: "updated";
|
|
@@ -972,6 +1007,26 @@ owner-only.
|
|
|
972
1007
|
|
|
973
1008
|
---
|
|
974
1009
|
|
|
1010
|
+
### ApprovalHostRefusal
|
|
1011
|
+
|
|
1012
|
+
```ts
|
|
1013
|
+
type ApprovalHostRefusal =
|
|
1014
|
+
| Readonly<{
|
|
1015
|
+
kind: "refused";
|
|
1016
|
+
reason: "not-granted" | "read-only";
|
|
1017
|
+
}>
|
|
1018
|
+
| Readonly<{
|
|
1019
|
+
kind: "refused";
|
|
1020
|
+
reason: "not-executed";
|
|
1021
|
+
refusalDetail: string;
|
|
1022
|
+
refusalCode?: typeof ApprovalRefusalCodeSchema.Type;
|
|
1023
|
+
}>;
|
|
1024
|
+
```
|
|
1025
|
+
|
|
1026
|
+
Host-attested zero-effect refusals, whether found at recheck or dispatch.
|
|
1027
|
+
|
|
1028
|
+
---
|
|
1029
|
+
|
|
975
1030
|
### ApprovalAdmission
|
|
976
1031
|
|
|
977
1032
|
```ts
|
|
@@ -980,10 +1035,7 @@ type ApprovalAdmission =
|
|
|
980
1035
|
kind: "authorized";
|
|
981
1036
|
authorityFence: string;
|
|
982
1037
|
}>
|
|
983
|
-
|
|
|
984
|
-
kind: "refused";
|
|
985
|
-
reason: "not-granted" | "read-only";
|
|
986
|
-
}>;
|
|
1038
|
+
| ApprovalHostRefusal;
|
|
987
1039
|
```
|
|
988
1040
|
|
|
989
1041
|
Mycelium owns admission; the ledger compares its opaque fence, never grant
|
|
@@ -999,10 +1051,7 @@ type ApprovalDispatchCompletion =
|
|
|
999
1051
|
kind: "completed";
|
|
1000
1052
|
output: typeof Schema.Json.Type;
|
|
1001
1053
|
}>
|
|
1002
|
-
|
|
|
1003
|
-
kind: "refused";
|
|
1004
|
-
reason: "not-granted" | "read-only";
|
|
1005
|
-
}>;
|
|
1054
|
+
| ApprovalHostRefusal;
|
|
1006
1055
|
```
|
|
1007
1056
|
|
|
1008
1057
|
Host verdict outside App JSON: only an attested zero-effect refusal is denied.
|
|
@@ -1181,6 +1230,7 @@ const ApprovalRefusalReasonSchema: Literals<
|
|
|
1181
1230
|
"fenced",
|
|
1182
1231
|
"not-granted",
|
|
1183
1232
|
"read-only",
|
|
1233
|
+
"not-executed",
|
|
1184
1234
|
"pending",
|
|
1185
1235
|
"in-flight",
|
|
1186
1236
|
"outcome-unknown",
|
|
@@ -1203,6 +1253,27 @@ Human explanation for a denied approval; distinct from the typed refusal cause.
|
|
|
1203
1253
|
|
|
1204
1254
|
---
|
|
1205
1255
|
|
|
1256
|
+
### ApprovalRefusalDetailSchema
|
|
1257
|
+
|
|
1258
|
+
```ts
|
|
1259
|
+
const ApprovalRefusalDetailSchema: String;
|
|
1260
|
+
```
|
|
1261
|
+
|
|
1262
|
+
Host-authored explanation of a refusal, distinct from a person's denial note.
|
|
1263
|
+
|
|
1264
|
+
---
|
|
1265
|
+
|
|
1266
|
+
### ApprovalRefusalCodeSchema
|
|
1267
|
+
|
|
1268
|
+
```ts
|
|
1269
|
+
const ApprovalRefusalCodeSchema: Literal<"too_large">;
|
|
1270
|
+
```
|
|
1271
|
+
|
|
1272
|
+
The host's own typed cause for a not-executed refusal, when its detail alone is
|
|
1273
|
+
not enough.
|
|
1274
|
+
|
|
1275
|
+
---
|
|
1276
|
+
|
|
1206
1277
|
### ApprovalDenialNoteSchema
|
|
1207
1278
|
|
|
1208
1279
|
```ts
|
|
@@ -1325,6 +1396,7 @@ const ApprovalRecordSchema: Struct<{
|
|
|
1325
1396
|
"fenced",
|
|
1326
1397
|
"not-granted",
|
|
1327
1398
|
"read-only",
|
|
1399
|
+
"not-executed",
|
|
1328
1400
|
"pending",
|
|
1329
1401
|
"in-flight",
|
|
1330
1402
|
"outcome-unknown",
|
|
@@ -1332,6 +1404,8 @@ const ApprovalRecordSchema: Struct<{
|
|
|
1332
1404
|
]
|
|
1333
1405
|
>
|
|
1334
1406
|
>;
|
|
1407
|
+
refusalDetail: optionalKey<String>;
|
|
1408
|
+
refusalCode: optionalKey<Literal<"too_large">>;
|
|
1335
1409
|
denialNote: optionalKey<String>;
|
|
1336
1410
|
requestedAt: Int;
|
|
1337
1411
|
expiresAt: Int;
|
|
@@ -1420,6 +1494,7 @@ const ApprovalViewSchema: Struct<{
|
|
|
1420
1494
|
"fenced",
|
|
1421
1495
|
"not-granted",
|
|
1422
1496
|
"read-only",
|
|
1497
|
+
"not-executed",
|
|
1423
1498
|
"pending",
|
|
1424
1499
|
"in-flight",
|
|
1425
1500
|
"outcome-unknown",
|
|
@@ -1427,6 +1502,8 @@ const ApprovalViewSchema: Struct<{
|
|
|
1427
1502
|
]
|
|
1428
1503
|
>
|
|
1429
1504
|
>;
|
|
1505
|
+
refusalDetail: optionalKey<String>;
|
|
1506
|
+
refusalCode: optionalKey<Literal<"too_large">>;
|
|
1430
1507
|
denialNote: optionalKey<String>;
|
|
1431
1508
|
requestedAt: Int;
|
|
1432
1509
|
expiresAt: Int;
|
|
@@ -1531,6 +1608,7 @@ const ApprovalRefusalSchema: Struct<{
|
|
|
1531
1608
|
"fenced",
|
|
1532
1609
|
"not-granted",
|
|
1533
1610
|
"read-only",
|
|
1611
|
+
"not-executed",
|
|
1534
1612
|
"pending",
|
|
1535
1613
|
"in-flight",
|
|
1536
1614
|
"outcome-unknown",
|
|
@@ -1538,6 +1616,8 @@ const ApprovalRefusalSchema: Struct<{
|
|
|
1538
1616
|
]
|
|
1539
1617
|
>;
|
|
1540
1618
|
denialNote: optionalKey<String>;
|
|
1619
|
+
refusalDetail: optionalKey<String>;
|
|
1620
|
+
refusalCode: optionalKey<Literal<"too_large">>;
|
|
1541
1621
|
}>;
|
|
1542
1622
|
```
|
|
1543
1623
|
|
|
@@ -1565,37 +1645,39 @@ Host-supplied human identity; the bounded reason remains quoted user text.
|
|
|
1565
1645
|
|
|
1566
1646
|
#### Parameters
|
|
1567
1647
|
|
|
1568
|
-
| Parameter | Type
|
|
1569
|
-
| --------------------------------------- |
|
|
1570
|
-
| `record` | \{ `recordId`: `string`; `requester`: \{ `principalId`: `string`; `agentId`: `string` \| `null`; `sessionId`: `string` \| `null`; `displayName`: `string`; \}; `module`: `string`; `operation`: `string`; `access`: `"write"` \| `"external"`; `description`: \{ `title`: `string`; `app?`: \{ `displayName`: `string`; `operationLabel`: `string`; \}; `inputBytes`: `number`; `inputSha256`: `string`; \}; `evidence?`: readonly `object`[]; `authorityFence`: `string`; `reversibility`: `"reversible"` \| `"irreversible-external"`; `state`: \| `"pending"` \| `"expired"` \| `"denied"` \| `"requested"` \| `"approved"` \| `"claimed"` \| `"applied"` \| `"outcome_unknown"`; `by`: \| \{ `kind`: `"human"`; `memberId`: `string`; \} \| \{ `kind`: `"policy"`; \} \| `null`; `reason`: \| `"pending"` \| `"expired"` \| `"not-found"` \| `"not-eligible"` \| `"already-answered"` \| `"stale-revision"` \| `"declined"` \| `"fenced"` \| `"not-granted"` \| `"read-only"` \| `"in-flight"` \| `"outcome-unknown"` \| `"identity-conflict"` \| `null`; `denialNote?`: `string`; `requestedAt`: `number`; `expiresAt`: `number`; `updatedAt`: `number`; `revision`: `number`; \} | - |
|
|
1571
|
-
| `record.recordId` | `string`
|
|
1572
|
-
| `record.requester` | \{ `principalId`: `string`; `agentId`: `string` \| `null`; `sessionId`: `string` \| `null`; `displayName`: `string`; \}
|
|
1573
|
-
| `record.requester.principalId` | `string`
|
|
1574
|
-
| `record.requester.agentId` | `string` \| `null`
|
|
1575
|
-
| `record.requester.sessionId` | `string` \| `null`
|
|
1576
|
-
| `record.requester.displayName` | `string`
|
|
1577
|
-
| `record.module` | `string`
|
|
1578
|
-
| `record.operation` | `string`
|
|
1579
|
-
| `record.access` | `"write"` \| `"external"`
|
|
1580
|
-
| `record.description` | \{ `title`: `string`; `app?`: \{ `displayName`: `string`; `operationLabel`: `string`; \}; `inputBytes`: `number`; `inputSha256`: `string`; \}
|
|
1581
|
-
| `record.description.title` | `string`
|
|
1582
|
-
| `record.description.app?` | \{ `displayName`: `string`; `operationLabel`: `string`; \}
|
|
1583
|
-
| `record.description.app.displayName` | `string`
|
|
1584
|
-
| `record.description.app.operationLabel` | `string`
|
|
1585
|
-
| `record.description.inputBytes` | `number`
|
|
1586
|
-
| `record.description.inputSha256` | `string`
|
|
1587
|
-
| `record.evidence?` | readonly `object`[]
|
|
1588
|
-
| `record.authorityFence` | `string`
|
|
1589
|
-
| `record.reversibility` | `"reversible"` \| `"irreversible-external"`
|
|
1590
|
-
| `record.state` | \| `"pending"` \| `"expired"` \| `"denied"` \| `"requested"` \| `"approved"` \| `"claimed"` \| `"applied"` \| `"outcome_unknown"`
|
|
1591
|
-
| `record.by` | \| \{ `kind`: `"human"`; `memberId`: `string`; \} \| \{ `kind`: `"policy"`; \} \| `null`
|
|
1592
|
-
| `record.reason` | \| `"pending"` \| `"expired"` \| `"not-found"` \| `"not-eligible"` \| `"already-answered"` \| `"stale-revision"` \| `"declined"` \| `"fenced"` \| `"not-granted"` \| `"read-only"` \| `"in-flight"` \| `"outcome-unknown"` \| `"identity-conflict"` \| `null`
|
|
1593
|
-
| `record.
|
|
1594
|
-
| `record.
|
|
1595
|
-
| `record.
|
|
1596
|
-
| `record.
|
|
1597
|
-
| `record.
|
|
1598
|
-
| `
|
|
1648
|
+
| Parameter | Type | Description |
|
|
1649
|
+
| --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- |
|
|
1650
|
+
| `record` | \{ `recordId`: `string`; `requester`: \{ `principalId`: `string`; `agentId`: `string` \| `null`; `sessionId`: `string` \| `null`; `displayName`: `string`; \}; `module`: `string`; `operation`: `string`; `access`: `"write"` \| `"external"`; `description`: \{ `title`: `string`; `app?`: \{ `displayName`: `string`; `operationLabel`: `string`; \}; `inputBytes`: `number`; `inputSha256`: `string`; \}; `evidence?`: readonly `object`[]; `authorityFence`: `string`; `reversibility`: `"reversible"` \| `"irreversible-external"`; `state`: \| `"pending"` \| `"expired"` \| `"denied"` \| `"requested"` \| `"approved"` \| `"claimed"` \| `"applied"` \| `"outcome_unknown"`; `by`: \| \{ `kind`: `"human"`; `memberId`: `string`; \} \| \{ `kind`: `"policy"`; \} \| `null`; `reason`: \| `"pending"` \| `"expired"` \| `"not-found"` \| `"not-eligible"` \| `"already-answered"` \| `"stale-revision"` \| `"declined"` \| `"fenced"` \| `"not-granted"` \| `"read-only"` \| `"not-executed"` \| `"in-flight"` \| `"outcome-unknown"` \| `"identity-conflict"` \| `null`; `refusalDetail?`: `string`; `refusalCode?`: `"too_large"`; `denialNote?`: `string`; `requestedAt`: `number`; `expiresAt`: `number`; `updatedAt`: `number`; `revision`: `number`; \} | - |
|
|
1651
|
+
| `record.recordId` | `string` | - |
|
|
1652
|
+
| `record.requester` | \{ `principalId`: `string`; `agentId`: `string` \| `null`; `sessionId`: `string` \| `null`; `displayName`: `string`; \} | - |
|
|
1653
|
+
| `record.requester.principalId` | `string` | - |
|
|
1654
|
+
| `record.requester.agentId` | `string` \| `null` | - |
|
|
1655
|
+
| `record.requester.sessionId` | `string` \| `null` | - |
|
|
1656
|
+
| `record.requester.displayName` | `string` | - |
|
|
1657
|
+
| `record.module` | `string` | - |
|
|
1658
|
+
| `record.operation` | `string` | - |
|
|
1659
|
+
| `record.access` | `"write"` \| `"external"` | - |
|
|
1660
|
+
| `record.description` | \{ `title`: `string`; `app?`: \{ `displayName`: `string`; `operationLabel`: `string`; \}; `inputBytes`: `number`; `inputSha256`: `string`; \} | - |
|
|
1661
|
+
| `record.description.title` | `string` | - |
|
|
1662
|
+
| `record.description.app?` | \{ `displayName`: `string`; `operationLabel`: `string`; \} | Catalog-authored App copy, not identity or authorization. |
|
|
1663
|
+
| `record.description.app.displayName` | `string` | - |
|
|
1664
|
+
| `record.description.app.operationLabel` | `string` | - |
|
|
1665
|
+
| `record.description.inputBytes` | `number` | - |
|
|
1666
|
+
| `record.description.inputSha256` | `string` | - |
|
|
1667
|
+
| `record.evidence?` | readonly `object`[] | - |
|
|
1668
|
+
| `record.authorityFence` | `string` | - |
|
|
1669
|
+
| `record.reversibility` | `"reversible"` \| `"irreversible-external"` | - |
|
|
1670
|
+
| `record.state` | \| `"pending"` \| `"expired"` \| `"denied"` \| `"requested"` \| `"approved"` \| `"claimed"` \| `"applied"` \| `"outcome_unknown"` | - |
|
|
1671
|
+
| `record.by` | \| \{ `kind`: `"human"`; `memberId`: `string`; \} \| \{ `kind`: `"policy"`; \} \| `null` | - |
|
|
1672
|
+
| `record.reason` | \| `"pending"` \| `"expired"` \| `"not-found"` \| `"not-eligible"` \| `"already-answered"` \| `"stale-revision"` \| `"declined"` \| `"fenced"` \| `"not-granted"` \| `"read-only"` \| `"not-executed"` \| `"in-flight"` \| `"outcome-unknown"` \| `"identity-conflict"` \| `null` | - |
|
|
1673
|
+
| `record.refusalDetail?` | `string` | - |
|
|
1674
|
+
| `record.refusalCode?` | `"too_large"` | - |
|
|
1675
|
+
| `record.denialNote?` | `string` | - |
|
|
1676
|
+
| `record.requestedAt` | `number` | - |
|
|
1677
|
+
| `record.expiresAt` | `number` | - |
|
|
1678
|
+
| `record.updatedAt` | `number` | - |
|
|
1679
|
+
| `record.revision` | `number` | - |
|
|
1680
|
+
| `person` | `string` | - |
|
|
1599
1681
|
|
|
1600
1682
|
#### Returns
|
|
1601
1683
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/approvals",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
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",
|