@wrongstack/core 0.299.0 → 0.301.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chronicle/index.d.ts +2 -0
- package/dist/chronicle/index.js +297 -10
- package/dist/chronicle/project-server.js +253 -15
- package/dist/chronicle/sqlite-compaction.d.ts +20 -0
- package/dist/chronicle/sqlite-journal.d.ts +57 -0
- package/dist/coordination/agents/capability-manifest.d.ts +7 -0
- package/dist/coordination/agents/index.d.ts +3 -2
- package/dist/coordination/agents/index.js +818 -570
- package/dist/coordination/agents/project-agent-identity.d.ts +6 -6
- package/dist/coordination/agents/role-skills.d.ts +1 -1
- package/dist/coordination/agents/types.d.ts +6 -0
- package/dist/coordination/director.d.ts +10 -2
- package/dist/coordination/fleet-manager.d.ts +48 -3
- package/dist/coordination/ifleet-manager.d.ts +2 -0
- package/dist/coordination/index.js +6880 -6440
- package/dist/coordination/mail-tools.d.ts +3 -3
- package/dist/coordination/mailbox-project-server.js +3 -4
- package/dist/coordination/mailbox-types.d.ts +6 -0
- package/dist/coordination/multi-agent-coordinator.d.ts +1 -0
- package/dist/core/agent-response.d.ts +5 -1
- package/dist/core/agent-tools.d.ts +3 -0
- package/dist/core/context.d.ts +20 -0
- package/dist/core/fallback-model.d.ts +48 -0
- package/dist/core/index.d.ts +11 -9
- package/dist/core/index.js +1119 -310
- package/dist/core/instruction-template.d.ts +83 -0
- package/dist/core/next-steps-slot.d.ts +88 -0
- package/dist/core/system-prompt-blocks.d.ts +10 -1
- package/dist/core/system-prompt-builder.d.ts +40 -4
- package/dist/core/system-prompt-memory-skills.d.ts +1 -0
- package/dist/core/system-prompt-skill-bodies.d.ts +3 -3
- package/dist/defaults/index.js +9805 -8767
- package/dist/design/index.js +11 -3
- package/dist/execution/auto-compaction-middleware.d.ts +17 -0
- package/dist/execution/autonomy-brain.d.ts +15 -2
- package/dist/execution/brain-runtime.d.ts +3 -1
- package/dist/execution/compaction-core.d.ts +41 -2
- package/dist/execution/council-brain.d.ts +47 -1
- package/dist/execution/council-orchestrator.d.ts +25 -6
- package/dist/execution/council-prompts.d.ts +12 -1
- package/dist/execution/index.d.ts +11 -10
- package/dist/execution/index.js +10507 -9189
- package/dist/execution/tool-executor.d.ts +4 -1
- package/dist/execution/topic-shift-advisor.d.ts +53 -0
- package/dist/extension/index.js +8 -2
- package/dist/extension/registry.d.ts +8 -1
- package/dist/fleet-notifier.d.ts +9 -2
- package/dist/goal/index.js +11 -3
- package/dist/hooks/index.js +50 -13
- package/dist/hooks/runner.d.ts +12 -1
- package/dist/hq/index.js +59 -21
- package/dist/hq/protocol/fleet.d.ts +20 -0
- package/dist/hq/protocol.js +10 -0
- package/dist/hq/publisher.d.ts +21 -3
- package/dist/index.d.ts +22 -20
- package/dist/index.js +12211 -8572
- package/dist/infrastructure/index.js +108 -21
- package/dist/kernel/events/brain-events.d.ts +9 -0
- package/dist/kernel/events/provider-events.d.ts +42 -1
- package/dist/kernel/events/session-events.d.ts +13 -0
- package/dist/kernel/events/tool-events.d.ts +3 -3
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +18 -1
- package/dist/models/provider-credentials.d.ts +54 -0
- package/dist/plugin/api.d.ts +6 -0
- package/dist/plugin/config.d.ts +55 -0
- package/dist/plugin/index.d.ts +2 -1
- package/dist/plugin/index.js +2179 -544
- package/dist/plugins/auto-review-plugin.d.ts +3 -0
- package/dist/plugins/cloud-config-sync-plugin.d.ts +22 -0
- package/dist/plugins/review-claim-registry.d.ts +23 -8
- package/dist/plugins/review-types.d.ts +2 -0
- package/dist/registry/index.js +109 -74
- package/dist/registry/tool-registry.d.ts +15 -0
- package/dist/security/capabilities.d.ts +2 -0
- package/dist/security/index.d.ts +2 -2
- package/dist/security/index.js +166 -44
- package/dist/security/permission-helpers.d.ts +23 -6
- package/dist/security/permission-policy.d.ts +16 -0
- package/dist/security/readonly-permission-policy.d.ts +20 -0
- package/dist/security/totp.d.ts +14 -0
- package/dist/session-registry-atomic-file.d.ts +32 -5
- package/dist/skills/frontmatter.d.ts +6 -0
- package/dist/skills/index.js +22 -5
- package/dist/storage/cloud-config-sync/sanitize.d.ts +54 -0
- package/dist/storage/cloud-config-sync.d.ts +87 -0
- package/dist/storage/director-state.d.ts +7 -0
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.js +887 -74
- package/dist/tools/fallback-system-config-view-tool.d.ts +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +898 -335
- package/dist/tools/one-shot-llm-tool.d.ts +1 -0
- package/dist/tools/plugin-manager.d.ts +27 -0
- package/dist/types/config/mcp-features.d.ts +18 -11
- package/dist/types/config/root.d.ts +8 -1
- package/dist/types/config/runtime.d.ts +20 -6
- package/dist/types/config/skills-fleet-brain.d.ts +12 -4
- package/dist/types/config/tools.d.ts +16 -0
- package/dist/types/context-window.d.ts +1 -0
- package/dist/types/council.d.ts +11 -0
- package/dist/types/hooks.d.ts +14 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.js +1 -0
- package/dist/types/multi-agent.d.ts +12 -0
- package/dist/types/one-shot-llm.d.ts +25 -0
- package/dist/types/plugin.d.ts +28 -0
- package/dist/types/provider.d.ts +16 -0
- package/dist/types/runtime-capability-manifest.d.ts +168 -0
- package/dist/types/skill.d.ts +5 -0
- package/dist/types/system-prompt.d.ts +3 -1
- package/dist/types/tool-executor.d.ts +8 -1
- package/dist/utils/context-breakdown.d.ts +8 -2
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +141 -31
- package/dist/utils/regex-guard.d.ts +16 -2
- package/dist/utils/sage-output-block.d.ts +7 -10
- package/dist/utils/wstack-paths.d.ts +11 -3
- package/dist/worktree/index.js +4 -4
- package/instructions/agents/browser.md +1 -4
- package/instructions/agents/e2e.md +17 -15
- package/instructions/agents/ios.md +3 -3
- package/instructions/agents/search.md +1 -1
- package/instructions/autonomy/goal-preamble.md +4 -4
- package/instructions/coordination/director-preamble.md +2 -3
- package/instructions/coordination/subagent-baseline.md +3 -1
- package/instructions/leader-after-task.md +12 -0
- package/instructions/llm/chimera-review.md +1 -1
- package/instructions/modes/audit-lite.md +1 -1
- package/instructions/sections/tool/common-patterns.md +18 -2
- package/instructions/sections/tool/mailbox-compact.md +1 -1
- package/instructions/sections/tool/mailbox-full.md +1 -1
- package/instructions/system-lite.md +91 -3
- package/instructions/system-pro.md +296 -102
- package/instructions/system.md +248 -92
- package/package.json +3 -3
- package/skills/api-design/SKILL.md +3 -0
- package/skills/audit-log/SKILL.md +2 -0
- package/skills/auto-review/SKILL.md +6 -1
- package/skills/bug-hunter/SKILL.md +4 -1
- package/skills/chimera/SKILL.md +3 -0
- package/skills/data-governance/SKILL.md +3 -0
- package/skills/design-system/SKILL.md +5 -2
- package/skills/docker-deploy/SKILL.md +2 -0
- package/skills/git-flow/SKILL.md +2 -0
- package/skills/mailbox-bridge/SKILL.md +3 -0
- package/skills/mnemosyne/SKILL.md +2 -0
- package/skills/multi-agent/SKILL.md +4 -1
- package/skills/node-modern/SKILL.md +4 -1
- package/skills/observability/SKILL.md +3 -0
- package/skills/output-standards/SKILL.md +2 -0
- package/skills/plugin-author/SKILL.md +4 -1
- package/skills/prompt-engineering/SKILL.md +3 -1
- package/skills/react-modern/SKILL.md +6 -3
- package/skills/refactor-planner/SKILL.md +2 -0
- package/skills/research-web/SKILL.md +3 -0
- package/skills/sdd/SKILL.md +3 -1
- package/skills/security-scanner/SKILL.md +3 -0
- package/skills/skill-creator/SKILL.md +2 -0
- package/skills/tech-stack/SKILL.md +3 -0
- package/skills/testing/SKILL.md +4 -1
- package/skills/typescript-strict/SKILL.md +4 -1
- package/skills/wrongstack-kanban/SKILL.md +6 -3
- package/skills/wrongstack-mailbox/SKILL.md +4 -1
- package/skills/wrongstack-mailbox-mcp/SKILL.md +10 -8
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conditional templating for the file-backed instruction layers.
|
|
3
|
+
*
|
|
4
|
+
* Why this exists: `instructions/system.md` (and its `-lite` / `-pro`
|
|
5
|
+
* variants) used to be injected as layer-1 verbatim, listing ~100 tool names
|
|
6
|
+
* regardless of which tools the current request actually exposed. At
|
|
7
|
+
* `minimal`/`light` tier only the 15 TIER1 tools are sent directly
|
|
8
|
+
* (`@wrongstack/tools` `selectBuiltinToolsForTier`), yet the prompt still
|
|
9
|
+
* spent ~8k tokens explaining `kanban`, the browser tools, the SAGE memory
|
|
10
|
+
* tools and the Telegram bridge. Those tools may remain executable through
|
|
11
|
+
* lazy discovery, but are not legal direct calls in that request. The
|
|
12
|
+
* token-saving tier was spending most of its savings back in the prompt, and
|
|
13
|
+
* the text had to carry a "some of the above may be a lie" disclaimer to
|
|
14
|
+
* compensate.
|
|
15
|
+
*
|
|
16
|
+
* Layer-2 (`buildToolUsage`) already gated its guidance on the live tool set;
|
|
17
|
+
* this module gives the markdown layers the same power without splitting the
|
|
18
|
+
* files apart, so project/profile overrides keep working and the sources stay
|
|
19
|
+
* readable.
|
|
20
|
+
*
|
|
21
|
+
* ## Syntax
|
|
22
|
+
*
|
|
23
|
+
* Block form — HTML comments, invisible in a markdown preview:
|
|
24
|
+
*
|
|
25
|
+
* ```markdown
|
|
26
|
+
* <!--ws:if tool=kanban-->
|
|
27
|
+
* ## Work planning with Kanban
|
|
28
|
+
* ...
|
|
29
|
+
* <!--ws:else-->
|
|
30
|
+
* Track multi-step work with `todo`.
|
|
31
|
+
* <!--ws:end-->
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* Conditions are space-separated attributes, ANDed together. Values within one
|
|
35
|
+
* attribute are comma-separated and ORed. A leading `!` negates the attribute.
|
|
36
|
+
*
|
|
37
|
+
* - `tool=a,b,c` — at least one of those tools is registered
|
|
38
|
+
* - `!tool=a,b` — none of those tools is registered
|
|
39
|
+
* - `tier=off,medium` — the active token-saving tier is one of these
|
|
40
|
+
* - `role=leader` / `role=subagent`
|
|
41
|
+
*
|
|
42
|
+
* Inline form, for tool inventory lines:
|
|
43
|
+
*
|
|
44
|
+
* ```markdown
|
|
45
|
+
* {{tools:read,edit,write,patch}}
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* renders only the registered names, backticked and comma-joined; it renders
|
|
49
|
+
* as the empty string when none are registered.
|
|
50
|
+
*
|
|
51
|
+
* ## Fail-open contract
|
|
52
|
+
*
|
|
53
|
+
* A malformed override must never blank the identity prompt, so every error
|
|
54
|
+
* path keeps text and drops only the marker:
|
|
55
|
+
*
|
|
56
|
+
* - unknown attribute / malformed condition → the condition is treated as true
|
|
57
|
+
* - stray `ws:else` / `ws:end` → the marker is dropped, surrounding text stays
|
|
58
|
+
* - unclosed `ws:if` at EOF → every branch's content is emitted in source order
|
|
59
|
+
* - no context passed → every condition is true (the "all tools present" view)
|
|
60
|
+
*
|
|
61
|
+
* @module core/instruction-template
|
|
62
|
+
*/
|
|
63
|
+
import type { ConcreteTokenSavingTier } from '../types/config.js';
|
|
64
|
+
export interface InstructionTemplateContext {
|
|
65
|
+
/** Names of the tools registered for the current request. */
|
|
66
|
+
toolNames: ReadonlySet<string>;
|
|
67
|
+
/** Effective token-saving tier, as resolved by the system prompt builder. */
|
|
68
|
+
tier: ConcreteTokenSavingTier;
|
|
69
|
+
/** True when building a subagent prompt (`role=subagent`). */
|
|
70
|
+
subagent: boolean;
|
|
71
|
+
/** Values for plain `{{name}}` placeholders. Unknown names are left as-is. */
|
|
72
|
+
vars?: Record<string, string | number> | undefined;
|
|
73
|
+
/** Drop lines that format a declared but unavailable tool as callable. */
|
|
74
|
+
strictToolReferences?: boolean | undefined;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Render an instruction markdown layer against the live request.
|
|
78
|
+
*
|
|
79
|
+
* Passing no context strips every marker and keeps the full text, which is the
|
|
80
|
+
* right view for embedders reading the bundled prompt directly.
|
|
81
|
+
*/
|
|
82
|
+
export declare function renderInstructionLayer(text: string, ctx?: InstructionTemplateContext | undefined): string;
|
|
83
|
+
//# sourceMappingURL=instruction-template.d.ts.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turn-scoped slot for `<nextsteps>` suggestions produced by the `nextsteps`
|
|
3
|
+
* tool, plus the renderer that turns them back into the canonical XML block.
|
|
4
|
+
*
|
|
5
|
+
* ## Why a slot and not a direct channel to the UI
|
|
6
|
+
*
|
|
7
|
+
* Every suggestion surface — the TUI history renderer, the WebUI and SimpleUI
|
|
8
|
+
* chat stores, the CLI REPL suggestion store, and the session replay/rehydrate
|
|
9
|
+
* paths — reads `<nextsteps>` out of the assistant's *message text* via
|
|
10
|
+
* `parseNextSteps` in `@wrongstack/tools/next-steps`. Handing the tool its own
|
|
11
|
+
* transport would mean teaching all of them a second source of truth, and any
|
|
12
|
+
* one of them lagging behind would silently drop suggestions.
|
|
13
|
+
*
|
|
14
|
+
* Instead the tool parks its steps here, and `maybeAppendPendingNextSteps`
|
|
15
|
+
* appends the rendered block to the turn-ending provider response before that
|
|
16
|
+
* response is emitted, persisted, or folded into `finalText`. Downstream code
|
|
17
|
+
* cannot tell the difference between a block the model typed and one the tool
|
|
18
|
+
* produced, which is exactly the point.
|
|
19
|
+
*
|
|
20
|
+
* ## Why this module duplicates the tag knowledge
|
|
21
|
+
*
|
|
22
|
+
* `core` sits below `tools` in the package DAG (enforced by
|
|
23
|
+
* `package-boundaries.test.ts`), so it cannot import the parser. The overlap is
|
|
24
|
+
* deliberately kept to the tag name and the item line shape; the round-trip
|
|
25
|
+
* test in `tests/next-steps-slot.test.ts` feeds this renderer's output through
|
|
26
|
+
* the real parser so the two cannot drift apart unnoticed.
|
|
27
|
+
*/
|
|
28
|
+
import type { Response } from '../types/provider.js';
|
|
29
|
+
import type { Context } from './context.js';
|
|
30
|
+
/** A single suggestion parked by the `nextsteps` tool. */
|
|
31
|
+
export interface PendingNextStep {
|
|
32
|
+
text: string;
|
|
33
|
+
/** Opt-in unattended execution. Honored only on the first item. */
|
|
34
|
+
auto?: boolean | undefined;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Upper bound on parked steps. The parser accepts up to 6, but the leader
|
|
38
|
+
* prompt's contract is 1–4, so the slot enforces the tighter number and the
|
|
39
|
+
* tool's schema mirrors it.
|
|
40
|
+
*/
|
|
41
|
+
export declare const MAX_PENDING_NEXT_STEPS = 4;
|
|
42
|
+
/**
|
|
43
|
+
* Park the steps for this turn, replacing anything already there.
|
|
44
|
+
*
|
|
45
|
+
* Replace (rather than append) matches `todo`'s whole-list semantics: a second
|
|
46
|
+
* call in the same turn is the model changing its mind, not adding to a list.
|
|
47
|
+
*/
|
|
48
|
+
export declare function writePendingNextSteps(ctx: Pick<Context, 'meta'>, steps: readonly PendingNextStep[]): void;
|
|
49
|
+
/** Read the parked steps, or undefined when the slot is empty or malformed. */
|
|
50
|
+
export declare function readPendingNextSteps(ctx: Pick<Context, 'meta'>): PendingNextStep[] | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Empty the slot. Called at the start of every `run()` so a block produced for
|
|
53
|
+
* one prompt can never attach itself to the answer for the next one, and again
|
|
54
|
+
* after a successful append so it cannot repeat within the same run.
|
|
55
|
+
*/
|
|
56
|
+
export declare function clearPendingNextSteps(ctx: Pick<Context, 'meta'>): void;
|
|
57
|
+
/** True when the text already carries a `<nextsteps>` block the model wrote. */
|
|
58
|
+
export declare function hasNextStepsTag(text: string): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Render parked steps as the canonical block.
|
|
61
|
+
*
|
|
62
|
+
* The output must satisfy `parseNextSteps` exactly: an opening tag with no
|
|
63
|
+
* attributes, one `N. text` line per item, `auto="true"` only ever on item 1,
|
|
64
|
+
* and a balanced closing tag.
|
|
65
|
+
*/
|
|
66
|
+
export declare function renderNextStepsBlock(steps: readonly PendingNextStep[]): string;
|
|
67
|
+
/**
|
|
68
|
+
* Append the parked `<nextsteps>` block to the turn-ending response.
|
|
69
|
+
*
|
|
70
|
+
* Returns `res` untouched unless every gate passes:
|
|
71
|
+
*
|
|
72
|
+
* - **leader only** — subagent output is parsed or rolled up by its parent, so
|
|
73
|
+
* a suggestion block there is noise that leaks into specs and plans. Same
|
|
74
|
+
* check as `buildLiveNextStepsGateBlock`.
|
|
75
|
+
* - **turn-ending stop reason** — mid-turn prose must not surface suggestions;
|
|
76
|
+
* every surface gates on this already.
|
|
77
|
+
* - **not aborted** — an interrupted turn has no answer to follow up on.
|
|
78
|
+
* - **no open todos** — finishing tracked work outranks proposing new work.
|
|
79
|
+
* Enforced here rather than per-surface so the gate has one home.
|
|
80
|
+
* - **no block already in the text** — if the model also typed one, its own
|
|
81
|
+
* wording is the fresher intent and wins.
|
|
82
|
+
*
|
|
83
|
+
* The block is *appended* to the last text block, never prepended: the WebUI
|
|
84
|
+
* only accepts a canonical-response update when it extends the text it already
|
|
85
|
+
* streamed (`session-handlers.ts`), so a prefix would be silently dropped.
|
|
86
|
+
*/
|
|
87
|
+
export declare function maybeAppendPendingNextSteps(ctx: Pick<Context, 'meta' | 'agentId' | 'todos' | 'signal'>, res: Response): Response;
|
|
88
|
+
//# sourceMappingURL=next-steps-slot.d.ts.map
|
|
@@ -12,6 +12,7 @@ import type { MailboxAgentStatus } from '../coordination/mailbox-types.js';
|
|
|
12
12
|
import type { TextBlock } from '../types/blocks.js';
|
|
13
13
|
import type { Tool } from '../types/tool.js';
|
|
14
14
|
import type { InstructionBundle } from './instruction-bundle.js';
|
|
15
|
+
import { type InstructionTemplateContext } from './instruction-template.js';
|
|
15
16
|
/**
|
|
16
17
|
* The section of the system prompt a given TextBlock originated from. Used by
|
|
17
18
|
* `getContextBreakdown()` to attribute real token counts per category in the
|
|
@@ -30,7 +31,15 @@ export declare const SYSTEM_BLOCK_SOURCE: WeakMap<TextBlock, SystemBlockSource>;
|
|
|
30
31
|
/** Tag a freshly-built block with its origin, returning the same reference. */
|
|
31
32
|
export declare function tagBlock(block: TextBlock, source: SystemBlockSource): TextBlock;
|
|
32
33
|
export declare function shortSessionId(sessionId: string): string;
|
|
33
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Render one `sections/*.md` entry.
|
|
36
|
+
*
|
|
37
|
+
* `tplCtx` opts the section into the same conditional-block syntax the identity
|
|
38
|
+
* layers use (see `instruction-template.ts`); without it the section is
|
|
39
|
+
* rendered with every condition true, which matches the pre-templating
|
|
40
|
+
* behaviour for callers that don't have a live tool set to hand.
|
|
41
|
+
*/
|
|
42
|
+
export declare function instructionSection(bundle: InstructionBundle, key: string, vars?: Record<string, string | number>, tplCtx?: InstructionTemplateContext | undefined): string;
|
|
34
43
|
export declare function renderToolSelectionBoundary(tool: Tool): string;
|
|
35
44
|
/**
|
|
36
45
|
* Cheap content fingerprint of the online agents array. The mailbox
|
|
@@ -6,7 +6,8 @@ import type { SkillLoader } from '../types/skill.js';
|
|
|
6
6
|
import type { BuildContext, ModelCapabilities, SystemPromptBuilder, SystemPromptRegions } from '../types/system-prompt.js';
|
|
7
7
|
import type { SystemPromptContributor } from '../types/system-prompt-contributor.js';
|
|
8
8
|
import { type InstructionBundle, type InstructionBundlePaths } from './instruction-bundle.js';
|
|
9
|
-
|
|
9
|
+
import { type InstructionTemplateContext } from './instruction-template.js';
|
|
10
|
+
export { type EffectiveShell, effectiveShell, shellGuidanceBlock } from './system-prompt-shell.js';
|
|
10
11
|
export declare const LAYER_1_IDENTITY: string;
|
|
11
12
|
/**
|
|
12
13
|
* Compose the layer-1 identity from the bundled default plus any override.
|
|
@@ -20,8 +21,16 @@ export declare const LAYER_1_IDENTITY: string;
|
|
|
20
21
|
*
|
|
21
22
|
* Bundled, profile-global and explicitly-passed override files are user-owned
|
|
22
23
|
* and keep full replacement semantics.
|
|
24
|
+
*
|
|
25
|
+
* `tplCtx` renders the conditional blocks in the markdown against the live tool
|
|
26
|
+
* set (see `instruction-template.ts`), so guidance for tools the current
|
|
27
|
+
* request never registered stays out of the prompt entirely. The two layers are
|
|
28
|
+
* rendered **separately** rather than after concatenation: an unclosed
|
|
29
|
+
* `ws:if` in the repo-committed file must not be able to swallow the genuine
|
|
30
|
+
* identity that precedes it. Omitting `tplCtx` keeps the full text, which is
|
|
31
|
+
* what embedders reading the bundled prompt directly expect.
|
|
23
32
|
*/
|
|
24
|
-
export declare function buildIdentityLayer(identity: string | undefined, source: 'bundled' | 'global' | 'project' | 'file' | undefined): string;
|
|
33
|
+
export declare function buildIdentityLayer(identity: string | undefined, source: 'bundled' | 'global' | 'project' | 'file' | undefined, tplCtx?: InstructionTemplateContext | undefined): string;
|
|
25
34
|
export type { SystemBlockSource } from './system-prompt-blocks.js';
|
|
26
35
|
export { SYSTEM_BLOCK_SOURCE } from './system-prompt-blocks.js';
|
|
27
36
|
export interface DefaultSystemPromptBuilderOptions {
|
|
@@ -36,8 +45,8 @@ export interface DefaultSystemPromptBuilderOptions {
|
|
|
36
45
|
injectMemory?: boolean | undefined;
|
|
37
46
|
skillLoader?: SkillLoader | undefined;
|
|
38
47
|
/**
|
|
39
|
-
* How skill bodies reach the prompt. `'
|
|
40
|
-
*
|
|
48
|
+
* How skill bodies reach the prompt. `'progressive'` (runtime default)
|
|
49
|
+
* injects only a name+trigger manifest; `'eager'` injects discovered bodies
|
|
41
50
|
* and relies on the agent calling the `skill` tool to load a body on demand
|
|
42
51
|
* (the agentskills.io progressive-disclosure model).
|
|
43
52
|
*/
|
|
@@ -122,11 +131,20 @@ export declare class DefaultSystemPromptBuilder implements SystemPromptBuilder {
|
|
|
122
131
|
private skillBodyCache?;
|
|
123
132
|
/** Tools from last build — used for memory relevance scoring. */
|
|
124
133
|
private _lastBuildTools?;
|
|
134
|
+
/** Full executable catalog used to capability-gate progressive skills. */
|
|
135
|
+
private _lastCatalogTools?;
|
|
125
136
|
/** Cached rendered online agents string, keyed by content fingerprint. */
|
|
126
137
|
private _lastOnlineAgents?;
|
|
127
138
|
/** Cached full buildToolUsage output — keyed by tools array ref + agents fingerprint + tier. */
|
|
128
139
|
private _toolsUsageCache?;
|
|
129
140
|
private _instructionBundle?;
|
|
141
|
+
/**
|
|
142
|
+
* Cached rendered identity layer. Keyed the same way as `_toolsUsageCache`:
|
|
143
|
+
* the ToolRegistry snapshot keeps the array reference stable until a registry
|
|
144
|
+
* mutation, so reference equality is a sound key for "the tool set did not
|
|
145
|
+
* change".
|
|
146
|
+
*/
|
|
147
|
+
private _identityCache?;
|
|
130
148
|
constructor(opts?: DefaultSystemPromptBuilderOptions);
|
|
131
149
|
/**
|
|
132
150
|
* Normalizes `tokenSavingMode` to a boolean for backward-compatible boolean checks.
|
|
@@ -152,6 +170,24 @@ export declare class DefaultSystemPromptBuilder implements SystemPromptBuilder {
|
|
|
152
170
|
private toolDescLimit;
|
|
153
171
|
build(ctx: BuildContext): Promise<TextBlock[]>;
|
|
154
172
|
buildRegions(ctx: BuildContext): Promise<SystemPromptRegions>;
|
|
173
|
+
/**
|
|
174
|
+
* The view of the live request that the markdown conditionals are evaluated
|
|
175
|
+
* against: which tools can actually be called, the effective token-saving
|
|
176
|
+
* tier, and whether this prompt is for a subagent.
|
|
177
|
+
*/
|
|
178
|
+
private templateContext;
|
|
179
|
+
/**
|
|
180
|
+
* Render the identity layer, memoized on the tool set / tier / role triple.
|
|
181
|
+
*
|
|
182
|
+
* The rendering itself is a couple of regex passes over ~40 KB, which is
|
|
183
|
+
* cheap but happens on every turn; the tool set is stable for the life of a
|
|
184
|
+
* session in the normal case, so the cache turns it into a one-off.
|
|
185
|
+
*
|
|
186
|
+
* This does not cost prompt-cache hits: in the wire format the `tools` array
|
|
187
|
+
* precedes `system`, so any registry mutation already invalidates the
|
|
188
|
+
* provider's prefix cache before the identity block is reached.
|
|
189
|
+
*/
|
|
190
|
+
private buildIdentity;
|
|
155
191
|
private instructions;
|
|
156
192
|
/**
|
|
157
193
|
* Cached plan content keyed by (planPath, mtimeMs). The plan is read
|
|
@@ -46,6 +46,7 @@ export interface MemorySkillsContext {
|
|
|
46
46
|
skillEagerMaxChars: number | undefined;
|
|
47
47
|
/** Tools from the last build — used for memory relevance scoring. */
|
|
48
48
|
lastBuildTools: Tool[] | undefined;
|
|
49
|
+
catalogTools: Tool[] | undefined;
|
|
49
50
|
skillBodyCache: string | undefined;
|
|
50
51
|
}
|
|
51
52
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SkillLoader } from '../types/skill.js';
|
|
2
|
-
export declare function buildProgressiveSkillManifestText(loader: SkillLoader): Promise<string>;
|
|
3
|
-
export declare function buildFullSkillBodiesText(loader: SkillLoader, budget?: number): Promise<string>;
|
|
4
|
-
export declare function buildCompactSkillBodiesText(loader: SkillLoader, budget?: number): Promise<string>;
|
|
2
|
+
export declare function buildProgressiveSkillManifestText(loader: SkillLoader, availableToolNames?: readonly string[]): Promise<string>;
|
|
3
|
+
export declare function buildFullSkillBodiesText(loader: SkillLoader, budget?: number, availableToolNames?: readonly string[]): Promise<string>;
|
|
4
|
+
export declare function buildCompactSkillBodiesText(loader: SkillLoader, budget?: number, availableToolNames?: readonly string[]): Promise<string>;
|
|
5
5
|
//# sourceMappingURL=system-prompt-skill-bodies.d.ts.map
|