@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
|
@@ -2,24 +2,24 @@ import type {
|
|
|
2
2
|
ExtensionContext,
|
|
3
3
|
InputEventResult,
|
|
4
4
|
} from "@earendil-works/pi-coding-agent";
|
|
5
|
-
import {
|
|
6
|
-
formatMissingToolNameReason,
|
|
7
|
-
formatUnknownToolReason,
|
|
8
|
-
} from "#src/permission-prompts";
|
|
9
|
-
import type { PermissionSession } from "#src/permission-session";
|
|
10
5
|
import {
|
|
11
6
|
checkRequestedToolRegistration,
|
|
12
7
|
getToolNameFromValue,
|
|
13
8
|
type ToolRegistry,
|
|
14
|
-
} from "#src/tool-registry";
|
|
15
|
-
import {
|
|
16
|
-
import type { GateRunner } from "./gates/runner";
|
|
9
|
+
} from "#src/exposure/tool-registry";
|
|
10
|
+
import type { GateRunner } from "#src/handlers/gates/runner";
|
|
17
11
|
import type {
|
|
18
12
|
GateNotifier,
|
|
19
13
|
SkillInputGatePipeline,
|
|
20
|
-
} from "
|
|
21
|
-
import type { ToolCallGatePipeline } from "
|
|
22
|
-
import type { GateOutcome, ToolCallContext } from "
|
|
14
|
+
} from "#src/handlers/gates/skill-input-gate-pipeline";
|
|
15
|
+
import type { ToolCallGatePipeline } from "#src/handlers/gates/tool-call-gate-pipeline";
|
|
16
|
+
import type { GateOutcome, ToolCallContext } from "#src/handlers/gates/types";
|
|
17
|
+
import {
|
|
18
|
+
formatMissingToolNameReason,
|
|
19
|
+
formatUnknownToolReason,
|
|
20
|
+
} from "#src/presentation/permission-prompts";
|
|
21
|
+
import type { PermissionSession } from "#src/session/permission-session";
|
|
22
|
+
import { toRecord } from "#src/value-guards";
|
|
23
23
|
|
|
24
24
|
/** Minimal subset of InputEvent used by handleInput. */
|
|
25
25
|
interface InputPayload {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import type { ReadyAnnouncer } from "#src/service-lifecycle";
|
|
2
|
+
import type { ReadyAnnouncer } from "#src/service/service-lifecycle";
|
|
3
3
|
|
|
4
4
|
/** The session surface the turn-prep routine drives. */
|
|
5
5
|
export interface TurnPrepSession {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
2
|
+
import type { GateOutcome } from "#src/handlers/gates/types";
|
|
3
|
+
import type { DecisionRecorder } from "#src/logging/decision-audit";
|
|
4
|
+
import type { DecisionReporter } from "#src/logging/decision-reporter";
|
|
4
5
|
import { createPermissionRequestId } from "#src/permission-request-id";
|
|
5
6
|
import { toRecord } from "#src/value-guards";
|
|
6
|
-
import type { GateOutcome } from "./gates/types";
|
|
7
7
|
|
|
8
8
|
/** The SDK-facing result shape for a `tool_call` handler. */
|
|
9
9
|
type ToolCallResult = { block?: true; reason?: string };
|
package/src/index.ts
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
1
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { getAgentDir, getPackageDir } from "@earendil-works/pi-coding-agent";
|
|
3
|
-
import { warmBashParser } from "
|
|
4
|
-
import { buildResolvedIntentFromMatchValues } from "
|
|
3
|
+
import { warmBashParser } from "#src/access-intent/bash/parser";
|
|
4
|
+
import { buildResolvedIntentFromMatchValues } from "#src/access-intent/input-normalizer";
|
|
5
5
|
import {
|
|
6
6
|
AuthorizerRegistry,
|
|
7
7
|
ObservedAuthorizerRegistrar,
|
|
8
|
-
} from "
|
|
9
|
-
import { AuthorizerSelection } from "
|
|
10
|
-
import { ChildNodeAudit } from "
|
|
8
|
+
} from "#src/authority/authorizer-registry";
|
|
9
|
+
import { AuthorizerSelection } from "#src/authority/authorizer-selection";
|
|
10
|
+
import { ChildNodeAudit } from "#src/authority/child-node-audit";
|
|
11
11
|
import {
|
|
12
12
|
ForwardedRequestServer,
|
|
13
13
|
type ServingPolicy,
|
|
14
|
-
} from "
|
|
14
|
+
} from "#src/authority/forwarded-request-server";
|
|
15
15
|
import {
|
|
16
16
|
ForwardingLivenessJudge,
|
|
17
17
|
ServingHeartbeatStore,
|
|
18
|
-
} from "
|
|
19
|
-
import { ForwardingManager } from "
|
|
18
|
+
} from "#src/authority/forwarding-liveness";
|
|
19
|
+
import { ForwardingManager } from "#src/authority/forwarding-manager";
|
|
20
20
|
import {
|
|
21
21
|
AncestorNodes,
|
|
22
22
|
InheritingToolAccessExtractorLookup,
|
|
23
23
|
InheritingToolInputFormatterLookup,
|
|
24
|
-
} from "
|
|
25
|
-
import { PERMISSION_FORWARDING_TIMEOUT_MS } from "
|
|
26
|
-
import { requestPermissionDecision } from "
|
|
27
|
-
import { PermissionPrompter } from "
|
|
24
|
+
} from "#src/authority/inherited-registrations";
|
|
25
|
+
import { PERMISSION_FORWARDING_TIMEOUT_MS } from "#src/authority/permission-forwarding";
|
|
26
|
+
import { requestPermissionDecision } from "#src/authority/permission-prompt-component";
|
|
27
|
+
import { PermissionPrompter } from "#src/authority/permission-prompter";
|
|
28
28
|
import {
|
|
29
29
|
composeServingAnnouncers,
|
|
30
30
|
getServingSessionRegistry,
|
|
31
|
-
} from "
|
|
32
|
-
import { SubagentDetection } from "
|
|
33
|
-
import { subscribeSubagentLifecycle } from "
|
|
34
|
-
import { getSubagentSessionRegistry } from "
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
31
|
+
} from "#src/authority/serving-registry";
|
|
32
|
+
import { SubagentDetection } from "#src/authority/subagent-detection";
|
|
33
|
+
import { subscribeSubagentLifecycle } from "#src/authority/subagent-lifecycle-events";
|
|
34
|
+
import { getSubagentSessionRegistry } from "#src/authority/subagent-registry";
|
|
35
|
+
import { registerPermissionSystemCommand } from "#src/config/config-modal";
|
|
36
|
+
import { getGlobalConfigPath } from "#src/config/config-paths";
|
|
37
|
+
import { ConfigStore } from "#src/config/config-store";
|
|
38
|
+
import { isYoloModeEnabled } from "#src/config/extension-config";
|
|
39
|
+
import { computeExtensionPaths } from "#src/config/extension-paths";
|
|
40
|
+
import { GateRunner } from "#src/handlers/gates/runner";
|
|
41
|
+
import { SkillInputGatePipeline } from "#src/handlers/gates/skill-input-gate-pipeline";
|
|
42
|
+
import { ToolCallGatePipeline } from "#src/handlers/gates/tool-call-gate-pipeline";
|
|
43
|
+
import { createFailClosedToolCall } from "#src/handlers/tool-call-boundary";
|
|
44
|
+
import { DecisionAudit } from "#src/logging/decision-audit";
|
|
45
|
+
import { GateDecisionReporter } from "#src/logging/decision-reporter";
|
|
46
|
+
import { PermissionSessionLogger } from "#src/logging/session-logger";
|
|
47
|
+
import { pathFlavorForPlatform } from "#src/path/path-flavor";
|
|
48
|
+
import { PermissionManager } from "#src/policy/permission-manager";
|
|
49
|
+
import { PermissionResolver } from "#src/policy/permission-resolver";
|
|
50
|
+
import { resolveRenderBudget } from "#src/presentation/dialog-renderer";
|
|
51
|
+
import { LocalPermissionsService } from "#src/service/permissions-service";
|
|
52
|
+
import { PermissionServiceLifecycle } from "#src/service/service-lifecycle";
|
|
53
|
+
import { PermissionSession } from "#src/session/permission-session";
|
|
54
|
+
import { SessionRules } from "#src/session/session-rules";
|
|
55
|
+
import { registerBuiltinToolInputFormatters } from "#src/tool-input/builtin-tool-input-formatters";
|
|
56
|
+
import { ToolAccessExtractorRegistry } from "#src/tool-input/tool-access-extractor-registry";
|
|
57
|
+
import { ToolInputFormatterRegistry } from "#src/tool-input/tool-input-formatter-registry";
|
|
43
58
|
import {
|
|
44
59
|
AgentPrepHandler,
|
|
45
60
|
PermissionGateHandler,
|
|
46
61
|
SessionLifecycleHandler,
|
|
47
62
|
SessionTurnPrep,
|
|
48
63
|
} from "./handlers";
|
|
49
|
-
import { GateRunner } from "./handlers/gates/runner";
|
|
50
|
-
import { SkillInputGatePipeline } from "./handlers/gates/skill-input-gate-pipeline";
|
|
51
|
-
import { ToolCallGatePipeline } from "./handlers/gates/tool-call-gate-pipeline";
|
|
52
|
-
import { createFailClosedToolCall } from "./handlers/tool-call-boundary";
|
|
53
|
-
import { pathFlavorForPlatform } from "./path/path-flavor";
|
|
54
|
-
import { PermissionManager } from "./permission-manager";
|
|
55
|
-
import { PermissionResolver } from "./permission-resolver";
|
|
56
|
-
import { PermissionSession } from "./permission-session";
|
|
57
|
-
import { LocalPermissionsService } from "./permissions-service";
|
|
58
|
-
import { resolveRenderBudget } from "./presentation/dialog-renderer";
|
|
59
64
|
import { getPermissionsService, type PermissionsService } from "./service";
|
|
60
|
-
import { PermissionServiceLifecycle } from "./service-lifecycle";
|
|
61
|
-
import { PermissionSessionLogger } from "./session-logger";
|
|
62
|
-
import { SessionRules } from "./session-rules";
|
|
63
|
-
import { ToolAccessExtractorRegistry } from "./tool-access-extractor-registry";
|
|
64
|
-
import { ToolInputFormatterRegistry } from "./tool-input-formatter-registry";
|
|
65
65
|
|
|
66
66
|
export default function piPermissionSystemExtension(pi: ExtensionAPI): void {
|
|
67
67
|
const agentDir = getAgentDir();
|
|
@@ -3,7 +3,7 @@ import { appendFileSync } from "node:fs";
|
|
|
3
3
|
import {
|
|
4
4
|
EXTENSION_ID,
|
|
5
5
|
type PermissionSystemExtensionConfig,
|
|
6
|
-
} from "
|
|
6
|
+
} from "#src/config/extension-config";
|
|
7
7
|
import { capLogFieldWidths, resolveReviewLogFieldWidth } from "./log-field-cap";
|
|
8
8
|
import {
|
|
9
9
|
OWNER_ONLY_FILE_MODE,
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
DEBUG_LOG_FILENAME,
|
|
4
|
+
REVIEW_LOG_FILENAME,
|
|
5
|
+
} from "#src/config/config-paths";
|
|
3
6
|
import {
|
|
4
7
|
ensurePermissionSystemLogsDirectory,
|
|
5
8
|
type PermissionSystemExtensionConfig,
|
|
6
|
-
} from "
|
|
9
|
+
} from "#src/config/extension-config";
|
|
7
10
|
import {
|
|
8
11
|
createPermissionSystemLogger,
|
|
9
12
|
type PermissionSystemLogger,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PathFlavor } from "
|
|
2
|
-
import { isSafeSystemPath } from "
|
|
1
|
+
import type { PathFlavor } from "./path-flavor";
|
|
2
|
+
import { isSafeSystemPath } from "./safe-system-paths";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Pure geometry: is `canonicalPath` outside `canonicalCwd`?
|
package/src/path/path-flavor.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
type BashTokenShape,
|
|
6
6
|
classifyWin32BashToken,
|
|
7
7
|
} from "#src/access-intent/bash/msys-bash-tokens";
|
|
8
|
-
import type { WildcardMatchOptions } from "#src/wildcard-matcher";
|
|
8
|
+
import type { WildcardMatchOptions } from "#src/policy/wildcard-matcher";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* The resolved product of the single win32-vs-POSIX platform decision: the
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { lstatSync } from "node:fs";
|
|
2
|
-
|
|
3
|
-
import type { PathFlavor } from "#src/path/path-flavor";
|
|
4
|
-
|
|
5
|
-
import { AccessPath } from "./access-intent/access-path";
|
|
2
|
+
import { AccessPath } from "#src/access-intent/access-path";
|
|
6
3
|
import {
|
|
7
4
|
canonicalNormalizePathForComparison,
|
|
8
5
|
normalizePathForComparison,
|
|
9
6
|
normalizePathPolicyLiteral,
|
|
10
|
-
} from "
|
|
11
|
-
import { deriveApprovalPattern } from "./
|
|
12
|
-
import { isPathOutsideWorkingDirectory } from "./path
|
|
13
|
-
import {
|
|
7
|
+
} from "#src/access-intent/path-normalization";
|
|
8
|
+
import { deriveApprovalPattern } from "./approval-pattern";
|
|
9
|
+
import { isPathOutsideWorkingDirectory } from "./path-containment";
|
|
10
|
+
import type { PathFlavor } from "./path-flavor";
|
|
11
|
+
import { isPiInfrastructureRead } from "./pi-infrastructure-read";
|
|
14
12
|
|
|
15
13
|
/**
|
|
16
14
|
* The interpreted effect of a literal `cd` target on the effective base, under
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { READ_ONLY_PATH_BEARING_TOOLS } from "#src/access-intent/path-surfaces";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
3
|
+
import { wildcardMatch } from "#src/policy/wildcard-matcher";
|
|
4
|
+
import { expandHomePath } from "./expand-home";
|
|
5
|
+
import type { PathFlavor } from "./path-flavor";
|
|
6
6
|
|
|
7
7
|
function containsGlobChars(value: string): boolean {
|
|
8
8
|
return value.includes("*") || value.includes("?");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { surfaceFamilyMembers } from "#src/access-intent/path-surfaces";
|
|
2
|
+
import type { FlatPermissionConfig, PatternValue } from "#src/types";
|
|
3
|
+
import { isDenyWithReason, isPermissionState } from "#src/types";
|
|
2
4
|
import type { Rule, Ruleset } from "./rule";
|
|
3
|
-
import type { FlatPermissionConfig, PatternValue } from "./types";
|
|
4
|
-
import { isDenyWithReason, isPermissionState } from "./types";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* A surface's value in a flat permission config: a catch-all or a pattern map.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { SessionGrantWidth } from "#src/approval-grant";
|
|
2
1
|
import type { DecisionSource } from "#src/authority/decision-source";
|
|
3
2
|
import type { PermissionPromptDecision } from "#src/authority/permission-dialog";
|
|
3
|
+
import type { SessionGrantWidth } from "#src/session/approval-grant";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Result of applying the permission gate.
|
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
-
import type { ResolvedAccessIntent } from "
|
|
3
|
-
import { normalizeInput } from "
|
|
4
|
-
import {
|
|
5
|
-
|
|
2
|
+
import type { ResolvedAccessIntent } from "#src/access-intent/access-intent";
|
|
3
|
+
import { normalizeInput } from "#src/access-intent/input-normalizer";
|
|
4
|
+
import {
|
|
5
|
+
PATH_SURFACES,
|
|
6
|
+
surfaceFamilyOf,
|
|
7
|
+
} from "#src/access-intent/path-surfaces";
|
|
8
|
+
import { classifyToolKind } from "#src/access-intent/tool-kind";
|
|
6
9
|
import {
|
|
7
10
|
getGlobalConfigPath,
|
|
8
11
|
getProjectAgentsDir,
|
|
9
12
|
getProjectConfigPath,
|
|
10
|
-
} from "
|
|
11
|
-
import { normalizeFlatConfig } from "./normalize";
|
|
12
|
-
import { type PathFlavor, posixPathFlavor } from "./path/path-flavor";
|
|
13
|
+
} from "#src/config/config-paths";
|
|
13
14
|
import {
|
|
14
15
|
FilePolicyLoader,
|
|
15
16
|
type PolicyLoader,
|
|
16
17
|
type PolicyLoaderOptions,
|
|
17
18
|
type ResolvedPolicyPaths,
|
|
18
|
-
} from "
|
|
19
|
+
} from "#src/config/policy-loader";
|
|
20
|
+
import { type PathFlavor, posixPathFlavor } from "#src/path/path-flavor";
|
|
21
|
+
import type {
|
|
22
|
+
FlatPermissionConfig,
|
|
23
|
+
PermissionCheckResult,
|
|
24
|
+
PermissionState,
|
|
25
|
+
} from "#src/types";
|
|
26
|
+
import { isPermissionState } from "#src/types";
|
|
27
|
+
import { normalizeFlatConfig } from "./normalize";
|
|
19
28
|
import type { Rule, RuleOrigin, Ruleset } from "./rule";
|
|
20
29
|
import {
|
|
21
30
|
evaluate,
|
|
@@ -31,12 +40,6 @@ import {
|
|
|
31
40
|
synthesizeBaseline,
|
|
32
41
|
synthesizeDefaults,
|
|
33
42
|
} from "./synthesize";
|
|
34
|
-
import type {
|
|
35
|
-
FlatPermissionConfig,
|
|
36
|
-
PermissionCheckResult,
|
|
37
|
-
PermissionState,
|
|
38
|
-
} from "./types";
|
|
39
|
-
import { isPermissionState } from "./types";
|
|
40
43
|
|
|
41
44
|
const SPECIAL_PERMISSION_KEYS = new Set(["external_directory", "path"]);
|
|
42
45
|
|
|
@@ -448,4 +451,7 @@ function deriveSource(
|
|
|
448
451
|
}
|
|
449
452
|
|
|
450
453
|
// Re-export types that external modules import from this file.
|
|
451
|
-
export type {
|
|
454
|
+
export type {
|
|
455
|
+
PolicyLoader,
|
|
456
|
+
ResolvedPolicyPaths,
|
|
457
|
+
} from "#src/config/policy-loader";
|
|
@@ -2,14 +2,14 @@ import type {
|
|
|
2
2
|
AccessIntent,
|
|
3
3
|
PathValuesAccessIntent,
|
|
4
4
|
ResolvedAccessIntent,
|
|
5
|
-
} from "
|
|
6
|
-
import { surfaceFamilyMembers } from "
|
|
5
|
+
} from "#src/access-intent/access-intent";
|
|
6
|
+
import { surfaceFamilyMembers } from "#src/access-intent/path-surfaces";
|
|
7
|
+
import type { SkillPermissionChecker } from "#src/exposure/skill-prompt-sanitizer";
|
|
8
|
+
import type { SessionRules } from "#src/session/session-rules";
|
|
9
|
+
import type { PermissionCheckResult, PermissionState } from "#src/types";
|
|
7
10
|
import type { ScopedPermissionManager } from "./permission-manager";
|
|
8
11
|
import { mostRestrictiveOf } from "./restrictiveness";
|
|
9
12
|
import type { Rule } from "./rule";
|
|
10
|
-
import type { SessionRules } from "./session-rules";
|
|
11
|
-
import type { SkillPermissionChecker } from "./skill-prompt-sanitizer";
|
|
12
|
-
import type { PermissionCheckResult, PermissionState } from "./types";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Answers an {@link AccessIntent} a gate emits, applying the current session
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import { PATH_SURFACES } from "#src/access-intent/path-surfaces";
|
|
2
|
+
import { expandHomePath } from "#src/path/expand-home";
|
|
1
3
|
import type { PathFlavor } from "#src/path/path-flavor";
|
|
2
|
-
|
|
3
|
-
import { PATH_SURFACES } from "./access-intent/path-surfaces";
|
|
4
|
-
import { expandHomePath } from "./expand-home";
|
|
5
|
-
import type { PermissionState } from "./types";
|
|
4
|
+
import type { PermissionState } from "#src/types";
|
|
6
5
|
import { type WildcardMatchOptions, wildcardMatch } from "./wildcard-matcher";
|
|
7
6
|
|
|
8
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { expandDirectionalSugar } from "#src/normalize";
|
|
2
|
-
import { mergeFlatPermissions } from "#src/permission-merge";
|
|
3
|
-
import type { RuleOrigin } from "#src/rule";
|
|
4
1
|
import type { FlatPermissionConfig, ScopeConfig } from "#src/types";
|
|
2
|
+
import { expandDirectionalSugar } from "./normalize";
|
|
3
|
+
import { mergeFlatPermissions } from "./permission-merge";
|
|
4
|
+
import type { RuleOrigin } from "./rule";
|
|
5
5
|
|
|
6
6
|
/** Surface → (pattern → originating scope). */
|
|
7
7
|
type OriginMap = Map<string, Map<string, RuleOrigin>>;
|
|
@@ -2,19 +2,19 @@ import {
|
|
|
2
2
|
type DecisionSource,
|
|
3
3
|
effectiveDecider,
|
|
4
4
|
} from "#src/authority/decision-source";
|
|
5
|
-
import { EXTENSION_ID } from "#src/extension-config";
|
|
6
|
-
import {
|
|
5
|
+
import { EXTENSION_ID } from "#src/config/extension-config";
|
|
6
|
+
import type { BashCommandContext } from "#src/types";
|
|
7
|
+
import { DEFAULT_RENDER_BUDGET } from "./dialog-renderer";
|
|
7
8
|
import {
|
|
8
9
|
describeBashCommandContext,
|
|
9
10
|
flaggedElementLabel,
|
|
10
11
|
flaggedElements,
|
|
11
|
-
} from "
|
|
12
|
+
} from "./fact-vocabulary";
|
|
12
13
|
import {
|
|
13
14
|
allEvidence,
|
|
14
15
|
findEvidence,
|
|
15
16
|
type PromptPayload,
|
|
16
|
-
} from "
|
|
17
|
-
import type { BashCommandContext } from "#src/types";
|
|
17
|
+
} from "./prompt-payload";
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* The agent-facing render of a refused permission ask (ADR 0011 §7).
|
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
describeBashCommandContext,
|
|
3
3
|
flaggedElements,
|
|
4
4
|
valueLabel,
|
|
5
|
-
} from "
|
|
6
|
-
import { fitLinesToWidth } from "
|
|
7
|
-
import type { PromptPayload } from "
|
|
5
|
+
} from "./fact-vocabulary";
|
|
6
|
+
import { fitLinesToWidth } from "./line-fitting";
|
|
7
|
+
import type { PromptPayload } from "./prompt-payload";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Render a {@link PromptPayload} for a human deciding an ask (ADR 0011 §5).
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
allEvidence,
|
|
3
|
-
type PromptPayload,
|
|
4
|
-
} from "#src/presentation/prompt-payload";
|
|
5
1
|
import type { BashCommandContext } from "#src/types";
|
|
2
|
+
import { allEvidence, type PromptPayload } from "./prompt-payload";
|
|
6
3
|
|
|
7
4
|
/**
|
|
8
5
|
* The render vocabulary shared by every renderer over a {@link PromptPayload}.
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { ForwardedPermissionRequest } from "#src/authority/permission-forwarding";
|
|
2
|
-
import type {
|
|
3
|
-
PromptPayload,
|
|
4
|
-
PromptRequester,
|
|
5
|
-
} from "#src/presentation/prompt-payload";
|
|
2
|
+
import type { PromptPayload, PromptRequester } from "./prompt-payload";
|
|
6
3
|
|
|
7
4
|
/**
|
|
8
5
|
* Build the payload for an ask forwarded up from a subagent.
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
PromptPayload,
|
|
4
|
-
} from "#src/presentation/prompt-payload";
|
|
5
|
-
import { localRequester } from "#src/presentation/prompt-payload";
|
|
1
|
+
import type { PromptEvidence, PromptPayload } from "./prompt-payload";
|
|
2
|
+
import { localRequester } from "./prompt-payload";
|
|
6
3
|
|
|
7
4
|
/** A displayed external path paired with its resolved target, when distinct. */
|
|
8
5
|
export interface ExternalPathDisclosure {
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
prefix,
|
|
3
|
+
stripBashCommentLines,
|
|
4
|
+
} from "#src/access-intent/bash/bash-arity";
|
|
1
5
|
import {
|
|
2
6
|
type CapabilityDirection,
|
|
3
7
|
PATH_BEARING_TOOLS,
|
|
4
8
|
surfaceFamilyOf,
|
|
5
|
-
} from "
|
|
6
|
-
import type { ApprovalGrant } from "
|
|
7
|
-
import { prefix, stripBashCommentLines } from "./bash-arity";
|
|
9
|
+
} from "#src/access-intent/path-surfaces";
|
|
10
|
+
import type { ApprovalGrant } from "#src/session/approval-grant";
|
|
8
11
|
|
|
9
12
|
/** The suggestion returned for a "Yes, for this session" dialog option. */
|
|
10
13
|
export interface SessionApprovalSuggestion {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { classifyToolKind } from "
|
|
1
|
+
import { classifyToolKind } from "#src/access-intent/tool-kind";
|
|
2
2
|
|
|
3
3
|
// NOTE: the ask prompts are now payload builders under src/presentation/, and
|
|
4
4
|
// denial text is a render over the payload (presentation/agent-renderer.ts).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import type { SkillPromptEntry } from "#src/exposure/skill-prompt-sanitizer";
|
|
2
|
+
import type { PromptPayload } from "./prompt-payload";
|
|
3
|
+
import { localRequester } from "./prompt-payload";
|
|
4
4
|
|
|
5
5
|
/** A request to load a skill. */
|
|
6
6
|
export function buildSkillAskPayload(
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { classifyToolKind, isMcpCheck } from "#src/access-intent/tool-kind";
|
|
2
|
-
import type {
|
|
3
|
-
PromptEvidence,
|
|
4
|
-
PromptPayload,
|
|
5
|
-
} from "#src/presentation/prompt-payload";
|
|
6
|
-
import { localRequester } from "#src/presentation/prompt-payload";
|
|
7
|
-
import type { ToolPreviewFormatter } from "#src/tool-preview-formatter";
|
|
2
|
+
import type { ToolPreviewFormatter } from "#src/tool-input/tool-preview-formatter";
|
|
8
3
|
import type { PermissionCheckResult } from "#src/types";
|
|
9
4
|
import { getNonEmptyString, toRecord } from "#src/value-guards";
|
|
5
|
+
import type { PromptEvidence, PromptPayload } from "./prompt-payload";
|
|
6
|
+
import { localRequester } from "./prompt-payload";
|
|
10
7
|
|
|
11
8
|
/** The facts the per-tool gate holds when it raises an ask. */
|
|
12
9
|
export interface ToolAskFacts {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseBashCommandsSync } from "#src/access-intent/bash/sync-commands";
|
|
2
2
|
import { resolveBashCommandCheck } from "#src/handlers/gates/bash-command";
|
|
3
|
-
import type { ScopedPermissionResolver } from "#src/permission-resolver";
|
|
3
|
+
import type { ScopedPermissionResolver } from "#src/policy/permission-resolver";
|
|
4
4
|
import type { PermissionCheckResult } from "#src/types";
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import type { AccessIntent } from "
|
|
2
|
-
import { buildAccessIntentForSurface } from "
|
|
3
|
-
import type { Authorizer } from "
|
|
4
|
-
import type { AuthorizerRegistrar } from "
|
|
5
|
-
import {
|
|
6
|
-
import type {
|
|
7
|
-
import type { PermissionsService } from "./service";
|
|
1
|
+
import type { AccessIntent } from "#src/access-intent/access-intent";
|
|
2
|
+
import { buildAccessIntentForSurface } from "#src/access-intent/input-normalizer";
|
|
3
|
+
import type { Authorizer } from "#src/authority/authorizer";
|
|
4
|
+
import type { AuthorizerRegistrar } from "#src/authority/authorizer-registry";
|
|
5
|
+
import type { PathNormalizer } from "#src/path/path-normalizer";
|
|
6
|
+
import type { PermissionsService } from "#src/service";
|
|
8
7
|
import type {
|
|
9
8
|
ToolAccessExtractor,
|
|
10
9
|
ToolAccessExtractorLookup,
|
|
11
10
|
ToolAccessExtractorRegistrar,
|
|
12
|
-
} from "
|
|
11
|
+
} from "#src/tool-input/tool-access-extractor-registry";
|
|
13
12
|
import type {
|
|
14
13
|
ToolInputFormatter,
|
|
15
14
|
ToolInputFormatterLookup,
|
|
16
15
|
ToolInputFormatterRegistrar,
|
|
17
|
-
} from "
|
|
18
|
-
import type { PermissionCheckResult, PermissionState } from "
|
|
16
|
+
} from "#src/tool-input/tool-input-formatter-registry";
|
|
17
|
+
import type { PermissionCheckResult, PermissionState } from "#src/types";
|
|
18
|
+
import { resolveBashAdvisoryCheck } from "./bash-advisory-check";
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Resolution surface the service needs: answer a gate-style {@link AccessIntent}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import type { AdjudicationRole } from "
|
|
3
|
-
import type { NodeIdentity } from "
|
|
4
|
-
import { emitReadyEvent, type PermissionEventBus } from "./permission-events";
|
|
2
|
+
import type { AdjudicationRole } from "#src/authority/authorizer-selection";
|
|
3
|
+
import type { NodeIdentity } from "#src/authority/inherited-registrations";
|
|
5
4
|
import {
|
|
6
5
|
type PermissionsService,
|
|
7
6
|
publishPermissionsService,
|
|
8
7
|
unpublishPermissionsService,
|
|
9
|
-
} from "
|
|
10
|
-
import { readSessionId } from "
|
|
8
|
+
} from "#src/service";
|
|
9
|
+
import { readSessionId } from "#src/session/session-identity";
|
|
10
|
+
import { emitReadyEvent, type PermissionEventBus } from "./permission-events";
|
|
11
11
|
|
|
12
12
|
/** The session-scoped service lifecycle that the lifecycle handler drives. */
|
|
13
13
|
export interface ServiceLifecycle {
|