@gotgenes/pi-permission-system 20.1.0 → 20.3.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/CHANGELOG.md +25 -0
- package/docs/cross-extension-api.md +2 -1
- package/docs/subagent-integration.md +2 -0
- package/package.json +1 -1
- package/src/authority/approval-escalator.ts +17 -7
- package/src/authority/authorizer-selection.ts +26 -27
- package/src/authority/denying-authorizer.ts +9 -1
- package/src/authority/forwarded-request-server.ts +209 -87
- package/src/authority/forwarding-io.ts +27 -0
- package/src/authority/local-user-authorizer.ts +35 -5
- package/src/authority/permission-prompter.ts +30 -1
- package/src/handlers/gates/helpers.ts +4 -3
- package/src/handlers/gates/runner.ts +11 -7
- package/src/index.ts +38 -15
- package/src/pattern-suggest.ts +29 -0
- package/src/permission-dialog.ts +34 -0
- package/src/permission-forwarding.ts +23 -1
- package/src/permission-gate.ts +15 -21
- package/src/permission-ui-prompt.ts +39 -54
- package/src/session-approval.ts +11 -0
- package/src/gate-prompter.ts +0 -12
package/src/session-approval.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ForwardedSessionApproval } from "./permission-forwarding";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Value object for a session-scoped approval: one surface, one-or-more patterns.
|
|
3
5
|
*
|
|
@@ -40,4 +42,13 @@ export class SessionApproval {
|
|
|
40
42
|
if (pattern === undefined) return undefined;
|
|
41
43
|
return { surface: this.surface, pattern };
|
|
42
44
|
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Plain data shape for relaying this approval on a forwarded request, so the
|
|
48
|
+
* serving node can record the same pattern(s) as a whole-session grant.
|
|
49
|
+
* Returns a defensive copy of the patterns.
|
|
50
|
+
*/
|
|
51
|
+
toForwardedData(): ForwardedSessionApproval {
|
|
52
|
+
return { surface: this.surface, patterns: [...this.patterns] };
|
|
53
|
+
}
|
|
43
54
|
}
|
package/src/gate-prompter.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { PromptPermissionDetails } from "./authority/permission-prompter";
|
|
2
|
-
import type { PermissionPromptDecision } from "./permission-dialog";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* The prompting role the gate runner needs: a yes/no on whether an
|
|
6
|
-
* interactive confirmation is possible, and the prompt itself. The context
|
|
7
|
-
* is bound by the implementor, not threaded per call.
|
|
8
|
-
*/
|
|
9
|
-
export interface GatePrompter {
|
|
10
|
-
canConfirm(): boolean;
|
|
11
|
-
prompt(details: PromptPermissionDetails): Promise<PermissionPromptDecision>;
|
|
12
|
-
}
|