@linkshell/wire 0.2.0 → 0.2.2
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 +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/model.d.ts +222 -30
- package/dist/model.js +6 -0
- package/dist/model.js.map +1 -1
- package/dist/relay.d.ts +2 -2
- package/dist/rpc.d.ts +4253 -1853
- package/dist/rpc.js +21 -0
- package/dist/rpc.js.map +1 -1
- package/dist/updates.d.ts +1867 -560
- package/dist/updates.js +5 -0
- package/dist/updates.js.map +1 -1
- package/dist/workflow.d.ts +187 -0
- package/dist/workflow.js +35 -0
- package/dist/workflow.js.map +1 -0
- package/package.json +2 -2
- package/src/index.ts +1 -0
- package/src/model.ts +6 -0
- package/src/rpc.ts +21 -0
- package/src/updates.ts +5 -0
- package/src/workflow.ts +44 -0
package/dist/updates.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { permissionOptionSchema, questionAnswerSchema, questionSchema, sessionDriverSchema, sessionStateSchema, toolKindSchema } from "./model.js";
|
|
3
|
+
import { workflowAgentStateSchema, workflowSchema } from "./workflow.js";
|
|
3
4
|
// Session updates mirror ACP's `SessionUpdate` shapes (discriminated by
|
|
4
5
|
// `sessionUpdate`) so one renderer works for every agent. LinkShell-specific
|
|
5
6
|
// updates use the `ls_` prefix.
|
|
@@ -58,6 +59,10 @@ export const toolDetailSchema = z.discriminatedUnion("type", [
|
|
|
58
59
|
/** The sub-agent's role or type, e.g. "Explore". */
|
|
59
60
|
agentType: z.string().optional(),
|
|
60
61
|
model: z.string().optional(),
|
|
62
|
+
/** Agent outcome when a tool's coarse completed/failed state is insufficient. */
|
|
63
|
+
state: workflowAgentStateSchema.optional(),
|
|
64
|
+
/** A Claude workflow is a background run containing its own agents. Counts are observed, not a predicted total. */
|
|
65
|
+
workflow: workflowSchema.optional(),
|
|
61
66
|
}),
|
|
62
67
|
z.object({ type: z.literal("skill"), name: z.string(), description: z.string().optional() }),
|
|
63
68
|
z.object({ type: z.literal("web_search"), query: z.string().optional() }),
|
package/dist/updates.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updates.js","sourceRoot":"","sources":["../src/updates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,cAAc,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"updates.js","sourceRoot":"","sources":["../src/updates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,cAAc,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACnJ,OAAO,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEzE,wEAAwE;AACxE,6EAA6E;AAC7E,gCAAgC;AAEhC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC7D,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;IACvD,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;QACxB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC3B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAC3B,CAAC;IAC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AO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAC5B,CAAC;CACH,CAAC,CAAC;AAIH,sDAAsD;AACtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAChC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,MAAM,EAAE,mBAAmB;CAC5B,CAAC,CAAC"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const workflowStateSchema: z.ZodEnum<["running", "paused", "completed", "failed", "stopped"]>;
|
|
3
|
+
export type WorkflowState = z.infer<typeof workflowStateSchema>;
|
|
4
|
+
export declare const workflowAgentStateSchema: z.ZodEnum<["pending", "running", "paused", "completed", "failed", "stopped", "unknown"]>;
|
|
5
|
+
export type WorkflowAgentState = z.infer<typeof workflowAgentStateSchema>;
|
|
6
|
+
export declare const workflowAgentSchema: z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
/** Present only after the host has imported this agent's transcript. */
|
|
9
|
+
toolCallId: z.ZodOptional<z.ZodString>;
|
|
10
|
+
title: z.ZodString;
|
|
11
|
+
state: z.ZodEnum<["pending", "running", "paused", "completed", "failed", "stopped", "unknown"]>;
|
|
12
|
+
phaseId: z.ZodOptional<z.ZodString>;
|
|
13
|
+
model: z.ZodOptional<z.ZodString>;
|
|
14
|
+
tokens: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
toolCalls: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
startedAt: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
endedAt: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
result: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
id: string;
|
|
22
|
+
title: string;
|
|
23
|
+
state: "running" | "paused" | "completed" | "failed" | "stopped" | "pending" | "unknown";
|
|
24
|
+
toolCallId?: string | undefined;
|
|
25
|
+
phaseId?: string | undefined;
|
|
26
|
+
model?: string | undefined;
|
|
27
|
+
tokens?: number | undefined;
|
|
28
|
+
toolCalls?: number | undefined;
|
|
29
|
+
durationMs?: number | undefined;
|
|
30
|
+
startedAt?: number | undefined;
|
|
31
|
+
endedAt?: number | undefined;
|
|
32
|
+
result?: string | undefined;
|
|
33
|
+
}, {
|
|
34
|
+
id: string;
|
|
35
|
+
title: string;
|
|
36
|
+
state: "running" | "paused" | "completed" | "failed" | "stopped" | "pending" | "unknown";
|
|
37
|
+
toolCallId?: string | undefined;
|
|
38
|
+
phaseId?: string | undefined;
|
|
39
|
+
model?: string | undefined;
|
|
40
|
+
tokens?: number | undefined;
|
|
41
|
+
toolCalls?: number | undefined;
|
|
42
|
+
durationMs?: number | undefined;
|
|
43
|
+
startedAt?: number | undefined;
|
|
44
|
+
endedAt?: number | undefined;
|
|
45
|
+
result?: string | undefined;
|
|
46
|
+
}>;
|
|
47
|
+
export type WorkflowAgent = z.infer<typeof workflowAgentSchema>;
|
|
48
|
+
export declare const workflowPhaseSchema: z.ZodObject<{
|
|
49
|
+
id: z.ZodString;
|
|
50
|
+
title: z.ZodString;
|
|
51
|
+
order: z.ZodNumber;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
id: string;
|
|
54
|
+
title: string;
|
|
55
|
+
order: number;
|
|
56
|
+
}, {
|
|
57
|
+
id: string;
|
|
58
|
+
title: string;
|
|
59
|
+
order: number;
|
|
60
|
+
}>;
|
|
61
|
+
export type WorkflowPhase = z.infer<typeof workflowPhaseSchema>;
|
|
62
|
+
/** A complete run snapshot, independent of the loaded conversation window. */
|
|
63
|
+
export declare const workflowSchema: z.ZodObject<{
|
|
64
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
65
|
+
name: z.ZodOptional<z.ZodString>;
|
|
66
|
+
state: z.ZodOptional<z.ZodEnum<["running", "paused", "completed", "failed", "stopped"]>>;
|
|
67
|
+
/** Observed counts: a dynamic script may start more agents later. */
|
|
68
|
+
started: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
completed: z.ZodOptional<z.ZodNumber>;
|
|
70
|
+
tokens: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
startedAt: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
endedAt: z.ZodOptional<z.ZodNumber>;
|
|
74
|
+
phases: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
75
|
+
id: z.ZodString;
|
|
76
|
+
title: z.ZodString;
|
|
77
|
+
order: z.ZodNumber;
|
|
78
|
+
}, "strip", z.ZodTypeAny, {
|
|
79
|
+
id: string;
|
|
80
|
+
title: string;
|
|
81
|
+
order: number;
|
|
82
|
+
}, {
|
|
83
|
+
id: string;
|
|
84
|
+
title: string;
|
|
85
|
+
order: number;
|
|
86
|
+
}>, "many">>;
|
|
87
|
+
agents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
88
|
+
id: z.ZodString;
|
|
89
|
+
/** Present only after the host has imported this agent's transcript. */
|
|
90
|
+
toolCallId: z.ZodOptional<z.ZodString>;
|
|
91
|
+
title: z.ZodString;
|
|
92
|
+
state: z.ZodEnum<["pending", "running", "paused", "completed", "failed", "stopped", "unknown"]>;
|
|
93
|
+
phaseId: z.ZodOptional<z.ZodString>;
|
|
94
|
+
model: z.ZodOptional<z.ZodString>;
|
|
95
|
+
tokens: z.ZodOptional<z.ZodNumber>;
|
|
96
|
+
toolCalls: z.ZodOptional<z.ZodNumber>;
|
|
97
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
98
|
+
startedAt: z.ZodOptional<z.ZodNumber>;
|
|
99
|
+
endedAt: z.ZodOptional<z.ZodNumber>;
|
|
100
|
+
result: z.ZodOptional<z.ZodString>;
|
|
101
|
+
}, "strip", z.ZodTypeAny, {
|
|
102
|
+
id: string;
|
|
103
|
+
title: string;
|
|
104
|
+
state: "running" | "paused" | "completed" | "failed" | "stopped" | "pending" | "unknown";
|
|
105
|
+
toolCallId?: string | undefined;
|
|
106
|
+
phaseId?: string | undefined;
|
|
107
|
+
model?: string | undefined;
|
|
108
|
+
tokens?: number | undefined;
|
|
109
|
+
toolCalls?: number | undefined;
|
|
110
|
+
durationMs?: number | undefined;
|
|
111
|
+
startedAt?: number | undefined;
|
|
112
|
+
endedAt?: number | undefined;
|
|
113
|
+
result?: string | undefined;
|
|
114
|
+
}, {
|
|
115
|
+
id: string;
|
|
116
|
+
title: string;
|
|
117
|
+
state: "running" | "paused" | "completed" | "failed" | "stopped" | "pending" | "unknown";
|
|
118
|
+
toolCallId?: string | undefined;
|
|
119
|
+
phaseId?: string | undefined;
|
|
120
|
+
model?: string | undefined;
|
|
121
|
+
tokens?: number | undefined;
|
|
122
|
+
toolCalls?: number | undefined;
|
|
123
|
+
durationMs?: number | undefined;
|
|
124
|
+
startedAt?: number | undefined;
|
|
125
|
+
endedAt?: number | undefined;
|
|
126
|
+
result?: string | undefined;
|
|
127
|
+
}>, "many">>;
|
|
128
|
+
}, "strip", z.ZodTypeAny, {
|
|
129
|
+
completed?: number | undefined;
|
|
130
|
+
state?: "running" | "paused" | "completed" | "failed" | "stopped" | undefined;
|
|
131
|
+
tokens?: number | undefined;
|
|
132
|
+
durationMs?: number | undefined;
|
|
133
|
+
startedAt?: number | undefined;
|
|
134
|
+
endedAt?: number | undefined;
|
|
135
|
+
runId?: string | undefined;
|
|
136
|
+
name?: string | undefined;
|
|
137
|
+
started?: number | undefined;
|
|
138
|
+
phases?: {
|
|
139
|
+
id: string;
|
|
140
|
+
title: string;
|
|
141
|
+
order: number;
|
|
142
|
+
}[] | undefined;
|
|
143
|
+
agents?: {
|
|
144
|
+
id: string;
|
|
145
|
+
title: string;
|
|
146
|
+
state: "running" | "paused" | "completed" | "failed" | "stopped" | "pending" | "unknown";
|
|
147
|
+
toolCallId?: string | undefined;
|
|
148
|
+
phaseId?: string | undefined;
|
|
149
|
+
model?: string | undefined;
|
|
150
|
+
tokens?: number | undefined;
|
|
151
|
+
toolCalls?: number | undefined;
|
|
152
|
+
durationMs?: number | undefined;
|
|
153
|
+
startedAt?: number | undefined;
|
|
154
|
+
endedAt?: number | undefined;
|
|
155
|
+
result?: string | undefined;
|
|
156
|
+
}[] | undefined;
|
|
157
|
+
}, {
|
|
158
|
+
completed?: number | undefined;
|
|
159
|
+
state?: "running" | "paused" | "completed" | "failed" | "stopped" | undefined;
|
|
160
|
+
tokens?: number | undefined;
|
|
161
|
+
durationMs?: number | undefined;
|
|
162
|
+
startedAt?: number | undefined;
|
|
163
|
+
endedAt?: number | undefined;
|
|
164
|
+
runId?: string | undefined;
|
|
165
|
+
name?: string | undefined;
|
|
166
|
+
started?: number | undefined;
|
|
167
|
+
phases?: {
|
|
168
|
+
id: string;
|
|
169
|
+
title: string;
|
|
170
|
+
order: number;
|
|
171
|
+
}[] | undefined;
|
|
172
|
+
agents?: {
|
|
173
|
+
id: string;
|
|
174
|
+
title: string;
|
|
175
|
+
state: "running" | "paused" | "completed" | "failed" | "stopped" | "pending" | "unknown";
|
|
176
|
+
toolCallId?: string | undefined;
|
|
177
|
+
phaseId?: string | undefined;
|
|
178
|
+
model?: string | undefined;
|
|
179
|
+
tokens?: number | undefined;
|
|
180
|
+
toolCalls?: number | undefined;
|
|
181
|
+
durationMs?: number | undefined;
|
|
182
|
+
startedAt?: number | undefined;
|
|
183
|
+
endedAt?: number | undefined;
|
|
184
|
+
result?: string | undefined;
|
|
185
|
+
}[] | undefined;
|
|
186
|
+
}>;
|
|
187
|
+
export type Workflow = z.infer<typeof workflowSchema>;
|
package/dist/workflow.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const workflowStateSchema = z.enum(["running", "paused", "completed", "failed", "stopped"]);
|
|
3
|
+
export const workflowAgentStateSchema = z.enum(["pending", "running", "paused", "completed", "failed", "stopped", "unknown"]);
|
|
4
|
+
export const workflowAgentSchema = z.object({
|
|
5
|
+
id: z.string(),
|
|
6
|
+
/** Present only after the host has imported this agent's transcript. */
|
|
7
|
+
toolCallId: z.string().optional(),
|
|
8
|
+
title: z.string(),
|
|
9
|
+
state: workflowAgentStateSchema,
|
|
10
|
+
phaseId: z.string().optional(),
|
|
11
|
+
model: z.string().optional(),
|
|
12
|
+
tokens: z.number().nonnegative().optional(),
|
|
13
|
+
toolCalls: z.number().int().nonnegative().optional(),
|
|
14
|
+
durationMs: z.number().nonnegative().optional(),
|
|
15
|
+
startedAt: z.number().optional(),
|
|
16
|
+
endedAt: z.number().optional(),
|
|
17
|
+
result: z.string().optional(),
|
|
18
|
+
});
|
|
19
|
+
export const workflowPhaseSchema = z.object({ id: z.string(), title: z.string(), order: z.number() });
|
|
20
|
+
/** A complete run snapshot, independent of the loaded conversation window. */
|
|
21
|
+
export const workflowSchema = z.object({
|
|
22
|
+
runId: z.string().optional(),
|
|
23
|
+
name: z.string().optional(),
|
|
24
|
+
state: workflowStateSchema.optional(),
|
|
25
|
+
/** Observed counts: a dynamic script may start more agents later. */
|
|
26
|
+
started: z.number().int().nonnegative().optional(),
|
|
27
|
+
completed: z.number().int().nonnegative().optional(),
|
|
28
|
+
tokens: z.number().nonnegative().optional(),
|
|
29
|
+
durationMs: z.number().nonnegative().optional(),
|
|
30
|
+
startedAt: z.number().optional(),
|
|
31
|
+
endedAt: z.number().optional(),
|
|
32
|
+
phases: z.array(workflowPhaseSchema).optional(),
|
|
33
|
+
agents: z.array(workflowAgentSchema).optional(),
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=workflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.js","sourceRoot":"","sources":["../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+
"version": "0.2.2",
|
|
4
4
|
"description": "Wire protocol for LinkShell v2: session model, JSON-RPC methods, end-to-end encryption and the relay client.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
|
-
"build": "tsc -p tsconfig.json",
|
|
45
|
+
"build": "rm -rf dist *.tsbuildinfo && tsc -p tsconfig.json",
|
|
46
46
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
47
47
|
"test": "vitest run"
|
|
48
48
|
}
|
package/src/index.ts
CHANGED
package/src/model.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { workflowAgentStateSchema, workflowSchema } from "./workflow.js";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* How far LinkShell can take a given agent. The UI renders capabilities from
|
|
@@ -149,6 +150,7 @@ export type QueuedMessage = z.infer<typeof queuedMessageSchema>;
|
|
|
149
150
|
/** A sub-agent a session started: the tool call it runs under, and how it is doing. */
|
|
150
151
|
export const subagentInfoSchema = z.object({
|
|
151
152
|
toolCallId: z.string(),
|
|
153
|
+
parentToolCallId: z.string().optional(),
|
|
152
154
|
/** What it was asked to do. */
|
|
153
155
|
task: z.string(),
|
|
154
156
|
/** Its role or type, e.g. "Explore". */
|
|
@@ -157,6 +159,10 @@ export const subagentInfoSchema = z.object({
|
|
|
157
159
|
failed: z.boolean().optional(),
|
|
158
160
|
startedAt: z.number(),
|
|
159
161
|
endedAt: z.number().optional(),
|
|
162
|
+
state: workflowAgentStateSchema.optional(),
|
|
163
|
+
workflow: workflowSchema.optional(),
|
|
164
|
+
/** Orders list snapshots against events arriving while the request is in flight. */
|
|
165
|
+
lastSeq: z.number().int().nonnegative().optional(),
|
|
160
166
|
});
|
|
161
167
|
export type SubagentInfo = z.infer<typeof subagentInfoSchema>;
|
|
162
168
|
|
package/src/rpc.ts
CHANGED
|
@@ -488,6 +488,27 @@ export const methods = {
|
|
|
488
488
|
displays: z.array(z.object({ index: z.number().int(), name: z.string() })),
|
|
489
489
|
}),
|
|
490
490
|
},
|
|
491
|
+
/**
|
|
492
|
+
* Whether this computer's screen can be watched and controlled: the capture
|
|
493
|
+
* program, and the two permissions the system gives to an app by name. With
|
|
494
|
+
* `ask`, the system puts its own question for the first one missing and opens
|
|
495
|
+
* its settings page there, on the computer.
|
|
496
|
+
*/
|
|
497
|
+
"screen.access": {
|
|
498
|
+
params: z.object({ ask: z.boolean().optional() }),
|
|
499
|
+
result: z.object({
|
|
500
|
+
/** This kind of computer can show its screen at all. */
|
|
501
|
+
supported: z.boolean(),
|
|
502
|
+
ffmpeg: z.boolean(),
|
|
503
|
+
/** May record the screen / post pointer and key events; null where that isn't known. */
|
|
504
|
+
recording: z.boolean().nullable(),
|
|
505
|
+
control: z.boolean().nullable(),
|
|
506
|
+
/** The app the system lists for these permissions: the one to allow. */
|
|
507
|
+
app: z.string().optional(),
|
|
508
|
+
/** Why the answer is missing, or what stands in the way besides the permissions. */
|
|
509
|
+
problem: z.string().optional(),
|
|
510
|
+
}),
|
|
511
|
+
},
|
|
491
512
|
/** Bytes to the host's end of a stream (base64). */
|
|
492
513
|
"proxy.write": {
|
|
493
514
|
params: z.object({ streamId: z.string().min(1), data: z.string().max(2_000_000) }),
|
package/src/updates.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { permissionOptionSchema, questionAnswerSchema, questionSchema, sessionDriverSchema, sessionStateSchema, toolKindSchema } from "./model.js";
|
|
3
|
+
import { workflowAgentStateSchema, workflowSchema } from "./workflow.js";
|
|
3
4
|
|
|
4
5
|
// Session updates mirror ACP's `SessionUpdate` shapes (discriminated by
|
|
5
6
|
// `sessionUpdate`) so one renderer works for every agent. LinkShell-specific
|
|
@@ -68,6 +69,10 @@ export const toolDetailSchema = z.discriminatedUnion("type", [
|
|
|
68
69
|
/** The sub-agent's role or type, e.g. "Explore". */
|
|
69
70
|
agentType: z.string().optional(),
|
|
70
71
|
model: z.string().optional(),
|
|
72
|
+
/** Agent outcome when a tool's coarse completed/failed state is insufficient. */
|
|
73
|
+
state: workflowAgentStateSchema.optional(),
|
|
74
|
+
/** A Claude workflow is a background run containing its own agents. Counts are observed, not a predicted total. */
|
|
75
|
+
workflow: workflowSchema.optional(),
|
|
71
76
|
}),
|
|
72
77
|
z.object({ type: z.literal("skill"), name: z.string(), description: z.string().optional() }),
|
|
73
78
|
z.object({ type: z.literal("web_search"), query: z.string().optional() }),
|
package/src/workflow.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const workflowStateSchema = z.enum(["running", "paused", "completed", "failed", "stopped"]);
|
|
4
|
+
export type WorkflowState = z.infer<typeof workflowStateSchema>;
|
|
5
|
+
|
|
6
|
+
export const workflowAgentStateSchema = z.enum(["pending", "running", "paused", "completed", "failed", "stopped", "unknown"]);
|
|
7
|
+
export type WorkflowAgentState = z.infer<typeof workflowAgentStateSchema>;
|
|
8
|
+
|
|
9
|
+
export const workflowAgentSchema = z.object({
|
|
10
|
+
id: z.string(),
|
|
11
|
+
/** Present only after the host has imported this agent's transcript. */
|
|
12
|
+
toolCallId: z.string().optional(),
|
|
13
|
+
title: z.string(),
|
|
14
|
+
state: workflowAgentStateSchema,
|
|
15
|
+
phaseId: z.string().optional(),
|
|
16
|
+
model: z.string().optional(),
|
|
17
|
+
tokens: z.number().nonnegative().optional(),
|
|
18
|
+
toolCalls: z.number().int().nonnegative().optional(),
|
|
19
|
+
durationMs: z.number().nonnegative().optional(),
|
|
20
|
+
startedAt: z.number().optional(),
|
|
21
|
+
endedAt: z.number().optional(),
|
|
22
|
+
result: z.string().optional(),
|
|
23
|
+
});
|
|
24
|
+
export type WorkflowAgent = z.infer<typeof workflowAgentSchema>;
|
|
25
|
+
|
|
26
|
+
export const workflowPhaseSchema = z.object({ id: z.string(), title: z.string(), order: z.number() });
|
|
27
|
+
export type WorkflowPhase = z.infer<typeof workflowPhaseSchema>;
|
|
28
|
+
|
|
29
|
+
/** A complete run snapshot, independent of the loaded conversation window. */
|
|
30
|
+
export const workflowSchema = z.object({
|
|
31
|
+
runId: z.string().optional(),
|
|
32
|
+
name: z.string().optional(),
|
|
33
|
+
state: workflowStateSchema.optional(),
|
|
34
|
+
/** Observed counts: a dynamic script may start more agents later. */
|
|
35
|
+
started: z.number().int().nonnegative().optional(),
|
|
36
|
+
completed: z.number().int().nonnegative().optional(),
|
|
37
|
+
tokens: z.number().nonnegative().optional(),
|
|
38
|
+
durationMs: z.number().nonnegative().optional(),
|
|
39
|
+
startedAt: z.number().optional(),
|
|
40
|
+
endedAt: z.number().optional(),
|
|
41
|
+
phases: z.array(workflowPhaseSchema).optional(),
|
|
42
|
+
agents: z.array(workflowAgentSchema).optional(),
|
|
43
|
+
});
|
|
44
|
+
export type Workflow = z.infer<typeof workflowSchema>;
|