@gotgenes/pi-permission-system 31.1.0 → 31.1.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/CHANGELOG.md +14 -0
- package/dist/public.d.ts +15 -15
- package/docs/configuration.md +1 -1
- package/docs/cross-extension-api.md +1 -1
- package/docs/session-approvals.md +2 -2
- package/package.json +2 -1
- package/src/access-intent/access-intent.ts +1 -1
- package/src/access-intent/bash/bash-path-resolver.ts +11 -14
- package/src/access-intent/bash/command-enumeration.ts +6 -12
- package/src/access-intent/bash/msys-bash-tokens.ts +1 -1
- package/src/access-intent/bash/nested-execution.ts +1 -1
- package/src/access-intent/bash/node-text.ts +2 -2
- package/src/access-intent/bash/parser.ts +1 -1
- package/src/access-intent/bash/program.ts +4 -7
- package/src/access-intent/bash/redirect-analysis.ts +2 -2
- package/src/access-intent/bash/shell-variable-expansion.ts +1 -1
- package/src/access-intent/bash/sync-commands.ts +2 -5
- package/src/access-intent/bash/token-collection.ts +6 -9
- package/src/access-intent/bash/wrapper-analysis.ts +1 -1
- package/src/access-intent/input-normalizer.ts +2 -2
- package/src/access-intent/path-normalization.ts +1 -1
- package/src/access-intent/path-surfaces.ts +1 -1
- package/src/access-intent/tool-input-path.ts +1 -1
- package/src/access-intent/tool-kind.ts +1 -1
- package/src/authority/approval-escalator.ts +13 -13
- package/src/authority/authorizer-chain.ts +1 -1
- package/src/authority/authorizer-registry.ts +1 -1
- package/src/authority/authorizer-selection.ts +1 -1
- package/src/authority/authorizer.ts +9 -9
- package/src/authority/decision-resolution.ts +2 -5
- package/src/authority/denying-authorizer.ts +1 -1
- package/src/authority/forwarded-request-server.ts +21 -24
- package/src/authority/forwarder-context.ts +2 -2
- package/src/authority/forwarding-io.ts +14 -12
- package/src/authority/forwarding-liveness.ts +5 -8
- package/src/authority/forwarding-manager.ts +1 -1
- package/src/authority/inherited-registrations.ts +2 -2
- package/src/authority/local-user-authorizer.ts +13 -13
- package/src/authority/permission-dialog.ts +2 -2
- package/src/authority/permission-forwarding.ts +6 -3
- package/src/authority/permission-prompt-component.ts +12 -15
- package/src/authority/permission-prompt-decision.ts +2 -2
- package/src/authority/permission-prompter.ts +8 -8
- package/src/authority/subagent-context.ts +3 -3
- package/src/authority/subagent-detection.ts +3 -3
- package/src/{config-loader.ts → config/config-loader.ts} +3 -3
- package/src/{config-modal.ts → config/config-modal.ts} +1 -2
- package/src/{config-reporter.ts → config/config-reporter.ts} +1 -1
- package/src/{config-store.ts → config/config-store.ts} +1 -2
- package/src/{extension-config.ts → config/extension-config.ts} +4 -4
- package/src/{extension-paths.ts → config/extension-paths.ts} +1 -1
- package/src/{policy-loader.ts → config/policy-loader.ts} +2 -2
- package/src/{skill-prompt-sanitizer.ts → exposure/skill-prompt-sanitizer.ts} +2 -2
- package/src/{tool-registry.ts → exposure/tool-registry.ts} +1 -1
- package/src/handlers/before-agent-start.ts +11 -8
- package/src/handlers/gates/bash-command.ts +2 -2
- package/src/handlers/gates/bash-external-directory.ts +3 -3
- package/src/handlers/gates/bash-path-extractor.ts +1 -1
- package/src/handlers/gates/bash-path.ts +4 -4
- package/src/handlers/gates/descriptor.ts +2 -2
- package/src/handlers/gates/external-directory-policy.ts +2 -2
- package/src/handlers/gates/external-directory.ts +4 -4
- package/src/handlers/gates/helpers.ts +1 -1
- package/src/handlers/gates/path.ts +4 -4
- package/src/handlers/gates/runner.ts +4 -4
- package/src/handlers/gates/skill-read.ts +3 -3
- package/src/handlers/gates/tool-call-gate-pipeline.ts +7 -7
- package/src/handlers/gates/tool.ts +3 -3
- package/src/handlers/lifecycle.ts +6 -7
- package/src/handlers/permission-gate-handler.ts +11 -11
- package/src/handlers/session-turn-prep.ts +1 -1
- package/src/handlers/tool-call-boundary.ts +3 -3
- package/src/index.ts +39 -39
- package/src/{decision-reporter.ts → logging/decision-reporter.ts} +1 -1
- package/src/{logging.ts → logging/logging.ts} +1 -1
- package/src/{session-logger.ts → logging/session-logger.ts} +5 -2
- package/src/path/approval-pattern.ts +1 -1
- package/src/path/canonicalize-path.ts +1 -1
- package/src/path/path-containment.ts +2 -2
- package/src/path/path-flavor.ts +1 -1
- package/src/{path-normalizer.ts → path/path-normalizer.ts} +6 -8
- package/src/path/pi-infrastructure-read.ts +3 -3
- package/src/{normalize.ts → policy/normalize.ts} +2 -2
- package/src/{permission-gate.ts → policy/permission-gate.ts} +1 -1
- package/src/{permission-manager.ts → policy/permission-manager.ts} +21 -15
- package/src/{permission-merge.ts → policy/permission-merge.ts} +1 -1
- package/src/{permission-resolver.ts → policy/permission-resolver.ts} +5 -5
- package/src/{rule.ts → policy/rule.ts} +3 -4
- package/src/{scope-merge.ts → policy/scope-merge.ts} +3 -3
- package/src/{synthesize.ts → policy/synthesize.ts} +1 -1
- package/src/{wildcard-matcher.ts → policy/wildcard-matcher.ts} +1 -1
- package/src/presentation/agent-renderer.ts +5 -5
- package/src/presentation/dialog-renderer.ts +3 -3
- package/src/presentation/fact-vocabulary.ts +1 -4
- package/src/presentation/forwarded-ask-payload.ts +1 -4
- package/src/presentation/path-ask-payload.ts +2 -5
- package/src/{pattern-suggest.ts → presentation/pattern-suggest.ts} +6 -3
- package/src/{permission-prompts.ts → presentation/permission-prompts.ts} +1 -1
- package/src/presentation/review-log-renderer.ts +1 -1
- package/src/presentation/skill-ask-payload.ts +3 -3
- package/src/presentation/tool-ask-payload.ts +3 -6
- package/src/{bash-advisory-check.ts → service/bash-advisory-check.ts} +1 -1
- package/src/{permissions-service.ts → service/permissions-service.ts} +10 -10
- package/src/{service-lifecycle.ts → service/service-lifecycle.ts} +5 -5
- package/src/service.ts +18 -18
- package/src/{permission-session.ts → session/permission-session.ts} +19 -20
- package/src/{session-approval.ts → session/session-approval.ts} +2 -2
- package/src/{session-rules.ts → session/session-rules.ts} +1 -1
- package/src/{builtin-tool-input-formatters.ts → tool-input/builtin-tool-input-formatters.ts} +1 -1
- package/src/{tool-input-preview.ts → tool-input/tool-input-preview.ts} +2 -2
- package/src/{tool-input-prompt-formatters.ts → tool-input/tool-input-prompt-formatters.ts} +1 -1
- package/src/{tool-preview-formatter.ts → tool-input/tool-preview-formatter.ts} +3 -3
- package/src/types.ts +2 -2
- /package/src/{async-cache.ts → access-intent/bash/async-cache.ts} +0 -0
- /package/src/{bash-arity.ts → access-intent/bash/bash-arity.ts} +0 -0
- /package/src/{config-paths.ts → config/config-paths.ts} +0 -0
- /package/src/{config-schema.ts → config/config-schema.ts} +0 -0
- /package/src/{status.ts → config/status.ts} +0 -0
- /package/src/{yaml-frontmatter.ts → config/yaml-frontmatter.ts} +0 -0
- /package/src/{system-prompt-sanitizer.ts → exposure/system-prompt-sanitizer.ts} +0 -0
- /package/src/{tool-surface-baseline.ts → exposure/tool-surface-baseline.ts} +0 -0
- /package/src/{decision-audit.ts → logging/decision-audit.ts} +0 -0
- /package/src/{json-safe-stringify.ts → logging/json-safe-stringify.ts} +0 -0
- /package/src/{log-field-cap.ts → logging/log-field-cap.ts} +0 -0
- /package/src/{log-file-permissions.ts → logging/log-file-permissions.ts} +0 -0
- /package/src/{log-redaction.ts → logging/log-redaction.ts} +0 -0
- /package/src/{expand-home.ts → path/expand-home.ts} +0 -0
- /package/src/{node-modules-discovery.ts → path/node-modules-discovery.ts} +0 -0
- /package/src/{safe-system-paths.ts → path/safe-system-paths.ts} +0 -0
- /package/src/{restrictiveness.ts → policy/restrictiveness.ts} +0 -0
- /package/src/{permission-events.ts → service/permission-events.ts} +0 -0
- /package/src/{permission-ui-prompt.ts → service/permission-ui-prompt.ts} +0 -0
- /package/src/{active-agent.ts → session/active-agent.ts} +0 -0
- /package/src/{approval-grant.ts → session/approval-grant.ts} +0 -0
- /package/src/{session-approval-recorder.ts → session/session-approval-recorder.ts} +0 -0
- /package/src/{session-identity.ts → session/session-identity.ts} +0 -0
- /package/src/{tool-access-extractor-registry.ts → tool-input/tool-access-extractor-registry.ts} +0 -0
- /package/src/{tool-input-formatter-registry.ts → tool-input/tool-input-formatter-registry.ts} +0 -0
package/src/service.ts
CHANGED
|
@@ -18,15 +18,15 @@
|
|
|
18
18
|
* ensures resilience across `/reload` and load-order edge cases.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
import type { Authorizer } from "
|
|
22
|
-
import type { ToolAccessExtractor } from "
|
|
23
|
-
import type { ToolInputFormatter } from "
|
|
21
|
+
import type { Authorizer } from "#src/authority/authorizer";
|
|
22
|
+
import type { ToolAccessExtractor } from "#src/tool-input/tool-access-extractor-registry";
|
|
23
|
+
import type { ToolInputFormatter } from "#src/tool-input/tool-input-formatter-registry";
|
|
24
24
|
import type { PermissionCheckResult, PermissionState } from "./types";
|
|
25
25
|
|
|
26
26
|
export type {
|
|
27
27
|
Authorizer,
|
|
28
28
|
AuthorizerVerdict,
|
|
29
|
-
} from "
|
|
29
|
+
} from "#src/authority/authorizer";
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* The narrow review-log seam handed to a chain link at `authorize` time
|
|
@@ -43,19 +43,7 @@ export interface AuthorizerLog {
|
|
|
43
43
|
review(event: string, details?: Record<string, unknown>): void;
|
|
44
44
|
debug(event: string, details?: Record<string, unknown>): void;
|
|
45
45
|
}
|
|
46
|
-
export type { PromptPermissionDetails } from "
|
|
47
|
-
export type {
|
|
48
|
-
ForwardedPromptContext,
|
|
49
|
-
PermissionDecisionEvent,
|
|
50
|
-
PermissionsReadyEvent,
|
|
51
|
-
PermissionUiPromptEvent,
|
|
52
|
-
PermissionUiPromptSource,
|
|
53
|
-
} from "./permission-events";
|
|
54
|
-
export {
|
|
55
|
-
PERMISSIONS_DECISION_CHANNEL,
|
|
56
|
-
PERMISSIONS_READY_CHANNEL,
|
|
57
|
-
PERMISSIONS_UI_PROMPT_CHANNEL,
|
|
58
|
-
} from "./permission-events";
|
|
46
|
+
export type { PromptPermissionDetails } from "#src/authority/permission-prompter";
|
|
59
47
|
// The declaration bundle already inlines these through `PromptPermissionDetails`
|
|
60
48
|
// and `PermissionUiPromptEvent`; the named exports are what a consumer needs to
|
|
61
49
|
// annotate a variable of their own.
|
|
@@ -66,7 +54,19 @@ export type {
|
|
|
66
54
|
PromptPayloadKind,
|
|
67
55
|
PromptRequester,
|
|
68
56
|
PromptRequestFacts,
|
|
69
|
-
} from "
|
|
57
|
+
} from "#src/presentation/prompt-payload";
|
|
58
|
+
export type {
|
|
59
|
+
ForwardedPromptContext,
|
|
60
|
+
PermissionDecisionEvent,
|
|
61
|
+
PermissionsReadyEvent,
|
|
62
|
+
PermissionUiPromptEvent,
|
|
63
|
+
PermissionUiPromptSource,
|
|
64
|
+
} from "#src/service/permission-events";
|
|
65
|
+
export {
|
|
66
|
+
PERMISSIONS_DECISION_CHANNEL,
|
|
67
|
+
PERMISSIONS_READY_CHANNEL,
|
|
68
|
+
PERMISSIONS_UI_PROMPT_CHANNEL,
|
|
69
|
+
} from "#src/service/permission-events";
|
|
70
70
|
export type { PermissionCheckResult, PermissionState, ToolInputFormatter };
|
|
71
71
|
|
|
72
72
|
/** Process-global key for the session-keyed service map (ADR 0012 decision 2). */
|
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import type { AuthorizerSelectionLifecycle } from "#src/authority/authorizer-selection";
|
|
2
3
|
import type { ForwardingController } from "#src/authority/forwarding-manager";
|
|
4
|
+
import type { ShellToolsConfig } from "#src/config/config-schema";
|
|
5
|
+
import type { SessionConfigStore } from "#src/config/config-store";
|
|
6
|
+
import type { PermissionSystemExtensionConfig } from "#src/config/extension-config";
|
|
7
|
+
import type { ExtensionPaths } from "#src/config/extension-paths";
|
|
8
|
+
import type { SkillPromptEntry } from "#src/exposure/skill-prompt-sanitizer";
|
|
3
9
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
10
|
-
import
|
|
11
|
-
import type {
|
|
12
|
-
import type { ToolCallGateInputs } from "./handlers/gates/tool-call-gate-pipeline";
|
|
13
|
-
import type { PathFlavor } from "./path/path-flavor";
|
|
14
|
-
import { PathNormalizer } from "./path-normalizer";
|
|
15
|
-
import type { ScopedPermissionManager } from "./permission-manager";
|
|
16
|
-
|
|
17
|
-
import type { SessionRules } from "./session-rules";
|
|
18
|
-
import type { SkillPromptEntry } from "./skill-prompt-sanitizer";
|
|
10
|
+
ToolSurfaceBaseline,
|
|
11
|
+
type ToolSurfaceObservation,
|
|
12
|
+
type ToolSurfaceResolution,
|
|
13
|
+
} from "#src/exposure/tool-surface-baseline";
|
|
14
|
+
import type { ToolCallGateInputs } from "#src/handlers/gates/tool-call-gate-pipeline";
|
|
15
|
+
import type { PathFlavor } from "#src/path/path-flavor";
|
|
16
|
+
import { PathNormalizer } from "#src/path/path-normalizer";
|
|
17
|
+
import type { ScopedPermissionManager } from "#src/policy/permission-manager";
|
|
19
18
|
import {
|
|
20
19
|
resolveToolPreviewLimits,
|
|
21
20
|
type ToolPreviewFormatterOptions,
|
|
22
|
-
} from "
|
|
21
|
+
} from "#src/tool-input/tool-preview-formatter";
|
|
23
22
|
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} from "./
|
|
23
|
+
getActiveAgentName,
|
|
24
|
+
getActiveAgentNameFromSystemPrompt,
|
|
25
|
+
} from "./active-agent";
|
|
26
|
+
import type { SessionRules } from "./session-rules";
|
|
28
27
|
|
|
29
28
|
/**
|
|
30
29
|
* Encapsulates all mutable session state and exposes operations instead of
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import type { ForwardedSessionApproval } from "#src/authority/permission-forwarding";
|
|
1
2
|
import {
|
|
2
3
|
type ApprovalGrant,
|
|
3
4
|
type SessionGrantWidth,
|
|
4
5
|
widenGrant,
|
|
5
|
-
} from "
|
|
6
|
-
import type { ForwardedSessionApproval } from "#src/authority/permission-forwarding";
|
|
6
|
+
} from "./approval-grant";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Value object for a session-scoped approval: one or more
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { surfaceFamilyMembers } from "#src/access-intent/path-surfaces";
|
|
2
|
-
import type { Ruleset } from "
|
|
2
|
+
import type { Ruleset } from "#src/policy/rule";
|
|
3
3
|
import type { SessionApproval } from "./session-approval";
|
|
4
4
|
import type { SessionApprovalRecorder } from "./session-approval-recorder";
|
|
5
5
|
|
package/src/{builtin-tool-input-formatters.ts → tool-input/builtin-tool-input-formatters.ts}
RENAMED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
* through exactly the same path a third-party extension would use.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import { toRecord } from "#src/value-guards";
|
|
8
9
|
import type {
|
|
9
10
|
ToolInputFormatter,
|
|
10
11
|
ToolInputFormatterRegistry,
|
|
11
12
|
} from "./tool-input-formatter-registry";
|
|
12
13
|
import { truncateInlineText } from "./tool-input-preview";
|
|
13
|
-
import { toRecord } from "./value-guards";
|
|
14
14
|
|
|
15
15
|
/** Maximum total length of the generated argument summary (before "with " prefix). */
|
|
16
16
|
const MCP_ARGS_SUMMARY_MAX_LENGTH = 160;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { safeJsonStringify } from "
|
|
2
|
-
import { redactedJsonStringify } from "
|
|
1
|
+
import { safeJsonStringify } from "#src/logging/json-safe-stringify";
|
|
2
|
+
import { redactedJsonStringify } from "#src/logging/log-redaction";
|
|
3
3
|
|
|
4
4
|
export const TOOL_INPUT_PREVIEW_MAX_LENGTH = 200;
|
|
5
5
|
export const TOOL_TEXT_SUMMARY_MAX_LENGTH = 80;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { getNonEmptyString, toRecord } from "#src/value-guards";
|
|
1
2
|
import { countTextLines, formatCount } from "./tool-input-preview";
|
|
2
|
-
import { getNonEmptyString, toRecord } from "./value-guards";
|
|
3
3
|
|
|
4
4
|
export function getPromptPath(input: Record<string, unknown>): string | null {
|
|
5
5
|
return getNonEmptyString(input.path) ?? getNonEmptyString(input.file_path);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { classifyToolKind, isMcpCheck } from "
|
|
1
|
+
import { classifyToolKind, isMcpCheck } from "#src/access-intent/tool-kind";
|
|
2
|
+
import type { PermissionCheckResult } from "#src/types";
|
|
3
|
+
import { getNonEmptyString, toRecord } from "#src/value-guards";
|
|
2
4
|
import type { ToolInputFormatterLookup } from "./tool-input-formatter-registry";
|
|
3
5
|
import {
|
|
4
6
|
serializeRedactedToolInputPreview,
|
|
@@ -13,8 +15,6 @@ import {
|
|
|
13
15
|
formatWriteInputForPrompt,
|
|
14
16
|
getPromptPath,
|
|
15
17
|
} from "./tool-input-prompt-formatters";
|
|
16
|
-
import type { PermissionCheckResult } from "./types";
|
|
17
|
-
import { getNonEmptyString, toRecord } from "./value-guards";
|
|
18
18
|
|
|
19
19
|
export interface ToolPreviewFormatterOptions {
|
|
20
20
|
toolInputPreviewMaxLength: number;
|
package/src/types.ts
CHANGED
|
@@ -3,8 +3,8 @@ import type {
|
|
|
3
3
|
FlatPermissionConfig,
|
|
4
4
|
PatternValue,
|
|
5
5
|
PermissionState,
|
|
6
|
-
} from "
|
|
7
|
-
import type { RuleOrigin } from "
|
|
6
|
+
} from "#src/config/config-schema";
|
|
7
|
+
import type { RuleOrigin } from "#src/policy/rule";
|
|
8
8
|
|
|
9
9
|
// The config-file shape types are derived from the zod schema
|
|
10
10
|
// (config-schema.ts) — the single source of truth — and re-exported here so
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/{tool-access-extractor-registry.ts → tool-input/tool-access-extractor-registry.ts}
RENAMED
|
File without changes
|
/package/src/{tool-input-formatter-registry.ts → tool-input/tool-input-formatter-registry.ts}
RENAMED
|
File without changes
|