@smithers-orchestrator/cli 0.17.0 → 0.18.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/CliExitCode-dlFKbqup.d.ts +12 -0
- package/dist/HijackCandidate-FxLeKpcZ.d.ts +13 -0
- package/dist/SemanticToolDefinition-C1UT6pZk.d.ts +71 -0
- package/dist/SupervisorOptions-DtiPbGFx.d.ts +27 -0
- package/dist/agent-commands/agentAddWizard.d.ts +18 -0
- package/dist/agent-commands/regenerateAgentsTsIfPresent.d.ts +15 -0
- package/dist/agent-commands/runAgentAdd.d.ts +83 -0
- package/dist/agent-detection.d.ts +27 -0
- package/dist/ask.d.ts +29 -0
- package/dist/chat.d.ts +96 -0
- package/dist/diff.d.ts +64 -0
- package/dist/event-categories.d.ts +26 -0
- package/dist/find-db.d.ts +47 -0
- package/dist/format.d.ts +35 -0
- package/dist/hijack-session.d.ts +25 -0
- package/dist/hijack.d.ts +54 -0
- package/dist/index.d.ts +1 -0
- package/dist/mcp/semantic-server.d.ts +30 -0
- package/dist/mcp/semantic-tools.d.ts +4 -0
- package/dist/mdx-plugin.d.ts +3 -0
- package/dist/node-detail.d.ts +143 -0
- package/dist/output.d.ts +31 -0
- package/dist/resume-detached.d.ts +17 -0
- package/dist/rewind.d.ts +28 -0
- package/dist/scheduler.d.ts +3 -0
- package/dist/smithersRuntime.d.ts +23 -0
- package/dist/supervisor.d.ts +44 -0
- package/dist/tree.d.ts +51 -0
- package/dist/util/errorMessage.d.ts +40 -0
- package/dist/util/exitCodes.d.ts +19 -0
- package/dist/watch.d.ts +44 -0
- package/dist/why-diagnosis.d.ts +56 -0
- package/dist/workflow-pack.d.ts +38 -0
- package/dist/workflows.d.ts +35 -0
- package/package.json +20 -19
- package/src/workflow-pack.js +652 -19
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Uniform CLI exit codes for the devtools live-run commands.
|
|
3
|
+
*
|
|
4
|
+
* - 0 ok
|
|
5
|
+
* - 1 user error (bad flags, missing id, declined confirmation)
|
|
6
|
+
* - 2 server error (transport, backend, unexpected condition)
|
|
7
|
+
* - 3 declined (user aborted at an interactive prompt)
|
|
8
|
+
* - 130 sigint (ctrl-c during a watch/stream)
|
|
9
|
+
*/
|
|
10
|
+
type CliExitCode = 0 | 1 | 2 | 3 | 130;
|
|
11
|
+
|
|
12
|
+
export type { CliExitCode as C };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type HijackCandidate = {
|
|
2
|
+
runId: string;
|
|
3
|
+
nodeId: string;
|
|
4
|
+
iteration: number;
|
|
5
|
+
attempt: number;
|
|
6
|
+
engine: string;
|
|
7
|
+
mode: "native-cli" | "conversation";
|
|
8
|
+
resume?: string;
|
|
9
|
+
messages?: unknown[];
|
|
10
|
+
cwd: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type { HijackCandidate as H };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { findAndOpenDb } from './find-db.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param {Partial<SemanticToolContext>} [options]
|
|
6
|
+
* @returns {SemanticToolDefinition[]}
|
|
7
|
+
*/
|
|
8
|
+
declare function createSemanticToolDefinitions(options?: Partial<SemanticToolContext>): SemanticToolDefinition$1[];
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {{ content: Array<{ type: "text"; text: string; }>; structuredContent: { ok: boolean; data?: unknown; error?: z.infer<typeof toolErrorSchema>; }; isError?: boolean; }} SemanticToolCallResult
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* @typedef {{ cwd: () => string; openDb: typeof findAndOpenDb; }} SemanticToolContext
|
|
14
|
+
*/
|
|
15
|
+
/** @typedef {import("./SemanticToolDefinition.ts").SemanticToolDefinition} SemanticToolDefinition */
|
|
16
|
+
declare const SEMANTIC_TOOL_NAMES: string[];
|
|
17
|
+
type SemanticToolCallResult$1 = {
|
|
18
|
+
content: Array<{
|
|
19
|
+
type: "text";
|
|
20
|
+
text: string;
|
|
21
|
+
}>;
|
|
22
|
+
structuredContent: {
|
|
23
|
+
ok: boolean;
|
|
24
|
+
data?: unknown;
|
|
25
|
+
error?: z.infer<typeof toolErrorSchema>;
|
|
26
|
+
};
|
|
27
|
+
isError?: boolean;
|
|
28
|
+
};
|
|
29
|
+
type SemanticToolContext = {
|
|
30
|
+
cwd: () => string;
|
|
31
|
+
openDb: typeof findAndOpenDb;
|
|
32
|
+
};
|
|
33
|
+
type SemanticToolDefinition$1 = SemanticToolDefinition;
|
|
34
|
+
|
|
35
|
+
declare const toolErrorSchema: z.ZodObject<{
|
|
36
|
+
code: z.ZodString;
|
|
37
|
+
message: z.ZodString;
|
|
38
|
+
details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
39
|
+
docsUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
|
|
42
|
+
type SemanticToolError = {
|
|
43
|
+
code: string;
|
|
44
|
+
message: string;
|
|
45
|
+
details?: Record<string, unknown> | null;
|
|
46
|
+
docsUrl?: string | null;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
type SemanticToolCallResult = {
|
|
50
|
+
content: Array<{
|
|
51
|
+
type: "text";
|
|
52
|
+
text: string;
|
|
53
|
+
}>;
|
|
54
|
+
structuredContent: {
|
|
55
|
+
ok: boolean;
|
|
56
|
+
data?: unknown;
|
|
57
|
+
error?: SemanticToolError;
|
|
58
|
+
};
|
|
59
|
+
isError?: boolean;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
type SemanticToolDefinition = {
|
|
63
|
+
name: (typeof SEMANTIC_TOOL_NAMES)[number];
|
|
64
|
+
description: string;
|
|
65
|
+
inputSchema: z.ZodTypeAny;
|
|
66
|
+
outputSchema: z.ZodTypeAny;
|
|
67
|
+
annotations: Record<string, boolean>;
|
|
68
|
+
handler: (input: any) => Promise<SemanticToolCallResult>;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export { type SemanticToolDefinition as S, SEMANTIC_TOOL_NAMES as a, type SemanticToolCallResult$1 as b, type SemanticToolContext as c, type SemanticToolDefinition$1 as d, createSemanticToolDefinitions as e };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SmithersDb } from '@smithers-orchestrator/db/adapter';
|
|
2
|
+
|
|
3
|
+
type SupervisorSpawnClaim = {
|
|
4
|
+
claimOwnerId: string;
|
|
5
|
+
claimHeartbeatAtMs: number;
|
|
6
|
+
restoreRuntimeOwnerId?: string | null;
|
|
7
|
+
restoreHeartbeatAtMs?: number | null;
|
|
8
|
+
};
|
|
9
|
+
type SupervisorDeps = {
|
|
10
|
+
now: () => number;
|
|
11
|
+
workflowExists: (workflowPath: string) => boolean;
|
|
12
|
+
parseRuntimeOwnerPid: (runtimeOwnerId: string | null | undefined) => number | null;
|
|
13
|
+
isPidAlive: (pid: number) => boolean;
|
|
14
|
+
spawnResumeDetached: (workflowPath: string, runId: string, claim?: SupervisorSpawnClaim) => number | null;
|
|
15
|
+
};
|
|
16
|
+
type SupervisorOptions = {
|
|
17
|
+
adapter: SmithersDb;
|
|
18
|
+
pollIntervalMs?: number;
|
|
19
|
+
staleThresholdMs?: number;
|
|
20
|
+
maxConcurrent?: number;
|
|
21
|
+
dryRun?: boolean;
|
|
22
|
+
supervisorId?: string;
|
|
23
|
+
supervisorRunId?: string;
|
|
24
|
+
deps?: Partial<SupervisorDeps>;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type { SupervisorSpawnClaim as S, SupervisorOptions as a };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as _smithers_orchestrator_accounts from '@smithers-orchestrator/accounts';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Interactive `smithers agents add` wizard. Loops until the user is done
|
|
5
|
+
* adding accounts. Returns the list of labels that were added in this session.
|
|
6
|
+
*
|
|
7
|
+
* @param {{ env?: NodeJS.ProcessEnv; cwd?: string; loop?: boolean; skipIntro?: boolean }} [opts]
|
|
8
|
+
* @returns {Promise<string[]>}
|
|
9
|
+
*/
|
|
10
|
+
declare function agentAddWizard(opts?: {
|
|
11
|
+
env?: NodeJS.ProcessEnv;
|
|
12
|
+
cwd?: string;
|
|
13
|
+
loop?: boolean;
|
|
14
|
+
skipIntro?: boolean;
|
|
15
|
+
}): Promise<string[]>;
|
|
16
|
+
type AccountProvider = _smithers_orchestrator_accounts.AccountProvider;
|
|
17
|
+
|
|
18
|
+
export { type AccountProvider, agentAddWizard };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* If the current working directory contains a `.smithers/agents.ts` that was
|
|
3
|
+
* previously generated by smithers (sentinel comment present), regenerate it
|
|
4
|
+
* to reflect the current accounts registry. User-edited files are left alone.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} [cwd]
|
|
7
|
+
* @returns {{ rewritten: boolean; path: string | null; reason?: string }}
|
|
8
|
+
*/
|
|
9
|
+
declare function regenerateAgentsTsIfPresent(cwd?: string): {
|
|
10
|
+
rewritten: boolean;
|
|
11
|
+
path: string | null;
|
|
12
|
+
reason?: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { regenerateAgentsTsIfPresent };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as _smithers_orchestrator_accounts from '@smithers-orchestrator/accounts';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {{
|
|
5
|
+
* provider: AccountProvider;
|
|
6
|
+
* label: string;
|
|
7
|
+
* configDir?: string;
|
|
8
|
+
* apiKey?: string;
|
|
9
|
+
* model?: string;
|
|
10
|
+
* skipLogin?: boolean;
|
|
11
|
+
* force?: boolean;
|
|
12
|
+
* replace?: boolean;
|
|
13
|
+
* env?: NodeJS.ProcessEnv;
|
|
14
|
+
* cwd?: string;
|
|
15
|
+
* loginInstructions?: (cmd: string) => void;
|
|
16
|
+
* }} RunAgentAddInput
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Non-interactive entry point: register an account from already-resolved
|
|
20
|
+
* inputs. Used by both the flag-driven CLI and the clack wizard. Returns the
|
|
21
|
+
* persisted account plus a summary of the register/regen operation.
|
|
22
|
+
*
|
|
23
|
+
* @param {RunAgentAddInput} input
|
|
24
|
+
*/
|
|
25
|
+
declare function runAgentAdd(input: RunAgentAddInput): {
|
|
26
|
+
ok: boolean;
|
|
27
|
+
reason: string;
|
|
28
|
+
detail: string;
|
|
29
|
+
configDir: string;
|
|
30
|
+
account?: undefined;
|
|
31
|
+
regen?: undefined;
|
|
32
|
+
} | {
|
|
33
|
+
ok: boolean;
|
|
34
|
+
account: _smithers_orchestrator_accounts.Account;
|
|
35
|
+
regen: {
|
|
36
|
+
rewritten: boolean;
|
|
37
|
+
path: string | null;
|
|
38
|
+
reason?: string;
|
|
39
|
+
};
|
|
40
|
+
reason?: undefined;
|
|
41
|
+
detail?: undefined;
|
|
42
|
+
configDir?: undefined;
|
|
43
|
+
} | {
|
|
44
|
+
ok: boolean;
|
|
45
|
+
reason: string;
|
|
46
|
+
detail: string;
|
|
47
|
+
configDir?: undefined;
|
|
48
|
+
account?: undefined;
|
|
49
|
+
regen?: undefined;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Quick health check: spawn `<bin> --version` (or equivalent) under the
|
|
53
|
+
* account's env vars and report whether the CLI starts cleanly. Best-effort —
|
|
54
|
+
* a non-zero exit is reported but does not throw.
|
|
55
|
+
*
|
|
56
|
+
* @param {{ provider: AccountProvider; configDir?: string; apiKey?: string }} account
|
|
57
|
+
* @returns {{ ran: boolean; exitCode: number | null; cmd: string }}
|
|
58
|
+
*/
|
|
59
|
+
declare function pingAccount(account: {
|
|
60
|
+
provider: AccountProvider;
|
|
61
|
+
configDir?: string;
|
|
62
|
+
apiKey?: string;
|
|
63
|
+
}): {
|
|
64
|
+
ran: boolean;
|
|
65
|
+
exitCode: number | null;
|
|
66
|
+
cmd: string;
|
|
67
|
+
};
|
|
68
|
+
type RunAgentAddInput = {
|
|
69
|
+
provider: AccountProvider;
|
|
70
|
+
label: string;
|
|
71
|
+
configDir?: string;
|
|
72
|
+
apiKey?: string;
|
|
73
|
+
model?: string;
|
|
74
|
+
skipLogin?: boolean;
|
|
75
|
+
force?: boolean;
|
|
76
|
+
replace?: boolean;
|
|
77
|
+
env?: NodeJS.ProcessEnv;
|
|
78
|
+
cwd?: string;
|
|
79
|
+
loginInstructions?: (cmd: string) => void;
|
|
80
|
+
};
|
|
81
|
+
type AccountProvider = _smithers_orchestrator_accounts.AccountProvider;
|
|
82
|
+
|
|
83
|
+
export { type AccountProvider, type RunAgentAddInput, pingAccount, runAgentAdd };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
type AgentAvailabilityStatus$1 = "likely-subscription" | "api-key" | "binary-only" | "unavailable";
|
|
2
|
+
|
|
3
|
+
type AgentAvailability$1 = {
|
|
4
|
+
id: "claude" | "codex" | "gemini" | "pi" | "kimi" | "amp";
|
|
5
|
+
binary: string;
|
|
6
|
+
hasBinary: boolean;
|
|
7
|
+
hasAuthSignal: boolean;
|
|
8
|
+
hasApiKeySignal: boolean;
|
|
9
|
+
status: AgentAvailabilityStatus$1;
|
|
10
|
+
score: number;
|
|
11
|
+
usable: boolean;
|
|
12
|
+
checks: string[];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {NodeJS.ProcessEnv} [env]
|
|
17
|
+
* @returns {AgentAvailability[]}
|
|
18
|
+
*/
|
|
19
|
+
declare function detectAvailableAgents(env?: NodeJS.ProcessEnv): AgentAvailability[];
|
|
20
|
+
/**
|
|
21
|
+
* @param {NodeJS.ProcessEnv} [env]
|
|
22
|
+
*/
|
|
23
|
+
declare function generateAgentsTs(env?: NodeJS.ProcessEnv): string;
|
|
24
|
+
type AgentAvailability = AgentAvailability$1;
|
|
25
|
+
type AgentAvailabilityStatus = AgentAvailabilityStatus$1;
|
|
26
|
+
|
|
27
|
+
export { type AgentAvailability, type AgentAvailabilityStatus, detectAvailableAgents, generateAgentsTs };
|
package/dist/ask.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as _smithers_orchestrator_agents_agent_contract from '@smithers-orchestrator/agents/agent-contract';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {string | undefined} question
|
|
5
|
+
* @param {string} cwd
|
|
6
|
+
* @param {AskOptions} [options]
|
|
7
|
+
* @returns {Promise<void>}
|
|
8
|
+
*/
|
|
9
|
+
declare function ask(question: string | undefined, cwd: string, options?: AskOptions): Promise<void>;
|
|
10
|
+
type AskAgentId = (typeof ASK_AGENT_IDS)[number];
|
|
11
|
+
type AskOptions = {
|
|
12
|
+
agent?: AskAgentId;
|
|
13
|
+
listAgents?: boolean;
|
|
14
|
+
dumpPrompt?: boolean;
|
|
15
|
+
toolSurface?: SmithersToolSurface;
|
|
16
|
+
noMcp?: boolean;
|
|
17
|
+
printBootstrap?: boolean;
|
|
18
|
+
};
|
|
19
|
+
type SmithersToolSurface = _smithers_orchestrator_agents_agent_contract.SmithersToolSurface;
|
|
20
|
+
/**
|
|
21
|
+
* @typedef {typeof ASK_AGENT_IDS[number]} AskAgentId
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* @typedef {{ agent?: AskAgentId; listAgents?: boolean; dumpPrompt?: boolean; toolSurface?: SmithersToolSurface; noMcp?: boolean; printBootstrap?: boolean; }} AskOptions
|
|
25
|
+
*/
|
|
26
|
+
/** @typedef {import("@smithers-orchestrator/agents/agent-contract").SmithersToolSurface} SmithersToolSurface */
|
|
27
|
+
declare const ASK_AGENT_IDS: string[];
|
|
28
|
+
|
|
29
|
+
export { type AskAgentId, type AskOptions, type SmithersToolSurface, ask };
|
package/dist/chat.d.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
type ParsedNodeOutputEvent$1 = {
|
|
2
|
+
seq: number;
|
|
3
|
+
timestampMs: number;
|
|
4
|
+
nodeId: string;
|
|
5
|
+
iteration: number;
|
|
6
|
+
attempt: number;
|
|
7
|
+
stream: "stdout" | "stderr";
|
|
8
|
+
text: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
type ChatOutputEvent$1 = {
|
|
12
|
+
seq: number;
|
|
13
|
+
timestampMs: number;
|
|
14
|
+
type: string;
|
|
15
|
+
payloadJson: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type ChatAttemptRow$1 = {
|
|
19
|
+
runId: string;
|
|
20
|
+
nodeId: string;
|
|
21
|
+
iteration: number;
|
|
22
|
+
attempt: number;
|
|
23
|
+
state: string;
|
|
24
|
+
startedAtMs: number;
|
|
25
|
+
finishedAtMs?: number | null;
|
|
26
|
+
cached?: boolean | null;
|
|
27
|
+
metaJson?: string | null;
|
|
28
|
+
responseText?: string | null;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
type ChatAttemptMeta$1 = {
|
|
32
|
+
kind?: string | null;
|
|
33
|
+
prompt?: string | null;
|
|
34
|
+
label?: string | null;
|
|
35
|
+
agentId?: string | null;
|
|
36
|
+
agentModel?: string | null;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** @typedef {import("./ChatAttemptMeta.ts").ChatAttemptMeta} ChatAttemptMeta */
|
|
40
|
+
/** @typedef {import("./ChatAttemptRow.ts").ChatAttemptRow} ChatAttemptRow */
|
|
41
|
+
/** @typedef {import("./ChatOutputEvent.ts").ChatOutputEvent} ChatOutputEvent */
|
|
42
|
+
/** @typedef {import("./ParsedNodeOutputEvent.ts").ParsedNodeOutputEvent} ParsedNodeOutputEvent */
|
|
43
|
+
/**
|
|
44
|
+
* @param {string | null} [metaJson]
|
|
45
|
+
* @returns {ChatAttemptMeta}
|
|
46
|
+
*/
|
|
47
|
+
declare function parseChatAttemptMeta(metaJson?: string | null): ChatAttemptMeta;
|
|
48
|
+
/**
|
|
49
|
+
* @param {Pick<ChatAttemptRow, "nodeId" | "iteration" | "attempt">} attempt
|
|
50
|
+
*/
|
|
51
|
+
declare function chatAttemptKey(attempt: Pick<ChatAttemptRow, "nodeId" | "iteration" | "attempt">): string;
|
|
52
|
+
/**
|
|
53
|
+
* @param {ChatOutputEvent} event
|
|
54
|
+
* @returns {ParsedNodeOutputEvent | null}
|
|
55
|
+
*/
|
|
56
|
+
declare function parseNodeOutputEvent(event: ChatOutputEvent): ParsedNodeOutputEvent | null;
|
|
57
|
+
/**
|
|
58
|
+
* @param {ChatOutputEvent} event
|
|
59
|
+
* @returns {ParsedNodeOutputEvent | null}
|
|
60
|
+
*/
|
|
61
|
+
declare function parseAgentEvent(event: ChatOutputEvent): ParsedNodeOutputEvent | null;
|
|
62
|
+
/**
|
|
63
|
+
* @param {ChatAttemptRow} attempt
|
|
64
|
+
* @param {ReadonlySet<string>} outputAttemptKeys
|
|
65
|
+
* @returns {boolean}
|
|
66
|
+
*/
|
|
67
|
+
declare function isAgentAttempt(attempt: ChatAttemptRow, outputAttemptKeys: ReadonlySet<string>): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* @param {ChatAttemptRow[]} attempts
|
|
70
|
+
* @param {ReadonlySet<string>} outputAttemptKeys
|
|
71
|
+
* @param {boolean} includeAll
|
|
72
|
+
* @returns {ChatAttemptRow[]}
|
|
73
|
+
*/
|
|
74
|
+
declare function selectChatAttempts(attempts: ChatAttemptRow[], outputAttemptKeys: ReadonlySet<string>, includeAll: boolean): ChatAttemptRow[];
|
|
75
|
+
/**
|
|
76
|
+
* @param {ChatAttemptRow} attempt
|
|
77
|
+
* @returns {string}
|
|
78
|
+
*/
|
|
79
|
+
declare function formatChatAttemptHeader(attempt: ChatAttemptRow): string;
|
|
80
|
+
/**
|
|
81
|
+
* @param {{ baseMs: number; timestampMs: number; role: "user" | "assistant" | "stderr"; attempt: Pick<ChatAttemptRow, "nodeId" | "iteration" | "attempt">; text: string; }} options
|
|
82
|
+
* @returns {string}
|
|
83
|
+
*/
|
|
84
|
+
declare function formatChatBlock(options: {
|
|
85
|
+
baseMs: number;
|
|
86
|
+
timestampMs: number;
|
|
87
|
+
role: "user" | "assistant" | "stderr";
|
|
88
|
+
attempt: Pick<ChatAttemptRow, "nodeId" | "iteration" | "attempt">;
|
|
89
|
+
text: string;
|
|
90
|
+
}): string;
|
|
91
|
+
type ChatAttemptMeta = ChatAttemptMeta$1;
|
|
92
|
+
type ChatAttemptRow = ChatAttemptRow$1;
|
|
93
|
+
type ChatOutputEvent = ChatOutputEvent$1;
|
|
94
|
+
type ParsedNodeOutputEvent = ParsedNodeOutputEvent$1;
|
|
95
|
+
|
|
96
|
+
export { type ChatAttemptMeta, type ChatAttemptRow, type ChatOutputEvent, type ParsedNodeOutputEvent, chatAttemptKey, formatChatAttemptHeader, formatChatBlock, isAgentAttempt, parseAgentEvent, parseChatAttemptMeta, parseNodeOutputEvent, selectChatAttempts };
|
package/dist/diff.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { SmithersDb } from '@smithers-orchestrator/db/adapter';
|
|
2
|
+
|
|
3
|
+
type RunDiffCommandResult$1 = {
|
|
4
|
+
exitCode: number;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
type RunDiffCommandInput$1 = {
|
|
8
|
+
adapter: SmithersDb;
|
|
9
|
+
runId: string;
|
|
10
|
+
nodeId: string;
|
|
11
|
+
iteration?: number;
|
|
12
|
+
stat?: boolean;
|
|
13
|
+
json?: boolean;
|
|
14
|
+
color?: boolean;
|
|
15
|
+
stdout: NodeJS.WritableStream;
|
|
16
|
+
stderr: NodeJS.WritableStream;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type DiffBundleLike$1 = {
|
|
20
|
+
patches: Array<{
|
|
21
|
+
path?: string;
|
|
22
|
+
diff?: string;
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @param {DiffBundleLike} bundle
|
|
28
|
+
* @param {{ color?: boolean }} [options]
|
|
29
|
+
* @returns {string}
|
|
30
|
+
*/
|
|
31
|
+
declare function renderUnifiedDiff(bundle: DiffBundleLike, options?: {
|
|
32
|
+
color?: boolean;
|
|
33
|
+
}): string;
|
|
34
|
+
/**
|
|
35
|
+
* Render a stat summary. Accepts either:
|
|
36
|
+
* - a server-side `summary` response ({ filesChanged, added, removed, files })
|
|
37
|
+
* - or a legacy `DiffBundle` (computes summary on the fly, streaming
|
|
38
|
+
* through patches so no intermediate array of full patch text is held).
|
|
39
|
+
*
|
|
40
|
+
* @param {DiffBundleLike | { summary: { filesChanged: number; added: number; removed: number; files: Array<{ path: string; added: number; removed: number }> } }} input
|
|
41
|
+
* @returns {string}
|
|
42
|
+
*/
|
|
43
|
+
declare function renderDiffStat(input: DiffBundleLike | {
|
|
44
|
+
summary: {
|
|
45
|
+
filesChanged: number;
|
|
46
|
+
added: number;
|
|
47
|
+
removed: number;
|
|
48
|
+
files: Array<{
|
|
49
|
+
path: string;
|
|
50
|
+
added: number;
|
|
51
|
+
removed: number;
|
|
52
|
+
}>;
|
|
53
|
+
};
|
|
54
|
+
}): string;
|
|
55
|
+
/**
|
|
56
|
+
* @param {RunDiffCommandInput} input
|
|
57
|
+
* @returns {Promise<RunDiffCommandResult>}
|
|
58
|
+
*/
|
|
59
|
+
declare function runDiffOnce(input: RunDiffCommandInput): Promise<RunDiffCommandResult>;
|
|
60
|
+
type DiffBundleLike = DiffBundleLike$1;
|
|
61
|
+
type RunDiffCommandInput = RunDiffCommandInput$1;
|
|
62
|
+
type RunDiffCommandResult = RunDiffCommandResult$1;
|
|
63
|
+
|
|
64
|
+
export { type DiffBundleLike, type RunDiffCommandInput, type RunDiffCommandResult, renderDiffStat, renderUnifiedDiff, runDiffOnce };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SmithersEvent } from '@smithers-orchestrator/observability/SmithersEvent';
|
|
2
|
+
|
|
3
|
+
type SmithersEventType$1 = SmithersEvent["type"];
|
|
4
|
+
|
|
5
|
+
type EventCategory$1 = "agent" | "approval" | "frame" | "memory" | "node" | "openapi" | "output" | "revert" | "run" | "sandbox" | "scorer" | "snapshot" | "supervisor" | "timer" | "token" | "tool-call" | "workflow";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @param {string} raw
|
|
9
|
+
* @returns {EventCategory | null}
|
|
10
|
+
*/
|
|
11
|
+
declare function normalizeEventCategory(raw: string): EventCategory | null;
|
|
12
|
+
/**
|
|
13
|
+
* @param {string} type
|
|
14
|
+
* @returns {EventCategory | null}
|
|
15
|
+
*/
|
|
16
|
+
declare function eventCategoryForType(type: string): EventCategory | null;
|
|
17
|
+
/**
|
|
18
|
+
* @param {EventCategory} category
|
|
19
|
+
* @returns {readonly SmithersEventType[]}
|
|
20
|
+
*/
|
|
21
|
+
declare function eventTypesForCategory(category: EventCategory): readonly SmithersEventType[];
|
|
22
|
+
declare const EVENT_CATEGORY_VALUES: string[];
|
|
23
|
+
type EventCategory = EventCategory$1;
|
|
24
|
+
type SmithersEventType = SmithersEventType$1;
|
|
25
|
+
|
|
26
|
+
export { EVENT_CATEGORY_VALUES, type EventCategory, type SmithersEventType, eventCategoryForType, eventTypesForCategory, normalizeEventCategory };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { SmithersDb } from '@smithers-orchestrator/db/adapter';
|
|
2
|
+
|
|
3
|
+
type FindDbWaitOptions$1 = {
|
|
4
|
+
timeoutMs?: number;
|
|
5
|
+
intervalMs?: number;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
/** @typedef {import("./FindDbWaitOptions.ts").FindDbWaitOptions} FindDbWaitOptions */
|
|
9
|
+
/**
|
|
10
|
+
* Walk from `from` (default: cwd) upward looking for smithers.db.
|
|
11
|
+
* Returns the absolute path to the database file.
|
|
12
|
+
*
|
|
13
|
+
* @param {string} [from]
|
|
14
|
+
* @returns {string}
|
|
15
|
+
*/
|
|
16
|
+
declare function findSmithersDb(from?: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* @param {string} [from]
|
|
19
|
+
* @param {FindDbWaitOptions} [opts]
|
|
20
|
+
* @returns {Promise<string>}
|
|
21
|
+
*/
|
|
22
|
+
declare function waitForSmithersDb(from?: string, opts?: FindDbWaitOptions): Promise<string>;
|
|
23
|
+
/**
|
|
24
|
+
* Open a smithers.db file and return a SmithersDb adapter with cleanup function.
|
|
25
|
+
*
|
|
26
|
+
* @param {string} dbPath
|
|
27
|
+
* @returns {Promise<{ adapter: SmithersDb; cleanup: () => void }>}
|
|
28
|
+
*/
|
|
29
|
+
declare function openSmithersDb(dbPath: string): Promise<{
|
|
30
|
+
adapter: SmithersDb;
|
|
31
|
+
cleanup: () => void;
|
|
32
|
+
}>;
|
|
33
|
+
/**
|
|
34
|
+
* Find and open the nearest smithers.db.
|
|
35
|
+
*
|
|
36
|
+
* @param {string} [from]
|
|
37
|
+
* @param {FindDbWaitOptions} [opts]
|
|
38
|
+
* @returns {Promise<{ adapter: SmithersDb; dbPath: string; cleanup: () => void }>}
|
|
39
|
+
*/
|
|
40
|
+
declare function findAndOpenDb(from?: string, opts?: FindDbWaitOptions): Promise<{
|
|
41
|
+
adapter: SmithersDb;
|
|
42
|
+
dbPath: string;
|
|
43
|
+
cleanup: () => void;
|
|
44
|
+
}>;
|
|
45
|
+
type FindDbWaitOptions = FindDbWaitOptions$1;
|
|
46
|
+
|
|
47
|
+
export { type FindDbWaitOptions, findAndOpenDb, findSmithersDb, openSmithersDb, waitForSmithersDb };
|
package/dist/format.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
type FormatEventLineOptions$1 = {
|
|
2
|
+
includeTimestamp?: boolean;
|
|
3
|
+
truncatePayloadAt?: number;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Format a timestamp as relative age: "2m ago", "1h ago", "3d ago"
|
|
8
|
+
*/
|
|
9
|
+
declare function formatAge(ms: any): string;
|
|
10
|
+
/**
|
|
11
|
+
* Format elapsed time compactly: "5m 23s", "1h 2m", "45s"
|
|
12
|
+
*/
|
|
13
|
+
declare function formatElapsedCompact(startMs: any, endMs: any): string;
|
|
14
|
+
/**
|
|
15
|
+
* Format an elapsed time as HH:MM:SS from a base timestamp.
|
|
16
|
+
*/
|
|
17
|
+
declare function formatTimestamp(baseMs: any, eventMs: any): string;
|
|
18
|
+
/**
|
|
19
|
+
* Format an elapsed time as a signed relative offset:
|
|
20
|
+
* +MM:SS.mmm (or +HH:MM:SS.mmm when hours > 0).
|
|
21
|
+
*/
|
|
22
|
+
declare function formatRelativeOffset(baseMs: any, eventMs: any): string;
|
|
23
|
+
/**
|
|
24
|
+
* @param {string} type
|
|
25
|
+
* @param {string} text
|
|
26
|
+
* @returns {string}
|
|
27
|
+
*/
|
|
28
|
+
declare function colorizeEventText(type: string, text: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Format a single event from _smithers_events into a log line.
|
|
31
|
+
*/
|
|
32
|
+
declare function formatEventLine(event: any, baseMs: any, options: any): string;
|
|
33
|
+
type FormatEventLineOptions = FormatEventLineOptions$1;
|
|
34
|
+
|
|
35
|
+
export { type FormatEventLineOptions, colorizeEventText, formatAge, formatElapsedCompact, formatEventLine, formatRelativeOffset, formatTimestamp };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as _smithers_orchestrator_db_adapter from '@smithers-orchestrator/db/adapter';
|
|
2
|
+
import { H as HijackCandidate$1 } from './HijackCandidate-FxLeKpcZ.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param {SmithersDb} adapter
|
|
6
|
+
* @param {HijackCandidate} candidate
|
|
7
|
+
* @param {unknown[]} messages
|
|
8
|
+
*/
|
|
9
|
+
declare function persistConversationHijackHandoff(adapter: SmithersDb, candidate: HijackCandidate, messages: unknown[]): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* @param {SmithersDb} adapter
|
|
12
|
+
* @param {HijackCandidate & { mode: "conversation"; messages: unknown[] }} candidate
|
|
13
|
+
* @returns {Promise<{ code: number; messages: unknown[] }>}
|
|
14
|
+
*/
|
|
15
|
+
declare function launchConversationHijackSession(adapter: SmithersDb, candidate: HijackCandidate & {
|
|
16
|
+
mode: "conversation";
|
|
17
|
+
messages: unknown[];
|
|
18
|
+
}): Promise<{
|
|
19
|
+
code: number;
|
|
20
|
+
messages: unknown[];
|
|
21
|
+
}>;
|
|
22
|
+
type HijackCandidate = HijackCandidate$1;
|
|
23
|
+
type SmithersDb = _smithers_orchestrator_db_adapter.SmithersDb;
|
|
24
|
+
|
|
25
|
+
export { type HijackCandidate, type SmithersDb, launchConversationHijackSession, persistConversationHijackHandoff };
|
package/dist/hijack.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as _smithers_orchestrator_db_adapter from '@smithers-orchestrator/db/adapter';
|
|
2
|
+
import { H as HijackCandidate$1 } from './HijackCandidate-FxLeKpcZ.js';
|
|
3
|
+
|
|
4
|
+
type NativeHijackEngine$1 = "claude-code" | "codex" | "gemini" | "pi" | "kimi" | "forge" | "amp";
|
|
5
|
+
|
|
6
|
+
type HijackLaunchSpec$1 = {
|
|
7
|
+
command: string;
|
|
8
|
+
args: string[];
|
|
9
|
+
cwd: string;
|
|
10
|
+
env: Record<string, string>;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @param {SmithersDb} adapter
|
|
15
|
+
* @param {string} runId
|
|
16
|
+
* @param {string} [target]
|
|
17
|
+
* @returns {Promise<HijackCandidate | null>}
|
|
18
|
+
*/
|
|
19
|
+
declare function resolveHijackCandidate(adapter: SmithersDb, runId: string, target?: string): Promise<HijackCandidate | null>;
|
|
20
|
+
/**
|
|
21
|
+
* @param {SmithersDb} adapter
|
|
22
|
+
* @param {string} runId
|
|
23
|
+
* @param {{ target?: string; timeoutMs?: number }} [options]
|
|
24
|
+
* @returns {Promise<HijackCandidate>}
|
|
25
|
+
*/
|
|
26
|
+
declare function waitForHijackCandidate(adapter: SmithersDb, runId: string, options?: {
|
|
27
|
+
target?: string;
|
|
28
|
+
timeoutMs?: number;
|
|
29
|
+
}): Promise<HijackCandidate>;
|
|
30
|
+
/**
|
|
31
|
+
* @param {HijackCandidate} candidate
|
|
32
|
+
* @returns {HijackLaunchSpec}
|
|
33
|
+
*/
|
|
34
|
+
declare function buildHijackLaunchSpec(candidate: HijackCandidate): HijackLaunchSpec;
|
|
35
|
+
/**
|
|
36
|
+
* @param {HijackCandidate} candidate
|
|
37
|
+
* @returns {candidate is HijackCandidate & { mode: "native-cli"; engine: NativeHijackEngine; resume: string }}
|
|
38
|
+
*/
|
|
39
|
+
declare function isNativeHijackCandidate(candidate: HijackCandidate): candidate is HijackCandidate & {
|
|
40
|
+
mode: "native-cli";
|
|
41
|
+
engine: NativeHijackEngine;
|
|
42
|
+
resume: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* @param {HijackLaunchSpec} spec
|
|
46
|
+
* @returns {Promise<number>}
|
|
47
|
+
*/
|
|
48
|
+
declare function launchHijackSession(spec: HijackLaunchSpec): Promise<number>;
|
|
49
|
+
type HijackCandidate = HijackCandidate$1;
|
|
50
|
+
type HijackLaunchSpec = HijackLaunchSpec$1;
|
|
51
|
+
type NativeHijackEngine = NativeHijackEngine$1;
|
|
52
|
+
type SmithersDb = _smithers_orchestrator_db_adapter.SmithersDb;
|
|
53
|
+
|
|
54
|
+
export { type HijackCandidate, type HijackLaunchSpec, type NativeHijackEngine, type SmithersDb, buildHijackLaunchSpec, isNativeHijackCandidate, launchHijackSession, resolveHijackCandidate, waitForHijackCandidate };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|