@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,83 @@
|
|
|
1
|
+
import { type BrandProfile, type McpServerConfig, type ResolvedSettingSource, type SettingSource } from "@yanlinglabs/winter-agent-sdk";
|
|
2
|
+
import type { McpConfigSourceOrigin, McpServerSource } from "../../mcp/lifecycle.js";
|
|
3
|
+
/**
|
|
4
|
+
* WS-01 §2.4: the native project MCP config, under `brand.projectDirName`. The official branch's
|
|
5
|
+
* `.mcp.json` is NOT read.
|
|
6
|
+
*/
|
|
7
|
+
export declare function projectMcpConfigRelative(brand?: Pick<BrandProfile, "projectDirName">): string;
|
|
8
|
+
/** Winter's own value, for every caller that has not threaded a brand. */
|
|
9
|
+
export declare const PROJECT_MCP_CONFIG_RELATIVE: string;
|
|
10
|
+
export interface RejectedMcpConfig {
|
|
11
|
+
origin: McpConfigSourceOrigin;
|
|
12
|
+
path?: string;
|
|
13
|
+
reason: string;
|
|
14
|
+
}
|
|
15
|
+
export interface McpConfigLoadResult {
|
|
16
|
+
sources: McpServerSource[];
|
|
17
|
+
rejected: RejectedMcpConfig[];
|
|
18
|
+
}
|
|
19
|
+
/** One settings tier's contribution -- the same input shape `buildHookEntriesFromSettings` accepts. */
|
|
20
|
+
export interface SettingsMcpSourceInput {
|
|
21
|
+
source: ResolvedSettingSource;
|
|
22
|
+
path?: string;
|
|
23
|
+
settings?: {
|
|
24
|
+
mcpServers?: unknown;
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
};
|
|
27
|
+
values?: {
|
|
28
|
+
mcpServers?: unknown;
|
|
29
|
+
[key: string]: unknown;
|
|
30
|
+
};
|
|
31
|
+
policyOrigin?: string;
|
|
32
|
+
loaded?: boolean;
|
|
33
|
+
error?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* `<cwd>/.winter/mcp.json`.
|
|
37
|
+
*
|
|
38
|
+
* SOURCE-GATED on `project ∈ settingSources`, exactly like project skills and commands: WS-01 §2.4
|
|
39
|
+
* has the official branch run with `settingSources: []` and get its servers "via explicit
|
|
40
|
+
* `mcpServers` options only", which is only true if this file is not read in that mode.
|
|
41
|
+
*
|
|
42
|
+
* NO PARENT-WALK, unlike skills. The project `mcp.json` names PROCESSES to run, and a walk would let a
|
|
43
|
+
* config committed several directories above the session's cwd start a stdio server the user never
|
|
44
|
+
* looked at. The skills walk carries no such authority. Disclosed divergence from the skill tier.
|
|
45
|
+
*/
|
|
46
|
+
export declare function loadProjectMcpConfig(opts: {
|
|
47
|
+
cwd: string;
|
|
48
|
+
settingSources?: SettingSource[] | undefined;
|
|
49
|
+
brand?: Pick<BrandProfile, "projectDirName">;
|
|
50
|
+
}): McpConfigLoadResult;
|
|
51
|
+
/**
|
|
52
|
+
* `Settings.mcpServers` from every loaded tier.
|
|
53
|
+
*
|
|
54
|
+
* ORDER: the caller's tier order is preserved, and `resolveMcpServerSources` processes by ORIGIN
|
|
55
|
+
* first, so ordering within an origin is all this controls. Pass the tiers highest-precedence first
|
|
56
|
+
* (which is the order `resolveSettingsDetailed` already returns them in), and pass this result
|
|
57
|
+
* BEFORE `loadProjectMcpConfig`'s so a project settings.json entry outranks the ambient
|
|
58
|
+
* the project `mcp.json` while still sharing its gate.
|
|
59
|
+
*/
|
|
60
|
+
export declare function settingsMcpServerSources(perSource: readonly SettingsMcpSourceInput[] | undefined): McpConfigLoadResult;
|
|
61
|
+
export interface GlobalConfigMcpInput {
|
|
62
|
+
/** The shared runtime home (`sdkHomeOf(WINTER_HOME)`), where `.winter.json` lives. */
|
|
63
|
+
home: string;
|
|
64
|
+
cwd: string;
|
|
65
|
+
/** The canonical git root, or `null` outside a repository -- the caller's own resolution (see header). */
|
|
66
|
+
gitRoot: string | null;
|
|
67
|
+
brand: Pick<BrandProfile, "homeDirName">;
|
|
68
|
+
sources: readonly SettingSource[];
|
|
69
|
+
}
|
|
70
|
+
export interface GlobalConfigMcpResult {
|
|
71
|
+
user: Record<string, McpServerConfig>;
|
|
72
|
+
/** This checkout's `projects[<key>].mcpServers` only -- never another project's entry in the same file. */
|
|
73
|
+
local: Record<string, McpServerConfig>;
|
|
74
|
+
/**
|
|
75
|
+
* NOT in the plan brief's sketch interface, added here for the same reason every other loader in
|
|
76
|
+
* this file carries one: "a malformed file produces a scan error, not a throw" (the brief's own
|
|
77
|
+
* L1a.5 test list) needs somewhere to put that scan error. `RejectedMcpConfig` already exists for
|
|
78
|
+
* exactly this shape, so this is the minimal extension rather than a second, parallel error
|
|
79
|
+
* channel.
|
|
80
|
+
*/
|
|
81
|
+
rejected: RejectedMcpConfig[];
|
|
82
|
+
}
|
|
83
|
+
export declare function loadGlobalConfigMcp(input: GlobalConfigMcpInput): GlobalConfigMcpResult;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** The pinned area names. An unrecognised string in the array is ignored, never treated as `true`. */
|
|
2
|
+
export type StrictPluginOnlyArea = "skills" | "agents" | "hooks" | "mcp";
|
|
3
|
+
export type StrictPluginOnlyCustomization = boolean | readonly string[];
|
|
4
|
+
/**
|
|
5
|
+
* Does the setting restrict `area` to plugin-sourced customization only?
|
|
6
|
+
*
|
|
7
|
+
* `true` restricts every area; an array restricts exactly the areas it names; `false`/absent/an
|
|
8
|
+
* empty array restrict nothing. A non-array, non-boolean value (a settings file is JSON and may
|
|
9
|
+
* carry anything) restricts nothing -- the fail-OPEN direction is correct here because this setting
|
|
10
|
+
* REMOVES capability: reading a malformed value as "restrict everything" would silently delete a
|
|
11
|
+
* user's whole skills directory from the session over a typo.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isStrictPluginOnly(value: StrictPluginOnlyCustomization | undefined, area: StrictPluginOnlyArea): boolean;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { resolveSettings, resolveSettingsDetailed, filterEscalatingDefaultMode, applyWorkspaceTrust, settingsPathFor, loadSettingsFile, SETTING_SOURCES, OVERLAY_NEVER_KEYS, ESCALATING_PERMISSION_MODES, PROJECT_PERMISSIVE_KEYS, providerSettingsFrom, } from "@yanlinglabs/winter-agent-sdk";
|
|
2
|
+
export type { SettingSource, ResolvedSettingSource, PolicySettingsOrigin, Settings, SettingsPermissionsBlock, SettingsHooksConfig, SettingsHookMatcherGroup, SettingsHookHandler, ProvenanceEntry, ResolvedSettings, ResolvedSettingsSourceEntry, ResolveSettingsOptions, DetailedResolvedSettings, DetailedSettingsSourceEntry, ResolveSettingsDetailedOptions, WorkspaceTrustFilterOptions, } from "@yanlinglabs/winter-agent-sdk";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { RuntimeConfig } from "@yanlinglabs/winter-agent-sdk";
|
|
2
|
+
/**
|
|
3
|
+
* Two reasons, not four.
|
|
4
|
+
*
|
|
5
|
+
* The Task 2 brief's union also carried `"project-source-selected"` and
|
|
6
|
+
* `"captured-no-trust-concept"` — the two outcomes R5-6 was hedging between. Capture (1)
|
|
7
|
+
* DISCRIMINATED, and neither is reachable: selecting `'project'` is not trust, and the pin does have
|
|
8
|
+
* a trust concept. They are removed rather than left as dead members a lane might one day produce,
|
|
9
|
+
* which would be a verdict no consumer could act on. Narrowing here is a deliberate divergence from
|
|
10
|
+
* the brief's literal type, recorded in the Task 2 report.
|
|
11
|
+
*/
|
|
12
|
+
export type TrustVerdictReason = "host-declared" | "untrusted-default";
|
|
13
|
+
export interface TrustVerdict {
|
|
14
|
+
trusted: boolean;
|
|
15
|
+
reason: TrustVerdictReason;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The seam engine.ts consults. `cwd` is part of the signature because a HOST-supplied source may
|
|
19
|
+
* legitimately vary by directory (a daemon that remembers which repositories a user has approved);
|
|
20
|
+
* Winter's own `defaultTrustSource` deliberately does not, per the capture.
|
|
21
|
+
*/
|
|
22
|
+
export interface WorkspaceTrustSource {
|
|
23
|
+
verdict(cwd: string): TrustVerdict;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The default source: trusted iff the host explicitly declared `trustedWorkspace: true`.
|
|
27
|
+
*
|
|
28
|
+
* `settingSources` is in the parameter type and is deliberately NOT read — the signature keeps it so
|
|
29
|
+
* a future host-side source can see what the session selected, and so the ONE thing capture (1)
|
|
30
|
+
* rules out (inferring trust from source selection) is visibly not done rather than merely absent.
|
|
31
|
+
* An exact `=== true` check, never a truthy coercion: this value crosses a JSON wire, where a
|
|
32
|
+
* `"false"` string would otherwise grant trust.
|
|
33
|
+
*/
|
|
34
|
+
export declare function defaultTrustSource(config: Pick<RuntimeConfig, "settingSources" | "trustedWorkspace">): WorkspaceTrustSource;
|
|
35
|
+
/** A constant source, for tests and for a host that has already made the decision elsewhere. */
|
|
36
|
+
export declare function fixedTrustSource(trusted: boolean): WorkspaceTrustSource;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { SkillTier } from "./loader.js";
|
|
2
|
+
/** The entry name. One constant, so a future dialect entry and this producer cannot disagree. */
|
|
3
|
+
export declare const INVOKED_SKILLS_ATTACHMENT_TYPE = "invoked_skills";
|
|
4
|
+
export interface InvokedSkillEntry {
|
|
5
|
+
/** The skill's PRIMARY identity, not the alias the model happened to type. */
|
|
6
|
+
name: string;
|
|
7
|
+
source: SkillTier;
|
|
8
|
+
/** Absolute path of the SKILL.md whose body entered the conversation. */
|
|
9
|
+
path: string;
|
|
10
|
+
/** The contributing plugin, present iff `source === "plugin"`. */
|
|
11
|
+
plugin?: string;
|
|
12
|
+
/** The invocation's `args`, omitted entirely when none were given. */
|
|
13
|
+
args?: string;
|
|
14
|
+
/** Size of the body AS DELIVERED -- post byte-cap, so it reflects what the model actually received. */
|
|
15
|
+
bodyBytes: number;
|
|
16
|
+
}
|
|
17
|
+
export interface InvokedSkillsAttachment {
|
|
18
|
+
type: typeof INVOKED_SKILLS_ATTACHMENT_TYPE;
|
|
19
|
+
skills: InvokedSkillEntry[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* An attachment carries an ARRAY even for a single invocation: a turn may invoke several skills, and
|
|
23
|
+
* a consumer that folds attachments should never have to distinguish "one" from "several".
|
|
24
|
+
*/
|
|
25
|
+
export declare function invokedSkillsAttachment(skills: InvokedSkillEntry[]): InvokedSkillsAttachment;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/** WS-11 §2.5's jail, verbatim: lowercase alnum + dash, 1-64 chars, no separators/dots/underscores/uppercase. */
|
|
2
|
+
export declare const SKILL_NAME_PATTERN: RegExp;
|
|
3
|
+
/**
|
|
4
|
+
* A PLUGIN name may additionally carry the leading dot the canonical project plugin has
|
|
5
|
+
* (the project dot-dir, WS-01 §2.4 / WS-11 §4) -- so the qualified form `<projectDir>:<skill>` is expressible.
|
|
6
|
+
* Otherwise the same jail: no path separators, no `..`, no whitespace.
|
|
7
|
+
*/
|
|
8
|
+
export declare const PLUGIN_NAME_PATTERN: RegExp;
|
|
9
|
+
/** Norma parity: the body cap applied at LOAD time (never at index time -- bodies are not read at index time at all). */
|
|
10
|
+
export declare const DEFAULT_SKILL_BODY_BYTES = 32768;
|
|
11
|
+
/**
|
|
12
|
+
* WINTER ADDITION, disclosed: a description byte cap applied at PARSE time so a pathological
|
|
13
|
+
* SKILL.md cannot grow the in-memory index without bound. Deliberately far above
|
|
14
|
+
* `skillListingMaxDescChars`' pinned default of 1536 CHARS (listing.ts), so the observable listing
|
|
15
|
+
* is decided by that cap and never by this one -- this bounds memory, not presentation.
|
|
16
|
+
*/
|
|
17
|
+
export declare const DEFAULT_SKILL_DESCRIPTION_BYTES = 4096;
|
|
18
|
+
/** Norma parity, byte-for-byte. */
|
|
19
|
+
export declare const SKILL_TRUNCATION_MARKER = "\n[\u2026truncated]";
|
|
20
|
+
/**
|
|
21
|
+
* `null` when the name is a legal slug; an error string otherwise.
|
|
22
|
+
*
|
|
23
|
+
* WHEN IT RUNS, precisely (fix round 1, corrected -- this used to say "before any fs op", which is
|
|
24
|
+
* true of only one of the two callers): on the EXECUTOR path (`isLegalSkillIdentity`) it runs before
|
|
25
|
+
* anything touches the filesystem, because the name comes from the model. On the INDEX path
|
|
26
|
+
* (`SkillIndex.build`) the SKILL.md has already been read by then -- the jail is applied to the
|
|
27
|
+
* RESOLVED name, which may come from the file's own `name:` frontmatter and so cannot be known
|
|
28
|
+
* earlier. That is safe because the PATH the index reads is always built from `readdirSync` output,
|
|
29
|
+
* never from a declared name; the jail's job there is to keep an escaping declared name out of the
|
|
30
|
+
* index, not to protect the read.
|
|
31
|
+
*/
|
|
32
|
+
export declare function skillNameError(name: string): string | null;
|
|
33
|
+
/** `null` when the plugin name is legal (the leading-dot form included). */
|
|
34
|
+
export declare function pluginNameError(name: string): string | null;
|
|
35
|
+
export interface ParsedSkillFile {
|
|
36
|
+
name: string;
|
|
37
|
+
description: string;
|
|
38
|
+
body: string;
|
|
39
|
+
/** Winter extension (WS-11 §2.5): the `author:` stamp `self`-tier skills carry. */
|
|
40
|
+
author?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Cap `s` to `maxBytes` UTF-8 bytes on a byte boundary, appending the truncation marker when cut.
|
|
44
|
+
* Norma's `capBytes`, unchanged -- including the deliberate detail that `subarray` may split a
|
|
45
|
+
* multi-byte sequence, which `toString("utf8")` then renders as a replacement character rather than
|
|
46
|
+
* throwing. A byte cap that silently became a character cap would stop bounding memory.
|
|
47
|
+
*/
|
|
48
|
+
export declare function capBytes(s: string, maxBytes: number): string;
|
|
49
|
+
/**
|
|
50
|
+
* Parse a SKILL.md's raw text. `null` for anything that is not a usable skill: no leading fence, or
|
|
51
|
+
* an unterminated fence.
|
|
52
|
+
*
|
|
53
|
+
* WS-21 §6.3 items 9-10 (claude's `getSkillCommandName`, measured 2026-09-23): a skill's IDENTITY is
|
|
54
|
+
* always the directory it was discovered under -- `fallbackName` -- never a frontmatter `name:` key.
|
|
55
|
+
* Earlier this parser let a declared `name:` override the directory, which meant a checked-in
|
|
56
|
+
* SKILL.md could claim any identity a caller had not yet validated; now the frontmatter's `name:`
|
|
57
|
+
* line, if present, is not even read. A missing `description:` no longer invalidates the file either
|
|
58
|
+
* -- it yields `""` and the skill is kept (claude does not drop undescribed skills; the model still
|
|
59
|
+
* sees the name, and `renderSkillListingLine` already prints a name-only line for an empty
|
|
60
|
+
* description).
|
|
61
|
+
*
|
|
62
|
+
* The fence must start at byte 0 -- a `---` deeper in the file is body text, never frontmatter.
|
|
63
|
+
*/
|
|
64
|
+
export declare function parseSkillFile(raw: string, fallbackName: string): ParsedSkillFile | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { DEFAULT_SKILL_BODY_BYTES, DEFAULT_SKILL_DESCRIPTION_BYTES, SKILL_NAME_PATTERN, SKILL_TRUNCATION_MARKER, capBytes, parseSkillFile, pluginNameError, skillNameError } from "./frontmatter.js";
|
|
2
|
+
export type { ParsedSkillFile } from "./frontmatter.js";
|
|
3
|
+
export { SELF_SUBDIR, SKILL_METADATA_PREFIX_BYTES, ABSENT_SKILL_FILE, findRepoRoot, projectSkillRoots, readSkillMetadata, scanSkillRoot, scanUserSkillRoot } from "./loader.js";
|
|
4
|
+
export type { DiscoveredSkill, SkillMetadataRead, SkillScanError, SkillScanResult, SkillTier } from "./loader.js";
|
|
5
|
+
export { PROJECT_PLUGIN_NAME, SkillIndex } from "./store.js";
|
|
6
|
+
export type { PluginSkillContribution, SkillIndexOptions, SkillMeta } from "./store.js";
|
|
7
|
+
export { DEFAULT_SKILL_LISTING_BUDGET_FRACTION, DEFAULT_SKILL_LISTING_MAX_DESC_CHARS, LISTING_TRUNCATION_SUFFIX, SKILL_LISTING_CHARS_PER_TOKEN, DEFAULT_SKILL_LISTING_CONTEXT_WINDOW_TOKENS, buildSkillListing, isModelVisible, renderSkillListingContent, renderSkillListingLine, truncateSkillDescription, isUserInvocable, skillListingBudgetChars, } from "./listing.js";
|
|
8
|
+
export type { BuildSkillListingOptions, SkillOverride, SkillOverrides } from "./listing.js";
|
|
9
|
+
export { SKILL_TOOL_NAME, autoSkillPermissionEntries, isLegalSkillIdentity, isSkillEnabled, validateSkillsOption } from "./option.js";
|
|
10
|
+
export type { SkillsOptionFailure, SkillsOptionSuccess, SkillsOptionValidation, ValidateSkillsOptions } from "./option.js";
|
|
11
|
+
export { matchesSkillRule, parseSkillRule, skillRulesAllow } from "./permission-rules.js";
|
|
12
|
+
export type { SkillRuleTarget } from "./permission-rules.js";
|
|
13
|
+
export { INVOKED_SKILLS_ATTACHMENT_TYPE, invokedSkillsAttachment } from "./attachment.js";
|
|
14
|
+
export type { InvokedSkillEntry, InvokedSkillsAttachment } from "./attachment.js";
|
|
15
|
+
export { clearSkillSessionRuntime, getSkillSessionRuntime, registerSkillSessionRuntime } from "./runtime.js";
|
|
16
|
+
export type { SkillSessionRuntime } from "./runtime.js";
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { SkillListing } from "../context/seam.js";
|
|
2
|
+
import type { SkillMeta } from "./store.js";
|
|
3
|
+
/** `sdk.d.ts:5499`'s doc-stated default. */
|
|
4
|
+
export declare const DEFAULT_SKILL_LISTING_MAX_DESC_CHARS = 1536;
|
|
5
|
+
/** `sdk.d.ts:5503`'s doc-stated default: the fraction of the context window reserved for the listing. */
|
|
6
|
+
export declare const DEFAULT_SKILL_LISTING_BUDGET_FRACTION = 0.01;
|
|
7
|
+
/**
|
|
8
|
+
* WINTER-DEFINED, disclosed: the budget setting is a fraction of a TOKEN window, and this producer
|
|
9
|
+
* measures CHARACTERS. 4 chars/token is the conventional English-text approximation and is used
|
|
10
|
+
* only to size a budget -- nothing downstream treats it as a real tokenizer, and the accountant
|
|
11
|
+
* (T2's `ContextAccountant`) remains the only thing that counts real tokens. A caller that knows
|
|
12
|
+
* better passes `budgetChars` directly and this constant is not consulted.
|
|
13
|
+
*/
|
|
14
|
+
export declare const SKILL_LISTING_CHARS_PER_TOKEN = 4;
|
|
15
|
+
/** Appended to a description cut by `maxDescChars`. One character, so it barely moves the budget. */
|
|
16
|
+
export declare const LISTING_TRUNCATION_SUFFIX = "\u2026";
|
|
17
|
+
/**
|
|
18
|
+
* `Settings.skillOverrides` (`sdk.d.ts:5651`) -- four states of per-skill visibility.
|
|
19
|
+
*
|
|
20
|
+
* `on` (or absent): listed to the model and invocable.
|
|
21
|
+
* `name-only`: listed WITHOUT its description (the model sees it exists; the description costs nothing).
|
|
22
|
+
* `user-invocable-only`: not listed to the model at all, but still resolvable by a user `/name`.
|
|
23
|
+
* `off`: invisible and uninvocable.
|
|
24
|
+
*/
|
|
25
|
+
export type SkillOverride = "on" | "name-only" | "user-invocable-only" | "off";
|
|
26
|
+
/** Open-valued on purpose: a settings file is JSON and may carry a state a newer engine defines. */
|
|
27
|
+
export type SkillOverrides = Readonly<Record<string, string>>;
|
|
28
|
+
export interface BuildSkillListingOptions {
|
|
29
|
+
maxDescChars?: number | undefined;
|
|
30
|
+
budgetFraction?: number | undefined;
|
|
31
|
+
contextWindowTokens?: number | undefined;
|
|
32
|
+
/** An explicit character budget, bypassing the fraction x window x ratio derivation. `0` disables the budget. */
|
|
33
|
+
budgetChars?: number | undefined;
|
|
34
|
+
skillOverrides?: SkillOverrides | undefined;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* True when the model may see this skill in the listing. An UNRECOGNISED override value reads as
|
|
38
|
+
* `on`: a settings file written for a newer engine must never silently hide a skill on an older one
|
|
39
|
+
* (the same "accepted, preserved, inert" posture WS-08 §1 pins for unknown hook event names).
|
|
40
|
+
*/
|
|
41
|
+
export declare function isModelVisible(overrides: SkillOverrides | undefined, skill: SkillMeta | string): boolean;
|
|
42
|
+
/** True when a USER `/name` may still reach this skill. Only `off` closes that door. */
|
|
43
|
+
export declare function isUserInvocable(overrides: SkillOverrides | undefined, skill: SkillMeta | string): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* claude's `Ckn`: the context window a budget is sized against when the session reports none.
|
|
46
|
+
*/
|
|
47
|
+
export declare const DEFAULT_SKILL_LISTING_CONTEXT_WINDOW_TOKENS = 200000;
|
|
48
|
+
/**
|
|
49
|
+
* The whole-listing character budget -- claude's `Ige`: `floor(window x chars-per-token x fraction)`,
|
|
50
|
+
* with claude's 200k-token default window when the session reports none (or a non-finite one).
|
|
51
|
+
* An explicit `budgetChars` wins (claude's `SLASH_COMMAND_TOOL_CHAR_BUDGET` analog), and there `0`
|
|
52
|
+
* means "no budget" -- a Winter extension, never "no listing".
|
|
53
|
+
*/
|
|
54
|
+
export declare function skillListingBudgetChars(opts: {
|
|
55
|
+
contextWindowTokens?: number | undefined;
|
|
56
|
+
budgetFraction?: number | undefined;
|
|
57
|
+
budgetChars?: number | undefined;
|
|
58
|
+
}): number;
|
|
59
|
+
/**
|
|
60
|
+
* claude's `xkn`: a description longer than the cap keeps `cap - 1` characters and gains the
|
|
61
|
+
* ellipsis, so the result is exactly `cap` characters long.
|
|
62
|
+
*/
|
|
63
|
+
export declare function truncateSkillDescription(description: string, maxDescChars: number): string;
|
|
64
|
+
/**
|
|
65
|
+
* claude's per-skill line (`Mkn`): `- <name>: <description>`, or `- <name>` for an entry whose
|
|
66
|
+
* description is empty (a `name-only` override, or one the budget reduced to its name).
|
|
67
|
+
*/
|
|
68
|
+
export declare function renderSkillListingLine(entry: {
|
|
69
|
+
name: string;
|
|
70
|
+
description: string;
|
|
71
|
+
}): string;
|
|
72
|
+
/** The `skill_listing` attachment's `content`: one line per entry, newline-joined (claude's `Rot` output). */
|
|
73
|
+
export declare function renderSkillListingContent(entries: readonly {
|
|
74
|
+
name: string;
|
|
75
|
+
description: string;
|
|
76
|
+
}[]): string;
|
|
77
|
+
/**
|
|
78
|
+
* Build the model-facing listing -- claude 0.3.250's `Rot`, applied here once so every consumer sees
|
|
79
|
+
* the budgeted result.
|
|
80
|
+
*
|
|
81
|
+
* ORDER IS PRECEDENCE ORDER (the index's own): project first, builtin last. Every visible skill is
|
|
82
|
+
* listed; the budget decides only which ones keep their DESCRIPTION:
|
|
83
|
+
* - everything fits -> every line is full;
|
|
84
|
+
* - over budget -> `name-only` entries and Winter's builtin (claude: bundled) skills stay full,
|
|
85
|
+
* every other entry starts as its bare name, and descriptions are restored in priority order
|
|
86
|
+
* while the remaining budget holds them. claude orders that priority by its per-skill usage
|
|
87
|
+
* score; Winter keeps no usage history, so every score ties and precedence order decides.
|
|
88
|
+
*/
|
|
89
|
+
export declare function buildSkillListing(skills: readonly SkillMeta[], opts?: BuildSkillListingOptions): SkillListing;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { type BrandProfile } from "@yanlinglabs/winter-agent-sdk";
|
|
2
|
+
import { type ParsedSkillFile } from "./frontmatter.js";
|
|
3
|
+
/** WS-11 §2.1's tier table, and `SkillListing["source"]` (context/seam.ts, R5-17) verbatim. */
|
|
4
|
+
export type SkillTier = "project" | "user" | "plugin" | "builtin" | "self";
|
|
5
|
+
export interface DiscoveredSkill {
|
|
6
|
+
/** The INVOCABLE name. Plugin skills arrive here already qualified `<plugin>:<skill>` (store.ts). */
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
source: SkillTier;
|
|
10
|
+
/** Absolute path of the SKILL.md this was discovered from. */
|
|
11
|
+
path: string;
|
|
12
|
+
/** Winter extension (WS-11 §2.5). */
|
|
13
|
+
author?: string;
|
|
14
|
+
/** Present iff `source === "plugin"` -- the contributing plugin's name. */
|
|
15
|
+
plugin?: string;
|
|
16
|
+
}
|
|
17
|
+
/** One SKILL.md that could not become an index entry -- surfaced, never silently dropped (A-11). */
|
|
18
|
+
export interface SkillScanError {
|
|
19
|
+
/** The immediate subdirectory of the scanned root -- what an author would go and look at. */
|
|
20
|
+
directory: string;
|
|
21
|
+
/** Absolute path of the SKILL.md. */
|
|
22
|
+
path: string;
|
|
23
|
+
source: SkillTier;
|
|
24
|
+
reason: string;
|
|
25
|
+
}
|
|
26
|
+
export interface SkillScanResult {
|
|
27
|
+
skills: DiscoveredSkill[];
|
|
28
|
+
errors: SkillScanError[];
|
|
29
|
+
}
|
|
30
|
+
/** The reserved subdirectory of the user root that holds agent-authored skills (Norma parity). */
|
|
31
|
+
export declare const SELF_SUBDIR = "self";
|
|
32
|
+
/**
|
|
33
|
+
* THE INDEX-TIME READ BOUND (fix wave, A-11 / T5 review Nit 5).
|
|
34
|
+
*
|
|
35
|
+
* `SkillIndex.build()` used to `readFileSync` every SKILL.md in full and drop the parsed body --
|
|
36
|
+
* "lazy" meant NOT RETAINED, not NOT READ. That read is unconditional and pre-session: it covers
|
|
37
|
+
* every `<cwd>/.winter/skills/**` up to the repository root, content that arrives with a `git clone`,
|
|
38
|
+
* before any trust decision and before the model runs. With no cap at all the bound was "the total
|
|
39
|
+
* bytes of every skill file in the tree" -- a 64 MB SKILL.md cost 64 MB of heap during startup, and
|
|
40
|
+
* a startup failure is not something a session can route around.
|
|
41
|
+
*
|
|
42
|
+
* Frontmatter lives at the HEAD of the file, so a bounded prefix is everything the index needs.
|
|
43
|
+
* `load()` keeps the full read (bodies are what it exists to fetch), which is the split that makes
|
|
44
|
+
* this safe: the cap bounds DISCOVERY, never invocation.
|
|
45
|
+
*/
|
|
46
|
+
export declare const SKILL_METADATA_PREFIX_BYTES = 65536;
|
|
47
|
+
/**
|
|
48
|
+
* The nearest ancestor of `from` (inclusive) that holds a `.git` entry, or `undefined` when there is
|
|
49
|
+
* none. `.git` may be a DIRECTORY or a FILE (a worktree/submodule gitlink is a file), so existence
|
|
50
|
+
* is what is checked, never `isDirectory()` -- a session run inside a git worktree must find the
|
|
51
|
+
* same boundary a session in the main checkout does.
|
|
52
|
+
*/
|
|
53
|
+
export declare function findRepoRoot(from: string): string | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* WS-11 §2.1 / report §60: "project lookup walks `<projectDir>/skills/` at cwd and parent
|
|
56
|
+
* directories up to the repository root". NEAREST FIRST -- the returned order IS the precedence
|
|
57
|
+
* order, so a project skill beside the code shadows one at the repo root.
|
|
58
|
+
*
|
|
59
|
+
* With no repository root above `cwd` the walk covers `cwd` ALONE. Climbing to the filesystem root
|
|
60
|
+
* in that case would let a stray project dot-dir under `/tmp` (or a home directory) silently join a
|
|
61
|
+
* session started in a scratch directory -- the boundary exists to stop exactly that.
|
|
62
|
+
*
|
|
63
|
+
* P7a (D19): the dot-dir is `brand.projectDirName`; omitted = `WINTER_BRAND`, i.e. today's walk.
|
|
64
|
+
*/
|
|
65
|
+
export declare function projectSkillRoots(cwd: string, brand?: Pick<BrandProfile, "projectDirName">): string[];
|
|
66
|
+
/**
|
|
67
|
+
* Scan `<root>/<dir>/SKILL.md` for every immediate SUBDIRECTORY of `root`. `exclude` skips reserved
|
|
68
|
+
* subdirectory names (the user root's `self/`, scanned separately as its own tier).
|
|
69
|
+
*
|
|
70
|
+
* A directory whose name fails the slug jail is still scanned, not skipped here: a skill's identity
|
|
71
|
+
* is ALWAYS the directory it was discovered under (`parseSkillFile`'s own `fallbackName`, never a
|
|
72
|
+
* frontmatter `name:` key -- that field's own header explains why the declared-name-wins behaviour
|
|
73
|
+
* was retired). Filtering the directory out at scan time would make a jail-failing skill vanish with
|
|
74
|
+
* no explanation; scanning it and letting store-level validation apply the jail to the resolved name
|
|
75
|
+
* (store.ts) is what lets A-11's "no silent vanish" rule report WHY it was refused.
|
|
76
|
+
*/
|
|
77
|
+
export declare function scanSkillRoot(root: string, source: SkillTier, exclude?: ReadonlySet<string>): SkillScanResult;
|
|
78
|
+
/** Scan the user root, skipping its reserved `self/` subdirectory. */
|
|
79
|
+
export declare function scanUserSkillRoot(root: string): SkillScanResult;
|
|
80
|
+
/** The one reason `scanSkillRoot` does NOT report: a subdirectory that simply holds no SKILL.md. */
|
|
81
|
+
export declare const ABSENT_SKILL_FILE = "no SKILL.md";
|
|
82
|
+
export type SkillMetadataRead = {
|
|
83
|
+
ok: true;
|
|
84
|
+
skill: ParsedSkillFile;
|
|
85
|
+
} | {
|
|
86
|
+
ok: false;
|
|
87
|
+
reason: string;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Read one SKILL.md's METADATA. Shared by `scanSkillRoot` above and by store.ts's `load()`, so the
|
|
91
|
+
* frontmatter contract is applied exactly once.
|
|
92
|
+
*
|
|
93
|
+
* `opts.maxBytes` reads only that many bytes from the head of the file (A-11): the frontmatter is at
|
|
94
|
+
* the top, so the index never pays for a body it is about to drop. WITHOUT it the whole file is
|
|
95
|
+
* read, which is what `load()` wants and needs.
|
|
96
|
+
*
|
|
97
|
+
* A RESULT, not `null`, because the two failures are not the same fact: "this is not a skill" and
|
|
98
|
+
* "this skill could not be read" both used to disappear identically, which is precisely the silent
|
|
99
|
+
* vanish A-11 is about. A prefix read that finds an unclosed fence says so, naming the bound, rather
|
|
100
|
+
* than reporting the file as unparseable -- it may be perfectly valid and merely enormous.
|
|
101
|
+
*/
|
|
102
|
+
export declare function readSkillMetadata(path: string, fallbackName: string, opts?: {
|
|
103
|
+
maxBytes?: number;
|
|
104
|
+
}): SkillMetadataRead;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { SkillsOption } from "@yanlinglabs/winter-agent-sdk";
|
|
2
|
+
import type { SkillIndex } from "./store.js";
|
|
3
|
+
/** The one tool every skill is invoked through (WS-11 §2.3 -- never one tool per skill). */
|
|
4
|
+
export declare const SKILL_TOOL_NAME = "Skill";
|
|
5
|
+
export interface SkillsOptionSuccess {
|
|
6
|
+
ok: true;
|
|
7
|
+
/** The caller's names, order preserved, unresolved aliases left exactly as written. */
|
|
8
|
+
skills: string[];
|
|
9
|
+
warnings: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface SkillsOptionFailure {
|
|
12
|
+
ok: false;
|
|
13
|
+
unknown: string[];
|
|
14
|
+
message: string;
|
|
15
|
+
warnings: string[];
|
|
16
|
+
}
|
|
17
|
+
export type SkillsOptionValidation = SkillsOptionSuccess | SkillsOptionFailure;
|
|
18
|
+
export interface ValidateSkillsOptions {
|
|
19
|
+
/**
|
|
20
|
+
* An explicit BUILT-IN RESTRICTION list -- `AgentDefinition.tools` for a child, or a host's own
|
|
21
|
+
* equivalent for the main session. An EMPTY array is treated as "no restriction", matching
|
|
22
|
+
* `validateAgentDefinition`'s existing reading in subagents/definitions.ts.
|
|
23
|
+
*/
|
|
24
|
+
tools?: readonly string[] | undefined;
|
|
25
|
+
/** `Options.disallowedTools` -- the other way to make the Skill tool unreachable. */
|
|
26
|
+
disallowedTools?: readonly string[] | undefined;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Validate the option against a built index.
|
|
30
|
+
*
|
|
31
|
+
* `undefined` and `"all"` both mean "every indexed skill" (capture (4): omitting the option is NOT
|
|
32
|
+
* "skills off"); `[]` means "none", which is a legitimate, validated configuration and NOT the same
|
|
33
|
+
* thing as omission.
|
|
34
|
+
*/
|
|
35
|
+
export declare function validateSkillsOption(skills: SkillsOption | undefined, index: SkillIndex, opts?: ValidateSkillsOptions): SkillsOptionValidation;
|
|
36
|
+
/**
|
|
37
|
+
* Is `name` invocable under this session's `skills` option?
|
|
38
|
+
*
|
|
39
|
+
* Alias-aware in BOTH directions: an option listing `.winter:review` enables an invocation of
|
|
40
|
+
* `review`, and vice versa. Without that, the two spellings of one skill would disagree about
|
|
41
|
+
* whether it is enabled, which is the drift WS-11 §4's "permission rules match identically across
|
|
42
|
+
* branches" exists to prevent (permission-rules.ts carries the same obligation for rules).
|
|
43
|
+
*/
|
|
44
|
+
export declare function isSkillEnabled(skills: SkillsOption | undefined, name: string, index: SkillIndex): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* The permission entries the ENGINE adds when `skills` is set -- WS-11 §2.2: "callers do not add
|
|
47
|
+
* them to `allowedTools`".
|
|
48
|
+
*
|
|
49
|
+
* Rule strings, not `PermissionRuleValue` objects, because `RuntimeConfig.allowedTools` /
|
|
50
|
+
* `permissions.allow` are both `string[]` and that is where these land.
|
|
51
|
+
*
|
|
52
|
+
* `"all"` produces the BARE tool rule (`Skill`), which grammar.ts already treats as matching every
|
|
53
|
+
* call regardless of input -- exactly the intended meaning, and it stays one entry however many
|
|
54
|
+
* skills are installed. A list produces one name-scoped rule each; matching those against a live
|
|
55
|
+
* invocation is permission-rules.ts's job (grammar.ts cannot do it today -- see that file's header).
|
|
56
|
+
*/
|
|
57
|
+
export declare function autoSkillPermissionEntries(skills: SkillsOption | undefined): string[];
|
|
58
|
+
/**
|
|
59
|
+
* A name is rejected before it ever reaches the filesystem if it is not a legal identity: a bare
|
|
60
|
+
* slug, or `<plugin>:<slug>`. Used by the executor, which receives its name from the MODEL and must
|
|
61
|
+
* not hand an arbitrary string to a path join.
|
|
62
|
+
*
|
|
63
|
+
* The plugin half uses `pluginNameError`, THE SAME JAIL `SkillIndex.build` admits plugin names by --
|
|
64
|
+
* not a stricter one. Two jails that disagree produce a skill the index advertises and the executor
|
|
65
|
+
* refuses: `PLUGIN_NAME_PATTERN` admits any leading-dot name, so a plugin named `.acme` indexes
|
|
66
|
+
* `.acme:ship`, and a check that special-cased only the project dot-dir would reject it at invocation.
|
|
67
|
+
*/
|
|
68
|
+
export declare function isLegalSkillIdentity(name: string): boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** The invocation, reduced to what a rule can see. `identities` is `SkillIndex.identities(name)`. */
|
|
2
|
+
export interface SkillRuleTarget {
|
|
3
|
+
identities: readonly string[];
|
|
4
|
+
args?: string | undefined;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Parse a rule STRING into its Skill content, or `undefined` when the rule is not a Skill rule at
|
|
8
|
+
* all. A bare `Skill` yields `{ content: undefined }` -- the match-everything form, matching
|
|
9
|
+
* grammar.ts's own `isBareEquivalent` reading of a bare tool name.
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseSkillRule(raw: string): {
|
|
12
|
+
content: string | undefined;
|
|
13
|
+
} | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Does `content` (a `Skill(...)` rule's raw inner text) match this invocation?
|
|
16
|
+
*
|
|
17
|
+
* `undefined` content (a bare `Skill` rule) and a literal `*` both match everything.
|
|
18
|
+
*/
|
|
19
|
+
export declare function matchesSkillRule(content: string | undefined, target: SkillRuleTarget): boolean;
|
|
20
|
+
/** True when ANY rule in the list is a Skill rule matching this invocation. Non-Skill rules are ignored. */
|
|
21
|
+
export declare function skillRulesAllow(rules: readonly string[] | undefined, target: SkillRuleTarget): boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { SkillsOption } from "@yanlinglabs/winter-agent-sdk";
|
|
2
|
+
import type { InvokedSkillsAttachment } from "./attachment.js";
|
|
3
|
+
import type { SkillOverrides } from "./listing.js";
|
|
4
|
+
import type { SkillIndex } from "./store.js";
|
|
5
|
+
export interface SkillSessionRuntime {
|
|
6
|
+
index: SkillIndex;
|
|
7
|
+
/** This session's `Options.skills`. Absent means every indexed skill (capture (4)). */
|
|
8
|
+
skills?: SkillsOption | undefined;
|
|
9
|
+
/** `Settings.skillOverrides` for this session. */
|
|
10
|
+
skillOverrides?: SkillOverrides | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* The attachment SINK. Absent is legitimate (a host that does not persist attachments), and the
|
|
13
|
+
* executor still returns the body -- the attachment is a record of the invocation, never a
|
|
14
|
+
* precondition for it. A throwing sink must never fail the tool call, so the executor guards it.
|
|
15
|
+
*/
|
|
16
|
+
onInvoked?: ((attachment: InvokedSkillsAttachment) => void) | undefined;
|
|
17
|
+
}
|
|
18
|
+
export declare function registerSkillSessionRuntime(key: string, runtime: SkillSessionRuntime): void;
|
|
19
|
+
export declare function getSkillSessionRuntime(key: string): SkillSessionRuntime | undefined;
|
|
20
|
+
/** Called on run teardown. A registry that only ever grows would leak an index per session. */
|
|
21
|
+
export declare function clearSkillSessionRuntime(key: string): void;
|