@punica/editor 1.15.0 → 1.16.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.bundle.esm.js +2 -2
- package/dist/index.bundle.esm.js.map +1 -1
- package/dist/index.bundle.umd.js +2 -2
- package/dist/index.bundle.umd.js.map +1 -1
- package/package.json +1 -1
- package/types/punica.module.flow.engine.d.ts +9 -0
- package/types/punica.module.kernel.ai.d.ts +17 -1
- package/types/punica.module.kernel.policy.d.ts +73 -1
package/package.json
CHANGED
|
@@ -116,6 +116,15 @@ declare module 'punica' {
|
|
|
116
116
|
risk: string;
|
|
117
117
|
approval: string;
|
|
118
118
|
reason?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Argument binding carried from the gate — see
|
|
121
|
+
* `kernel.PolicyRequest.argsBinding`. Without it the approval
|
|
122
|
+
* recorded when this pending resolves covers every argument
|
|
123
|
+
* tuple for the step's capability, not just this step's.
|
|
124
|
+
*/
|
|
125
|
+
argsBinding?: string;
|
|
126
|
+
/** Redacted view of the bound arguments, for the approval UI. */
|
|
127
|
+
argsPreview?: unknown;
|
|
119
128
|
workspaceId?: string;
|
|
120
129
|
timestampMs: number;
|
|
121
130
|
}
|
|
@@ -46,6 +46,20 @@ declare module 'punica' {
|
|
|
46
46
|
risk: string;
|
|
47
47
|
approval: string;
|
|
48
48
|
reason?: string;
|
|
49
|
+
/**
|
|
50
|
+
* The argument binding the gate computed for this call — see
|
|
51
|
+
* `kernel.PolicyRequest.argsBinding`. Carried across the round
|
|
52
|
+
* trip so `approvePending` grants for the arguments the user was
|
|
53
|
+
* shown rather than for the capability as a whole.
|
|
54
|
+
*/
|
|
55
|
+
argsBinding?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Redacted view of those arguments, so an approval prompt can
|
|
58
|
+
* show what is being bound. A user asked to allow
|
|
59
|
+
* `mcp.aws.deleteObject` without seeing the bucket is consenting
|
|
60
|
+
* to a name, not to an action.
|
|
61
|
+
*/
|
|
62
|
+
argsPreview?: unknown;
|
|
49
63
|
correlationId?: string;
|
|
50
64
|
/**
|
|
51
65
|
* Trace id of the invocation that hit the gate (an agent run id
|
|
@@ -509,7 +523,9 @@ declare module 'punica' {
|
|
|
509
523
|
* history rather than fail a run.
|
|
510
524
|
*/
|
|
511
525
|
export interface ToolUsageStore {
|
|
512
|
-
read(): Promise<
|
|
526
|
+
read(): Promise<
|
|
527
|
+
Record<string, { calls: number; ok: number; last: number }>
|
|
528
|
+
>;
|
|
513
529
|
record(capabilityId: string, ok: boolean, atMs: number): Promise<void>;
|
|
514
530
|
forget(): Promise<void>;
|
|
515
531
|
}
|
|
@@ -22,6 +22,27 @@ declare module 'punica' {
|
|
|
22
22
|
* Optional human-readable reason shown in UI prompts.
|
|
23
23
|
*/
|
|
24
24
|
reason?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Which arguments this decision is about — a digest computed by
|
|
27
|
+
* `computeArgsBinding` from the capability's REDACTED input, or the
|
|
28
|
+
* literal `'any'` for a grant deliberately made argument-blind
|
|
29
|
+
* (an unattended-client pre-authorisation).
|
|
30
|
+
*
|
|
31
|
+
* Absent means the request has no argument dimension (`llm.remote`,
|
|
32
|
+
* a flow step). Absence keys exactly as it did before bindings
|
|
33
|
+
* existed, so those kinds re-prompt nothing.
|
|
34
|
+
*
|
|
35
|
+
* The field is what stops one "always" grant on
|
|
36
|
+
* `mcp.aws.deleteObject` from authorising every bucket.
|
|
37
|
+
*/
|
|
38
|
+
argsBinding?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Redacted, possibly truncated view of the bound arguments.
|
|
41
|
+
* Carried so an approval prompt can show what is being bound and
|
|
42
|
+
* an evidence package can read it back — a digest alone means the
|
|
43
|
+
* user consented to a hash they never saw.
|
|
44
|
+
*/
|
|
45
|
+
argsPreview?: unknown;
|
|
25
46
|
}
|
|
26
47
|
|
|
27
48
|
/**
|
|
@@ -123,6 +144,15 @@ declare module 'punica' {
|
|
|
123
144
|
* record + chain state by this id.
|
|
124
145
|
*/
|
|
125
146
|
chainRef?: string;
|
|
147
|
+
/**
|
|
148
|
+
* The arguments this grant covers. See `PolicyRequest.argsBinding`.
|
|
149
|
+
* Persisted so a grant matches only the arguments it was given
|
|
150
|
+
* for, and so a reader can distinguish a bucket-specific approval
|
|
151
|
+
* from an `'any'` blanket one.
|
|
152
|
+
*/
|
|
153
|
+
argsBinding?: string;
|
|
154
|
+
/** Redacted view of the bound arguments, for display and audit. */
|
|
155
|
+
argsPreview?: unknown;
|
|
126
156
|
/**
|
|
127
157
|
* Time-bounded approvals — Sub-step 3.F. Epoch ms after which
|
|
128
158
|
* the approval is considered expired. `hasApproval` returns
|
|
@@ -191,8 +221,17 @@ declare module 'punica' {
|
|
|
191
221
|
}
|
|
192
222
|
): ApprovalRecord;
|
|
193
223
|
|
|
224
|
+
/**
|
|
225
|
+
* `argsBinding` must be supplied when revoking a bound grant —
|
|
226
|
+
* omitting it targets the unbound key and silently revokes
|
|
227
|
+
* nothing, which is how a consumed "approve once" would turn into
|
|
228
|
+
* a permanent allow.
|
|
229
|
+
*/
|
|
194
230
|
revokeApproval(
|
|
195
|
-
rec: Pick<
|
|
231
|
+
rec: Pick<
|
|
232
|
+
ApprovalRecord,
|
|
233
|
+
'kind' | 'id' | 'scope' | 'workspaceId' | 'argsBinding'
|
|
234
|
+
>
|
|
196
235
|
): boolean;
|
|
197
236
|
|
|
198
237
|
/**
|
|
@@ -308,8 +347,41 @@ declare module 'punica' {
|
|
|
308
347
|
isRevoked(jti: string): boolean;
|
|
309
348
|
}
|
|
310
349
|
|
|
350
|
+
/** What `computeArgsBinding` returns. */
|
|
351
|
+
export interface ArgsBinding {
|
|
352
|
+
/** Digest of the bound arguments. */
|
|
353
|
+
binding: string;
|
|
354
|
+
/** Redacted, possibly truncated view of what was bound. */
|
|
355
|
+
preview: unknown;
|
|
356
|
+
}
|
|
357
|
+
|
|
311
358
|
export namespace Policy {
|
|
312
359
|
const manager: PolicyApi;
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Literal binding meaning "any arguments" — a grant deliberately
|
|
363
|
+
* made argument-blind, as opposed to a request that has no
|
|
364
|
+
* argument dimension at all (absent binding).
|
|
365
|
+
*/
|
|
366
|
+
const ARGS_BINDING_ANY: 'any';
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Digest the arguments a decision is about.
|
|
370
|
+
*
|
|
371
|
+
* `source` must be the REDACTED input, so no secret value reaches
|
|
372
|
+
* the digest. `policyKeyPaths` narrows the binding to the declared
|
|
373
|
+
* fields, which is what makes an `always` grant practical; empty
|
|
374
|
+
* binds the whole argument tuple.
|
|
375
|
+
*
|
|
376
|
+
* An extension that pre-records a grant must call this rather than
|
|
377
|
+
* hashing locally — otherwise its key and the gate's key drift and
|
|
378
|
+
* the grant never matches. Throws when Web Crypto is unavailable
|
|
379
|
+
* rather than falling back to a weaker hash.
|
|
380
|
+
*/
|
|
381
|
+
function computeArgsBinding(
|
|
382
|
+
source: unknown,
|
|
383
|
+
options?: { policyKeyPaths?: ReadonlyArray<ReadonlyArray<string>> }
|
|
384
|
+
): Promise<ArgsBinding>;
|
|
313
385
|
}
|
|
314
386
|
}
|
|
315
387
|
}
|