@yanlinglabs/winter-agent-runtime 0.0.27
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/LICENSE +21 -0
- package/NOTICE +41 -0
- package/README.md +64 -0
- package/dist/checkpoint/file-history.d.ts +81 -0
- package/dist/checkpoint/rewind.d.ts +55 -0
- package/dist/checkpoint/seam.d.ts +47 -0
- package/dist/checkpoint/sink.d.ts +66 -0
- package/dist/commands/builtins-listing.d.ts +40 -0
- package/dist/commands/resolver.d.ts +103 -0
- package/dist/commands/seam.d.ts +53 -0
- package/dist/compaction/controller.d.ts +23 -0
- package/dist/compaction/retention.d.ts +35 -0
- package/dist/compaction/seam.d.ts +115 -0
- package/dist/compaction/summarizer.d.ts +79 -0
- package/dist/context/agent-listing.d.ts +39 -0
- package/dist/context/assembler.d.ts +46 -0
- package/dist/context/attachments.d.ts +104 -0
- package/dist/context/dynamic-sections.d.ts +31 -0
- package/dist/context/git-fixture.d.ts +18 -0
- package/dist/context/git-status.d.ts +16 -0
- package/dist/context/imports.d.ts +22 -0
- package/dist/context/injection.d.ts +53 -0
- package/dist/context/memory-key.d.ts +46 -0
- package/dist/context/memory.d.ts +28 -0
- package/dist/context/minimal-prompt.d.ts +5 -0
- package/dist/context/output-styles.d.ts +68 -0
- package/dist/context/plan-mode.d.ts +29 -0
- package/dist/context/request-layout.d.ts +138 -0
- package/dist/context/rules.d.ts +63 -0
- package/dist/context/seam.d.ts +136 -0
- package/dist/context/tool-epoch.d.ts +118 -0
- package/dist/context/winter-code-preset.d.ts +39 -0
- package/dist/context/winter-md.d.ts +81 -0
- package/dist/embedded-host.d.ts +48 -0
- package/dist/embedded-host.js +155 -0
- package/dist/embedded-protocol.d.ts +44 -0
- package/dist/embedded-worker.d.ts +1 -0
- package/dist/embedded-worker.js +74 -0
- package/dist/embedded.d.ts +34 -0
- package/dist/embedded.js +9 -0
- package/dist/engine.d.ts +1298 -0
- package/dist/hooks/additional-context.d.ts +21 -0
- package/dist/hooks/bounds.d.ts +6 -0
- package/dist/hooks/bridge-invoker.d.ts +3 -0
- package/dist/hooks/command-invoker.d.ts +52 -0
- package/dist/hooks/from-config.d.ts +31 -0
- package/dist/hooks/hook-stage.d.ts +25 -0
- package/dist/hooks/input-validator.d.ts +6 -0
- package/dist/hooks/reducer.d.ts +74 -0
- package/dist/hooks/registry.d.ts +33 -0
- package/dist/hooks/runner.d.ts +105 -0
- package/dist/index-584yahed.js +6037 -0
- package/dist/index-97t2rmtf.js +42 -0
- package/dist/index-9qgkpv56.js +27183 -0
- package/dist/index-bef62z3r.js +437 -0
- package/dist/index-rkhh0457.js +187 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +353 -0
- package/dist/main.d.ts +1 -0
- package/dist/mcp/client.d.ts +105 -0
- package/dist/mcp/control-seam.d.ts +25 -0
- package/dist/mcp/control.d.ts +5 -0
- package/dist/mcp/elicitation.d.ts +35 -0
- package/dist/mcp/env.d.ts +12 -0
- package/dist/mcp/lifecycle.d.ts +142 -0
- package/dist/mcp/output-cap.d.ts +15 -0
- package/dist/mcp/state.d.ts +24 -0
- package/dist/mcp/test-fixtures.d.ts +88 -0
- package/dist/mcp/transports/__fixtures__/stdio-server.d.ts +1 -0
- package/dist/mcp/transports/http.d.ts +5 -0
- package/dist/mcp/transports/sdk.d.ts +5 -0
- package/dist/mcp/transports/sse.d.ts +3 -0
- package/dist/mcp/transports/stdio.d.ts +35 -0
- package/dist/mcp/winter-server.d.ts +2 -0
- package/dist/messaging/reference-adapter.d.ts +88 -0
- package/dist/messaging/router.d.ts +8 -0
- package/dist/paths/project-dir-name.d.ts +2 -0
- package/dist/paths/temp.d.ts +25 -0
- package/dist/permissions/approvals.d.ts +107 -0
- package/dist/permissions/auto/caches.d.ts +53 -0
- package/dist/permissions/auto/config.d.ts +37 -0
- package/dist/permissions/auto/engine.d.ts +74 -0
- package/dist/permissions/auto/envelope.d.ts +45 -0
- package/dist/permissions/auto/inheritance.d.ts +27 -0
- package/dist/permissions/edit-recognition.d.ts +30 -0
- package/dist/permissions/evaluator.d.ts +284 -0
- package/dist/permissions/file-rules.d.ts +384 -0
- package/dist/permissions/grammar.d.ts +113 -0
- package/dist/permissions/paths.d.ts +32 -0
- package/dist/permissions/policy-state.d.ts +64 -0
- package/dist/permissions/prompt-stage.d.ts +3 -0
- package/dist/permissions/protected.d.ts +54 -0
- package/dist/permissions/ruleset.d.ts +134 -0
- package/dist/permissions/shell-structure.d.ts +41 -0
- package/dist/plugins/bundle.d.ts +100 -0
- package/dist/plugins/installed.d.ts +30 -0
- package/dist/plugins/loader.d.ts +56 -0
- package/dist/plugins/manifest.d.ts +115 -0
- package/dist/production-wiring.d.ts +340 -0
- package/dist/protocol/channel.d.ts +22 -0
- package/dist/provider/advisor-route.d.ts +47 -0
- package/dist/provider/bridge.d.ts +124 -0
- package/dist/provider/classifier/model-classifier.d.ts +82 -0
- package/dist/provider/classifier/prompt.d.ts +62 -0
- package/dist/provider/classifier/verdict-schema.d.ts +83 -0
- package/dist/provider/credential-api.d.ts +160 -0
- package/dist/provider/family-listing.d.ts +27 -0
- package/dist/provider/first-party.d.ts +4 -0
- package/dist/provider/keychain-store.d.ts +59 -0
- package/dist/provider/lean-prompt.d.ts +7 -0
- package/dist/provider/mock.d.ts +55 -0
- package/dist/provider/scenario-fake.d.ts +96 -0
- package/dist/provider/selection.d.ts +115 -0
- package/dist/provider/session-provider.d.ts +426 -0
- package/dist/provider/slots.d.ts +120 -0
- package/dist/provider/stream-frames.d.ts +25 -0
- package/dist/provider/tool-secret.d.ts +57 -0
- package/dist/rpc/bridge.d.ts +14 -0
- package/dist/rpc/mcp-control.d.ts +26 -0
- package/dist/runtime.d.ts +14 -0
- package/dist/sandbox/profile.d.ts +249 -0
- package/dist/sandbox/spawn.d.ts +139 -0
- package/dist/settings/env-filter.d.ts +52 -0
- package/dist/settings/loaders/hooks.d.ts +44 -0
- package/dist/settings/loaders/mcp-config.d.ts +83 -0
- package/dist/settings/loaders/plugin-mcp.d.ts +3 -0
- package/dist/settings/loaders/strict-plugin-only.d.ts +13 -0
- package/dist/settings/resolve.d.ts +2 -0
- package/dist/settings/sources.d.ts +2 -0
- package/dist/settings/trust.d.ts +36 -0
- package/dist/skills/attachment.d.ts +25 -0
- package/dist/skills/frontmatter.d.ts +64 -0
- package/dist/skills/index.d.ts +16 -0
- package/dist/skills/listing.d.ts +89 -0
- package/dist/skills/loader.d.ts +104 -0
- package/dist/skills/option.d.ts +68 -0
- package/dist/skills/permission-rules.d.ts +21 -0
- package/dist/skills/runtime.d.ts +21 -0
- package/dist/skills/store.d.ts +163 -0
- package/dist/store/continuation-attach.d.ts +44 -0
- package/dist/store/dialect.d.ts +526 -0
- package/dist/store/provider-state.d.ts +188 -0
- package/dist/store/resume.d.ts +92 -0
- package/dist/structured/ajv-seam.d.ts +7 -0
- package/dist/structured/descriptor.d.ts +9 -0
- package/dist/structured/seam.d.ts +51 -0
- package/dist/structured/validator.d.ts +22 -0
- package/dist/subagents/activity.d.ts +13 -0
- package/dist/subagents/availability.d.ts +30 -0
- package/dist/subagents/builtin-agents.d.ts +37 -0
- package/dist/subagents/child-engine.d.ts +198 -0
- package/dist/subagents/child-handle.d.ts +344 -0
- package/dist/subagents/definitions.d.ts +189 -0
- package/dist/subagents/fork.d.ts +55 -0
- package/dist/subagents/git-root.d.ts +1 -0
- package/dist/subagents/limits.d.ts +28 -0
- package/dist/subagents/notification-queue.d.ts +233 -0
- package/dist/subagents/plugin-agents.d.ts +5 -0
- package/dist/subagents/policy.d.ts +46 -0
- package/dist/subagents/register-default-factory.d.ts +66 -0
- package/dist/subagents/resolution.d.ts +56 -0
- package/dist/subagents/restore.d.ts +9 -0
- package/dist/subagents/roster.d.ts +17 -0
- package/dist/subagents/test-fakes.d.ts +12 -0
- package/dist/subagents/tool-pools.d.ts +69 -0
- package/dist/subagents/watchdog.d.ts +13 -0
- package/dist/subagents/workspace.d.ts +27 -0
- package/dist/testing.d.ts +5 -0
- package/dist/testing.js +194 -0
- package/dist/tools/background-tasks.d.ts +10 -0
- package/dist/tools/descriptors/_shared.d.ts +34 -0
- package/dist/tools/descriptors/advisor.d.ts +1 -0
- package/dist/tools/descriptors/agent.d.ts +47 -0
- package/dist/tools/descriptors/artifact.d.ts +1 -0
- package/dist/tools/descriptors/ask-user-question.d.ts +1 -0
- package/dist/tools/descriptors/bash.d.ts +20 -0
- package/dist/tools/descriptors/claude-design.d.ts +1 -0
- package/dist/tools/descriptors/cron-create.d.ts +1 -0
- package/dist/tools/descriptors/cron-delete.d.ts +1 -0
- package/dist/tools/descriptors/cron-list.d.ts +1 -0
- package/dist/tools/descriptors/edit.d.ts +1 -0
- package/dist/tools/descriptors/end-conversation.d.ts +1 -0
- package/dist/tools/descriptors/enter-plan-mode.d.ts +1 -0
- package/dist/tools/descriptors/enter-worktree.d.ts +1 -0
- package/dist/tools/descriptors/exit-plan-mode.d.ts +1 -0
- package/dist/tools/descriptors/exit-worktree.d.ts +1 -0
- package/dist/tools/descriptors/glob.d.ts +1 -0
- package/dist/tools/descriptors/grep.d.ts +1 -0
- package/dist/tools/descriptors/index.d.ts +59 -0
- package/dist/tools/descriptors/list-agents.d.ts +1 -0
- package/dist/tools/descriptors/list-mcp-resources-tool.d.ts +1 -0
- package/dist/tools/descriptors/lsp.d.ts +1 -0
- package/dist/tools/descriptors/monitor.d.ts +1 -0
- package/dist/tools/descriptors/notebook-edit.d.ts +1 -0
- package/dist/tools/descriptors/powershell.d.ts +1 -0
- package/dist/tools/descriptors/projects.d.ts +1 -0
- package/dist/tools/descriptors/propose-goal.d.ts +1 -0
- package/dist/tools/descriptors/propose-skills.d.ts +1 -0
- package/dist/tools/descriptors/push-notification.d.ts +1 -0
- package/dist/tools/descriptors/read-mcp-resource-dir-tool.d.ts +1 -0
- package/dist/tools/descriptors/read-mcp-resource-tool.d.ts +1 -0
- package/dist/tools/descriptors/read-notifications.d.ts +1 -0
- package/dist/tools/descriptors/read.d.ts +1 -0
- package/dist/tools/descriptors/refresh-mcp-tools.d.ts +1 -0
- package/dist/tools/descriptors/remote-trigger.d.ts +1 -0
- package/dist/tools/descriptors/repl.d.ts +1 -0
- package/dist/tools/descriptors/report-findings.d.ts +1 -0
- package/dist/tools/descriptors/schedule-wakeup.d.ts +1 -0
- package/dist/tools/descriptors/send-feedback.d.ts +1 -0
- package/dist/tools/descriptors/send-message.d.ts +1 -0
- package/dist/tools/descriptors/send-user-file.d.ts +1 -0
- package/dist/tools/descriptors/share-onboarding-guide.d.ts +1 -0
- package/dist/tools/descriptors/show-onboarding-role-picker.d.ts +1 -0
- package/dist/tools/descriptors/skill.d.ts +1 -0
- package/dist/tools/descriptors/structured-output.d.ts +1 -0
- package/dist/tools/descriptors/task-create.d.ts +1 -0
- package/dist/tools/descriptors/task-get.d.ts +1 -0
- package/dist/tools/descriptors/task-list.d.ts +1 -0
- package/dist/tools/descriptors/task-output.d.ts +1 -0
- package/dist/tools/descriptors/task-stop.d.ts +1 -0
- package/dist/tools/descriptors/task-update.d.ts +1 -0
- package/dist/tools/descriptors/todo-write.d.ts +1 -0
- package/dist/tools/descriptors/tool-search.d.ts +1 -0
- package/dist/tools/descriptors/wait-for-mcp-servers.d.ts +1 -0
- package/dist/tools/descriptors/web-fetch.d.ts +8 -0
- package/dist/tools/descriptors/web-search.d.ts +15 -0
- package/dist/tools/descriptors/winter-list-agents.d.ts +1 -0
- package/dist/tools/descriptors/winter-send-message.d.ts +1 -0
- package/dist/tools/descriptors/workflow.d.ts +1 -0
- package/dist/tools/descriptors/write.d.ts +1 -0
- package/dist/tools/impl/_caller.d.ts +14 -0
- package/dist/tools/impl/_domains.d.ts +25 -0
- package/dist/tools/impl/_exa-client.d.ts +122 -0
- package/dist/tools/impl/_exa-session-client.d.ts +23 -0
- package/dist/tools/impl/_inner-model.d.ts +135 -0
- package/dist/tools/impl/_search-budget.d.ts +36 -0
- package/dist/tools/impl/_web-fetch-cache.d.ts +37 -0
- package/dist/tools/impl/_web-fetch-html.d.ts +26 -0
- package/dist/tools/impl/_web-fetch-net.d.ts +99 -0
- package/dist/tools/impl/_web-search-assembler.d.ts +57 -0
- package/dist/tools/impl/advisor.d.ts +37 -0
- package/dist/tools/impl/agent.d.ts +10 -0
- package/dist/tools/impl/ask-user-question.d.ts +5 -0
- package/dist/tools/impl/background-task-runtime.d.ts +272 -0
- package/dist/tools/impl/bash.d.ts +78 -0
- package/dist/tools/impl/cron.d.ts +11 -0
- package/dist/tools/impl/edit.d.ts +1 -0
- package/dist/tools/impl/enter-plan-mode.d.ts +4 -0
- package/dist/tools/impl/enter-worktree.d.ts +25 -0
- package/dist/tools/impl/exit-plan-mode.d.ts +4 -0
- package/dist/tools/impl/exit-worktree.d.ts +4 -0
- package/dist/tools/impl/glob.d.ts +1 -0
- package/dist/tools/impl/grep.d.ts +19 -0
- package/dist/tools/impl/index.d.ts +37 -0
- package/dist/tools/impl/list-agents.d.ts +7 -0
- package/dist/tools/impl/list-mcp-resources-tool.d.ts +9 -0
- package/dist/tools/impl/monitor.d.ts +66 -0
- package/dist/tools/impl/notebook-edit.d.ts +1 -0
- package/dist/tools/impl/push-notification.d.ts +4 -0
- package/dist/tools/impl/read-ladder.d.ts +25 -0
- package/dist/tools/impl/read-mcp-resource-dir-tool.d.ts +9 -0
- package/dist/tools/impl/read-mcp-resource-tool.d.ts +9 -0
- package/dist/tools/impl/read-notifications.d.ts +5 -0
- package/dist/tools/impl/read.d.ts +44 -0
- package/dist/tools/impl/refresh-mcp-tools.d.ts +8 -0
- package/dist/tools/impl/report-findings.d.ts +1 -0
- package/dist/tools/impl/schedule-wakeup.d.ts +2 -0
- package/dist/tools/impl/send-message.d.ts +7 -0
- package/dist/tools/impl/skill.d.ts +5 -0
- package/dist/tools/impl/task-graph.d.ts +1 -0
- package/dist/tools/impl/task-output.d.ts +16 -0
- package/dist/tools/impl/task-stop.d.ts +11 -0
- package/dist/tools/impl/todo-write.d.ts +8 -0
- package/dist/tools/impl/tool-search.d.ts +4 -0
- package/dist/tools/impl/wait-for-mcp-servers.d.ts +29 -0
- package/dist/tools/impl/web-fetch.d.ts +36 -0
- package/dist/tools/impl/web-search.d.ts +30 -0
- package/dist/tools/impl/workflow.d.ts +5 -0
- package/dist/tools/impl/write.d.ts +8 -0
- package/dist/tools/paths-seam.d.ts +6 -0
- package/dist/tools/read-state.d.ts +12 -0
- package/dist/tools/registry.d.ts +423 -0
- package/dist/tools/task-graph-store.d.ts +61 -0
- package/dist/toolsearch/aliases.d.ts +26 -0
- package/dist/toolsearch/exposure.d.ts +30 -0
- package/dist/toolsearch/ranking.d.ts +6 -0
- package/dist/toolsearch/search.d.ts +45 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +5 -0
- package/dist/web/fetchable-url.d.ts +28 -0
- package/dist/web/preapproved-hosts.d.ts +52 -0
- package/dist/web/private-address.d.ts +55 -0
- package/dist/web/session-runtime.d.ts +86 -0
- package/dist/workflows/bridge.d.ts +87 -0
- package/dist/workflows/budget.d.ts +24 -0
- package/dist/workflows/host-registry.d.ts +142 -0
- package/dist/workflows/journal.d.ts +29 -0
- package/dist/workflows/meta.d.ts +45 -0
- package/dist/workflows/registry.d.ts +24 -0
- package/dist/workflows/runtime.d.ts +254 -0
- package/dist/workflows/sandbox.d.ts +49 -0
- package/dist/workflows/script-api.d.ts +58 -0
- package/dist/workflows/seam.d.ts +92 -0
- package/dist/workflows/semaphore.d.ts +16 -0
- package/dist/workflows/store.d.ts +177 -0
- package/dist/workflows/subprocess-entry.d.ts +38 -0
- package/dist/workflows/subprocess-entry.js +14 -0
- package/dist/workflows/transcript.d.ts +56 -0
- package/dist/workflows/types.d.ts +84 -0
- package/dist/workflows/worker-harness.d.ts +45 -0
- package/package.json +76 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type BrandProfile } from "@yanlinglabs/winter-agent-sdk";
|
|
2
|
+
/**
|
|
3
|
+
* P7a (D19): the three brand fields the protected-path floor needs.
|
|
4
|
+
*
|
|
5
|
+
* A `Pick`, and OPTIONAL at every entry point, for the same reason as everywhere else in this
|
|
6
|
+
* sweep: ~30 hand-built contexts in this package's tests call these primitives directly, and
|
|
7
|
+
* `WINTER_BRAND` as the default keeps every one of them byte-identical.
|
|
8
|
+
*/
|
|
9
|
+
export type ProtectedBrand = Pick<BrandProfile, "homeDirName" | "projectDirName" | "instructionsFile">;
|
|
10
|
+
export declare const PROTECTED_DIRECTORY_NAMES: ReadonlySet<string>;
|
|
11
|
+
export declare const PROTECTED_FILE_BASENAMES: ReadonlySet<string>;
|
|
12
|
+
/**
|
|
13
|
+
* True when `absPath` is inside a session's own persisted-workflow-script directory under `home`.
|
|
14
|
+
*
|
|
15
|
+
* Takes an ALREADY-ABSOLUTE path (every caller here resolves first) and `home` explicitly -- this
|
|
16
|
+
* module resolves no environment of its own, matching `isProtectedWrite`'s existing `ctx.home`
|
|
17
|
+
* contract.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isWorkflowScriptCarveOut(absPath: string, home: string, resolvedWinterHome?: string, brand?: ProtectedBrand): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* True when `absPath` is inside a project's own auto-memory directory under `home` (SDK 0.0.4).
|
|
22
|
+
*
|
|
23
|
+
* Same contract as `isWorkflowScriptCarveOut` one function up -- an ALREADY-ABSOLUTE path, an
|
|
24
|
+
* explicit `home`, an optional resolved winter root, an optional brand -- and the same two anchors,
|
|
25
|
+
* for the same Phase-5-I1 reason: `context/memory-key.ts`'s `memoryDirFor` joins onto the RESOLVED
|
|
26
|
+
* winter home, so a carve-out anchored only at `<osHome>/<homeDirName>` would name a directory the
|
|
27
|
+
* feature never writes to whenever `<PREFIX>HOME` points elsewhere.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isMemoryCarveOut(absPath: string, home: string, resolvedWinterHome?: string, brand?: ProtectedBrand): boolean;
|
|
30
|
+
/** Is `outputsDir` (absolute) a directory the outputs carve-out may apply to? See the block above. */
|
|
31
|
+
export declare function isCarvableOutputsDir(outputsDir: string, home: string, resolvedWinterHome: string | undefined, brand?: ProtectedBrand): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* True when `absPath` is strictly inside one of `outputsDirs` (the caller's already-validated forms of
|
|
34
|
+
* one outputs directory -- its lexical path and its real path) and nothing BELOW that directory is
|
|
35
|
+
* itself protected.
|
|
36
|
+
*/
|
|
37
|
+
export declare function isOutputsCarveOut(absPath: string, outputsDirs: readonly string[], brand?: ProtectedBrand): boolean;
|
|
38
|
+
export declare function isProtectedWrite(path: string, ctx: {
|
|
39
|
+
cwd: string;
|
|
40
|
+
home: string;
|
|
41
|
+
winterHome?: string;
|
|
42
|
+
storeHome?: string;
|
|
43
|
+
brand?: ProtectedBrand;
|
|
44
|
+
outputsDirs?: readonly string[];
|
|
45
|
+
}): boolean;
|
|
46
|
+
export interface CriticalRemovalResult {
|
|
47
|
+
critical: boolean;
|
|
48
|
+
reason?: string;
|
|
49
|
+
}
|
|
50
|
+
export declare function isCriticalRemoval(command: string, ctx: {
|
|
51
|
+
cwd: string;
|
|
52
|
+
home: string;
|
|
53
|
+
additionalDirectories?: string[];
|
|
54
|
+
}): CriticalRemovalResult;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { type ParsedRule } from "./grammar.js";
|
|
2
|
+
import type { PermissionBehavior, PermissionRuleValue, PermissionMode, PermissionUpdate, RuleSource } from "@yanlinglabs/winter-agent-sdk";
|
|
3
|
+
export interface SourcedRuleEntry {
|
|
4
|
+
rule: ParsedRule;
|
|
5
|
+
behavior: PermissionBehavior;
|
|
6
|
+
source: RuleSource;
|
|
7
|
+
ruleValue: PermissionRuleValue;
|
|
8
|
+
/**
|
|
9
|
+
* Fix round 11 ("important" item, claude's own `TFt`/`bl`, dump byte 15441060): the settings
|
|
10
|
+
* SOURCE's own directory, for a SINGLE-`/`-anchored pattern's root (`resolveFileRuleAnchor`'s own
|
|
11
|
+
* `/`-branch, file-rules.ts -- already fully wired to consume this, INERT_ANCHOR when absent, a
|
|
12
|
+
* pre-existing disclosed gap this field closes). Populated ONLY by `buildSettingsRuleSeed`
|
|
13
|
+
* (production-wiring.ts, the one non-router host with a real settings-file path per tier,
|
|
14
|
+
* `tier.path`'s own directory) -- every other `sourceRule(...)` call site in this codebase (every
|
|
15
|
+
* test helper, every Options/canUseTool/plugin-permissions door) omits it, leaving a `/`-anchored
|
|
16
|
+
* rule from those doors exactly as inert as it always was. Disclosed as low real-world priority
|
|
17
|
+
* (the controller's own words: "it's inert under the router" -- the router-mediated production
|
|
18
|
+
* topology this codebase actually ships on does not exercise multiple distinct settings-file
|
|
19
|
+
* directories the way a bare-CLI/non-router host reading several tiers off disk directly would).
|
|
20
|
+
*/
|
|
21
|
+
sourceDir?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface SourcedRuleSet {
|
|
24
|
+
entries: SourcedRuleEntry[];
|
|
25
|
+
mode?: {
|
|
26
|
+
value: PermissionMode;
|
|
27
|
+
source: RuleSource;
|
|
28
|
+
};
|
|
29
|
+
directories: Array<{
|
|
30
|
+
path: string;
|
|
31
|
+
source: RuleSource;
|
|
32
|
+
}>;
|
|
33
|
+
}
|
|
34
|
+
export declare function emptyRuleSet(): SourcedRuleSet;
|
|
35
|
+
export declare class PermissionRuleValidationError extends Error {
|
|
36
|
+
readonly rule: PermissionRuleValue;
|
|
37
|
+
readonly behavior: PermissionBehavior;
|
|
38
|
+
constructor(message: string, rule: PermissionRuleValue, behavior: PermissionBehavior);
|
|
39
|
+
}
|
|
40
|
+
export declare class PermissionUpdateAuthorityError extends Error {
|
|
41
|
+
readonly authority: RuleSource;
|
|
42
|
+
readonly destination: string;
|
|
43
|
+
constructor(message: string, authority: RuleSource, destination: string);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Phase 5 fix wave, C1: EXPORTED so `production-wiring.ts` builds settings-file entries through the
|
|
47
|
+
* SAME raw-string parse `buildSdkSourcedEntries` uses. A second copy of "how a rule string becomes a
|
|
48
|
+
* PermissionRuleValue" is exactly the producer/consumer drift this module exists to prevent.
|
|
49
|
+
*/
|
|
50
|
+
export declare function rawToRuleValue(raw: string): PermissionRuleValue;
|
|
51
|
+
export declare function sourceRule(value: PermissionRuleValue, behavior: PermissionBehavior, source: RuleSource, sourceDir?: string): SourcedRuleEntry;
|
|
52
|
+
export declare function applyPermissionUpdate(set: SourcedRuleSet, update: PermissionUpdate, opts: {
|
|
53
|
+
authority: RuleSource;
|
|
54
|
+
}): SourcedRuleSet;
|
|
55
|
+
export declare function resolveRules(set: SourcedRuleSet, call: {
|
|
56
|
+
toolName: string;
|
|
57
|
+
input: Record<string, unknown>;
|
|
58
|
+
}, opts: {
|
|
59
|
+
trustedWorkspace: boolean;
|
|
60
|
+
allowManagedPermissionRulesOnly?: boolean;
|
|
61
|
+
}): {
|
|
62
|
+
deny?: SourcedRuleEntry;
|
|
63
|
+
ask?: SourcedRuleEntry;
|
|
64
|
+
allow?: SourcedRuleEntry;
|
|
65
|
+
};
|
|
66
|
+
export declare function effectiveDirectories(set: SourcedRuleSet, opts: {
|
|
67
|
+
trustedWorkspace: boolean;
|
|
68
|
+
}): string[];
|
|
69
|
+
export interface SdkOptionsRuleInputs {
|
|
70
|
+
allowedTools?: string[];
|
|
71
|
+
disallowedTools?: string[];
|
|
72
|
+
permissions?: {
|
|
73
|
+
allow?: string[];
|
|
74
|
+
ask?: string[];
|
|
75
|
+
deny?: string[];
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export declare function buildSdkSourcedEntries(opts: SdkOptionsRuleInputs): SourcedRuleEntry[];
|
|
79
|
+
export declare class PermissionJournalDirError extends Error {
|
|
80
|
+
constructor(message: string);
|
|
81
|
+
}
|
|
82
|
+
export interface PermissionJournalEnvelope {
|
|
83
|
+
authority: RuleSource;
|
|
84
|
+
at: string;
|
|
85
|
+
update: PermissionUpdate;
|
|
86
|
+
}
|
|
87
|
+
export declare function appendPermissionJournal(location: {
|
|
88
|
+
winterHome: string;
|
|
89
|
+
projectKey: string;
|
|
90
|
+
sessionId: string;
|
|
91
|
+
}, update: PermissionUpdate, opts: {
|
|
92
|
+
authority: RuleSource;
|
|
93
|
+
}): void;
|
|
94
|
+
export interface HookAuditJournalRecord {
|
|
95
|
+
hookId: string;
|
|
96
|
+
hookName?: string;
|
|
97
|
+
hookEvent: string;
|
|
98
|
+
sessionId: string;
|
|
99
|
+
uuid: string;
|
|
100
|
+
toolUseID?: string;
|
|
101
|
+
requestId?: string;
|
|
102
|
+
outcome: string;
|
|
103
|
+
decision?: string;
|
|
104
|
+
durationMs?: number;
|
|
105
|
+
agentID?: string;
|
|
106
|
+
}
|
|
107
|
+
export interface HookAuditJournalEnvelope {
|
|
108
|
+
kind: "hookAudit";
|
|
109
|
+
at: string;
|
|
110
|
+
entry: HookAuditJournalRecord;
|
|
111
|
+
}
|
|
112
|
+
export declare function appendHookAuditJournal(location: {
|
|
113
|
+
winterHome: string;
|
|
114
|
+
projectKey: string;
|
|
115
|
+
sessionId: string;
|
|
116
|
+
}, entry: HookAuditJournalRecord): void;
|
|
117
|
+
/** One hook invocation, as the journal recorded it. `at` is the envelope's own ISO timestamp. */
|
|
118
|
+
export interface HookAuditEntry extends HookAuditJournalRecord {
|
|
119
|
+
at: string;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Every hook invocation this session journalled, oldest first.
|
|
123
|
+
*
|
|
124
|
+
* `filter` narrows without a second pass over the file -- `event` and `outcome` are the two axes an
|
|
125
|
+
* operator actually asks about ("did my PreToolUse hooks run", "what failed").
|
|
126
|
+
*/
|
|
127
|
+
export declare function readHookAuditJournal(location: {
|
|
128
|
+
winterHome: string;
|
|
129
|
+
projectKey: string;
|
|
130
|
+
sessionId: string;
|
|
131
|
+
}, filter?: {
|
|
132
|
+
event?: string;
|
|
133
|
+
outcome?: string;
|
|
134
|
+
}): HookAuditEntry[];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export interface HeredocExtraction {
|
|
2
|
+
/** The command with every here-document body (and its delimiter line) and every comment removed. */
|
|
3
|
+
text: string;
|
|
4
|
+
/** Bodies of UNQUOTED here-documents: bash expands `$(…)` and backticks inside them. */
|
|
5
|
+
liveBodies: string[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Removes here-document bodies (and comments) from `command`, returning the remaining text and the
|
|
9
|
+
* bodies bash will still expand. Bodies are removed BEFORE line continuations are joined: a QUOTED
|
|
10
|
+
* here-document's body is literal (`\<newline>` is not a continuation there), and joining first could
|
|
11
|
+
* shift its delimiter so that a later line -- `> /etc/passwd` -- was swallowed into the body and never
|
|
12
|
+
* seen (claude's `extractOutputRedirections` documents that exact attack).
|
|
13
|
+
*
|
|
14
|
+
* This is the one scanner that DROPS text, so it follows bash's contexts closely enough never to drop
|
|
15
|
+
* a command bash runs: `<<` is a here-document only in a command context (not inside `((…))`,
|
|
16
|
+
* `$((…))`, `$[…]` or `${…}`, where it is a shift or a literal), and `#` is a comment only at the start
|
|
17
|
+
* of a word in a command context -- ending at a backtick body's closing backtick, as bash's does.
|
|
18
|
+
*/
|
|
19
|
+
export declare function extractHeredocs(command: string): HeredocExtraction | null;
|
|
20
|
+
/**
|
|
21
|
+
* The bodies of every command-running construct directly inside `text`: `$(…)`, backticks, `(…)`
|
|
22
|
+
* subshells, and `<(…)` / `>(…)` process substitutions (bash, so `=(…)` is an array, not zsh's
|
|
23
|
+
* process substitution). `doubleQuoted` scans text bash treats
|
|
24
|
+
* like the inside of double quotes (an unquoted here-document body), where only `$(…)` and backticks
|
|
25
|
+
* run. Null when a construct is not closed.
|
|
26
|
+
*/
|
|
27
|
+
export declare function substitutionBodies(text: string, doubleQuoted?: boolean): string[] | null;
|
|
28
|
+
/**
|
|
29
|
+
* Every simple command `command` runs -- its top-level subcommands and, recursively, the bodies of
|
|
30
|
+
* its subshells, brace groups, command/process substitutions and unquoted here-documents -- each with
|
|
31
|
+
* any compound-statement keyword head removed. Null when `command` cannot be analysed.
|
|
32
|
+
*/
|
|
33
|
+
export declare function flattenSubcommands(command: string): string[] | null;
|
|
34
|
+
/** True when `command` contains a process substitution (`<(…)` or `>(…)`) outside quotes. */
|
|
35
|
+
export declare function hasProcessSubstitution(command: string): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* A command the scanners could NOT parse, split naively -- at every separator and substitution
|
|
38
|
+
* opener, quotes ignored. Over-approximate by design: only for checks that must see a command
|
|
39
|
+
* anyway (a deny rule, the critical-removal breaker), where an extra piece can only add a match.
|
|
40
|
+
*/
|
|
41
|
+
export declare function naiveCommandPieces(command: string): string[];
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { InitPluginInfo } from "@yanlinglabs/winter-agent-sdk";
|
|
2
|
+
import type { PluginCommandContribution } from "../commands/resolver.js";
|
|
3
|
+
import type { PluginSkillContribution } from "../skills/store.js";
|
|
4
|
+
import type { PluginAgentDefinition } from "../subagents/definitions.js";
|
|
5
|
+
export interface PluginSkillEntry {
|
|
6
|
+
/** The BARE name, as the skill's own frontmatter declares it. */
|
|
7
|
+
name: string;
|
|
8
|
+
/** `<plugin>:<skill>` -- the one place plugin skills get namespaced (WS-11 §4). */
|
|
9
|
+
qualifiedName: string;
|
|
10
|
+
description: string;
|
|
11
|
+
/** Absolute. */
|
|
12
|
+
path: string;
|
|
13
|
+
author?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface PluginCommandEntry {
|
|
16
|
+
name: string;
|
|
17
|
+
qualifiedName: string;
|
|
18
|
+
/** Absolute. */
|
|
19
|
+
path: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
argumentHint?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface PluginMetadata {
|
|
24
|
+
description?: string;
|
|
25
|
+
author?: string;
|
|
26
|
+
homepage?: string;
|
|
27
|
+
keywords?: string[];
|
|
28
|
+
}
|
|
29
|
+
export interface PluginBundle {
|
|
30
|
+
/** Manifest `name`, else the root's basename (WS-11 §4's manifestless rule). */
|
|
31
|
+
name: string;
|
|
32
|
+
/** The RESOLVED absolute plugin root -- `system/init.plugins[].path`. */
|
|
33
|
+
path: string;
|
|
34
|
+
version?: string;
|
|
35
|
+
/** Absolute path of the manifest that named it, absent for a manifestless plugin. */
|
|
36
|
+
manifestPath?: string;
|
|
37
|
+
metadata: PluginMetadata;
|
|
38
|
+
skills: PluginSkillEntry[];
|
|
39
|
+
commands: PluginCommandEntry[];
|
|
40
|
+
/** Keyed by `subagent_type`, each already stamped with this plugin's name. */
|
|
41
|
+
agents: Record<string, PluginAgentDefinition>;
|
|
42
|
+
/** The manifest's `hooks` block, verbatim and unparsed. Absent when the plugin declares none. */
|
|
43
|
+
hooks?: unknown;
|
|
44
|
+
/** RAW per-name MCP configs (manifest + `.mcp.json`). Empty when `skipMcpDiscovery` is set. */
|
|
45
|
+
mcpServers: Record<string, unknown>;
|
|
46
|
+
/** Absolute path of the `.mcp.json` that contributed, when one did. */
|
|
47
|
+
mcpConfigPath?: string;
|
|
48
|
+
skipMcpDiscovery: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Absolute path of `<plugin>/output-styles/`, when it exists AND the manifest declares no
|
|
51
|
+
* `outputStyles` override (mutually exclusive with `outputStylesPaths` below -- see its own
|
|
52
|
+
* comment, and `workflowsPath`/`workflowsPaths`' identical pairing).
|
|
53
|
+
*/
|
|
54
|
+
outputStylesPath?: string;
|
|
55
|
+
/**
|
|
56
|
+
* WS-21 fix round 5: the manifest's own `outputStyles` key, resolved the same way
|
|
57
|
+
* `workflowsPaths` is -- present iff the manifest declares the key AND at least one entry
|
|
58
|
+
* resolved, REPLACING `outputStylesPath` on the key's mere presence regardless of whether
|
|
59
|
+
* anything resolved. Each entry may be a directory or a single style file.
|
|
60
|
+
*/
|
|
61
|
+
outputStylesPaths?: string[];
|
|
62
|
+
/**
|
|
63
|
+
* Absolute path of `<plugin>/workflows/`, when it exists AND the manifest declares no `workflows`
|
|
64
|
+
* override (mutually exclusive with `workflowsPaths` below -- see its own comment).
|
|
65
|
+
*/
|
|
66
|
+
workflowsPath?: string;
|
|
67
|
+
/**
|
|
68
|
+
* WS-21 fix round 4 (minors, M-3's last bullet): the manifest's own `workflows` key (`string |
|
|
69
|
+
* string[]`, `manifest.ts`'s own citation), resolved to absolute paths that exist and do not
|
|
70
|
+
* escape the plugin root -- present iff the manifest declares the key AND at least one entry
|
|
71
|
+
* resolved (the pinned binary's own `if(qn.length>0)ve.workflowsPaths=qn`, manifest.ts's
|
|
72
|
+
* citation). REPLACES `workflowsPath` rather than adding to it, and the replacement fires on the
|
|
73
|
+
* key's mere PRESENCE, not on whether anything resolved (the pinned binary's `Lt` gate is
|
|
74
|
+
* `!j.workflows&&...`, checked independently of `qn.length`): a plugin whose every declared entry
|
|
75
|
+
* is invalid ends up with NEITHER field set, exactly as claude leaves it with no workflows source
|
|
76
|
+
* at all rather than silently falling back to the shadowed default directory. Each entry may be a
|
|
77
|
+
* directory or a single workflow file.
|
|
78
|
+
*/
|
|
79
|
+
workflowsPaths?: string[];
|
|
80
|
+
/** Absolute path of `<plugin>/bin/`, when it exists. */
|
|
81
|
+
binPath?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* `system/init.plugins` (`sdk.d.ts:4881-4889`): `{ name, path, version? }`. `version` is
|
|
85
|
+
* plugin-author-controlled and its own pinned doc says to validate before trusting -- Winter carries
|
|
86
|
+
* it through verbatim and asserts nothing about it, which is what "carried, not trusted" means here.
|
|
87
|
+
*/
|
|
88
|
+
export declare function pluginInitInfo(bundles: readonly PluginBundle[]): InitPluginInfo[];
|
|
89
|
+
/**
|
|
90
|
+
* `loadAgentDefinitions`' `pluginAgents` input (subagents/definitions.ts, T2's fourth tier).
|
|
91
|
+
*
|
|
92
|
+
* FIRST PLUGIN WINS a name collision, matching `loadPlugins`' own first-wins order for every other
|
|
93
|
+
* subsystem. The alternative (last wins) would make a plugin's agents depend on where the host
|
|
94
|
+
* happened to put it in the array, in the opposite direction from skills and commands.
|
|
95
|
+
*/
|
|
96
|
+
export declare function pluginAgentDefinitions(bundles: readonly PluginBundle[]): Record<string, PluginAgentDefinition>;
|
|
97
|
+
/** `SkillIndex.build`'s `plugins` input. BARE names -- the index does the qualification itself. */
|
|
98
|
+
export declare function pluginSkillContributions(bundles: readonly PluginBundle[]): PluginSkillContribution[];
|
|
99
|
+
/** `FilesystemCommandResolver`'s `plugins` input. BARE names, for the same reason. */
|
|
100
|
+
export declare function pluginCommandContributions(bundles: readonly PluginBundle[]): PluginCommandContribution[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface PluginRecord {
|
|
2
|
+
/** The `installed_plugins.json` key this record came from -- see the header for why. */
|
|
3
|
+
id: string;
|
|
4
|
+
installPath: string;
|
|
5
|
+
version?: string;
|
|
6
|
+
scope: "user" | "project" | "local";
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Every installed record, across every key and every scope. Never throws: an absent file, malformed
|
|
10
|
+
* JSON, or a shape that is not the expected `{plugins: {...}}` object all read as `[]` -- a broken or
|
|
11
|
+
* missing install ledger must never fail a session's whole plugin load (the same posture
|
|
12
|
+
* `loadPlugins` takes toward one bad plugin directory).
|
|
13
|
+
*/
|
|
14
|
+
export declare function readInstalledPlugins(pluginsRoot: string): PluginRecord[];
|
|
15
|
+
/**
|
|
16
|
+
* Every installed record whose id is `true` in `enabled` -- `enabledPlugins` (settings.json's own
|
|
17
|
+
* field, the same one `manage.ts`'s `setEnabledInSettings` writes). `false`, absent, or a non-boolean
|
|
18
|
+
* value (`enabledPlugins`' own type also admits `string[]`/an object, claude-native shapes this
|
|
19
|
+
* build's own management API never writes) all resolve to "not loaded" -- the exact strict-`true`
|
|
20
|
+
* check `manage.ts`'s own `readEnabledFromSettings` makes, so the two readers of one settings field
|
|
21
|
+
* can never disagree about which plugins are on.
|
|
22
|
+
*
|
|
23
|
+
* SV-4: an enabled key with NO `installed_plugins.json` record falls back to resolving it against a
|
|
24
|
+
* DIRECTORY marketplace named by the key's own `@<marketplace>` suffix, read in place -- see the
|
|
25
|
+
* describe block above this function for the full citation. `scope` defaults to `"user"` for a
|
|
26
|
+
* marketplace-resolved plugin (there is no install record to read a real scope from; `"user"` is
|
|
27
|
+
* this file's own established fallback for exactly this "nothing to narrow from" case, see
|
|
28
|
+
* `normalizeScope`).
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolveEnabledPlugins(pluginsRoot: string, enabled: Record<string, boolean> | undefined): PluginRecord[];
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { BrandProfile, SdkPluginConfig } from "@yanlinglabs/winter-agent-sdk";
|
|
2
|
+
import type { AgentDefinitionRejection } from "../subagents/definitions.js";
|
|
3
|
+
import type { PluginBundle } from "./bundle.js";
|
|
4
|
+
export type PluginRejectionKind = "unsupported-type" | "missing" | "invalid-manifest" | "invalid-name" | "duplicate";
|
|
5
|
+
export interface RejectedPlugin {
|
|
6
|
+
/** The path exactly as the caller wrote it -- so a host can match a rejection to its own config entry. */
|
|
7
|
+
path: string;
|
|
8
|
+
kind: PluginRejectionKind;
|
|
9
|
+
reason: string;
|
|
10
|
+
}
|
|
11
|
+
export interface LoadPluginsResult {
|
|
12
|
+
bundles: PluginBundle[];
|
|
13
|
+
rejected: RejectedPlugin[];
|
|
14
|
+
/**
|
|
15
|
+
* Review r2 finding 2 (whole-branch): rejected `<plugin>/agents/*.md` files -- a broken file
|
|
16
|
+
* inside an OTHERWISE-loaded plugin (missing/invalid `name:`, missing `description:`) used to
|
|
17
|
+
* vanish with no channel at all (`scanPluginAgents`'s own former header: "no rejection channel
|
|
18
|
+
* exists at THIS call site the way `loadAgentDefinitions`'s own `onReject` does"). Distinct from
|
|
19
|
+
* `rejected` above, which is per-PLUGIN (a whole directory that never became a bundle); this is
|
|
20
|
+
* per-FILE within a plugin that DID load. `production-wiring.ts` folds these into its own
|
|
21
|
+
* `warnings` (main.ts's stderr, once per session -- plugin loading runs once).
|
|
22
|
+
*/
|
|
23
|
+
agentFileRejections: AgentDefinitionRejection[];
|
|
24
|
+
/**
|
|
25
|
+
* Fix round 3 (M-5): a `hooks/hooks.json` that exists, parses as an object, but carries no
|
|
26
|
+
* top-level `"hooks"` key -- claude's own `hook-load-failed` diagnostic (`hooks.json must have
|
|
27
|
+
* \`hooks\` (the hook matchers) or \`modules\` (hooks modules), or both`, dump-confirmed). The
|
|
28
|
+
* plugin itself still loads (a malformed hooks file is not a whole-plugin rejection, matching
|
|
29
|
+
* `agentFileRejections`'s own precedent immediately above), so this is the one channel that ever
|
|
30
|
+
* names it. `production-wiring.ts` folds these into the same `warnings` list.
|
|
31
|
+
*/
|
|
32
|
+
hookFileWarnings: string[];
|
|
33
|
+
/**
|
|
34
|
+
* WS-21 fix round 4/5 (minors, M-3's last bullet; generalised and renamed in round 5 from
|
|
35
|
+
* `workflowsPathWarnings` -- ONE fold site, one channel, for every manifest custom-path override
|
|
36
|
+
* this loader resolves, not a parallel field per component): a manifest `workflows`/`agents`/
|
|
37
|
+
* `output-styles`/`commands`/`skills` entry that could not be used -- not a string, escapes the
|
|
38
|
+
* plugin directory (lexically OR through a symlink -- fix round 5's own Aoe/KGe port), does not
|
|
39
|
+
* exist, or (skills only) is a file where a directory is required -- plus a
|
|
40
|
+
* `folder-shadowed-by-manifest` notice when an override silently drops an existing default
|
|
41
|
+
* directory. Named per-plugin, per-entry, on the SAME "recoverable, not a whole-plugin rejection"
|
|
42
|
+
* footing `hookFileWarnings` above already established for a malformed `hooks.json`.
|
|
43
|
+
* `production-wiring.ts` folds these into the same `warnings` list too.
|
|
44
|
+
*/
|
|
45
|
+
manifestPathWarnings: string[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Load every configured plugin.
|
|
49
|
+
*
|
|
50
|
+
* FIRST OCCURRENCE WINS throughout: a repeated path is a `duplicate` rejection rather than a second
|
|
51
|
+
* bundle, and every downstream derivation (bundle.ts) keeps the same direction.
|
|
52
|
+
*/
|
|
53
|
+
export declare function loadPlugins(plugins: readonly SdkPluginConfig[] | undefined, opts?: {
|
|
54
|
+
cwd?: string;
|
|
55
|
+
brand?: Pick<BrandProfile, "pluginManifestDir">;
|
|
56
|
+
}): LoadPluginsResult;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { type BrandProfile } from "@yanlinglabs/winter-agent-sdk";
|
|
2
|
+
/** Winter's OWN manifest dir, derived rather than spelled. A session's is `brand.pluginManifestDir`. */
|
|
3
|
+
export declare const WINTER_PLUGIN_MANIFEST_DIR: string;
|
|
4
|
+
export declare const CLAUDE_PLUGIN_MANIFEST_DIR = ".claude-plugin";
|
|
5
|
+
export declare const PLUGIN_MANIFEST_FILE = "plugin.json";
|
|
6
|
+
/**
|
|
7
|
+
* Preference order for a given brand: the brand's own dir first, so a plugin shipping both is read
|
|
8
|
+
* as native. `.claude-plugin` is never rebranded -- it is the official runtime's own name (WS-01 §5).
|
|
9
|
+
*/
|
|
10
|
+
export declare function pluginManifestDirs(brand?: Pick<BrandProfile, "pluginManifestDir">): readonly string[];
|
|
11
|
+
/** The default profile's pair, for every caller that has not threaded a brand. */
|
|
12
|
+
export declare const PLUGIN_MANIFEST_DIRS: readonly string[];
|
|
13
|
+
/**
|
|
14
|
+
* Open-keyed for the same reason `Settings` is: a manifest key Winter does not know about is
|
|
15
|
+
* PRESERVED and inert rather than dropped, so a plugin authored for a newer engine still loads.
|
|
16
|
+
*/
|
|
17
|
+
export interface PluginManifest {
|
|
18
|
+
name?: string;
|
|
19
|
+
version?: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
author?: unknown;
|
|
22
|
+
homepage?: string;
|
|
23
|
+
keywords?: string[];
|
|
24
|
+
/** Settings-shaped `{ <Event>: [{matcher?, hooks: [...]}] }` -- carried verbatim; parsed by the hook loader. */
|
|
25
|
+
hooks?: unknown;
|
|
26
|
+
/** RAW per-name configs; validated by Lane A's `resolveMcpServerSources`, never here. */
|
|
27
|
+
mcpServers?: Record<string, unknown>;
|
|
28
|
+
/**
|
|
29
|
+
* WS-21 fix round 4 (minors, M-3's last bullet): custom workflow source path(s), REPLACING the
|
|
30
|
+
* default `workflows/` directory rather than adding to it -- confirmed by content search against
|
|
31
|
+
* the installed claude CLI binary (`opt/homebrew/Caskroom/claude-code@latest`, 2.1.280; the pinned
|
|
32
|
+
* 2.1.250 was unavailable locally, so this is the closest available build, cited by content, not
|
|
33
|
+
* by offset): `if(j.workflows){let jn=Array.isArray(j.workflows)?j.workflows:[j.workflows],
|
|
34
|
+
* qn=await Tb(jn,e,j.name,n,"workflows","Workflow","specified in manifest but",M,B,!1,h);if
|
|
35
|
+
* (qn.length>0)ve.workflowsPaths=qn}`, and the default directory is populated only through a
|
|
36
|
+
* SEPARATE `Lt=!j.workflows&&Be` gate a few lines above -- `Lt` is false whenever `j.workflows` is
|
|
37
|
+
* present at all, regardless of whether any entry resolves. Each entry may name a DIRECTORY
|
|
38
|
+
* (scanned the same way as the default one) or a single FILE (the SAME `Tb` call site passes
|
|
39
|
+
* `requireDirectory:!1` for `workflows`, unlike the `!0` it passes for `skills`, which is the
|
|
40
|
+
* fourth-from-last argument and the one place the two calls differ). `plugins/loader.ts`'s
|
|
41
|
+
* `resolveManifestComponentOverride` (fix round 5's own generalisation) is where this is resolved
|
|
42
|
+
* into `PluginBundle.workflowsPaths`.
|
|
43
|
+
*/
|
|
44
|
+
workflows?: string | string[];
|
|
45
|
+
/**
|
|
46
|
+
* WS-21 fix round 5: the same custom-path-override shape as `workflows` above, for the built-in
|
|
47
|
+
* `agents/` component -- content-search confirmed against the installed claude CLI binary
|
|
48
|
+
* (2.1.280): `if(pt)ve.agentsPath=$t;if(j.agents){let jn=Array.isArray(j.agents)?j.agents:
|
|
49
|
+
* [j.agents],qn=await Tb(jn,e,j.name,n,"agents","Agent","specified in manifest but",M,B,!1,h);if
|
|
50
|
+
* (qn.length>0)ve.agentsPaths=qn}` -- `pt=!j.agents&&Fe` shadows the default directory on the
|
|
51
|
+
* key's mere presence, the identical `!j.X&&Y` shape `workflows`' own `Lt` gate has. The CONSUMER
|
|
52
|
+
* side (dump-confirmed separately, a different chunk of the same binary) stat()s each entry and
|
|
53
|
+
* branches directory-vs-file: `M.agentsPaths.map(async(he)=>{let ve=await stat(he);if(ve.
|
|
54
|
+
* isDirectory()){...scan the dir...}else if(...){...one file...}})` -- ported as
|
|
55
|
+
* `scanPluginAgentsOverride`.
|
|
56
|
+
*/
|
|
57
|
+
agents?: string | string[];
|
|
58
|
+
/**
|
|
59
|
+
* WS-21 fix round 5: the same custom-path-override shape as `workflows`/`agents`, for `commands`
|
|
60
|
+
* -- PLUS an inline `{<name>: {source?: string; content?: string}}` object-map form claude's own
|
|
61
|
+
* `eqt` also accepts (content-search confirmed against the installed claude CLI binary, 2.1.280),
|
|
62
|
+
* letting a manifest embed a command's text directly instead of pointing at a file. Winter does
|
|
63
|
+
* NOT port the inline form this round (`plugins/loader.ts`'s `resolveCommandsManifestOverride` has
|
|
64
|
+
* the full disclosed-scope note); it is typed here only so a manifest using it is not silently
|
|
65
|
+
* miscast, and so the shadow-on-presence check still fires for it.
|
|
66
|
+
*/
|
|
67
|
+
commands?: string | string[] | Record<string, {
|
|
68
|
+
source?: string;
|
|
69
|
+
content?: string;
|
|
70
|
+
}>;
|
|
71
|
+
/**
|
|
72
|
+
* WS-21 fix round 5: `skills` is a manifest custom-path override too, but content-search confirmed
|
|
73
|
+
* against the installed claude CLI binary (2.1.280) shows a DIFFERENT precedence than every other
|
|
74
|
+
* component here -- ADDITIVE, not shadow-on-presence. The builder's own gate (`_t=Le`, no `!j.
|
|
75
|
+
* skills` negation, unlike `commands`' `ht=!j.commands&&Me`/`agents`' `pt=!j.agents&&Fe`/
|
|
76
|
+
* `workflows`' `Lt=!j.workflows&&Be`) sets the default `ve.skillsPath` REGARDLESS of whether
|
|
77
|
+
* `j.skills` is also present; the CONSUMER (a separate chunk of the same binary) confirms it:
|
|
78
|
+
* `if(h.skillsPath){...load the default...}if(h.skillsPaths){...ALSO load every override entry...}`
|
|
79
|
+
* -- both run, never either/or. Consistent with this: `skills` is ABSENT from the
|
|
80
|
+
* `folder-shadowed-by-manifest` tuple list (`["commands",...],["agents",...],["outputStyles",...],
|
|
81
|
+
* ["themes",...]` -- no `"skills"` entry), so no shadow warning is possible for it.
|
|
82
|
+
* `plugins/loader.ts`'s `scanPluginSkillsOverride` is where this is resolved and merged.
|
|
83
|
+
*/
|
|
84
|
+
skills?: string | string[];
|
|
85
|
+
/**
|
|
86
|
+
* WS-21 fix round 5: the same custom-path-override shape as `agents`/`workflows` (shadow-on-
|
|
87
|
+
* presence, `requireDirectory:false`) for `output-styles` -- content-search confirmed against the
|
|
88
|
+
* installed claude CLI binary (2.1.280): `gt=j.outputStyles` (note the CAMEL-CASE manifest key,
|
|
89
|
+
* unlike the kebab-case default DIRECTORY name `output-styles/`), `Rt=!gt&&He` shadows the default
|
|
90
|
+
* on presence, and `if(gt){...Tb(...,"output-styles","Output style",...,!1,...);if(qn.length>0)
|
|
91
|
+
* ve.outputStylesPaths=qn}`. Resolved LAZILY (unlike commands/agents/skills, which are eagerly
|
|
92
|
+
* scanned at load time): `context/output-styles.ts`'s `PluginOutputStyleSource.outputStylesPaths`
|
|
93
|
+
* is where a `<plugin>:<style>` lookup actually reads it.
|
|
94
|
+
*/
|
|
95
|
+
outputStyles?: string | string[];
|
|
96
|
+
[key: string]: unknown;
|
|
97
|
+
}
|
|
98
|
+
export interface ReadPluginManifestResult {
|
|
99
|
+
manifest?: PluginManifest;
|
|
100
|
+
/** Absolute path of the manifest that was read. */
|
|
101
|
+
path?: string;
|
|
102
|
+
/** Set iff a manifest EXISTED but could not be used. A missing manifest sets neither field. */
|
|
103
|
+
error?: string;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Read a plugin root's manifest.
|
|
107
|
+
*
|
|
108
|
+
* `{}` (all three fields absent) means NO manifest -- the manifestless case, which WS-11 §4 makes a
|
|
109
|
+
* first-class shape (the root is then named by its basename). A manifest that exists but is
|
|
110
|
+
* unparseable or is not a JSON object returns `error` instead: loading it as though it were absent
|
|
111
|
+
* would silently rename the plugin and drop everything it declared.
|
|
112
|
+
*/
|
|
113
|
+
export declare function readPluginManifest(root: string, brand?: Pick<BrandProfile, "pluginManifestDir">): ReadPluginManifestResult;
|
|
114
|
+
/** A manifest's `author`, reduced to a display string. Accepts the bare-string and `{name}` forms. */
|
|
115
|
+
export declare function manifestAuthor(author: unknown): string | undefined;
|