@cargo-ai/cli 1.0.92 → 1.0.95
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/README.md +17 -17
- package/build/commands/ai/chat.d.ts.map +1 -1
- package/build/commands/ai/chat.js +2 -1
- package/build/commands/ai/message.d.ts.map +1 -1
- package/build/commands/ai/message.js +2 -1
- package/build/commands/ai/release.d.ts.map +1 -1
- package/build/commands/ai/release.js +7 -6
- package/build/commands/ask/harness/approvals.d.ts +7 -0
- package/build/commands/ask/harness/approvals.d.ts.map +1 -0
- package/build/commands/ask/harness/approvals.js +82 -0
- package/build/commands/ask/harness/artifacts.d.ts.map +1 -0
- package/build/commands/ask/harness/claudeConfig.d.ts.map +1 -0
- package/build/commands/ask/harness/create.d.ts +59 -0
- package/build/commands/ask/harness/create.d.ts.map +1 -0
- package/build/commands/ask/harness/create.js +292 -0
- package/build/commands/ask/harness/index.d.ts +8 -0
- package/build/commands/ask/harness/index.d.ts.map +1 -0
- package/build/commands/ask/harness/index.js +7 -0
- package/build/commands/ask/harness/ingest.d.ts +25 -0
- package/build/commands/ask/harness/ingest.d.ts.map +1 -0
- package/build/commands/ask/harness/ingest.js +35 -0
- package/build/commands/ask/harness/instructions.d.ts +13 -0
- package/build/commands/ask/harness/instructions.d.ts.map +1 -0
- package/build/commands/ask/harness/instructions.js +41 -0
- package/build/commands/ask/harness/layout.d.ts +23 -0
- package/build/commands/ask/harness/layout.d.ts.map +1 -0
- package/build/commands/ask/harness/layout.js +32 -0
- package/build/commands/ask/harness/mcp.d.ts +25 -0
- package/build/commands/ask/harness/mcp.d.ts.map +1 -0
- package/build/commands/ask/harness/mcp.js +72 -0
- package/build/commands/ask/harness/pnpmShim.d.ts.map +1 -0
- package/build/commands/ask/harness/release.d.ts +18 -0
- package/build/commands/ask/harness/release.d.ts.map +1 -0
- package/build/commands/ask/harness/release.js +117 -0
- package/build/commands/ask/harness/sandbox.d.ts +9 -0
- package/build/commands/ask/harness/sandbox.d.ts.map +1 -0
- package/build/commands/ask/harness/sandbox.js +27 -0
- package/build/commands/ask/harness/timing.d.ts +16 -0
- package/build/commands/ask/harness/timing.d.ts.map +1 -0
- package/build/commands/ask/harness/timing.js +72 -0
- package/build/commands/ask/harness/turn.d.ts +145 -0
- package/build/commands/ask/harness/turn.d.ts.map +1 -0
- package/build/commands/ask/harness/turn.js +626 -0
- package/build/commands/ask/harness/usage.d.ts +50 -0
- package/build/commands/ask/harness/usage.d.ts.map +1 -0
- package/build/commands/ask/harness/usage.js +87 -0
- package/build/commands/ask/index.d.ts +9 -0
- package/build/commands/ask/index.d.ts.map +1 -1
- package/build/commands/ask/index.js +7 -7
- package/build/commands/ask/input/completer.d.ts.map +1 -0
- package/build/commands/ask/input/index.d.ts +5 -0
- package/build/commands/ask/input/index.d.ts.map +1 -0
- package/build/commands/ask/input/index.js +4 -0
- package/build/commands/ask/input/prompt.d.ts.map +1 -0
- package/build/commands/ask/{prompt.js → input/prompt.js} +1 -1
- package/build/commands/ask/input/slash.d.ts.map +1 -0
- package/build/commands/ask/{slash.js → input/slash.js} +2 -2
- package/build/commands/ask/input/typeAhead.d.ts.map +1 -0
- package/build/commands/ask/{history.d.ts → persist/history.d.ts} +1 -1
- package/build/commands/ask/persist/history.d.ts.map +1 -0
- package/build/commands/ask/persist/index.d.ts +4 -0
- package/build/commands/ask/persist/index.d.ts.map +1 -0
- package/build/commands/ask/persist/index.js +3 -0
- package/build/commands/ask/persist/persist.d.ts.map +1 -0
- package/build/commands/ask/persist/state.d.ts.map +1 -0
- package/build/commands/ask/session/claim.d.ts +56 -0
- package/build/commands/ask/session/claim.d.ts.map +1 -0
- package/build/commands/ask/session/claim.js +76 -0
- package/build/commands/ask/session/index.d.ts +5 -0
- package/build/commands/ask/session/index.d.ts.map +1 -0
- package/build/commands/ask/session/index.js +4 -0
- package/build/commands/ask/session/run.d.ts +36 -0
- package/build/commands/ask/session/run.d.ts.map +1 -0
- package/build/commands/ask/session/run.js +832 -0
- package/build/commands/ask/session/thinking.d.ts.map +1 -0
- package/build/commands/ask/session/tree.d.ts +90 -0
- package/build/commands/ask/session/tree.d.ts.map +1 -0
- package/build/commands/ask/session/tree.js +318 -0
- package/build/commands/start/brief.js +1 -1
- package/build/commands/start/index.d.ts +1 -1
- package/build/commands/start/index.d.ts.map +1 -1
- package/build/commands/start/index.js +7 -7
- package/build/index.js +6 -1
- package/build/paletteLayout.d.ts.map +1 -1
- package/build/paletteLayout.js +9 -8
- package/build/utils/cdkState.js +2 -2
- package/build/utils/loadCompiledAgent.js +1 -1
- package/package.json +6 -5
- package/build/commands/ask/artifacts.d.ts.map +0 -1
- package/build/commands/ask/binding.d.ts +0 -13
- package/build/commands/ask/binding.d.ts.map +0 -1
- package/build/commands/ask/binding.js +0 -19
- package/build/commands/ask/claudeConfig.d.ts.map +0 -1
- package/build/commands/ask/completer.d.ts.map +0 -1
- package/build/commands/ask/history.d.ts.map +0 -1
- package/build/commands/ask/localHarness.d.ts +0 -278
- package/build/commands/ask/localHarness.d.ts.map +0 -1
- package/build/commands/ask/localHarness.js +0 -1300
- package/build/commands/ask/messageStream.d.ts +0 -33
- package/build/commands/ask/messageStream.d.ts.map +0 -1
- package/build/commands/ask/messageStream.js +0 -114
- package/build/commands/ask/persist.d.ts.map +0 -1
- package/build/commands/ask/pnpmShim.d.ts.map +0 -1
- package/build/commands/ask/prompt.d.ts.map +0 -1
- package/build/commands/ask/session.d.ts +0 -101
- package/build/commands/ask/session.d.ts.map +0 -1
- package/build/commands/ask/session.js +0 -1328
- package/build/commands/ask/slash.d.ts.map +0 -1
- package/build/commands/ask/state.d.ts.map +0 -1
- package/build/commands/ask/thinking.d.ts.map +0 -1
- package/build/commands/ask/typeAhead.d.ts.map +0 -1
- /package/build/commands/ask/{artifacts.d.ts → harness/artifacts.d.ts} +0 -0
- /package/build/commands/ask/{artifacts.js → harness/artifacts.js} +0 -0
- /package/build/commands/ask/{claudeConfig.d.ts → harness/claudeConfig.d.ts} +0 -0
- /package/build/commands/ask/{claudeConfig.js → harness/claudeConfig.js} +0 -0
- /package/build/commands/ask/{pnpmShim.d.ts → harness/pnpmShim.d.ts} +0 -0
- /package/build/commands/ask/{pnpmShim.js → harness/pnpmShim.js} +0 -0
- /package/build/commands/ask/{completer.d.ts → input/completer.d.ts} +0 -0
- /package/build/commands/ask/{completer.js → input/completer.js} +0 -0
- /package/build/commands/ask/{prompt.d.ts → input/prompt.d.ts} +0 -0
- /package/build/commands/ask/{slash.d.ts → input/slash.d.ts} +0 -0
- /package/build/commands/ask/{typeAhead.d.ts → input/typeAhead.d.ts} +0 -0
- /package/build/commands/ask/{typeAhead.js → input/typeAhead.js} +0 -0
- /package/build/commands/ask/{history.js → persist/history.js} +0 -0
- /package/build/commands/ask/{persist.d.ts → persist/persist.d.ts} +0 -0
- /package/build/commands/ask/{persist.js → persist/persist.js} +0 -0
- /package/build/commands/ask/{state.d.ts → persist/state.d.ts} +0 -0
- /package/build/commands/ask/{state.js → persist/state.js} +0 -0
- /package/build/commands/ask/{thinking.d.ts → session/thinking.d.ts} +0 -0
- /package/build/commands/ask/{thinking.js → session/thinking.js} +0 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { type LocalTurnAccumulator } from "./usage.js";
|
|
2
|
+
/**
|
|
3
|
+
* A built-in tool Claude Code wants to run that `permissionMode` does not
|
|
4
|
+
* auto-approve (anything that writes or shells out under `allow-reads`).
|
|
5
|
+
*/
|
|
6
|
+
export type LocalToolApproval = {
|
|
7
|
+
approvalId: string;
|
|
8
|
+
toolCallId: string;
|
|
9
|
+
toolName: string;
|
|
10
|
+
/** Compact one-line rendering of the tool input, for the prompt. */
|
|
11
|
+
summary: string;
|
|
12
|
+
input: unknown;
|
|
13
|
+
};
|
|
14
|
+
/** A tool starting or finishing, so the caller can show what is happening. */
|
|
15
|
+
export type LocalToolActivity = {
|
|
16
|
+
kind: "start";
|
|
17
|
+
toolCallId: string;
|
|
18
|
+
toolName: string;
|
|
19
|
+
summary: string;
|
|
20
|
+
} | {
|
|
21
|
+
kind: "end";
|
|
22
|
+
toolCallId: string;
|
|
23
|
+
toolName: string;
|
|
24
|
+
isError: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Announced, then never run — a tool whose input stopped mid-stream, one
|
|
28
|
+
* that was refused, or a sibling whose approval request the harness lost.
|
|
29
|
+
* None of them report a result, so `end` never comes: a caller tracking
|
|
30
|
+
* what is live has to be told, or it shows that tool for the rest of the
|
|
31
|
+
* turn. `retractAbandonedCalls` decides which calls qualify and when.
|
|
32
|
+
*/
|
|
33
|
+
| {
|
|
34
|
+
kind: "dropped";
|
|
35
|
+
toolCallId: string;
|
|
36
|
+
toolName: string;
|
|
37
|
+
};
|
|
38
|
+
export type LocalStreamHandlers = {
|
|
39
|
+
onTextDelta?: (delta: string) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Decide whether the tool may run. Omitted (`--print`, non-interactive)
|
|
42
|
+
* means deny — the turn continues and the model reports what it could not
|
|
43
|
+
* do rather than silently running commands on the user's machine.
|
|
44
|
+
*/
|
|
45
|
+
onApproval?: (approval: LocalToolApproval) => Promise<boolean>;
|
|
46
|
+
onActivity?: (activity: LocalToolActivity) => void;
|
|
47
|
+
/** Path of a file the turn wrote or edited, as the tool named it. */
|
|
48
|
+
onFileTouched?: (path: string) => void;
|
|
49
|
+
/** Something worth saying that is not part of the reply. */
|
|
50
|
+
onNotice?: (message: string) => void;
|
|
51
|
+
};
|
|
52
|
+
export type LocalStreamOptions = LocalStreamHandlers & {
|
|
53
|
+
/** Aborts the turn; the harness interrupts Claude Code gracefully. */
|
|
54
|
+
abortSignal?: AbortSignal;
|
|
55
|
+
/**
|
|
56
|
+
* Fired when the stall watchdog gives up, before the turn is rejected.
|
|
57
|
+
* Should abort `abortSignal` so Claude Code stops rather than being torn
|
|
58
|
+
* down out from under a still-open bridge.
|
|
59
|
+
*/
|
|
60
|
+
onStall?: () => void;
|
|
61
|
+
};
|
|
62
|
+
export type StreamLike = {
|
|
63
|
+
fullStream: AsyncIterable<unknown>;
|
|
64
|
+
text: PromiseLike<string>;
|
|
65
|
+
};
|
|
66
|
+
export type ApprovalContinuation = {
|
|
67
|
+
approvalResponse: {
|
|
68
|
+
type: "tool-approval-response";
|
|
69
|
+
approvalId: string;
|
|
70
|
+
approved: boolean;
|
|
71
|
+
reason?: string;
|
|
72
|
+
};
|
|
73
|
+
toolCall: {
|
|
74
|
+
type: "tool-call";
|
|
75
|
+
toolCallId: string;
|
|
76
|
+
toolName: string;
|
|
77
|
+
input: unknown;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
/** The two harness calls a turn needs. Split out so tests can fake them. */
|
|
81
|
+
export type TurnDriver = {
|
|
82
|
+
start: () => Promise<StreamLike>;
|
|
83
|
+
continueWithApprovals: (continuations: readonly ApprovalContinuation[]) => Promise<StreamLike>;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Run one turn to completion, answering approval requests along the way.
|
|
87
|
+
*
|
|
88
|
+
* A turn suspends whenever Claude Code wants a tool `permissionMode` does not
|
|
89
|
+
* cover: the stream ends with the approvals still pending, and the turn only
|
|
90
|
+
* finishes once decisions are fed back in. Exported for tests.
|
|
91
|
+
*/
|
|
92
|
+
export declare function runPromptTurn(input: {
|
|
93
|
+
driver: TurnDriver;
|
|
94
|
+
handlers: LocalStreamHandlers | undefined;
|
|
95
|
+
accumulator?: LocalTurnAccumulator;
|
|
96
|
+
/**
|
|
97
|
+
* Filled with approvals the harness asked about and drained as each is
|
|
98
|
+
* answered, so a turn that ends mid-question leaves the unanswered ones
|
|
99
|
+
* behind for the caller to deny.
|
|
100
|
+
*/
|
|
101
|
+
unanswered?: LocalToolApproval[];
|
|
102
|
+
/** Overridden by tests; `Infinity` waits forever. */
|
|
103
|
+
stallTimeoutMs?: number;
|
|
104
|
+
/** The same, for the stream while a tool is executing. */
|
|
105
|
+
toolStallTimeoutMs?: number;
|
|
106
|
+
/**
|
|
107
|
+
* Called when the stall watchdog fires, before the turn is rejected — abort
|
|
108
|
+
* the harness stream so Claude Code does not keep running after we give up.
|
|
109
|
+
*/
|
|
110
|
+
onStall?: () => void;
|
|
111
|
+
}): Promise<string>;
|
|
112
|
+
/**
|
|
113
|
+
* The previous turn could not be wound down, so this session cannot take
|
|
114
|
+
* another prompt. Raised rather than pressed on with: the harness would either
|
|
115
|
+
* refuse the prompt itself or run it alongside the turn we failed to finish.
|
|
116
|
+
*
|
|
117
|
+
* The caller's recovery is to replace the session — nothing about a wedged
|
|
118
|
+
* runtime gets better by asking it again.
|
|
119
|
+
*/
|
|
120
|
+
export declare class HarnessTurnStuck extends Error {
|
|
121
|
+
constructor();
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* The turn produced nothing for `TURN_STALL_TIMEOUT_MS` while no tool was in
|
|
125
|
+
* flight. Common causes: a step that asked to run several confirmable tools at
|
|
126
|
+
* once (the harness only surfaces one approval), or the Claude Code bridge
|
|
127
|
+
* going silent. Recoverable — replace the session and ask again.
|
|
128
|
+
*/
|
|
129
|
+
export declare class HarnessTurnStalled extends Error {
|
|
130
|
+
constructor(timeoutMs: number, whileToolRunning?: boolean);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* The Claude Code bridge dropped mid-turn. Same recovery as a stall: the
|
|
134
|
+
* process behind the session is gone, so the next question needs a new one.
|
|
135
|
+
*/
|
|
136
|
+
export declare function isBridgeClosedError(error: unknown): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Wait for `work`, but give up after `timeoutMs` rather than blocking a
|
|
139
|
+
* teardown forever. Resolves either way; the caller has already decided that
|
|
140
|
+
* an unfinished result is better than waiting.
|
|
141
|
+
*
|
|
142
|
+
* Exported for tests.
|
|
143
|
+
*/
|
|
144
|
+
export declare function settleWithin(work: Promise<unknown>, timeoutMs: number): Promise<void>;
|
|
145
|
+
//# sourceMappingURL=turn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tur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