@reasonlayer/sdk 0.0.1-rc.3
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/LICENSE +201 -0
- package/README.md +35 -0
- package/bin/rl.mjs +75 -0
- package/dist/builder.d.ts +38 -0
- package/dist/builder.js +41 -0
- package/dist/bundler/index.d.ts +32 -0
- package/dist/bundler/index.js +143 -0
- package/dist/bundler/node.d.ts +10 -0
- package/dist/bundler/node.js +55 -0
- package/dist/cli/args.d.ts +9 -0
- package/dist/cli/args.js +71 -0
- package/dist/cli/config.d.ts +38 -0
- package/dist/cli/config.js +94 -0
- package/dist/cli/convex.d.ts +9 -0
- package/dist/cli/convex.js +25 -0
- package/dist/cli/format.d.ts +11 -0
- package/dist/cli/format.js +140 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +721 -0
- package/dist/cli/keychain.d.ts +21 -0
- package/dist/cli/keychain.js +100 -0
- package/dist/cli/operations.d.ts +106 -0
- package/dist/cli/operations.js +623 -0
- package/dist/cli/sdk-package.d.ts +18 -0
- package/dist/cli/sdk-package.js +45 -0
- package/dist/cli/storage-upload.d.ts +9 -0
- package/dist/cli/storage-upload.js +21 -0
- package/dist/cli/watcher-compile.d.ts +1 -0
- package/dist/cli/watcher-compile.js +20 -0
- package/dist/cli/watcher-process.d.ts +1 -0
- package/dist/cli/watcher-process.js +312 -0
- package/dist/cli/workspace-files.d.ts +12 -0
- package/dist/cli/workspace-files.js +91 -0
- package/dist/cli/workspace-local.d.ts +27 -0
- package/dist/cli/workspace-local.js +310 -0
- package/dist/cli/workspace-session.d.ts +13 -0
- package/dist/cli/workspace-session.js +12 -0
- package/dist/compile.d.ts +27 -0
- package/dist/compile.js +834 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +5 -0
- package/dist/schedule-validation.d.ts +1 -0
- package/dist/schedule-validation.js +16 -0
- package/dist/selector-schema.d.ts +26 -0
- package/dist/selector-schema.js +780 -0
- package/dist/selectors.d.ts +25 -0
- package/dist/selectors.js +99 -0
- package/dist/testkit.d.ts +32 -0
- package/dist/testkit.js +161 -0
- package/dist/types.d.ts +184 -0
- package/dist/types.js +110 -0
- package/node_modules/@reasonlayer/integrations/dist/catalog.d.ts +4937 -0
- package/node_modules/@reasonlayer/integrations/dist/catalog.js +20 -0
- package/node_modules/@reasonlayer/integrations/dist/generated/slack.d.ts +3014 -0
- package/node_modules/@reasonlayer/integrations/dist/generated/slack.js +3101 -0
- package/node_modules/@reasonlayer/integrations/dist/index.d.ts +2 -0
- package/node_modules/@reasonlayer/integrations/dist/index.js +1 -0
- package/node_modules/@reasonlayer/integrations/dist/internal/definitions.d.ts +44 -0
- package/node_modules/@reasonlayer/integrations/dist/internal/definitions.js +52 -0
- package/node_modules/@reasonlayer/integrations/dist/internal/transport.d.ts +7 -0
- package/node_modules/@reasonlayer/integrations/dist/internal/transport.js +48 -0
- package/node_modules/@reasonlayer/integrations/dist/testkit.d.ts +1 -0
- package/node_modules/@reasonlayer/integrations/dist/testkit.js +1 -0
- package/node_modules/@reasonlayer/integrations/package.json +26 -0
- package/node_modules/@reasonlayer/protocol/dist/environments.d.ts +7 -0
- package/node_modules/@reasonlayer/protocol/dist/environments.js +7 -0
- package/node_modules/@reasonlayer/protocol/dist/events.d.ts +313 -0
- package/node_modules/@reasonlayer/protocol/dist/events.js +20 -0
- package/node_modules/@reasonlayer/protocol/dist/index.d.ts +18 -0
- package/node_modules/@reasonlayer/protocol/dist/index.js +9 -0
- package/node_modules/@reasonlayer/protocol/dist/ir.d.ts +252 -0
- package/node_modules/@reasonlayer/protocol/dist/ir.js +116 -0
- package/node_modules/@reasonlayer/protocol/dist/permissions.d.ts +5 -0
- package/node_modules/@reasonlayer/protocol/dist/permissions.js +30 -0
- package/node_modules/@reasonlayer/protocol/dist/readmodels.d.ts +617 -0
- package/node_modules/@reasonlayer/protocol/dist/readmodels.js +36 -0
- package/node_modules/@reasonlayer/protocol/dist/runtime.d.ts +67 -0
- package/node_modules/@reasonlayer/protocol/dist/runtime.js +66 -0
- package/node_modules/@reasonlayer/protocol/dist/scheduling.d.ts +69 -0
- package/node_modules/@reasonlayer/protocol/dist/scheduling.js +126 -0
- package/node_modules/@reasonlayer/protocol/dist/selector.d.ts +23 -0
- package/node_modules/@reasonlayer/protocol/dist/selector.js +77 -0
- package/node_modules/@reasonlayer/protocol/dist/tasks.d.ts +69 -0
- package/node_modules/@reasonlayer/protocol/dist/tasks.js +6 -0
- package/node_modules/@reasonlayer/protocol/dist/validate.d.ts +6 -0
- package/node_modules/@reasonlayer/protocol/dist/validate.js +18 -0
- package/node_modules/@reasonlayer/protocol/package.json +21 -0
- package/node_modules/@reasonlayer/runner/dist/environment-materializer.d.ts +13 -0
- package/node_modules/@reasonlayer/runner/dist/environment-materializer.js +92 -0
- package/node_modules/@reasonlayer/runner/dist/flue-transcript.d.ts +17 -0
- package/node_modules/@reasonlayer/runner/dist/flue-transcript.js +182 -0
- package/node_modules/@reasonlayer/runner/dist/index.d.ts +184 -0
- package/node_modules/@reasonlayer/runner/dist/index.js +884 -0
- package/node_modules/@reasonlayer/runner/dist/mcp-supervisor.d.ts +15 -0
- package/node_modules/@reasonlayer/runner/dist/mcp-supervisor.js +142 -0
- package/node_modules/@reasonlayer/runner/dist/sandbox-env.d.ts +36 -0
- package/node_modules/@reasonlayer/runner/dist/sandbox-env.js +171 -0
- package/node_modules/@reasonlayer/runner/dist/task-child.d.ts +1 -0
- package/node_modules/@reasonlayer/runner/dist/task-child.js +72 -0
- package/node_modules/@reasonlayer/runner/package.json +21 -0
- package/package.json +65 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AgentEvent } from "@reasonlayer/protocol";
|
|
2
|
+
export type FlueEvent = Record<string, any>;
|
|
3
|
+
export declare class FlueTranscriptMapper {
|
|
4
|
+
private readonly turnSeqByTurnId;
|
|
5
|
+
private nextTurnSeq;
|
|
6
|
+
private readonly pendingTools;
|
|
7
|
+
private readonly pendingTasks;
|
|
8
|
+
private readonly taskUsage;
|
|
9
|
+
map(event: FlueEvent): AgentEvent[];
|
|
10
|
+
private turnSeqFor;
|
|
11
|
+
private turn;
|
|
12
|
+
private tool;
|
|
13
|
+
private task;
|
|
14
|
+
private log;
|
|
15
|
+
terminalError(seq: number, error: unknown): AgentEvent;
|
|
16
|
+
private foldTaskUsage;
|
|
17
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
export class FlueTranscriptMapper {
|
|
2
|
+
turnSeqByTurnId = new Map();
|
|
3
|
+
nextTurnSeq = 0;
|
|
4
|
+
pendingTools = new Map();
|
|
5
|
+
pendingTasks = new Map();
|
|
6
|
+
taskUsage = new Map();
|
|
7
|
+
map(event) {
|
|
8
|
+
const turnSeq = event.turnId === undefined ? undefined : this.turnSeqFor(String(event.turnId));
|
|
9
|
+
const isTaskBoundary = event.type === "task_start" || event.type === "task";
|
|
10
|
+
if (event.taskId !== undefined && !isTaskBoundary) {
|
|
11
|
+
if (event.type === "turn")
|
|
12
|
+
this.foldTaskUsage(String(event.taskId), event);
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
switch (event.type) {
|
|
16
|
+
case "turn":
|
|
17
|
+
return [this.turn(event, turnSeq)];
|
|
18
|
+
case "tool_start":
|
|
19
|
+
this.pendingTools.set(String(event.toolCallId), {
|
|
20
|
+
toolName: String(event.toolName),
|
|
21
|
+
...(event.args !== undefined ? { args: event.args } : {}),
|
|
22
|
+
...(turnSeq !== undefined ? { turnSeq } : {}),
|
|
23
|
+
});
|
|
24
|
+
return [];
|
|
25
|
+
case "tool":
|
|
26
|
+
return [this.tool(event, turnSeq)];
|
|
27
|
+
case "task_start":
|
|
28
|
+
this.pendingTasks.set(String(event.taskId), {
|
|
29
|
+
...(typeof event.agent === "string" ? { agent: event.agent } : {}),
|
|
30
|
+
...(typeof event.prompt === "string" ? { prompt: event.prompt } : {}),
|
|
31
|
+
...(turnSeq !== undefined ? { turnSeq } : {}),
|
|
32
|
+
});
|
|
33
|
+
return [];
|
|
34
|
+
case "task":
|
|
35
|
+
return [this.task(event, turnSeq)];
|
|
36
|
+
case "log":
|
|
37
|
+
return [this.log(event, turnSeq)];
|
|
38
|
+
default:
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
turnSeqFor(turnId) {
|
|
43
|
+
const existing = this.turnSeqByTurnId.get(turnId);
|
|
44
|
+
if (existing !== undefined)
|
|
45
|
+
return existing;
|
|
46
|
+
const assigned = this.nextTurnSeq++;
|
|
47
|
+
this.turnSeqByTurnId.set(turnId, assigned);
|
|
48
|
+
return assigned;
|
|
49
|
+
}
|
|
50
|
+
turn(event, turnSeq) {
|
|
51
|
+
const usage = usageFromTurn(event);
|
|
52
|
+
const text = textFromTurn(event);
|
|
53
|
+
const finishReason = typeof event.response?.finishReason === "string" ? event.response.finishReason : undefined;
|
|
54
|
+
const purpose = event.purpose === "agent" || event.purpose === "compaction" ? event.purpose : undefined;
|
|
55
|
+
return {
|
|
56
|
+
type: "agent.turn",
|
|
57
|
+
seq: event.eventIndex,
|
|
58
|
+
...(turnSeq !== undefined ? { turnSeq } : {}),
|
|
59
|
+
level: event.isError ? "error" : "info",
|
|
60
|
+
ts: millis(event.timestamp),
|
|
61
|
+
data: {
|
|
62
|
+
...(usage.model ? { model: usage.model } : {}),
|
|
63
|
+
...(text !== undefined ? { text } : {}),
|
|
64
|
+
...(finishReason !== undefined ? { finishReason } : {}),
|
|
65
|
+
...(purpose !== undefined ? { purpose } : {}),
|
|
66
|
+
usage,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
tool(event, turnSeq) {
|
|
71
|
+
const pending = this.pendingTools.get(String(event.toolCallId));
|
|
72
|
+
this.pendingTools.delete(String(event.toolCallId));
|
|
73
|
+
const assignedTurnSeq = pending?.turnSeq ?? turnSeq;
|
|
74
|
+
return {
|
|
75
|
+
type: "agent.tool",
|
|
76
|
+
seq: event.eventIndex,
|
|
77
|
+
...(assignedTurnSeq !== undefined ? { turnSeq: assignedTurnSeq } : {}),
|
|
78
|
+
level: event.isError ? "error" : "info",
|
|
79
|
+
ts: millis(event.timestamp),
|
|
80
|
+
data: {
|
|
81
|
+
toolName: String(event.toolName),
|
|
82
|
+
...(pending?.args !== undefined ? { args: pending.args } : {}),
|
|
83
|
+
...(event.result !== undefined ? { result: event.result } : {}),
|
|
84
|
+
ok: !event.isError,
|
|
85
|
+
durationMs: Number(event.durationMs ?? 0),
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
task(event, turnSeq) {
|
|
90
|
+
const pending = this.pendingTasks.get(String(event.taskId));
|
|
91
|
+
this.pendingTasks.delete(String(event.taskId));
|
|
92
|
+
const usage = this.taskUsage.get(String(event.taskId)) ?? {
|
|
93
|
+
inputTokens: 0,
|
|
94
|
+
outputTokens: 0,
|
|
95
|
+
costUsd: 0,
|
|
96
|
+
};
|
|
97
|
+
this.taskUsage.delete(String(event.taskId));
|
|
98
|
+
const assignedTurnSeq = pending?.turnSeq ?? turnSeq;
|
|
99
|
+
return {
|
|
100
|
+
type: "agent.task",
|
|
101
|
+
seq: event.eventIndex,
|
|
102
|
+
...(assignedTurnSeq !== undefined ? { turnSeq: assignedTurnSeq } : {}),
|
|
103
|
+
level: event.isError ? "error" : "info",
|
|
104
|
+
ts: millis(event.timestamp),
|
|
105
|
+
data: {
|
|
106
|
+
...(event.agent ?? pending?.agent ? { agent: event.agent ?? pending?.agent } : {}),
|
|
107
|
+
...(pending?.prompt !== undefined ? { prompt: pending.prompt } : {}),
|
|
108
|
+
...(event.result !== undefined ? { result: event.result } : {}),
|
|
109
|
+
ok: !event.isError,
|
|
110
|
+
durationMs: Number(event.durationMs ?? 0),
|
|
111
|
+
usage,
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
log(event, turnSeq) {
|
|
116
|
+
return {
|
|
117
|
+
type: "agent.log",
|
|
118
|
+
seq: event.eventIndex,
|
|
119
|
+
...(turnSeq !== undefined ? { turnSeq } : {}),
|
|
120
|
+
level: event.level === "debug" ||
|
|
121
|
+
event.level === "warn" ||
|
|
122
|
+
event.level === "error"
|
|
123
|
+
? event.level
|
|
124
|
+
: "info",
|
|
125
|
+
ts: millis(event.timestamp),
|
|
126
|
+
data: {
|
|
127
|
+
message: String(event.message ?? ""),
|
|
128
|
+
...(event.attributes ? { fields: event.attributes } : {}),
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
terminalError(seq, error) {
|
|
133
|
+
const message = error instanceof Error
|
|
134
|
+
? error.message
|
|
135
|
+
: typeof error === "object" && error && "message" in error
|
|
136
|
+
? String(error.message)
|
|
137
|
+
: String(error ?? "unknown error");
|
|
138
|
+
const kind = error instanceof Error ? error.name : undefined;
|
|
139
|
+
return {
|
|
140
|
+
type: "agent.error",
|
|
141
|
+
seq,
|
|
142
|
+
level: "error",
|
|
143
|
+
ts: Date.now(),
|
|
144
|
+
data: { message, ...(kind ? { kind } : {}) },
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
foldTaskUsage(taskId, event) {
|
|
148
|
+
const usage = usageFromTurn(event);
|
|
149
|
+
const current = this.taskUsage.get(taskId) ?? { inputTokens: 0, outputTokens: 0, costUsd: 0 };
|
|
150
|
+
this.taskUsage.set(taskId, {
|
|
151
|
+
...(usage.model ? { model: usage.model } : current.model ? { model: current.model } : {}),
|
|
152
|
+
inputTokens: current.inputTokens + usage.inputTokens,
|
|
153
|
+
outputTokens: current.outputTokens + usage.outputTokens,
|
|
154
|
+
costUsd: current.costUsd + usage.costUsd,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function usageFromTurn(event) {
|
|
159
|
+
const usage = event.response?.usage;
|
|
160
|
+
return {
|
|
161
|
+
...(event.response?.responseModel ? { model: String(event.response.responseModel) } : {}),
|
|
162
|
+
inputTokens: Number(usage?.input ?? 0),
|
|
163
|
+
outputTokens: Number(usage?.output ?? 0),
|
|
164
|
+
costUsd: Number(usage?.cost?.total ?? 0),
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function textFromTurn(event) {
|
|
168
|
+
const content = event.response?.output?.content;
|
|
169
|
+
if (!Array.isArray(content))
|
|
170
|
+
return undefined;
|
|
171
|
+
const text = content
|
|
172
|
+
.filter((block) => block?.type === "text" && typeof block.text === "string")
|
|
173
|
+
.map((block) => block.text)
|
|
174
|
+
.join("");
|
|
175
|
+
return text || undefined;
|
|
176
|
+
}
|
|
177
|
+
function millis(value) {
|
|
178
|
+
if (typeof value !== "string")
|
|
179
|
+
return Date.now();
|
|
180
|
+
const parsed = Date.parse(value);
|
|
181
|
+
return Number.isNaN(parsed) ? Date.now() : parsed;
|
|
182
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { type AgentEvent, type HostIR, type RunReadModel, type TaskResult, type TaskSpec } from "@reasonlayer/protocol";
|
|
2
|
+
import type { SessionEnv, ToolDefinition } from "@flue/runtime";
|
|
3
|
+
export interface RunnerConfig {
|
|
4
|
+
convexUrl: string;
|
|
5
|
+
token: string;
|
|
6
|
+
}
|
|
7
|
+
export interface RunnerBackendConfig {
|
|
8
|
+
convexUrl: string;
|
|
9
|
+
}
|
|
10
|
+
export interface RunDeviceClaimLoopOptions extends RunnerBackendConfig {
|
|
11
|
+
deviceToken?: string;
|
|
12
|
+
deviceTokenProvider?: () => Promise<string>;
|
|
13
|
+
runnerId?: string;
|
|
14
|
+
pollIntervalMs?: number;
|
|
15
|
+
leaseMs?: number;
|
|
16
|
+
once?: boolean;
|
|
17
|
+
cacheDir?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface RunDispatchedTaskOptions extends RunnerBackendConfig {
|
|
20
|
+
taskId: string;
|
|
21
|
+
dispatchToken: string;
|
|
22
|
+
sandboxId?: string;
|
|
23
|
+
runnerId?: string;
|
|
24
|
+
leaseMs?: number;
|
|
25
|
+
cacheDir?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface RunTestRunOptions extends RunnerConfig {
|
|
28
|
+
runId: string;
|
|
29
|
+
executorToken: string;
|
|
30
|
+
runnerId?: string;
|
|
31
|
+
pollIntervalMs?: number;
|
|
32
|
+
leaseMs?: number;
|
|
33
|
+
cacheDir?: string;
|
|
34
|
+
concurrency?: number;
|
|
35
|
+
signal?: AbortSignal;
|
|
36
|
+
client?: RunnerClient;
|
|
37
|
+
executor?: TaskExecutor;
|
|
38
|
+
}
|
|
39
|
+
export interface ClaimedTask {
|
|
40
|
+
task: TaskSpec;
|
|
41
|
+
taskToken: string;
|
|
42
|
+
}
|
|
43
|
+
export interface RunnerClient {
|
|
44
|
+
query<T>(name: string, args: Record<string, unknown>): Promise<T>;
|
|
45
|
+
mutation<T>(name: string, args: Record<string, unknown>): Promise<T>;
|
|
46
|
+
action<T>(name: string, args: Record<string, unknown>): Promise<T>;
|
|
47
|
+
}
|
|
48
|
+
export interface TaskSource {
|
|
49
|
+
readonly label: string;
|
|
50
|
+
readonly stopWhenIdle?: boolean;
|
|
51
|
+
readonly taskOptions?: Pick<RunClaimOptions, "verifyDeviceEnvironments">;
|
|
52
|
+
claim(client: RunnerClient, runnerId: string, leaseMs: number | undefined): Promise<ClaimedTask | null>;
|
|
53
|
+
}
|
|
54
|
+
export interface TaskExecutor {
|
|
55
|
+
run(claim: ClaimedTask, options: {
|
|
56
|
+
cacheDir?: string;
|
|
57
|
+
leaseMs?: number;
|
|
58
|
+
materializeEnvironments?: boolean;
|
|
59
|
+
verifyDeviceEnvironments?: boolean;
|
|
60
|
+
signal?: AbortSignal;
|
|
61
|
+
}): Promise<TaskResult>;
|
|
62
|
+
}
|
|
63
|
+
export interface RunClaimOptions {
|
|
64
|
+
cacheDir?: string;
|
|
65
|
+
leaseMs?: number;
|
|
66
|
+
materializeEnvironments?: boolean;
|
|
67
|
+
verifyDeviceEnvironments?: boolean;
|
|
68
|
+
signal?: AbortSignal;
|
|
69
|
+
/** Test seam; production uses RunnerConvexClient. */
|
|
70
|
+
client?: RunnerClient;
|
|
71
|
+
/** Test seam; production derives this from the lease duration. Clamped to the shared lease floor. */
|
|
72
|
+
heartbeatIntervalMs?: number;
|
|
73
|
+
/** Test seam; production runs each task in a killable child process group. */
|
|
74
|
+
processAdapter?: TaskProcessAdapter;
|
|
75
|
+
}
|
|
76
|
+
export interface RunTaskLoopOptions extends RunnerBackendConfig {
|
|
77
|
+
source: TaskSource;
|
|
78
|
+
executor?: TaskExecutor;
|
|
79
|
+
runnerId?: string;
|
|
80
|
+
pollIntervalMs?: number;
|
|
81
|
+
leaseMs?: number;
|
|
82
|
+
once?: boolean;
|
|
83
|
+
cacheDir?: string;
|
|
84
|
+
materializeEnvironments?: boolean;
|
|
85
|
+
verifyDeviceEnvironments?: boolean;
|
|
86
|
+
signal?: AbortSignal;
|
|
87
|
+
client?: RunnerClient;
|
|
88
|
+
}
|
|
89
|
+
export interface TaskProcessReporter {
|
|
90
|
+
push(event: AgentEvent): Promise<void>;
|
|
91
|
+
}
|
|
92
|
+
export interface TaskProcessRunOptions {
|
|
93
|
+
convexUrl: string;
|
|
94
|
+
cacheDir?: string;
|
|
95
|
+
materializeEnvironments?: boolean;
|
|
96
|
+
verifyDeviceEnvironments?: boolean;
|
|
97
|
+
signal: AbortSignal;
|
|
98
|
+
reporter: TaskProcessReporter;
|
|
99
|
+
}
|
|
100
|
+
export interface TaskProcessAdapter {
|
|
101
|
+
run(claim: ClaimedTask, options: TaskProcessRunOptions): Promise<unknown>;
|
|
102
|
+
}
|
|
103
|
+
export declare class RunnerConvexClient implements RunnerClient {
|
|
104
|
+
readonly config: RunnerBackendConfig;
|
|
105
|
+
private readonly client;
|
|
106
|
+
constructor(config: RunnerBackendConfig);
|
|
107
|
+
query<T>(name: string, args: Record<string, unknown>): Promise<T>;
|
|
108
|
+
mutation<T>(name: string, args: Record<string, unknown>): Promise<T>;
|
|
109
|
+
action<T>(name: string, args: Record<string, unknown>): Promise<T>;
|
|
110
|
+
}
|
|
111
|
+
export declare function defaultDeviceRunnerId(): string;
|
|
112
|
+
export declare function defaultOrgRunnerId(): string;
|
|
113
|
+
export declare const TASK_ENV_CONCURRENCY = 1;
|
|
114
|
+
export declare const DEFAULT_DEVICE_POLL_INTERVAL_MS = 30000;
|
|
115
|
+
export declare class TranscriptReporter {
|
|
116
|
+
private readonly client;
|
|
117
|
+
private readonly claim;
|
|
118
|
+
private readonly secrets;
|
|
119
|
+
private readonly buffer;
|
|
120
|
+
private flushing;
|
|
121
|
+
private readonly flushTimer;
|
|
122
|
+
constructor(client: RunnerClient, claim: ClaimedTask, secrets: readonly string[]);
|
|
123
|
+
push(event: AgentEvent): Promise<void>;
|
|
124
|
+
flush(): Promise<void>;
|
|
125
|
+
close(): Promise<void>;
|
|
126
|
+
}
|
|
127
|
+
export interface AgentContext {
|
|
128
|
+
env: Record<string, string>;
|
|
129
|
+
signal: AbortSignal;
|
|
130
|
+
runId: string;
|
|
131
|
+
stepId: string;
|
|
132
|
+
outputSchemaJsonText: string;
|
|
133
|
+
host: HostIR;
|
|
134
|
+
emit: (event: AgentEvent) => Promise<void>;
|
|
135
|
+
}
|
|
136
|
+
export interface FlueCoordinatorAdapter {
|
|
137
|
+
createAdmission(agentName: string, instanceId: string): (request: {
|
|
138
|
+
message: string;
|
|
139
|
+
}, onEvent: () => void, wait: boolean) => Promise<void>;
|
|
140
|
+
waitForIdle(): Promise<void>;
|
|
141
|
+
abortInstance(agentName: string, instanceId: string): Promise<void>;
|
|
142
|
+
shutdown(timeoutMs: number): Promise<void>;
|
|
143
|
+
}
|
|
144
|
+
export interface FlueRuntimeAdapter {
|
|
145
|
+
observe(handler: (event: any) => void): () => void;
|
|
146
|
+
createInstrumentationOwner(): unknown;
|
|
147
|
+
runWithInstrumentationOwner<T>(owner: unknown, fn: () => Promise<T>): Promise<T>;
|
|
148
|
+
}
|
|
149
|
+
export declare function catalogToolDefinitions(actionIds: readonly string[]): ToolDefinition[];
|
|
150
|
+
/**
|
|
151
|
+
* Inject runner-owned tools into the agent's resolved runtime config — the
|
|
152
|
+
* definition alone can't know them (the runner owns catalog access and MCP
|
|
153
|
+
* server startup/port allocation).
|
|
154
|
+
*/
|
|
155
|
+
export declare function withMcpTools(agent: unknown, tools: ToolDefinition[]): unknown;
|
|
156
|
+
export declare function createDefaultFlueSessionEnv(_host: HostIR, cwd?: string): SessionEnv;
|
|
157
|
+
export declare function runFlueStepWithCoordinator(input: unknown, context: AgentContext, adapters: {
|
|
158
|
+
runtime: FlueRuntimeAdapter;
|
|
159
|
+
coordinator: FlueCoordinatorAdapter;
|
|
160
|
+
}): Promise<unknown>;
|
|
161
|
+
export declare function extractOutput(result: unknown, outputSchemaJsonText: string): unknown;
|
|
162
|
+
export declare function executeClaimTask(claim: ClaimedTask, options: TaskProcessRunOptions): Promise<unknown>;
|
|
163
|
+
export declare function createInProcessTaskProcessAdapter(): TaskProcessAdapter;
|
|
164
|
+
export declare function createSubprocessTaskProcessAdapter(options?: {
|
|
165
|
+
childEntryPath?: string;
|
|
166
|
+
}): TaskProcessAdapter;
|
|
167
|
+
export declare function runClaim(config: RunnerBackendConfig, claim: ClaimedTask, options?: RunClaimOptions): Promise<TaskResult>;
|
|
168
|
+
export declare function runScopedSource(options: {
|
|
169
|
+
runId: string;
|
|
170
|
+
executorToken: string;
|
|
171
|
+
}): TaskSource;
|
|
172
|
+
export declare function deviceJwtSource(options: {
|
|
173
|
+
deviceToken?: string;
|
|
174
|
+
deviceTokenProvider?: () => Promise<string>;
|
|
175
|
+
}): TaskSource;
|
|
176
|
+
export declare function dispatchTokenSource(options: {
|
|
177
|
+
taskId: string;
|
|
178
|
+
dispatchToken: string;
|
|
179
|
+
sandboxId?: string;
|
|
180
|
+
}): TaskSource;
|
|
181
|
+
export declare function runTaskLoop(options: RunTaskLoopOptions): Promise<TaskResult | undefined>;
|
|
182
|
+
export declare function runTestRun(options: RunTestRunOptions): Promise<RunReadModel>;
|
|
183
|
+
export declare function runDispatchedTask(options: RunDispatchedTaskOptions): Promise<TaskResult>;
|
|
184
|
+
export declare function runDeviceClaimLoop(options: RunDeviceClaimLoopOptions): Promise<void>;
|