@wrongstack/cli 1.1.2 → 1.1.5

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.
Files changed (117) hide show
  1. package/dist/{acp-HCGUTFNE.js → acp-NKUEYJDZ.js} +14 -5
  2. package/dist/acp-leader/acp-leader-confirm.d.ts +20 -0
  3. package/dist/acp-leader/acp-leader-context.d.ts +29 -0
  4. package/dist/acp-leader/acp-leader-fleet.d.ts +26 -0
  5. package/dist/acp-leader/acp-leader-host-binding.d.ts +17 -0
  6. package/dist/acp-leader/acp-leader-host.d.ts +82 -0
  7. package/dist/acp-leader/acp-leader-picker.d.ts +24 -0
  8. package/dist/acp-leader/acp-leader-provider.d.ts +85 -0
  9. package/dist/acp-leader/acp-leader-resume.d.ts +10 -0
  10. package/dist/acp-leader/acp-leader-stream.d.ts +83 -0
  11. package/dist/{auth-ANOVZVHE.js → auth-2ZG5DBHS.js} +62 -66
  12. package/dist/auth-menu/index.d.ts +1 -2
  13. package/dist/boot/dispatch-webui.d.ts +16 -0
  14. package/dist/boot/launch-menu-arrow.d.ts +20 -0
  15. package/dist/boot/launch-menu-types.d.ts +36 -0
  16. package/dist/boot/launch-menu.d.ts +1 -57
  17. package/dist/boot/tui-session-resume-rollback.d.ts +31 -0
  18. package/dist/{boot-auto-thin-7D4OVEWA.js → boot-auto-thin-N2CIGTXE.js} +3 -3
  19. package/dist/{chunk-TZPKOS5G.js → chunk-2XQ6SRKG.js} +2 -2
  20. package/dist/chunk-3LEIFO5D.js +65 -0
  21. package/dist/chunk-5SGMUDP5.js +752 -0
  22. package/dist/{chunk-3EXRPTAU.js → chunk-5TQ65PXQ.js} +17 -17
  23. package/dist/{chunk-GRAGMA4B.js → chunk-7BM4LGKQ.js} +18 -18
  24. package/dist/{chunk-VAQXOZKP.js → chunk-AJM4EFCM.js} +139 -136
  25. package/dist/{chunk-C2BBH4S4.js → chunk-E3MJFAFR.js} +2 -2
  26. package/dist/{chunk-5TRZZHMN.js → chunk-JCZ2D3VV.js} +4 -65
  27. package/dist/{chunk-AWRZWPJ3.js → chunk-JFYQGMMM.js} +99 -75
  28. package/dist/{chunk-BIGSVBPI.js → chunk-KNYIEQAY.js} +64 -61
  29. package/dist/chunk-LUEO5HLZ.js +50 -0
  30. package/dist/chunk-LYWOV4OX.js +252 -0
  31. package/dist/chunk-M7FNHCE3.js +2070 -0
  32. package/dist/{chunk-75OLD563.js → chunk-M7PSENGF.js} +3 -1
  33. package/dist/{chunk-NMXQFQ26.js → chunk-MEBXWI7U.js} +5 -5
  34. package/dist/{chunk-RAWHRRUJ.js → chunk-MKMM5RIW.js} +209 -201
  35. package/dist/{chunk-3R3OADC5.js → chunk-P7MEEUGT.js} +281 -252
  36. package/dist/chunk-QLYPIJ7X.js +258 -0
  37. package/dist/chunk-RN5CFAVQ.js +292 -0
  38. package/dist/{chunk-WDXNBYGD.js → chunk-TDP7CZGE.js} +6 -1
  39. package/dist/{chunk-6VPWQ4TG.js → chunk-UROB7MK5.js} +2 -1
  40. package/dist/chunk-VEESMPTX.js +254 -0
  41. package/dist/{chunk-IJLIAPCW.js → chunk-VPSAKGLK.js} +47 -47
  42. package/dist/{cli-context-YIT4FEDM.js → cli-context-CQYGIWOU.js} +254 -237
  43. package/dist/{cli-main-JIADJ5OL.js → cli-main-VRUJNUBX.js} +2081 -1594
  44. package/dist/cli-main-boot.d.ts +1 -1
  45. package/dist/config-doctor-known-keys.d.ts +33 -0
  46. package/dist/config-doctor.d.ts +2 -47
  47. package/dist/config-history-support.d.ts +36 -0
  48. package/dist/config-history.d.ts +1 -1
  49. package/dist/{config-transfer-Y7XJMJRN.js → config-transfer-B4GOZTFC.js} +2 -2
  50. package/dist/{execution-BAP566QC.js → execution-IV72RUSM.js} +5354 -5258
  51. package/dist/execution-tui.d.ts +30 -0
  52. package/dist/fleet/acp-live-steer.d.ts +28 -0
  53. package/dist/fleet/acp-permission-bridge.d.ts +49 -0
  54. package/dist/fleet/acp-quota-hold.d.ts +3 -0
  55. package/dist/fleet/acp-quota-reading.d.ts +3 -0
  56. package/dist/fleet/acp-turn-reminders.d.ts +15 -0
  57. package/dist/fleet/acp-wrongstack-bridge.d.ts +50 -0
  58. package/dist/fleet/host-acp.d.ts +23 -2
  59. package/dist/fleet/wrongforge-client.d.ts +116 -0
  60. package/dist/fleet/wrongforge-gateway.d.ts +20 -0
  61. package/dist/fleet/wrongforge-info.d.ts +32 -0
  62. package/dist/fleet/wrongforge-quota.d.ts +10 -0
  63. package/dist/fleet/wrongforge-runner.d.ts +37 -0
  64. package/dist/fleet/wrongforge-runtime.d.ts +10 -0
  65. package/dist/{hq-JD5AZVMG.js → hq-54PQYR5O.js} +311 -307
  66. package/dist/hq-server/sweeps.d.ts +28 -0
  67. package/dist/{hq-server-BI23EPM7.js → hq-server-YK7FBLL6.js} +3 -3
  68. package/dist/index.js +8 -5
  69. package/dist/mcp-22CFBX4H.js +236 -0
  70. package/dist/mcp-serve-project.d.ts +18 -0
  71. package/dist/mcp-serve.d.ts +0 -63
  72. package/dist/{modeldiag-HDIKG37X.js → modeldiag-5PBB777J.js} +4 -4
  73. package/dist/{per-subcommand-help-D6J4ZXW2.js → per-subcommand-help-MQGERD4E.js} +2 -2
  74. package/dist/plugin-llm-command.d.ts +9 -0
  75. package/dist/{plugin-usage-TYF5HY4K.js → plugin-usage-UWKYMNQU.js} +3 -3
  76. package/dist/{plugins-XGAXDLPT.js → plugins-VP7JQH47.js} +4 -4
  77. package/dist/{sdd-runtime-6MFUXWJK.js → sdd-runtime-HIJ4Z5TF.js} +2 -2
  78. package/dist/services/sdd/state.d.ts +2 -0
  79. package/dist/session-event-wiring-types.d.ts +62 -0
  80. package/dist/session-event-wiring.d.ts +2 -52
  81. package/dist/{sessions-config-SJVQXCIE.js → sessions-config-7MK742OW.js} +2 -2
  82. package/dist/short-circuit-flags-AGHURHMQ.js +11 -0
  83. package/dist/slash-commands/command-context-fleet.d.ts +187 -0
  84. package/dist/slash-commands/command-context-sdd-goal.d.ts +102 -0
  85. package/dist/slash-commands/command-context.d.ts +3 -282
  86. package/dist/slash-commands/project-switch-interactive.d.ts +11 -0
  87. package/dist/slash-commands/setmodel-helpers.d.ts +36 -0
  88. package/dist/subcommands/handlers/hq-token.d.ts +3 -0
  89. package/dist/subcommands/handlers/hq.d.ts +0 -21
  90. package/dist/subcommands/handlers/per-subcommand-help-operations.d.ts +8 -0
  91. package/dist/subcommands/handlers/tools-cli-args.d.ts +57 -0
  92. package/dist/subcommands/handlers/tools-cli.d.ts +5 -0
  93. package/dist/subcommands/handlers/tools-serve.d.ts +4 -0
  94. package/dist/{subcommands-VTMIZQBP.js → subcommands-OCJNO57E.js} +2 -2
  95. package/dist/tool-gateway-http.d.ts +30 -0
  96. package/dist/tool-gateway.d.ts +185 -0
  97. package/dist/tools-cli-44MLIUQO.js +509 -0
  98. package/dist/tools-serve-TRCET2M7.js +102 -0
  99. package/dist/{tools-skills-55QVTMSK.js → tools-skills-WDTMCE46.js} +7 -2
  100. package/dist/tuneup-runtime-checks.d.ts +7 -0
  101. package/dist/tuneup-types.d.ts +118 -0
  102. package/dist/tuneup.d.ts +3 -122
  103. package/dist/{typesafe-YBEADNAH.js → typesafe-QLSMFU7J.js} +1 -1
  104. package/dist/{version-help-RBZC5GZZ.js → version-help-X6CC4CFY.js} +2 -2
  105. package/dist/{webui-server-HIUY3RHD.js → webui-server-V2R5WQUK.js} +79 -3
  106. package/dist/wiring/provider-runtime-setup.d.ts +3 -1
  107. package/dist/wiring/session-runtime.d.ts +1 -1
  108. package/dist/wrongforge-gateway-UOFBK56J.js +92 -0
  109. package/dist/wrongforge-leader/wrongforge-leader-gateway.d.ts +9 -0
  110. package/dist/wrongforge-leader/wrongforge-leader-picker.d.ts +12 -0
  111. package/dist/wrongforge-leader/wrongforge-leader-provider.d.ts +49 -0
  112. package/package.json +34 -30
  113. package/dist/auth-menu/anthropic-oauth.d.ts +0 -43
  114. package/dist/chunk-XT3NAHRX.js +0 -337
  115. package/dist/chunk-ZNNFEKDZ.js +0 -319
  116. package/dist/mcp-2XWBJEQN.js +0 -464
  117. package/dist/short-circuit-flags-CPCT5MWB.js +0 -11
@@ -0,0 +1,30 @@
1
+ import type { createToolVisionAdapters } from '@wrongstack/runtime/vision';
2
+ import type { ExecuteDeps } from './execute-deps.js';
3
+ import type { StandaloneAutoUpdate } from './standalone-auto-update.js';
4
+ import type { UpdateInfo } from './update-check.js';
5
+ /** Locals `execute` computes before branching, plus the coordinator-stop setter. */
6
+ export interface ExecutionTuiLocals {
7
+ wpaths: ExecuteDeps['core']['wpaths'];
8
+ projectRoot: ExecuteDeps['core']['projectRoot'];
9
+ activeSessionStore: ExecuteDeps['session']['sessionStore'];
10
+ detachActiveTodosCheckpoint: (() => void | Promise<void>) | undefined;
11
+ profileName: string;
12
+ bootUpdateInfo: UpdateInfo | undefined;
13
+ supportsVision: () => Promise<boolean>;
14
+ visionAdapters: () => ReturnType<typeof createToolVisionAdapters>;
15
+ goalFlag: string | undefined;
16
+ askFlag: string | undefined;
17
+ autoUpdate: StandaloneAutoUpdate | undefined;
18
+ setCoordinatorStop: (fn: (() => void) | undefined) => void;
19
+ }
20
+ /**
21
+ * The interactive TUI branch of `execute`: wire the TUI runtime state,
22
+ * project-switch and coordinator plumbing, then run the TUI until it exits.
23
+ * `exitWith` carries a project-switch child's exit code when one replaced
24
+ * this session.
25
+ */
26
+ export declare function runExecutionTui(deps: ExecuteDeps, local: ExecutionTuiLocals): Promise<{
27
+ code: number;
28
+ exitWith?: number;
29
+ }>;
30
+ //# sourceMappingURL=execution-tui.d.ts.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Live notes to a running external ACP worker.
3
+ *
4
+ * A WrongStack agent registers in the session note hub and folds notes in at
5
+ * its next iteration. An external agent (Claude Code over ACP) has no such
6
+ * loop, so while its turn runs this registers an inbox for it that injects
7
+ * each note into the turn through the agent's steering extension. The leader
8
+ * then reaches the worker with `session_note`, as it reaches its own workers.
9
+ */
10
+ import type { AcpSteerOutcome } from '@wrongstack/acp';
11
+ import { type SessionNoteHub } from '@wrongstack/core/coordination';
12
+ import type { SubagentRunContext, TaskSpec } from '@wrongstack/core/types';
13
+ interface Note {
14
+ from: string;
15
+ kind: string;
16
+ body: string;
17
+ subject?: string | undefined;
18
+ }
19
+ /** The note as the worker reads it: who sent it, as what, then the text. */
20
+ export declare function steerMessage(note: Note): string;
21
+ /**
22
+ * Register `ctx.subagentId` (and its display name) as a live agent of the
23
+ * delegating session for the length of the turn. Returns the unregister, or
24
+ * undefined when no WrongStack session delegated the task.
25
+ */
26
+ export declare function registerAcpSteerInbox(ctx: SubagentRunContext, _task: TaskSpec, steer: (text: string) => Promise<AcpSteerOutcome>, hub?: Pick<SessionNoteHub, 'register'>, onUndelivered?: (outcome: string) => void): (() => void) | undefined;
27
+ export {};
28
+ //# sourceMappingURL=acp-live-steer.d.ts.map
@@ -0,0 +1,49 @@
1
+ /**
2
+ * WrongStack's permission rules for an external ACP worker.
3
+ *
4
+ * A delegated agent must not be a one-hop bypass of the user's approval
5
+ * system. WrongStack's own subagents run every tool call through
6
+ * `AutoApprovePermissionPolicy`: the user's deny rules bind them, destructive
7
+ * commands and credential reads are refused (a worker cannot ask), and the
8
+ * user's YOLO+ lifts those refusals. An ACP worker gets the same treatment:
9
+ * the host starts it in a mode where it asks before edits, commands and
10
+ * fetches, and each `session/request_permission` is translated into the
11
+ * matching WrongStack tool call and decided by that policy. A request it
12
+ * cannot evaluate — an unknown kind, a call naming no target, a tool the run
13
+ * does not have — is refused, never waved through.
14
+ */
15
+ import type { PermissionPolicy as AcpPermissionPolicy } from '@wrongstack/acp';
16
+ import type { PermissionDecision, Tool } from '@wrongstack/core/types';
17
+ /** The WrongStack tool call an ACP permission request stands for. */
18
+ export interface WrongStackCall {
19
+ tool: string;
20
+ input: Record<string, unknown>;
21
+ }
22
+ export interface AcpPermissionBridgeOptions {
23
+ /** WrongStack's subagent policy (an `AutoApprovePermissionPolicy`). */
24
+ evaluate: (tool: Tool, input: unknown, ctx: {
25
+ projectRoot: string;
26
+ cwd: string;
27
+ }) => Promise<PermissionDecision>;
28
+ /** Resolve a WrongStack tool by name (the host's tool registry). */
29
+ getTool: (name: string) => Tool | undefined;
30
+ projectRoot: string;
31
+ /**
32
+ * Whether MCP tools may run at all. False under `--restricted`, which keeps
33
+ * MCP tools out of the registry and so out of a worker's reach too.
34
+ */
35
+ allowMcp?: boolean | undefined;
36
+ /**
37
+ * Ask the user when the policy wants a question (`confirm`). A worker has
38
+ * no one to ask, so without this a `confirm` is refused; a leader runs in
39
+ * front of the user and passes the session's own confirmation prompt.
40
+ */
41
+ confirm?: ((tool: Tool, call: WrongStackCall, request: {
42
+ toolCallId: string | undefined;
43
+ signal: AbortSignal;
44
+ }) => Promise<boolean>) | undefined;
45
+ /** Told about every refusal, for the host's log. */
46
+ onRefused?: ((call: WrongStackCall, reason: string) => void) | undefined;
47
+ }
48
+ export declare function wrongstackAcpPermissionPolicy(opts: AcpPermissionBridgeOptions): AcpPermissionPolicy;
49
+ //# sourceMappingURL=acp-permission-bridge.d.ts.map
@@ -0,0 +1,3 @@
1
+ /** Run `start` unless `agentId` is held; record a hold when it fails on quota. */
2
+ export declare function runWithQuotaHold<T>(agentId: string, start: () => Promise<T>, now?: () => number): Promise<T>;
3
+ //# sourceMappingURL=acp-quota-hold.d.ts.map
@@ -0,0 +1,3 @@
1
+ /** Record one rate-limit reading from `agentId`; ignores readings it cannot read. */
2
+ export declare function recordAcpRateLimit(agentId: string, info: Record<string, unknown>, now?: number): void;
3
+ //# sourceMappingURL=acp-quota-reading.d.ts.map
@@ -0,0 +1,15 @@
1
+ /** Remind an active ACP turn about local /btw notes and newly waiting mail. */
2
+ import { type Context } from '@wrongstack/core/agent';
3
+ type Steer = (text: string) => Promise<'injected' | 'promptRequired' | 'startedNewTurn' | 'unsupported'>;
4
+ export interface AcpTurnRemindersOptions {
5
+ steer: Steer;
6
+ context?: Context | undefined;
7
+ unreadCount?: (() => Promise<number>) | undefined;
8
+ btwPollMs?: number | undefined;
9
+ mailPollMs?: number | undefined;
10
+ }
11
+ /** Mailbox awareness embeds message bodies; ask ACP to read inbox instead. */
12
+ export declare function acpBtwBlock(notes: readonly string[]): string;
13
+ export declare function startAcpTurnReminders(options: AcpTurnRemindersOptions): () => void;
14
+ export {};
15
+ //# sourceMappingURL=acp-turn-reminders.d.ts.map
@@ -0,0 +1,50 @@
1
+ import { type AcpSessionSetup } from '@wrongstack/acp';
2
+ import type { Config, SubagentRunContext, TaskSpec } from '@wrongstack/core/types';
3
+ export type BridgeServer = 'sage' | 'mailbox' | 'kanban' | 'codebase-index' | 'requirement-intake';
4
+ export declare const DEFAULT_BRIDGE_AGENTS: readonly string[];
5
+ export declare const DEFAULT_BRIDGE_SERVERS: readonly BridgeServer[];
6
+ type BridgeConfig = NonNullable<NonNullable<Config['acp']>['bridge']>;
7
+ /** How to start this same `wstack`: the binary itself, or node/bun + the CLI entry. */
8
+ export declare function wstackLaunch(args: string[], entry?: string | undefined): {
9
+ command: string;
10
+ args: string[];
11
+ };
12
+ /**
13
+ * The worker's shell command for `wstack tools`, built from the same launcher
14
+ * as the MCP servers so it reaches this exact install. Stable for a given
15
+ * install, which keeps the system-prompt note cache-friendly across workers.
16
+ * Windows paths use forward slashes: the agent's shell is usually Git Bash,
17
+ * where an unquoted backslash is an escape.
18
+ */
19
+ export declare function wstackToolsCommand(entry?: string | undefined, platform?: NodeJS.Platform): string;
20
+ /** A short task-local cue: the Claude adapter gives user-turn text more immediate weight. */
21
+ export declare function bridgeTaskKickoff(servers: readonly BridgeServer[], indexCli?: string): string;
22
+ /**
23
+ * The note appended to the worker's system prompt. It must not vary per task
24
+ * or per worker: the system prompt is the head of the agent's prompt cache, so
25
+ * a task id or worker id in it made every worker rewrite ~25k cached tokens
26
+ * (measured: $0.21 per one-line task, against $0.008 with a stable prompt).
27
+ * Per-worker identity lives in the MCP servers' arguments instead.
28
+ */
29
+ export declare function bridgeNote(servers: readonly BridgeServer[], delegated?: boolean, indexCli?: string): string;
30
+ /**
31
+ * The note for an agent running as the session's LEADER: the user talks to it
32
+ * through WrongStack, so it answers them directly and ends a turn the way
33
+ * WrongStack's own leader does, with next steps the user can send back.
34
+ */
35
+ export declare function leaderBridgeNote(servers: readonly BridgeServer[], indexCli?: string): string;
36
+ /** True when `command` resolves to a file on PATH (PATHEXT-aware on Windows). */
37
+ export declare function onPath(command: string, env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): boolean;
38
+ /**
39
+ * Bridged agents the leader can hand a task to on this machine: listed in
40
+ * `acp.bridge.agents` (by catalog or registry id) and either configured by
41
+ * the user in `acp.agents` or with their CLI on PATH. Catalog ids, in order.
42
+ */
43
+ export declare function installedBridgeAgents(acp: Config['acp'] | undefined, isOnPath?: (command: string) => boolean): string[];
44
+ /**
45
+ * The per-session setup for `agentId`, or undefined when the bridge does not
46
+ * apply to it (not listed, turned off, or no servers).
47
+ */
48
+ export declare function wrongstackBridgeSetup(agentId: string, projectRoot: string, config: BridgeConfig | undefined, role?: 'worker' | 'leader'): ((task: TaskSpec, ctx: SubagentRunContext) => AcpSessionSetup) | undefined;
49
+ export {};
50
+ //# sourceMappingURL=acp-wrongstack-bridge.d.ts.map
@@ -1,10 +1,31 @@
1
- import { type ACPProgressEvent, type AcpAgentCommandOverrides, type AcpLiveCatalog } from '@wrongstack/acp';
2
- import type { SubagentRunContext, SubagentRunner, TaskSpec } from '@wrongstack/core/types';
1
+ import { type ACPProgressEvent, type AcpAgentCommandOverrides, type AcpLiveCatalog, type PermissionPolicy as AcpPermissionPolicy } from '@wrongstack/acp';
2
+ import type { Config, SubagentRunContext, SubagentRunner, TaskSpec } from '@wrongstack/core/types';
3
+ import { type WrongForgeGatewaySpec } from './wrongforge-runner.js';
3
4
  export type AcpLivePublisher = (ctx: SubagentRunContext, task: TaskSpec, event: ACPProgressEvent) => void;
4
5
  export interface BuildAcpSubagentRunnerOptions {
6
+ /**
7
+ * The project the worker works in: its cwd and file-access root. Without it
8
+ * the worker ran in the host process's cwd — a subdirectory, or another
9
+ * repository than the session's.
10
+ */
11
+ projectRoot?: string | undefined;
5
12
  overrides?: AcpAgentCommandOverrides | undefined;
6
13
  live?: AcpLiveCatalog | undefined;
7
14
  publishLive?: AcpLivePublisher | undefined;
15
+ /** Project the worker runs in, plus `acp.bridge` config: see acp-wrongstack-bridge.ts. */
16
+ bridge?: {
17
+ projectRoot: string;
18
+ config?: NonNullable<Config['acp']>['bridge'] | undefined;
19
+ } | undefined;
20
+ /**
21
+ * WrongStack's permission rules for the worker's session (see
22
+ * acp-permission-bridge.ts). When set, the worker is also started in its
23
+ * `default` mode so it asks before edits and commands, whatever mode the
24
+ * user runs the agent in on their own.
25
+ */
26
+ permissions?: ((ctx: SubagentRunContext) => AcpPermissionPolicy) | undefined;
27
+ /** WrongStack tools a WrongForge worker may call back (see wrongforge-gateway.ts). */
28
+ wrongforgeGateway?: (() => Promise<WrongForgeGatewaySpec | undefined>) | undefined;
8
29
  }
9
30
  /**
10
31
  * Same command resolution as `wstack acp spawn` / `/acp` — user override,
@@ -0,0 +1,116 @@
1
+ import type { ACPProgressEvent } from '@wrongstack/acp';
2
+ import type { WrongForgeInfo } from './wrongforge-info.js';
3
+ export declare const WRONGFORGE_AGENT_ID = "wrongforge";
4
+ /**
5
+ * WrongForge's own tools a task keeps when WrongStack's gateway carries the
6
+ * rest: reading, its todo list and progress reports. Writes and commands then
7
+ * go through `wstack_*`, i.e. through WrongStack's rules.
8
+ */
9
+ export declare const WRONGFORGE_READ_SIDE_TOOLS: string[];
10
+ export interface WrongForgeEndpoint {
11
+ url: string;
12
+ apiKey: string;
13
+ }
14
+ /** The `gateway` field of a WrongForge task: WrongStack tools it may call back. */
15
+ export interface WrongForgeGatewaySpec {
16
+ url: string;
17
+ token: string;
18
+ list_path: string;
19
+ call_path: string;
20
+ name_prefix?: string | undefined;
21
+ deny?: string[] | undefined;
22
+ optional?: boolean | undefined;
23
+ }
24
+ export interface WfTaskRecord {
25
+ id: string;
26
+ status: 'queued' | 'running' | 'completed' | 'failed' | 'cancelled' | 'timed_out';
27
+ session_id?: string;
28
+ result?: {
29
+ text: string;
30
+ finish_reason?: string;
31
+ steps: number;
32
+ tool_calls: number;
33
+ usage?: {
34
+ input_tokens?: number;
35
+ output_tokens?: number;
36
+ cache_read_tokens?: number;
37
+ cache_write_tokens?: number;
38
+ };
39
+ context_tokens?: number;
40
+ context_window?: number;
41
+ };
42
+ error?: {
43
+ code: string;
44
+ message: string;
45
+ };
46
+ cancel_reason?: string;
47
+ }
48
+ export interface WfEvent {
49
+ seq: number;
50
+ type: string;
51
+ data: Record<string, unknown>;
52
+ }
53
+ export declare class WfHttpError extends Error {
54
+ readonly status: number;
55
+ readonly code: string;
56
+ constructor(status: number, code: string, message: string);
57
+ }
58
+ /** The delegating side gave up on the task (its signal fired). */
59
+ export declare class WfAborted extends Error {
60
+ constructor();
61
+ }
62
+ /**
63
+ * Where a local WrongForge serves and the key it accepts: `WRONGFORGE_URL`
64
+ * (default 127.0.0.1:8787) and `WRONGFORGE_API_KEY`, else the key WrongForge
65
+ * saved on first start (`$WRONGFORGE_HOME|~/.wrongforge/api-key`).
66
+ */
67
+ export declare function resolveWrongForgeEndpoint(env?: NodeJS.ProcessEnv): WrongForgeEndpoint | undefined;
68
+ /** True when this machine has a WrongForge set up (a key to reach it with). */
69
+ export declare function wrongForgeConfigured(env?: NodeJS.ProcessEnv): boolean;
70
+ export declare const safeWfId: (s: string) => string;
71
+ export type WfCall = <T>(method: 'GET' | 'POST', route: string, body?: unknown, signal?: AbortSignal) => Promise<T>;
72
+ /** One JSON call to WrongForge; failures as WfHttpError (status 0 = unreachable). */
73
+ export declare function wrongForgeCall(ep: WrongForgeEndpoint, doFetch?: typeof fetch): WfCall;
74
+ /**
75
+ * A task's events in order, until it ends. Long-polls; a dropped connection or
76
+ * a WrongForge restart is retried (the task survives it). `onPoll` sees every
77
+ * answered poll's status: a task waiting in the shared queue emits nothing.
78
+ * Throws WfAborted when `signal` fires.
79
+ */
80
+ export declare function followTask(call: WfCall, taskId: string, signal: AbortSignal, opts?: {
81
+ retryDelayMs?: number | undefined;
82
+ onPoll?: ((status: string) => void) | undefined;
83
+ }): AsyncGenerator<WfEvent>;
84
+ /**
85
+ * The terminal task record, with the same dropped-connection tolerance as
86
+ * `followTask`: the task is already finished, so one transient failure of
87
+ * this fetch must not turn completed work into a failed delegation (the
88
+ * caller would re-run it). Throws WfAborted when `signal` fires.
89
+ */
90
+ export declare function terminalTaskRecord(call: WfCall, taskId: string, signal: AbortSignal, opts?: {
91
+ retryDelayMs?: number | undefined;
92
+ }): Promise<WfTaskRecord>;
93
+ /** Ask WrongForge to stop a task; best effort. */
94
+ export declare function cancelTask(call: WfCall, taskId: string, reason: string): void;
95
+ /**
96
+ * The model to ask WrongForge for. Its own `/v1/info` list is the authority:
97
+ * a model it does not serve fails fast, naming the ones it does, instead of
98
+ * failing inside WrongForge. Without the list (older server, info failed) only
99
+ * an id that looks like a Claude model is forwarded. An external-agent spawn
100
+ * may carry the agent's own name as its model; that is not a choice.
101
+ */
102
+ export declare function chooseModel(requested: string | undefined, agentName: string | undefined, info: WrongForgeInfo | undefined): {
103
+ id?: string;
104
+ error?: string;
105
+ };
106
+ /** A WrongForge task event as the progress events the fleet and leader seams consume. */
107
+ export declare function toProgress(ev: WfEvent): ACPProgressEvent[];
108
+ /** WrongForge's token split: `input_tokens` is the uncached part (measured live). */
109
+ export declare function wfTokens(usage: NonNullable<WfTaskRecord['result']>['usage']): {
110
+ input: number;
111
+ output: number;
112
+ cacheRead: number;
113
+ cacheWrite: number;
114
+ };
115
+ export declare function sleep(ms: number, signal: AbortSignal): Promise<void>;
116
+ //# sourceMappingURL=wrongforge-client.d.ts.map
@@ -0,0 +1,20 @@
1
+ import type { ToolRegistry } from '@wrongstack/core/registry';
2
+ import type { Config } from '@wrongstack/core/types';
3
+ import type { WrongForgeGatewaySpec } from './wrongforge-client.js';
4
+ /**
5
+ * Never served to a worker: steering the fleet and the leader's session is the
6
+ * leader's job. A worker that could `delegate` would spawn workers of its own,
7
+ * filed under a session nobody is in (the gateway has no session). Memory,
8
+ * mailbox and the board stay: those are how a worker shares what it learns.
9
+ */
10
+ export declare const WORKER_WITHHELD_TOOLS: ReadonlySet<string>;
11
+ interface GatewayOptions {
12
+ projectRoot: string;
13
+ registry: ToolRegistry;
14
+ config: Config;
15
+ yoloPlus?: (() => boolean) | undefined;
16
+ log?: ((message: string) => void) | undefined;
17
+ }
18
+ export declare function sharedWrongForgeGateway(opts: GatewayOptions): Promise<WrongForgeGatewaySpec>;
19
+ export {};
20
+ //# sourceMappingURL=wrongforge-gateway.d.ts.map
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Where WrongForge answers. Structural, so this module stays a leaf:
3
+ * wrongforge-client.ts imports from here, never the other way round.
4
+ */
5
+ interface WrongForgeEndpoint {
6
+ url: string;
7
+ apiKey: string;
8
+ }
9
+ export interface WrongForgeInfo {
10
+ models: string[];
11
+ defaultModel?: string | undefined;
12
+ features: string[];
13
+ effortLevels?: string[] | undefined;
14
+ modelDetails?: {
15
+ id: string;
16
+ description: string;
17
+ effortLevels: string[];
18
+ }[] | undefined;
19
+ }
20
+ export declare function wrongForgeInfoCacheFile(): string;
21
+ /** Normalises a `/v1/info` body; anything malformed reads as "nothing known". */
22
+ export declare function parseWrongForgeInfo(body: unknown): WrongForgeInfo;
23
+ export declare function readCachedWrongForgeInfo(file?: string): WrongForgeInfo | undefined;
24
+ export declare function writeWrongForgeInfoCache(info: WrongForgeInfo, file?: string): void;
25
+ export declare function fetchWrongForgeInfo(ep: WrongForgeEndpoint, opts?: {
26
+ fetchImpl?: typeof fetch | undefined;
27
+ signal?: AbortSignal | undefined;
28
+ }): Promise<WrongForgeInfo>;
29
+ /** Boot-time, fire-and-forget: refresh the cache for the next description. */
30
+ export declare function refreshWrongForgeInfoCache(ep: WrongForgeEndpoint | undefined): void;
31
+ export {};
32
+ //# sourceMappingURL=wrongforge-info.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { type WrongForgeEndpoint } from './wrongforge-client.js';
2
+ /** Read the signed-in WrongForge account into the shared quota plane; never a model call. */
3
+ export declare function reportWrongForgeQuota(opts?: {
4
+ endpoint?: WrongForgeEndpoint | undefined;
5
+ providerId?: string | undefined;
6
+ fetchImpl?: typeof fetch | undefined;
7
+ force?: boolean | undefined;
8
+ timeoutMs?: number | undefined;
9
+ }): Promise<boolean>;
10
+ //# sourceMappingURL=wrongforge-quota.d.ts.map
@@ -0,0 +1,37 @@
1
+ import type { ACPProgressEvent } from '@wrongstack/acp';
2
+ import type { SubagentRunContext, SubagentRunner, TaskSpec } from '@wrongstack/core/types';
3
+ import { chooseModel, resolveWrongForgeEndpoint, WRONGFORGE_AGENT_ID, WRONGFORGE_READ_SIDE_TOOLS, type WrongForgeEndpoint, type WrongForgeGatewaySpec } from './wrongforge-client.js';
4
+ export { wrongForgeConfigured } from './wrongforge-client.js';
5
+ export { chooseModel, resolveWrongForgeEndpoint, WRONGFORGE_AGENT_ID, WRONGFORGE_READ_SIDE_TOOLS, type WrongForgeEndpoint, type WrongForgeGatewaySpec, };
6
+ export interface WrongForgeRunnerOptions {
7
+ projectRoot: string;
8
+ endpoint?: (() => WrongForgeEndpoint | undefined) | undefined;
9
+ /** Started lazily on the first task; a failure runs the task without it. */
10
+ gateway?: (() => Promise<WrongForgeGatewaySpec | undefined>) | undefined;
11
+ publishLive?: ((ctx: SubagentRunContext, task: TaskSpec, event: ACPProgressEvent) => void) | undefined;
12
+ fetchImpl?: typeof fetch | undefined;
13
+ retryDelayMs?: number | undefined;
14
+ }
15
+ /**
16
+ * What the `delegate` description says about WrongForge at boot: whether it is
17
+ * set up, and the models it last reported (cached; refreshed in the background
18
+ * here and on every task, so the next boot names the current list).
19
+ */
20
+ export declare function wrongForgeDelegateEntry(env?: NodeJS.ProcessEnv): {
21
+ agent: string;
22
+ models?: {
23
+ models: string[];
24
+ default?: string | undefined;
25
+ };
26
+ } | undefined;
27
+ /**
28
+ * The models the machine's WrongForge serves, for a model picker: asked live
29
+ * (short timeout, cache refreshed), else the last list it reported, else
30
+ * none (no WrongForge here, or it never answered).
31
+ */
32
+ export declare function wrongForgeModels(env?: NodeJS.ProcessEnv): Promise<{
33
+ models: string[];
34
+ default?: string | undefined;
35
+ } | undefined>;
36
+ export declare function makeWrongForgeRunner(options: WrongForgeRunnerOptions): SubagentRunner;
37
+ //# sourceMappingURL=wrongforge-runner.d.ts.map
@@ -0,0 +1,10 @@
1
+ import type { ReasoningConfig, ReasoningRequest, RequestCacheControl } from '@wrongstack/core/types';
2
+ import type { WrongForgeInfo } from './wrongforge-info.js';
3
+ /** Task API accepts these controls and owns model-specific clamping/omission. */
4
+ export declare const WRONGFORGE_REASONING: ReasoningConfig;
5
+ /** WrongForge has a smaller effort vocabulary; model-specific clamping is server-owned. */
6
+ export declare function wrongForgeRuntime(reasoning?: ReasoningRequest, cache?: RequestCacheControl, info?: WrongForgeInfo): {
7
+ effort?: 'off' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
8
+ cache?: '5m' | '1h';
9
+ };
10
+ //# sourceMappingURL=wrongforge-runtime.d.ts.map