@wrongstack/core 0.1.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.
@@ -0,0 +1,180 @@
1
+ import { f as ContentBlock, m as MemoryStore, Y as SkillLoader, a0 as TextBlock, ag as Context, ah as Container, ai as EventBus, d as Config, j as Logger, aj as EventName, ak as Listener } from './secret-scrubber-Dax_Ou_o.js';
2
+ export { al as BindOptions, C as CacheStats, a as Capabilities, b as CompactReport, c as Compactor, e as ConfigLoader, g as ContextConfig, am as ContextInit, an as Decorator, E as ErrorHandler, ao as EventLogger, ap as EventMap, aq as Factory, F as FeaturesConfig, I as ImageBlock, h as InputReader, J as JSONSchema, L as LogConfig, i as LogLevel, M as MCPServerConfig, k as MemoryEntry, l as MemoryScope, n as Message, o as MessageRole, ar as Middleware, as as MiddlewareHandler, p as ModelsDevModel, q as ModelsDevPayload, r as ModelsDevProvider, s as ModelsRegistry, at as NextFn, P as PathResolver, t as Permission, u as PermissionDecision, v as PermissionPolicy, au as Pipeline, av as PipelineOptions, w as PluginConfig, x as PromptOption, y as Provider, z as ProviderConfig, A as ProviderError, B as ProviderErrorBody, R as Renderer, D as Request, G as ResolvedModel, H as ResolvedProvider, K as Response, N as ResumedSession, O as RetryPolicy, aw as RunOptions, S as SecretScrubber, Q as SessionData, T as SessionEvent, U as SessionMetadata, V as SessionStore, W as SessionSummary, X as SessionWriter, Z as SkillManifest, _ as StopReason, $ as StreamEvent, ax as TodoItem, ay as Token, a1 as TokenCounter, a2 as Tool, a3 as ToolCallContext, a4 as ToolResultBlock, a5 as ToolUseBlock, a6 as ToolsConfig, a7 as TrustPolicy, a8 as Usage, a9 as WireFamily, aa as asBlocks, ab as asText, ac as isImageBlock, ad as isTextBlock, ae as isToolResultBlock, af as isToolUseBlock } from './secret-scrubber-Dax_Ou_o.js';
3
+ export { RunController, RunControllerOptions, TOKENS } from './kernel/index.js';
4
+ import { g as AttachmentStore, f as AttachmentRef, A as AddAttachmentInput, q as ModeStore, x as SlashCommand, t as PluginAPI, u as PluginPipelines, ab as ToolRegistryView, w as ProviderRegistryView, M as MCPRegistryView, y as SlashCommandRegistryView, af as ToolRegistry, ag as ProviderRegistry, P as Plugin } from './tool-executor-DjnMELMV.js';
5
+ export { ah as Agent, a as AgentBridge, b as AgentBridgeConfig, ai as AgentInit, aj as AgentInput, ak as AgentPipelines, c as Attachment, d as AttachmentKind, e as AttachmentMeta, B as BridgeMessage, h as BridgeMessageType, i as BridgeTransport, C as CoordinatorEvents, j as CoordinatorStatus, k as CriticalPathResult, al as DEFAULT_MAX_ITERATIONS, D as DEFAULT_MODES, l as DEFAULT_SPEC_TEMPLATE, m as DoneCondition, E as ENCRYPTED_PREFIX, n as Mode, o as ModeConfig, p as ModeManifest, r as MultiAgentConfig, s as MultiAgentCoordinator, am as ProviderFactory, an as RunResult, S as SecretVault, z as SpawnResult, F as SpecAnalysis, G as SpecApiEndpoint, H as SpecRequirement, I as SpecSection, J as SpecSectionType, K as SpecStatus, L as SpecTemplate, N as SpecValidationResult, O as Specification, Q as SubagentConfig, R as SubagentContext, T as TaskAssignment, U as TaskDelegation, V as TaskDependency, W as TaskEdge, X as TaskFilter, Y as TaskGraph, Z as TaskNode, _ as TaskPriority, $ as TaskProgress, a0 as TaskResult, a1 as TaskSort, a2 as TaskSpec, a3 as TaskStatus, a4 as TaskType, a5 as ToolBatchResult, a6 as ToolExecution, a7 as ToolExecutionOutput, a8 as ToolExecutorInit, a9 as ToolExecutorOptions, aa as ToolExecutorStrategy, ao as UserInputPayload, ac as computeTaskProgress, ap as createDefaultPipelines, ad as findCriticalPath, ae as topologicalSort } from './tool-executor-DjnMELMV.js';
6
+ import { S as SystemPromptBuilder, B as BuildContext } from './system-prompt-BG3nks8P.js';
7
+ export { AtomicWriteOptions, NewlineStyle, SafeParseResult, ToolOutputSerializerOptions, UnifiedDiffOptions, atomicWrite, color, compileGlob, createToolOutputSerializer, detectNewlineStyle, ensureDir, matchAny, matchGlob, normalizeToLf, safeParse, safeStringify, sanitizeJsonString, stripAnsi, toStyle, unifiedDiff } from './utils/index.js';
8
+ export { W as WstackPathOptions, a as WstackPaths, p as projectHash, r as resolveWstackPaths } from './wstack-paths-D24ynAz1.js';
9
+ export { AbandonedSession, AttachmentStoreOptions, AutoCompactionMiddleware, AutonomousRunner, AutonomousRunnerOptions, CompactorOptions, ConfigLoaderOptions, ConfigSource, ContextManagerAction, ContextManagerInput, ContextManagerResult, ContextManagerToolOptions, DefaultAttachmentStore, DefaultConfigLoader, DefaultErrorHandler, DefaultLogger, DefaultLoggerOptions, DefaultMemoryStore, DefaultModeStore, DefaultModelsRegistry, DefaultModelsRegistryOptions, DefaultMultiAgentCoordinator, DefaultPathResolver, DefaultPermissionPolicy, DefaultRetryPolicy, DefaultSecretScrubber, DefaultSecretVault, DefaultSessionStore, DefaultSkillLoader, DefaultTaskStore, DefaultTokenCounter, DoneCheckResult, DoneConditionChecker, GeneratedTask, HybridCompactor, InMemoryAgentBridge, InMemoryBridgeTransport, IntelligentCompactor, IntelligentCompactorOptions, LLMSelector, LLMSelectorOptions, MemoryStoreOptions, ModeLoaderOptions, PermissionPolicyOptions, PersistedQueueItem, QueueStore, RecoveryLock, RecoveryLockOptions, SecretVaultOptions, SelectiveCompactor, SelectiveCompactorOptions, SessionStoreOptions, SkillLoaderOptions, SpecDrivenDev, SpecDrivenDevOptions, SpecParser, SpecParserOptions, TaskFlow, TaskFlowEventMap, TaskFlowEventName, TaskFlowExecutionContext, TaskFlowOptions, TaskFlowPhase, TaskGenerator, TaskGeneratorOptions, TaskStore, TaskTracker, TaskTrackerOptions, TaskTransition, ToolExecutor, classifyFamily, contextManagerTool, createContextManagerTool, createMessage, decryptConfigSecrets, encryptConfigSecrets, loadProjectModes, loadUserModes, migratePlaintextSecrets, rewriteConfigEncrypted } from './defaults/index.js';
10
+ import 'node:events';
11
+
12
+ interface InputBuilderOptions {
13
+ store: AttachmentStore;
14
+ /**
15
+ * Pastes ≥ this many lines collapse to a `[pasted #N]` placeholder.
16
+ * Default: 8 lines.
17
+ */
18
+ pasteLineThreshold?: number;
19
+ /**
20
+ * Pastes ≥ this many characters collapse to a placeholder regardless of
21
+ * line count. Default: 2000 chars.
22
+ */
23
+ pasteCharThreshold?: number;
24
+ }
25
+ interface InputBuilderEvent {
26
+ /** Current display string (with placeholders, before submit). */
27
+ display: string;
28
+ refs: AttachmentRef[];
29
+ }
30
+ /**
31
+ * UI-agnostic accumulator for user input. The frontend (CLI/TUI) feeds in:
32
+ * - typed text via `appendText()`
33
+ * - large pastes via `appendPaste()` → returns placeholder string
34
+ * - image paste via `appendImage()` → returns placeholder string
35
+ * - file refs (`@path`) via `appendFile()` → returns placeholder string
36
+ *
37
+ * On `submit()` the builder runs the display string through AttachmentStore.expand()
38
+ * and returns the final ContentBlock[] ready for `agent.run()`.
39
+ *
40
+ * The builder does not know what a "line" or "key" is — that is the
41
+ * frontend's job. It only operates on strings and byte payloads.
42
+ */
43
+ declare class InputBuilder {
44
+ private readonly store;
45
+ private readonly pasteLineThreshold;
46
+ private readonly pasteCharThreshold;
47
+ private display;
48
+ private readonly refs;
49
+ constructor(opts: InputBuilderOptions);
50
+ get text(): string;
51
+ get attachments(): AttachmentRef[];
52
+ get isEmpty(): boolean;
53
+ appendText(text: string): void;
54
+ /**
55
+ * Decide whether a chunk of pasted text is "big" enough to collapse.
56
+ * If yes, store it and append a placeholder. If no, inline it.
57
+ * Returns the placeholder string actually appended (or `null` if inlined).
58
+ */
59
+ appendPaste(text: string): Promise<string | null>;
60
+ /**
61
+ * Always collapses to `[image #N]` — images are never inlined.
62
+ * `dataBase64` is the raw base64 payload (no data: prefix).
63
+ */
64
+ appendImage(dataBase64: string, mediaType: string): Promise<string>;
65
+ appendFile(input: AddAttachmentInput): Promise<string>;
66
+ /** Reset display and ref list. Does NOT clear the store itself. */
67
+ reset(): void;
68
+ /**
69
+ * Resolve the current display string into ContentBlock[]. Empty
70
+ * input returns an empty array — caller decides what to do.
71
+ */
72
+ submit(): Promise<ContentBlock[]>;
73
+ private shouldCollapse;
74
+ }
75
+
76
+ declare const LAYER_1_IDENTITY = "You are WrongStack, a command-line AI coding agent.\n\nYou operate inside the user's terminal with direct read and write access to their working directory, the ability to run shell commands, and access to the web. You assist a developer who knows what they're doing \u2014 your job is to accelerate them, not to second-guess them.\n\n## Core principles\n\n1. Read before you write. Always inspect the relevant files before proposing changes. Assumptions about code you haven't read are bugs in waiting.\n\n2. Prefer surgical edits over rewrites. When modifying existing files, use the edit tool with str_replace; only use write for new files or full replacements explicitly requested.\n\n3. Show your work. Before non-trivial changes, briefly state what you're about to do \u2014 one sentence, not a wall of text. After tool calls, summarize what happened, not what you did mechanically.\n\n4. Honest about limits. If you don't know, say so. If something failed, say what failed and what you'll try next. Never fabricate file contents, API responses, or test results.\n\n5. Concise output. The user is a developer in a terminal. No marketing language, no \"great question!\", no bullet-point lists when prose works. If a one-liner answers, a one-liner is the answer.\n\n6. Ask when blocked, proceed when not. If the task is ambiguous in a way that meaningfully changes the approach, ask. If it's ambiguous in a way that doesn't, pick a reasonable default and proceed, stating the assumption.\n\n7. Trust the tools. If a permission prompt is shown, the user will answer. Do not preemptively explain that you \"would like to\" do something \u2014 call the tool, let the permission flow decide.\n\n## What you do not do\n\n- You do not lecture about software engineering principles unless asked.\n- You do not add comments to code unless they materially help or were requested.\n- You do not refactor adjacent code while fixing a bug, unless asked.\n- You do not claim work is \"production-ready\" or \"fully tested\" \u2014 the user decides that.\n- You do not apologize for failures. You report them and proceed.";
77
+ interface DefaultSystemPromptBuilderOptions {
78
+ memoryStore?: MemoryStore;
79
+ skillLoader?: SkillLoader;
80
+ modeStore?: ModeStore;
81
+ todayIso?: string;
82
+ }
83
+ declare class DefaultSystemPromptBuilder implements SystemPromptBuilder {
84
+ private readonly opts;
85
+ private envCache?;
86
+ constructor(opts?: DefaultSystemPromptBuilderOptions);
87
+ build(ctx: BuildContext): Promise<TextBlock[]>;
88
+ private buildToolUsage;
89
+ private buildEnvironment;
90
+ private buildMemoryAndSkills;
91
+ private buildMode;
92
+ private dirExists;
93
+ private gitStatus;
94
+ private detectLanguages;
95
+ }
96
+
97
+ declare class SlashCommandRegistry {
98
+ private readonly cmds;
99
+ /**
100
+ * Register a command. For plugins the `owner` is the plugin name and the
101
+ * registry auto-prefixes the command name as `owner:name` to prevent
102
+ * collisions with built-in commands and other plugins.
103
+ */
104
+ register(cmd: SlashCommand, owner?: string): void;
105
+ unregister(name: string): boolean;
106
+ get(name: string): SlashCommand | undefined;
107
+ ownerOf(name: string): string | undefined;
108
+ list(): SlashCommand[];
109
+ listWithOwner(): Array<{
110
+ cmd: SlashCommand;
111
+ owner: string;
112
+ fullName: string;
113
+ }>;
114
+ /**
115
+ * Parse a slash command line. Accepts both:
116
+ * `/cmd args` → builtin command (owner=core)
117
+ * `/pluginName:cmd args` → plugin command
118
+ * The command name is split at the first `:` if the prefix matches a known owner.
119
+ */
120
+ dispatch(line: string, ctx: Context): Promise<{
121
+ exit?: boolean;
122
+ message?: string;
123
+ } | null>;
124
+ }
125
+
126
+ interface PluginAPIInit {
127
+ ownerName: string;
128
+ container: Container;
129
+ events: EventBus;
130
+ /**
131
+ * The agent's concrete pipelines. `DefaultPluginAPI` converts each to a
132
+ * `ReadonlyPipeline` before exposing them to the plugin — plugins can
133
+ * inspect and invoke pipelines but cannot mutate them.
134
+ */
135
+ pipelines: PluginPipelines;
136
+ toolRegistry: ToolRegistry;
137
+ providerRegistry: ProviderRegistry;
138
+ slashCommandRegistry?: SlashCommandRegistry;
139
+ mcpRegistry?: MCPRegistryView;
140
+ config: Config;
141
+ log: Logger;
142
+ }
143
+ declare class DefaultPluginAPI implements PluginAPI {
144
+ readonly container: Container;
145
+ readonly events: EventBus;
146
+ readonly pipelines: PluginPipelines;
147
+ readonly tools: ToolRegistryView;
148
+ readonly providers: ProviderRegistryView;
149
+ readonly mcp: MCPRegistryView;
150
+ readonly slashCommands: SlashCommandRegistryView;
151
+ readonly config: Config;
152
+ readonly log: Logger;
153
+ private readonly pluginCleanupFns;
154
+ constructor(init: PluginAPIInit);
155
+ onEvent<K extends EventName>(event: K, handler: Listener<K>): () => void;
156
+ /** Called by the plugin loader when uninstalling the plugin. */
157
+ drainCleanup(): void;
158
+ }
159
+
160
+ /**
161
+ * Stable plugin API contract version. This is intentionally independent of
162
+ * the package version: bump only when the surface visible to plugins
163
+ * (PluginAPI, types/plugin) changes in a way that breaks existing setup
164
+ * functions. Plugins declare `apiVersion: "^1.0"` to opt into this contract.
165
+ */
166
+ declare const KERNEL_API_VERSION = "1.0.0";
167
+ interface LoadPluginsOptions {
168
+ apiFactory: (plugin: Plugin) => PluginAPI;
169
+ log: Logger;
170
+ kernelApiVersion?: string;
171
+ }
172
+ declare function loadPlugins(plugins: Plugin[], opts: LoadPluginsOptions): Promise<{
173
+ loaded: Plugin[];
174
+ failed: {
175
+ plugin: Plugin;
176
+ err: unknown;
177
+ }[];
178
+ }>;
179
+
180
+ export { AddAttachmentInput, AttachmentRef, AttachmentStore, BuildContext, Config, Container, ContentBlock, Context, DefaultPluginAPI, DefaultSystemPromptBuilder, type DefaultSystemPromptBuilderOptions, EventBus, EventName, InputBuilder, type InputBuilderEvent, type InputBuilderOptions, KERNEL_API_VERSION, LAYER_1_IDENTITY, Listener, type LoadPluginsOptions, Logger, MCPRegistryView, MemoryStore, ModeStore, Plugin, PluginAPI, type PluginAPIInit, PluginPipelines, ProviderRegistry, ProviderRegistryView, SkillLoader, SlashCommand, SlashCommandRegistry, SlashCommandRegistryView, SystemPromptBuilder, TextBlock, ToolRegistry, ToolRegistryView, loadPlugins };