@h-rig/provider-plugin 0.0.6-alpha.156
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 -0
- package/dist/src/claude-stream-records.d.ts +24 -0
- package/dist/src/claude-stream-records.js +158 -0
- package/dist/src/codex-app-server.d.ts +16 -0
- package/dist/src/codex-app-server.js +548 -0
- package/dist/src/codex-exec-records.d.ts +27 -0
- package/dist/src/codex-exec-records.js +203 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.js +127 -0
- package/dist/src/plugin.d.ts +4 -0
- package/dist/src/plugin.js +82 -0
- package/dist/src/rig-task-run-skill.d.ts +8 -0
- package/dist/src/rig-task-run-skill.js +39 -0
- package/dist/src/runtime-instructions.d.ts +4 -0
- package/dist/src/runtime-instructions.js +26 -0
- package/dist/src/service.d.ts +14 -0
- package/dist/src/service.js +33 -0
- package/package.json +36 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @h-rig/provider-plugin
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { EngineRunLog } from "@rig/contracts";
|
|
2
|
+
type ClaudeStreamStatus = EngineRunLog["status"];
|
|
3
|
+
export type PendingClaudeToolUse = {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string | null;
|
|
6
|
+
input: unknown;
|
|
7
|
+
timestamp: string;
|
|
8
|
+
record: Record<string, unknown>;
|
|
9
|
+
};
|
|
10
|
+
type BuildClaudeLogsFromRecordInput = {
|
|
11
|
+
runId: string;
|
|
12
|
+
record: Record<string, unknown>;
|
|
13
|
+
createdAtFallback: string;
|
|
14
|
+
status: ClaudeStreamStatus;
|
|
15
|
+
pendingToolUses: Map<string, PendingClaudeToolUse>;
|
|
16
|
+
includeMessageLogs?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare function buildClaudeLogsFromRecord(input: BuildClaudeLogsFromRecordInput): EngineRunLog[];
|
|
19
|
+
export declare function flushPendingClaudeToolUseLogs(input: {
|
|
20
|
+
runId: string;
|
|
21
|
+
status: ClaudeStreamStatus;
|
|
22
|
+
pendingToolUses: Map<string, PendingClaudeToolUse>;
|
|
23
|
+
}): EngineRunLog[];
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/provider-plugin/src/claude-stream-records.ts
|
|
3
|
+
function asRecord(value) {
|
|
4
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
5
|
+
}
|
|
6
|
+
function normalizeString(value) {
|
|
7
|
+
if (typeof value !== "string") {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
const trimmed = value.trim();
|
|
11
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
12
|
+
}
|
|
13
|
+
function normalizeIsoTimestamp(value) {
|
|
14
|
+
const normalized = normalizeString(value);
|
|
15
|
+
if (!normalized) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const timestamp = Date.parse(normalized);
|
|
19
|
+
return Number.isNaN(timestamp) ? null : new Date(timestamp).toISOString();
|
|
20
|
+
}
|
|
21
|
+
function buildClaudeLogsFromRecord(input) {
|
|
22
|
+
const logs = [];
|
|
23
|
+
const entryType = normalizeString(input.record.type);
|
|
24
|
+
const createdAt = normalizeIsoTimestamp(input.record.timestamp) ?? input.createdAtFallback;
|
|
25
|
+
if (entryType === "summary") {
|
|
26
|
+
return logs;
|
|
27
|
+
}
|
|
28
|
+
if (entryType === "system" || entryType === "result") {
|
|
29
|
+
logs.push({
|
|
30
|
+
id: normalizeString(input.record.uuid) ?? `${input.runId}-claude-${Date.now()}`,
|
|
31
|
+
runId: input.runId,
|
|
32
|
+
title: entryType === "result" ? "Agent result" : "Agent session initialized",
|
|
33
|
+
detail: JSON.stringify(input.record),
|
|
34
|
+
tone: entryType === "result" && input.record.is_error === true ? "error" : "info",
|
|
35
|
+
status: input.status,
|
|
36
|
+
payload: input.record,
|
|
37
|
+
createdAt
|
|
38
|
+
});
|
|
39
|
+
return logs;
|
|
40
|
+
}
|
|
41
|
+
const message = asRecord(input.record.message);
|
|
42
|
+
if (!message) {
|
|
43
|
+
return logs;
|
|
44
|
+
}
|
|
45
|
+
const role = normalizeString(message.role) ?? entryType ?? "assistant";
|
|
46
|
+
const content = Array.isArray(message.content) ? message.content : [];
|
|
47
|
+
for (const item of content) {
|
|
48
|
+
const contentRecord = asRecord(item);
|
|
49
|
+
if (!contentRecord) {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
const contentType = normalizeString(contentRecord.type);
|
|
53
|
+
if (contentType === "tool_use") {
|
|
54
|
+
const toolUseId = normalizeString(contentRecord.id) ?? normalizeString(contentRecord.tool_use_id);
|
|
55
|
+
if (!toolUseId) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
input.pendingToolUses.set(toolUseId, {
|
|
59
|
+
id: toolUseId,
|
|
60
|
+
name: normalizeString(contentRecord.name) ?? normalizeString(contentRecord.tool_name),
|
|
61
|
+
input: contentRecord.input ?? contentRecord.tool_input ?? {},
|
|
62
|
+
timestamp: createdAt,
|
|
63
|
+
record: contentRecord
|
|
64
|
+
});
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
if (contentType === "tool_result") {
|
|
68
|
+
const toolUseId = normalizeString(contentRecord.tool_use_id);
|
|
69
|
+
const pending = toolUseId ? input.pendingToolUses.get(toolUseId) ?? null : null;
|
|
70
|
+
if (pending && toolUseId) {
|
|
71
|
+
input.pendingToolUses.delete(toolUseId);
|
|
72
|
+
}
|
|
73
|
+
logs.push({
|
|
74
|
+
id: toolUseId ? `${input.runId}-claude-tool-${toolUseId}` : normalizeString(input.record.uuid) ?? `${input.runId}-claude-${Date.now()}`,
|
|
75
|
+
runId: input.runId,
|
|
76
|
+
title: "Tool activity",
|
|
77
|
+
detail: JSON.stringify({
|
|
78
|
+
type: "claude_tool_activity",
|
|
79
|
+
session_id: normalizeString(input.record.sessionId) ?? normalizeString(input.record.session_id),
|
|
80
|
+
uuid: normalizeString(input.record.uuid),
|
|
81
|
+
tool_use_id: toolUseId,
|
|
82
|
+
tool_name: pending?.name ?? null,
|
|
83
|
+
tool_input: pending?.input ?? null,
|
|
84
|
+
tool_result: contentRecord.content ?? contentRecord,
|
|
85
|
+
is_error: contentRecord.is_error === true,
|
|
86
|
+
raw: {
|
|
87
|
+
toolUse: pending?.record ?? null,
|
|
88
|
+
toolResult: contentRecord
|
|
89
|
+
}
|
|
90
|
+
}),
|
|
91
|
+
tone: contentRecord.is_error === true ? "error" : "tool",
|
|
92
|
+
status: input.status,
|
|
93
|
+
payload: {
|
|
94
|
+
toolUseId,
|
|
95
|
+
toolName: pending?.name ?? null,
|
|
96
|
+
toolInput: pending?.input ?? null,
|
|
97
|
+
content: contentRecord.content ?? null,
|
|
98
|
+
isError: contentRecord.is_error === true
|
|
99
|
+
},
|
|
100
|
+
createdAt: pending?.timestamp ?? createdAt
|
|
101
|
+
});
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (!input.includeMessageLogs) {
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
logs.push({
|
|
108
|
+
id: normalizeString(input.record.uuid) ? `${normalizeString(input.record.uuid)}:${contentType ?? "content"}:${logs.length + 1}` : `${input.runId}-claude-${Date.now()}-${logs.length + 1}`,
|
|
109
|
+
runId: input.runId,
|
|
110
|
+
title: role === "assistant" ? "Assistant output" : role === "user" ? "Tool activity" : "Agent output",
|
|
111
|
+
detail: JSON.stringify({
|
|
112
|
+
type: role,
|
|
113
|
+
message: {
|
|
114
|
+
role,
|
|
115
|
+
content: [contentRecord]
|
|
116
|
+
},
|
|
117
|
+
session_id: normalizeString(input.record.sessionId) ?? normalizeString(input.record.session_id),
|
|
118
|
+
uuid: normalizeString(input.record.uuid)
|
|
119
|
+
}),
|
|
120
|
+
tone: contentType === "text" ? "info" : "tool",
|
|
121
|
+
status: input.status,
|
|
122
|
+
payload: contentRecord,
|
|
123
|
+
createdAt
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
return logs;
|
|
127
|
+
}
|
|
128
|
+
function flushPendingClaudeToolUseLogs(input) {
|
|
129
|
+
const logs = [];
|
|
130
|
+
for (const pending of input.pendingToolUses.values()) {
|
|
131
|
+
logs.push({
|
|
132
|
+
id: `${input.runId}-claude-tool-${pending.id}`,
|
|
133
|
+
runId: input.runId,
|
|
134
|
+
title: "Tool activity",
|
|
135
|
+
detail: JSON.stringify({
|
|
136
|
+
type: "claude_tool_use",
|
|
137
|
+
tool_use_id: pending.id,
|
|
138
|
+
tool_name: pending.name,
|
|
139
|
+
tool_input: pending.input,
|
|
140
|
+
raw: pending.record
|
|
141
|
+
}),
|
|
142
|
+
tone: "tool",
|
|
143
|
+
status: input.status,
|
|
144
|
+
payload: {
|
|
145
|
+
toolUseId: pending.id,
|
|
146
|
+
toolName: pending.name,
|
|
147
|
+
toolInput: pending.input
|
|
148
|
+
},
|
|
149
|
+
createdAt: pending.timestamp
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
input.pendingToolUses.clear();
|
|
153
|
+
return logs;
|
|
154
|
+
}
|
|
155
|
+
export {
|
|
156
|
+
flushPendingClaudeToolUseLogs,
|
|
157
|
+
buildClaudeLogsFromRecord
|
|
158
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const CODEX_APP_SERVER_TASK_RUN_SENTINEL = "__rig_codex_app_server_task_run__";
|
|
2
|
+
export type CodexAppServerTaskRunConfig = {
|
|
3
|
+
model?: string;
|
|
4
|
+
prompt: string;
|
|
5
|
+
runtimeMode: string;
|
|
6
|
+
interactionMode?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function buildCodexAppServerArgs(): string[];
|
|
9
|
+
export declare function parseCodexAppServerTaskRunArgs(argv: string[]): CodexAppServerTaskRunConfig | null;
|
|
10
|
+
export declare function runCodexAppServerTaskRun(options: {
|
|
11
|
+
codexBinary: string;
|
|
12
|
+
launchArgs: string[];
|
|
13
|
+
cwd: string;
|
|
14
|
+
env: Record<string, string | undefined>;
|
|
15
|
+
config: CodexAppServerTaskRunConfig;
|
|
16
|
+
}): Promise<number>;
|
|
@@ -0,0 +1,548 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/provider-plugin/src/codex-app-server.ts
|
|
3
|
+
import { spawn } from "child_process";
|
|
4
|
+
import { createInterface } from "readline";
|
|
5
|
+
import { invokeRuntimeTool, CLAUDE_ROUTER_TOOL_DEFINITIONS } from "@rig/runtime/control-plane/runtime/tooling/claude-router";
|
|
6
|
+
var CODEX_APP_SERVER_TASK_RUN_SENTINEL = "__rig_codex_app_server_task_run__";
|
|
7
|
+
var RIG_DYNAMIC_TOOL_SERVER = "rig_runtime_tools";
|
|
8
|
+
var DEFAULT_CLIENT_INFO = {
|
|
9
|
+
name: "rig_task_runtime",
|
|
10
|
+
title: "Rig Task Runtime",
|
|
11
|
+
version: "0.1.0"
|
|
12
|
+
};
|
|
13
|
+
var CODEX_APP_SERVER_DISABLED_FEATURES = [
|
|
14
|
+
"shell_tool",
|
|
15
|
+
"apply_patch_freeform",
|
|
16
|
+
"request_permissions_tool",
|
|
17
|
+
"apps",
|
|
18
|
+
"plugins",
|
|
19
|
+
"tool_search",
|
|
20
|
+
"js_repl",
|
|
21
|
+
"js_repl_tools_only",
|
|
22
|
+
"collab"
|
|
23
|
+
];
|
|
24
|
+
function buildCodexAppServerArgs() {
|
|
25
|
+
return [
|
|
26
|
+
"app-server",
|
|
27
|
+
...CODEX_APP_SERVER_DISABLED_FEATURES.flatMap((feature) => ["--disable", feature]),
|
|
28
|
+
"-c",
|
|
29
|
+
'web_search="disabled"',
|
|
30
|
+
"-c",
|
|
31
|
+
"tools.view_image=false",
|
|
32
|
+
"-c",
|
|
33
|
+
"features.default_mode_request_user_input=false"
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
function parseCodexAppServerTaskRunArgs(argv) {
|
|
37
|
+
if (argv[0] !== CODEX_APP_SERVER_TASK_RUN_SENTINEL) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
let model;
|
|
41
|
+
let prompt;
|
|
42
|
+
let runtimeMode = "workspace-write";
|
|
43
|
+
let interactionMode;
|
|
44
|
+
for (let index = 1;index < argv.length; index += 1) {
|
|
45
|
+
const current = argv[index];
|
|
46
|
+
if (current === "--model") {
|
|
47
|
+
model = argv[index + 1];
|
|
48
|
+
index += 1;
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (current === "--runtime-mode") {
|
|
52
|
+
runtimeMode = argv[index + 1] ?? runtimeMode;
|
|
53
|
+
index += 1;
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (current === "--interaction-mode") {
|
|
57
|
+
interactionMode = argv[index + 1];
|
|
58
|
+
index += 1;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (current === "--prompt") {
|
|
62
|
+
prompt = argv[index + 1];
|
|
63
|
+
index += 1;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (!prompt?.trim()) {
|
|
68
|
+
throw new Error("Missing `--prompt` for Codex app-server task run.");
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
model: model?.trim() ? model.trim() : undefined,
|
|
72
|
+
prompt,
|
|
73
|
+
runtimeMode,
|
|
74
|
+
interactionMode
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
async function runCodexAppServerTaskRun(options) {
|
|
78
|
+
const child = spawn(options.codexBinary, options.launchArgs, {
|
|
79
|
+
cwd: options.cwd,
|
|
80
|
+
env: sanitizeEnv(options.env),
|
|
81
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
82
|
+
});
|
|
83
|
+
const pendingResponses = new Map;
|
|
84
|
+
const dynamicToolResults = new Map;
|
|
85
|
+
const agentMessageText = new Map;
|
|
86
|
+
const inFlightToolCalls = new Set;
|
|
87
|
+
let nextRequestId = 1;
|
|
88
|
+
let sendQueue = Promise.resolve();
|
|
89
|
+
const completionState = { current: null };
|
|
90
|
+
const stdout = createInterface({ input: child.stdout });
|
|
91
|
+
const stderr = createInterface({ input: child.stderr });
|
|
92
|
+
const sendMessage = (payload) => {
|
|
93
|
+
const line = `${JSON.stringify(payload)}
|
|
94
|
+
`;
|
|
95
|
+
sendQueue = sendQueue.then(() => writeChildLine(child, line));
|
|
96
|
+
return sendQueue;
|
|
97
|
+
};
|
|
98
|
+
const sendRequest = async (method, params) => {
|
|
99
|
+
const id = nextRequestId;
|
|
100
|
+
nextRequestId += 1;
|
|
101
|
+
const resultPromise = new Promise((resolve, reject) => {
|
|
102
|
+
pendingResponses.set(id, { resolve, reject });
|
|
103
|
+
});
|
|
104
|
+
await sendMessage({ id, method, params });
|
|
105
|
+
return resultPromise;
|
|
106
|
+
};
|
|
107
|
+
const sendResponse = async (id, result) => {
|
|
108
|
+
await sendMessage({ id, result });
|
|
109
|
+
};
|
|
110
|
+
const sendError = async (id, message) => {
|
|
111
|
+
await sendMessage({
|
|
112
|
+
id,
|
|
113
|
+
error: {
|
|
114
|
+
code: -32603,
|
|
115
|
+
message
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
const trackToolCall = (call) => {
|
|
120
|
+
inFlightToolCalls.add(call);
|
|
121
|
+
call.finally(() => inFlightToolCalls.delete(call)).catch((err) => {
|
|
122
|
+
console.warn("[codex-app-server] in-flight tool call failure:", err);
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
const handleNotification = (message) => {
|
|
126
|
+
const method = message.method;
|
|
127
|
+
if (!method) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const params = message.params ?? {};
|
|
131
|
+
const timestamp = new Date().toISOString();
|
|
132
|
+
if (method === "thread/started") {
|
|
133
|
+
emitSyntheticCodexRecord({
|
|
134
|
+
type: "thread.started",
|
|
135
|
+
timestamp,
|
|
136
|
+
thread: params.thread ?? null
|
|
137
|
+
});
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (method === "turn/started") {
|
|
141
|
+
emitSyntheticCodexRecord({
|
|
142
|
+
type: "turn.started",
|
|
143
|
+
timestamp,
|
|
144
|
+
turn: params.turn ?? null
|
|
145
|
+
});
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (method === "item/agentMessage/delta") {
|
|
149
|
+
const itemId = normalizeString(params.itemId);
|
|
150
|
+
const delta = typeof params.delta === "string" ? params.delta : "";
|
|
151
|
+
if (!itemId || delta.length === 0) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
agentMessageText.set(itemId, `${agentMessageText.get(itemId) ?? ""}${delta}`);
|
|
155
|
+
emitSyntheticCodexRecord({
|
|
156
|
+
type: "stream_event",
|
|
157
|
+
event: {
|
|
158
|
+
delta: {
|
|
159
|
+
type: "text_delta",
|
|
160
|
+
text: delta
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (method === "item/started" || method === "item/completed") {
|
|
167
|
+
const record = mapAppServerItemToCodexRecord({
|
|
168
|
+
phase: method === "item/started" ? "item.started" : "item.completed",
|
|
169
|
+
timestamp,
|
|
170
|
+
item: params.item,
|
|
171
|
+
dynamicToolResults,
|
|
172
|
+
agentMessageText
|
|
173
|
+
});
|
|
174
|
+
if (record) {
|
|
175
|
+
emitSyntheticCodexRecord(record);
|
|
176
|
+
}
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (method === "turn/completed") {
|
|
180
|
+
const turn = asRecord(params.turn);
|
|
181
|
+
const error = asRecord(turn?.error);
|
|
182
|
+
completionState.current = {
|
|
183
|
+
status: normalizeString(turn?.status) ?? "failed",
|
|
184
|
+
error: normalizeString(error?.message)
|
|
185
|
+
};
|
|
186
|
+
emitSyntheticCodexRecord({
|
|
187
|
+
type: "turn.completed",
|
|
188
|
+
timestamp,
|
|
189
|
+
turn
|
|
190
|
+
});
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (method === "error") {
|
|
194
|
+
const errorMessage = normalizeString(params.message) ?? JSON.stringify(params);
|
|
195
|
+
console.error(`[rig-codex-app-server] ${errorMessage}`);
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
const handleServerRequest = (message) => {
|
|
199
|
+
const method = message.method;
|
|
200
|
+
const requestId = message.id;
|
|
201
|
+
if (!method || requestId === undefined) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if (method === "item/tool/call") {
|
|
205
|
+
const params = message.params ?? {};
|
|
206
|
+
const callId = normalizeString(params.callId);
|
|
207
|
+
const toolName = normalizeString(params.tool);
|
|
208
|
+
const toolArgs = asRecord(params.arguments) ?? {};
|
|
209
|
+
const toolCall = (async () => {
|
|
210
|
+
if (!callId || !toolName) {
|
|
211
|
+
await sendError(requestId, "Malformed dynamic tool call.");
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
try {
|
|
215
|
+
const invocation = await invokeRuntimeTool(toolName, toolArgs, {
|
|
216
|
+
env: options.env
|
|
217
|
+
});
|
|
218
|
+
const contentItems = invocationToContentItems(invocation);
|
|
219
|
+
const contentText = contentItems.filter((item) => item.type === "inputText").map((item) => item.text).join(`
|
|
220
|
+
`).trim();
|
|
221
|
+
dynamicToolResults.set(callId, {
|
|
222
|
+
isError: invocation.isError === true,
|
|
223
|
+
contentText,
|
|
224
|
+
structuredResult: asRecord(invocation.structuredContent) ?? (contentText ? { content: contentText } : null)
|
|
225
|
+
});
|
|
226
|
+
await sendResponse(requestId, {
|
|
227
|
+
contentItems,
|
|
228
|
+
success: invocation.isError !== true
|
|
229
|
+
});
|
|
230
|
+
} catch (error) {
|
|
231
|
+
const messageText = error instanceof Error ? error.message : String(error);
|
|
232
|
+
dynamicToolResults.set(callId, {
|
|
233
|
+
isError: true,
|
|
234
|
+
contentText: messageText,
|
|
235
|
+
structuredResult: { error: messageText }
|
|
236
|
+
});
|
|
237
|
+
await sendResponse(requestId, {
|
|
238
|
+
contentItems: [{ type: "inputText", text: messageText }],
|
|
239
|
+
success: false
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
})();
|
|
243
|
+
trackToolCall(toolCall);
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
if (method === "item/commandExecution/requestApproval" || method === "item/fileChange/requestApproval") {
|
|
247
|
+
trackToolCall(sendResponse(requestId, { decision: "decline" }));
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
if (method === "item/permissions/requestApproval") {
|
|
251
|
+
trackToolCall(sendResponse(requestId, {
|
|
252
|
+
permissions: {},
|
|
253
|
+
scope: "turn"
|
|
254
|
+
}));
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
if (method === "applyPatchApproval" || method === "execCommandApproval") {
|
|
258
|
+
trackToolCall(sendResponse(requestId, { decision: "denied" }));
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
trackToolCall(sendError(requestId, `Unsupported app-server request: ${method}`));
|
|
262
|
+
};
|
|
263
|
+
stdout.on("line", (line) => {
|
|
264
|
+
const trimmed = line.trim();
|
|
265
|
+
if (!trimmed) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
let message;
|
|
269
|
+
try {
|
|
270
|
+
message = JSON.parse(trimmed);
|
|
271
|
+
} catch {
|
|
272
|
+
console.error(trimmed);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
if (message.method) {
|
|
276
|
+
if (message.id !== undefined) {
|
|
277
|
+
handleServerRequest(message);
|
|
278
|
+
} else {
|
|
279
|
+
handleNotification(message);
|
|
280
|
+
}
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
if (message.id !== undefined) {
|
|
284
|
+
const pending = pendingResponses.get(message.id);
|
|
285
|
+
if (!pending) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
pendingResponses.delete(message.id);
|
|
289
|
+
if (message.error) {
|
|
290
|
+
pending.reject(new Error(formatJsonRpcError(message.error)));
|
|
291
|
+
} else {
|
|
292
|
+
pending.resolve(message.result ?? {});
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
stderr.on("line", (line) => {
|
|
297
|
+
if (line.trim()) {
|
|
298
|
+
console.error(line);
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
const exitPromise = new Promise((resolve) => {
|
|
302
|
+
child.once("close", (code, signal) => resolve({ code, signal }));
|
|
303
|
+
});
|
|
304
|
+
await sendRequest("initialize", {
|
|
305
|
+
clientInfo: DEFAULT_CLIENT_INFO,
|
|
306
|
+
capabilities: {
|
|
307
|
+
experimentalApi: true
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
await sendMessage({
|
|
311
|
+
method: "initialized",
|
|
312
|
+
params: {}
|
|
313
|
+
});
|
|
314
|
+
const threadStart = await sendRequest("thread/start", {
|
|
315
|
+
model: options.config.model ?? null,
|
|
316
|
+
cwd: options.cwd,
|
|
317
|
+
approvalPolicy: "never",
|
|
318
|
+
sandbox: options.config.runtimeMode === "full-access" ? "danger-full-access" : "workspace-write",
|
|
319
|
+
serviceName: "rig_task_runtime",
|
|
320
|
+
experimentalRawEvents: false,
|
|
321
|
+
persistExtendedHistory: false,
|
|
322
|
+
dynamicTools: codexDynamicToolDefinitions()
|
|
323
|
+
});
|
|
324
|
+
const thread = asRecord(threadStart.thread);
|
|
325
|
+
const threadId = normalizeString(thread?.id);
|
|
326
|
+
if (!threadId) {
|
|
327
|
+
throw new Error("Codex app-server thread/start did not return a thread id.");
|
|
328
|
+
}
|
|
329
|
+
await sendRequest("turn/start", {
|
|
330
|
+
threadId,
|
|
331
|
+
input: [
|
|
332
|
+
{
|
|
333
|
+
type: "text",
|
|
334
|
+
text: options.config.prompt,
|
|
335
|
+
text_elements: []
|
|
336
|
+
}
|
|
337
|
+
]
|
|
338
|
+
});
|
|
339
|
+
let exitResult = null;
|
|
340
|
+
while (!completionState.current) {
|
|
341
|
+
exitResult = await Promise.race([
|
|
342
|
+
exitPromise,
|
|
343
|
+
new Promise((resolve) => setTimeout(() => resolve(null), 100))
|
|
344
|
+
]);
|
|
345
|
+
if (exitResult) {
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
const completedTurn = completionState.current;
|
|
350
|
+
if (!completedTurn) {
|
|
351
|
+
const detail = exitResult ? `codex app-server exited before turn completion (${String(exitResult.code ?? exitResult.signal ?? "unknown")})` : "codex app-server exited before turn completion";
|
|
352
|
+
throw new Error(detail);
|
|
353
|
+
}
|
|
354
|
+
if (inFlightToolCalls.size > 0) {
|
|
355
|
+
await Promise.allSettled(Array.from(inFlightToolCalls));
|
|
356
|
+
}
|
|
357
|
+
terminateChild(child);
|
|
358
|
+
await exitPromise;
|
|
359
|
+
if (completedTurn.status !== "completed") {
|
|
360
|
+
const reason = completedTurn.error ?? `Codex turn ended with status ${completedTurn.status}`;
|
|
361
|
+
console.error(`[rig-codex-app-server] ${reason}`);
|
|
362
|
+
return 1;
|
|
363
|
+
}
|
|
364
|
+
return 0;
|
|
365
|
+
}
|
|
366
|
+
function codexDynamicToolDefinitions() {
|
|
367
|
+
return [
|
|
368
|
+
{
|
|
369
|
+
name: "shell",
|
|
370
|
+
description: "Run a shell command through Rig's audited gateway inside the current task workspace. Use this for git, bun, node, python3, rg, and related command-line work. Never rely on absolute host binaries.",
|
|
371
|
+
inputSchema: {
|
|
372
|
+
type: "object",
|
|
373
|
+
properties: {
|
|
374
|
+
command: { type: "string", description: "Shell command to execute." },
|
|
375
|
+
workdir: { type: "string", description: "Optional workspace-relative working directory." },
|
|
376
|
+
shell: { type: "string", enum: ["bash", "sh", "zsh"] }
|
|
377
|
+
},
|
|
378
|
+
required: ["command"],
|
|
379
|
+
additionalProperties: false
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
...CLAUDE_ROUTER_TOOL_DEFINITIONS
|
|
383
|
+
];
|
|
384
|
+
}
|
|
385
|
+
function mapAppServerItemToCodexRecord(input) {
|
|
386
|
+
const item = asRecord(input.item);
|
|
387
|
+
const itemType = normalizeString(item?.type);
|
|
388
|
+
const itemId = normalizeString(item?.id);
|
|
389
|
+
if (!item || !itemType || !itemId) {
|
|
390
|
+
return null;
|
|
391
|
+
}
|
|
392
|
+
if (itemType === "agentMessage") {
|
|
393
|
+
if (input.phase !== "item.completed") {
|
|
394
|
+
return null;
|
|
395
|
+
}
|
|
396
|
+
const finalText = normalizeString(item.text) ?? input.agentMessageText.get(itemId) ?? "";
|
|
397
|
+
input.agentMessageText.delete(itemId);
|
|
398
|
+
return {
|
|
399
|
+
type: "item.completed",
|
|
400
|
+
timestamp: input.timestamp,
|
|
401
|
+
item: {
|
|
402
|
+
id: itemId,
|
|
403
|
+
type: "agent_message",
|
|
404
|
+
text: finalText
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
if (itemType === "commandExecution") {
|
|
409
|
+
return {
|
|
410
|
+
type: input.phase,
|
|
411
|
+
timestamp: input.timestamp,
|
|
412
|
+
item: {
|
|
413
|
+
id: itemId,
|
|
414
|
+
type: "command_execution",
|
|
415
|
+
command: normalizeString(item.command),
|
|
416
|
+
cwd: normalizeString(item.cwd),
|
|
417
|
+
status: normalizeStatus(item.status),
|
|
418
|
+
aggregated_output: normalizeString(item.aggregatedOutput),
|
|
419
|
+
exit_code: typeof item.exitCode === "number" ? item.exitCode : null,
|
|
420
|
+
duration_ms: typeof item.durationMs === "number" ? item.durationMs : null
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
if (itemType === "mcpToolCall") {
|
|
425
|
+
return {
|
|
426
|
+
type: input.phase,
|
|
427
|
+
timestamp: input.timestamp,
|
|
428
|
+
item: {
|
|
429
|
+
id: itemId,
|
|
430
|
+
type: "mcp_tool_call",
|
|
431
|
+
server: normalizeString(item.server),
|
|
432
|
+
tool: normalizeString(item.tool),
|
|
433
|
+
status: normalizeStatus(item.status),
|
|
434
|
+
arguments: item.arguments ?? null,
|
|
435
|
+
result: asRecord(item.result) ?? null,
|
|
436
|
+
error: asRecord(item.error) ?? null
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
if (itemType === "dynamicToolCall") {
|
|
441
|
+
const cached = input.dynamicToolResults.get(itemId) ?? null;
|
|
442
|
+
if (input.phase === "item.completed") {
|
|
443
|
+
input.dynamicToolResults.delete(itemId);
|
|
444
|
+
}
|
|
445
|
+
return {
|
|
446
|
+
type: input.phase,
|
|
447
|
+
timestamp: input.timestamp,
|
|
448
|
+
item: {
|
|
449
|
+
id: itemId,
|
|
450
|
+
type: "mcp_tool_call",
|
|
451
|
+
server: RIG_DYNAMIC_TOOL_SERVER,
|
|
452
|
+
tool: normalizeString(item.tool),
|
|
453
|
+
status: cached?.isError ? "failed" : normalizeStatus(item.status),
|
|
454
|
+
arguments: item.arguments ?? null,
|
|
455
|
+
result: cached?.structuredResult ?? {
|
|
456
|
+
content_items: item.contentItems ?? null,
|
|
457
|
+
success: item.success ?? null
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
return null;
|
|
463
|
+
}
|
|
464
|
+
function invocationToContentItems(invocation) {
|
|
465
|
+
const items = Array.isArray(invocation.content) ? invocation.content : [];
|
|
466
|
+
const mapped = items.map((item) => {
|
|
467
|
+
const entry = asRecord(item);
|
|
468
|
+
if (!entry || entry.type !== "text" || typeof entry.text !== "string") {
|
|
469
|
+
return null;
|
|
470
|
+
}
|
|
471
|
+
return {
|
|
472
|
+
type: "inputText",
|
|
473
|
+
text: entry.text
|
|
474
|
+
};
|
|
475
|
+
}).filter((item) => Boolean(item));
|
|
476
|
+
return mapped.length > 0 ? mapped : [{ type: "inputText", text: "(empty tool response)" }];
|
|
477
|
+
}
|
|
478
|
+
function emitSyntheticCodexRecord(record) {
|
|
479
|
+
process.stdout.write(`${JSON.stringify(record)}
|
|
480
|
+
`);
|
|
481
|
+
}
|
|
482
|
+
function sanitizeEnv(env) {
|
|
483
|
+
const next = {};
|
|
484
|
+
for (const [key, value] of Object.entries(env)) {
|
|
485
|
+
if (typeof value === "string") {
|
|
486
|
+
next[key] = value;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
return next;
|
|
490
|
+
}
|
|
491
|
+
function writeChildLine(child, line) {
|
|
492
|
+
return new Promise((resolve, reject) => {
|
|
493
|
+
child.stdin.write(line, (error) => {
|
|
494
|
+
if (error) {
|
|
495
|
+
reject(error);
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
resolve();
|
|
499
|
+
});
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
function terminateChild(child) {
|
|
503
|
+
if (child.killed) {
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
try {
|
|
507
|
+
child.kill("SIGTERM");
|
|
508
|
+
} catch {}
|
|
509
|
+
}
|
|
510
|
+
function asRecord(value) {
|
|
511
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
512
|
+
}
|
|
513
|
+
function normalizeString(value) {
|
|
514
|
+
if (typeof value !== "string") {
|
|
515
|
+
return null;
|
|
516
|
+
}
|
|
517
|
+
const trimmed = value.trim();
|
|
518
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
519
|
+
}
|
|
520
|
+
function normalizeStatus(value) {
|
|
521
|
+
const raw = normalizeString(value);
|
|
522
|
+
if (!raw) {
|
|
523
|
+
return null;
|
|
524
|
+
}
|
|
525
|
+
switch (raw) {
|
|
526
|
+
case "inProgress":
|
|
527
|
+
return "in_progress";
|
|
528
|
+
case "completed":
|
|
529
|
+
case "failed":
|
|
530
|
+
case "declined":
|
|
531
|
+
return raw;
|
|
532
|
+
default:
|
|
533
|
+
return raw;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
function formatJsonRpcError(error) {
|
|
537
|
+
if (!error) {
|
|
538
|
+
return "Unknown app-server error";
|
|
539
|
+
}
|
|
540
|
+
const parts = [error.message, error.data ? JSON.stringify(error.data) : null].filter(Boolean);
|
|
541
|
+
return parts.join(" ");
|
|
542
|
+
}
|
|
543
|
+
export {
|
|
544
|
+
runCodexAppServerTaskRun,
|
|
545
|
+
parseCodexAppServerTaskRunArgs,
|
|
546
|
+
buildCodexAppServerArgs,
|
|
547
|
+
CODEX_APP_SERVER_TASK_RUN_SENTINEL
|
|
548
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { EngineRunLog } from "@rig/contracts";
|
|
2
|
+
type CodexStreamStatus = EngineRunLog["status"];
|
|
3
|
+
export type PendingCodexToolUse = {
|
|
4
|
+
id: string;
|
|
5
|
+
itemType: "command_execution" | "mcp_tool_call";
|
|
6
|
+
name: string | null;
|
|
7
|
+
input: unknown;
|
|
8
|
+
timestamp: string;
|
|
9
|
+
record: Record<string, unknown>;
|
|
10
|
+
};
|
|
11
|
+
type BuildCodexLogsFromRecordInput = {
|
|
12
|
+
runId: string;
|
|
13
|
+
record: Record<string, unknown>;
|
|
14
|
+
createdAtFallback: string;
|
|
15
|
+
status: CodexStreamStatus;
|
|
16
|
+
pendingToolUses: Map<string, PendingCodexToolUse>;
|
|
17
|
+
includeMessageLogs?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare function isCodexExecRecord(record: Record<string, unknown>): boolean;
|
|
20
|
+
export declare function extractCodexAssistantMessageText(record: Record<string, unknown>): string | null;
|
|
21
|
+
export declare function buildCodexLogsFromRecord(input: BuildCodexLogsFromRecordInput): EngineRunLog[];
|
|
22
|
+
export declare function flushPendingCodexToolUseLogs(input: {
|
|
23
|
+
runId: string;
|
|
24
|
+
status: CodexStreamStatus;
|
|
25
|
+
pendingToolUses: Map<string, PendingCodexToolUse>;
|
|
26
|
+
}): EngineRunLog[];
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/provider-plugin/src/codex-exec-records.ts
|
|
3
|
+
function asRecord(value) {
|
|
4
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
5
|
+
}
|
|
6
|
+
function normalizeString(value) {
|
|
7
|
+
if (typeof value !== "string") {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
const trimmed = value.trim();
|
|
11
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
12
|
+
}
|
|
13
|
+
function normalizeIsoTimestamp(value) {
|
|
14
|
+
const normalized = normalizeString(value);
|
|
15
|
+
if (!normalized) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const timestamp = Date.parse(normalized);
|
|
19
|
+
return Number.isNaN(timestamp) ? null : new Date(timestamp).toISOString();
|
|
20
|
+
}
|
|
21
|
+
function isCodexExecRecord(record) {
|
|
22
|
+
const type = normalizeString(record.type);
|
|
23
|
+
return type === "thread.started" || type === "thread.completed" || type === "turn.started" || type === "turn.completed" || type === "item.started" || type === "item.completed";
|
|
24
|
+
}
|
|
25
|
+
function extractCodexAssistantMessageText(record) {
|
|
26
|
+
if (normalizeString(record.type) !== "item.completed") {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
const item = asRecord(record.item);
|
|
30
|
+
if (!item || normalizeString(item.type) !== "agent_message") {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return normalizeString(item.text);
|
|
34
|
+
}
|
|
35
|
+
function codexToolName(itemType, item) {
|
|
36
|
+
if (itemType === "command_execution") {
|
|
37
|
+
return "Bash";
|
|
38
|
+
}
|
|
39
|
+
const server = normalizeString(item.server);
|
|
40
|
+
const tool = normalizeString(item.tool);
|
|
41
|
+
if (server && tool) {
|
|
42
|
+
return `mcp__${server}__${tool}`;
|
|
43
|
+
}
|
|
44
|
+
return tool;
|
|
45
|
+
}
|
|
46
|
+
function codexToolInput(itemType, item) {
|
|
47
|
+
if (itemType === "command_execution") {
|
|
48
|
+
return {
|
|
49
|
+
command: normalizeString(item.command)
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return item.arguments ?? item.input ?? null;
|
|
53
|
+
}
|
|
54
|
+
function codexToolResult(itemType, item) {
|
|
55
|
+
if (itemType === "command_execution") {
|
|
56
|
+
return {
|
|
57
|
+
command: normalizeString(item.command),
|
|
58
|
+
stdout: normalizeString(item.aggregated_output),
|
|
59
|
+
exit_code: typeof item.exit_code === "number" ? item.exit_code : null,
|
|
60
|
+
status: normalizeString(item.status)
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const error = asRecord(item.error);
|
|
64
|
+
if (error) {
|
|
65
|
+
return {
|
|
66
|
+
content: normalizeString(error.message) ?? JSON.stringify(error),
|
|
67
|
+
error
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return item.result ?? item.output ?? item;
|
|
71
|
+
}
|
|
72
|
+
function codexToolError(itemType, item) {
|
|
73
|
+
if (itemType === "command_execution") {
|
|
74
|
+
return typeof item.exit_code === "number" && item.exit_code !== 0 || normalizeString(item.status) === "failed";
|
|
75
|
+
}
|
|
76
|
+
return item.error != null || normalizeString(item.status) === "failed";
|
|
77
|
+
}
|
|
78
|
+
function buildCodexLogsFromRecord(input) {
|
|
79
|
+
const entryType = normalizeString(input.record.type);
|
|
80
|
+
if (entryType !== "item.started" && entryType !== "item.completed") {
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
const item = asRecord(input.record.item);
|
|
84
|
+
if (!item) {
|
|
85
|
+
return [];
|
|
86
|
+
}
|
|
87
|
+
const itemTypeRaw = normalizeString(item.type);
|
|
88
|
+
const itemType = itemTypeRaw === "command_execution" || itemTypeRaw === "mcp_tool_call" ? itemTypeRaw : null;
|
|
89
|
+
const createdAt = normalizeIsoTimestamp(input.record.timestamp) ?? input.createdAtFallback;
|
|
90
|
+
if (!itemType) {
|
|
91
|
+
if (itemTypeRaw === "agent_message" && input.includeMessageLogs) {
|
|
92
|
+
const text = normalizeString(item.text);
|
|
93
|
+
if (!text) {
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
return [{
|
|
97
|
+
id: normalizeString(item.id) ?? `${input.runId}-codex-message-${Date.now()}`,
|
|
98
|
+
runId: input.runId,
|
|
99
|
+
title: "Assistant output",
|
|
100
|
+
detail: JSON.stringify({
|
|
101
|
+
type: "assistant",
|
|
102
|
+
message: {
|
|
103
|
+
role: "assistant",
|
|
104
|
+
content: [{ type: "text", text }]
|
|
105
|
+
}
|
|
106
|
+
}),
|
|
107
|
+
tone: "info",
|
|
108
|
+
status: input.status,
|
|
109
|
+
payload: { text },
|
|
110
|
+
createdAt
|
|
111
|
+
}];
|
|
112
|
+
}
|
|
113
|
+
return [];
|
|
114
|
+
}
|
|
115
|
+
const itemId = normalizeString(item.id);
|
|
116
|
+
if (!itemId) {
|
|
117
|
+
return [];
|
|
118
|
+
}
|
|
119
|
+
if (entryType === "item.started") {
|
|
120
|
+
input.pendingToolUses.set(itemId, {
|
|
121
|
+
id: itemId,
|
|
122
|
+
itemType,
|
|
123
|
+
name: codexToolName(itemType, item),
|
|
124
|
+
input: codexToolInput(itemType, item),
|
|
125
|
+
timestamp: createdAt,
|
|
126
|
+
record: item
|
|
127
|
+
});
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
const pending = input.pendingToolUses.get(itemId) ?? null;
|
|
131
|
+
if (pending) {
|
|
132
|
+
input.pendingToolUses.delete(itemId);
|
|
133
|
+
}
|
|
134
|
+
const toolName = pending?.name ?? codexToolName(itemType, item);
|
|
135
|
+
const toolInput = pending?.input ?? codexToolInput(itemType, item);
|
|
136
|
+
const toolResult = codexToolResult(itemType, item);
|
|
137
|
+
const isError = codexToolError(itemType, item);
|
|
138
|
+
const stdout = asRecord(toolResult)?.stdout;
|
|
139
|
+
return [{
|
|
140
|
+
id: `${input.runId}-codex-tool-${itemId}`,
|
|
141
|
+
runId: input.runId,
|
|
142
|
+
title: "Tool activity",
|
|
143
|
+
detail: JSON.stringify({
|
|
144
|
+
type: "agent_tool_activity",
|
|
145
|
+
provider: "codex",
|
|
146
|
+
item_type: itemType,
|
|
147
|
+
tool_use_id: itemId,
|
|
148
|
+
tool_name: toolName,
|
|
149
|
+
tool_input: toolInput,
|
|
150
|
+
tool_result: toolResult,
|
|
151
|
+
is_error: isError,
|
|
152
|
+
raw: {
|
|
153
|
+
started: pending?.record ?? null,
|
|
154
|
+
completed: item
|
|
155
|
+
}
|
|
156
|
+
}),
|
|
157
|
+
tone: isError ? "error" : "tool",
|
|
158
|
+
status: input.status,
|
|
159
|
+
payload: {
|
|
160
|
+
toolUseId: itemId,
|
|
161
|
+
toolName,
|
|
162
|
+
toolInput,
|
|
163
|
+
content: typeof stdout === "string" ? stdout : null,
|
|
164
|
+
isError
|
|
165
|
+
},
|
|
166
|
+
createdAt: pending?.timestamp ?? createdAt
|
|
167
|
+
}];
|
|
168
|
+
}
|
|
169
|
+
function flushPendingCodexToolUseLogs(input) {
|
|
170
|
+
const logs = [];
|
|
171
|
+
for (const pending of input.pendingToolUses.values()) {
|
|
172
|
+
logs.push({
|
|
173
|
+
id: `${input.runId}-codex-tool-${pending.id}`,
|
|
174
|
+
runId: input.runId,
|
|
175
|
+
title: "Tool activity",
|
|
176
|
+
detail: JSON.stringify({
|
|
177
|
+
type: "agent_tool_use",
|
|
178
|
+
provider: "codex",
|
|
179
|
+
item_type: pending.itemType,
|
|
180
|
+
tool_use_id: pending.id,
|
|
181
|
+
tool_name: pending.name,
|
|
182
|
+
tool_input: pending.input,
|
|
183
|
+
raw: pending.record
|
|
184
|
+
}),
|
|
185
|
+
tone: "tool",
|
|
186
|
+
status: input.status,
|
|
187
|
+
payload: {
|
|
188
|
+
toolUseId: pending.id,
|
|
189
|
+
toolName: pending.name,
|
|
190
|
+
toolInput: pending.input
|
|
191
|
+
},
|
|
192
|
+
createdAt: pending.timestamp
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
input.pendingToolUses.clear();
|
|
196
|
+
return logs;
|
|
197
|
+
}
|
|
198
|
+
export {
|
|
199
|
+
isCodexExecRecord,
|
|
200
|
+
flushPendingCodexToolUseLogs,
|
|
201
|
+
extractCodexAssistantMessageText,
|
|
202
|
+
buildCodexLogsFromRecord
|
|
203
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { providerPlugin, createProviderPlugin, PROVIDER_PLUGIN_NAME, } from "./plugin";
|
|
2
|
+
export { runtimeInstructionService, svc } from "./service";
|
|
3
|
+
export { normalizeRuntimeInstructionProvider, buildProviderTaskRunInstructionLines, buildProviderRuntimeContextLines, } from "./runtime-instructions";
|
|
4
|
+
export { loadRigTaskRunSkillBody } from "./rig-task-run-skill";
|
|
5
|
+
export { default } from "./plugin";
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __returnValue = (v) => v;
|
|
4
|
+
function __exportSetter(name, newValue) {
|
|
5
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
+
}
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
set: __exportSetter.bind(all, name)
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
17
|
+
|
|
18
|
+
// packages/provider-plugin/src/runtime-instructions.ts
|
|
19
|
+
function normalizeRuntimeInstructionProvider(_value) {
|
|
20
|
+
return "pi";
|
|
21
|
+
}
|
|
22
|
+
function buildProviderTaskRunInstructionLines(_provider) {
|
|
23
|
+
return [
|
|
24
|
+
"Use Pi's built-in `read`, `write`, `edit`, and `bash` tools from the isolated Rig task worktree.",
|
|
25
|
+
"Keep file writes inside the scoped task workspace unless Rig explicitly tells you a path is host/project metadata.",
|
|
26
|
+
"Prefer `read`, `write`, and `edit` over shell one-liners whenever those tools fit.",
|
|
27
|
+
"When shell access is needed, keep commands narrow and bounded; avoid repo-wide searches without an explicit path and output cap."
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
function buildProviderRuntimeContextLines(_provider) {
|
|
31
|
+
return [
|
|
32
|
+
"Pi runs from the isolated Rig task worktree with its built-in `read`, `write`, `edit`, and `bash` tools enabled.",
|
|
33
|
+
"Keep writes scoped to the task workspace unless Rig-provided instructions name an explicit metadata path.",
|
|
34
|
+
"Prefer Pi file tools over shell one-liners for file reads and edits.",
|
|
35
|
+
"Keep shell commands narrow and bounded; cap broad searches before widening."
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// packages/provider-plugin/src/service.ts
|
|
40
|
+
var exports_service = {};
|
|
41
|
+
__export(exports_service, {
|
|
42
|
+
svc: () => svc,
|
|
43
|
+
runtimeInstructionService: () => runtimeInstructionService
|
|
44
|
+
});
|
|
45
|
+
var svc, runtimeInstructionService;
|
|
46
|
+
var init_service = __esm(() => {
|
|
47
|
+
svc = {
|
|
48
|
+
normalizeProvider: normalizeRuntimeInstructionProvider,
|
|
49
|
+
buildTaskRunInstructionLines: buildProviderTaskRunInstructionLines,
|
|
50
|
+
buildRuntimeContextLines: buildProviderRuntimeContextLines
|
|
51
|
+
};
|
|
52
|
+
runtimeInstructionService = svc;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// packages/provider-plugin/src/plugin.ts
|
|
56
|
+
import { definePlugin } from "@rig/core/config";
|
|
57
|
+
import { RUNTIME_INSTRUCTION_SERVICE_CAPABILITY_ID } from "@rig/contracts";
|
|
58
|
+
var PROVIDER_PLUGIN_NAME = "@rig/provider-plugin";
|
|
59
|
+
var providerPlugin = definePlugin({
|
|
60
|
+
name: PROVIDER_PLUGIN_NAME,
|
|
61
|
+
version: "0.0.0-alpha.1",
|
|
62
|
+
contributes: {
|
|
63
|
+
capabilities: [
|
|
64
|
+
{
|
|
65
|
+
id: RUNTIME_INSTRUCTION_SERVICE_CAPABILITY_ID,
|
|
66
|
+
title: "Agent harness provider instructions",
|
|
67
|
+
description: "Provide the agent-harness file-tool contract and runtime-context instruction lines.",
|
|
68
|
+
run: async () => (await Promise.resolve().then(() => (init_service(), exports_service))).svc
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
function createProviderPlugin() {
|
|
74
|
+
return providerPlugin;
|
|
75
|
+
}
|
|
76
|
+
var plugin_default = providerPlugin;
|
|
77
|
+
|
|
78
|
+
// packages/provider-plugin/src/index.ts
|
|
79
|
+
init_service();
|
|
80
|
+
|
|
81
|
+
// packages/provider-plugin/src/rig-task-run-skill.ts
|
|
82
|
+
import { existsSync, readFileSync } from "fs";
|
|
83
|
+
import { dirname, resolve } from "path";
|
|
84
|
+
import { fileURLToPath } from "url";
|
|
85
|
+
var SKILL_FILENAME = "rig-task-run.md";
|
|
86
|
+
var FRONTMATTER_RE = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/;
|
|
87
|
+
var cachedBody = null;
|
|
88
|
+
function loadRigTaskRunSkillBody() {
|
|
89
|
+
if (cachedBody !== null) {
|
|
90
|
+
return cachedBody;
|
|
91
|
+
}
|
|
92
|
+
const path = resolveSkillPath();
|
|
93
|
+
if (!path) {
|
|
94
|
+
cachedBody = "";
|
|
95
|
+
return cachedBody;
|
|
96
|
+
}
|
|
97
|
+
const raw = readFileSync(path, "utf-8");
|
|
98
|
+
const match = raw.match(FRONTMATTER_RE);
|
|
99
|
+
cachedBody = (match ? match[2] ?? raw : raw).trim();
|
|
100
|
+
return cachedBody;
|
|
101
|
+
}
|
|
102
|
+
function resolveSkillPath() {
|
|
103
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
104
|
+
const candidates = [
|
|
105
|
+
resolve(here, "..", "skills", SKILL_FILENAME),
|
|
106
|
+
resolve(here, "..", "..", "skills", SKILL_FILENAME),
|
|
107
|
+
resolve(here, "..", "..", "..", "skills", SKILL_FILENAME)
|
|
108
|
+
];
|
|
109
|
+
for (const candidate of candidates) {
|
|
110
|
+
if (existsSync(candidate)) {
|
|
111
|
+
return candidate;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
export {
|
|
117
|
+
svc,
|
|
118
|
+
runtimeInstructionService,
|
|
119
|
+
providerPlugin,
|
|
120
|
+
normalizeRuntimeInstructionProvider,
|
|
121
|
+
loadRigTaskRunSkillBody,
|
|
122
|
+
plugin_default as default,
|
|
123
|
+
createProviderPlugin,
|
|
124
|
+
buildProviderTaskRunInstructionLines,
|
|
125
|
+
buildProviderRuntimeContextLines,
|
|
126
|
+
PROVIDER_PLUGIN_NAME
|
|
127
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __returnValue = (v) => v;
|
|
4
|
+
function __exportSetter(name, newValue) {
|
|
5
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
+
}
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
set: __exportSetter.bind(all, name)
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
17
|
+
|
|
18
|
+
// packages/provider-plugin/src/runtime-instructions.ts
|
|
19
|
+
function normalizeRuntimeInstructionProvider(_value) {
|
|
20
|
+
return "pi";
|
|
21
|
+
}
|
|
22
|
+
function buildProviderTaskRunInstructionLines(_provider) {
|
|
23
|
+
return [
|
|
24
|
+
"Use Pi's built-in `read`, `write`, `edit`, and `bash` tools from the isolated Rig task worktree.",
|
|
25
|
+
"Keep file writes inside the scoped task workspace unless Rig explicitly tells you a path is host/project metadata.",
|
|
26
|
+
"Prefer `read`, `write`, and `edit` over shell one-liners whenever those tools fit.",
|
|
27
|
+
"When shell access is needed, keep commands narrow and bounded; avoid repo-wide searches without an explicit path and output cap."
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
function buildProviderRuntimeContextLines(_provider) {
|
|
31
|
+
return [
|
|
32
|
+
"Pi runs from the isolated Rig task worktree with its built-in `read`, `write`, `edit`, and `bash` tools enabled.",
|
|
33
|
+
"Keep writes scoped to the task workspace unless Rig-provided instructions name an explicit metadata path.",
|
|
34
|
+
"Prefer Pi file tools over shell one-liners for file reads and edits.",
|
|
35
|
+
"Keep shell commands narrow and bounded; cap broad searches before widening."
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// packages/provider-plugin/src/service.ts
|
|
40
|
+
var exports_service = {};
|
|
41
|
+
__export(exports_service, {
|
|
42
|
+
svc: () => svc,
|
|
43
|
+
runtimeInstructionService: () => runtimeInstructionService
|
|
44
|
+
});
|
|
45
|
+
var svc, runtimeInstructionService;
|
|
46
|
+
var init_service = __esm(() => {
|
|
47
|
+
svc = {
|
|
48
|
+
normalizeProvider: normalizeRuntimeInstructionProvider,
|
|
49
|
+
buildTaskRunInstructionLines: buildProviderTaskRunInstructionLines,
|
|
50
|
+
buildRuntimeContextLines: buildProviderRuntimeContextLines
|
|
51
|
+
};
|
|
52
|
+
runtimeInstructionService = svc;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// packages/provider-plugin/src/plugin.ts
|
|
56
|
+
import { definePlugin } from "@rig/core/config";
|
|
57
|
+
import { RUNTIME_INSTRUCTION_SERVICE_CAPABILITY_ID } from "@rig/contracts";
|
|
58
|
+
var PROVIDER_PLUGIN_NAME = "@rig/provider-plugin";
|
|
59
|
+
var providerPlugin = definePlugin({
|
|
60
|
+
name: PROVIDER_PLUGIN_NAME,
|
|
61
|
+
version: "0.0.0-alpha.1",
|
|
62
|
+
contributes: {
|
|
63
|
+
capabilities: [
|
|
64
|
+
{
|
|
65
|
+
id: RUNTIME_INSTRUCTION_SERVICE_CAPABILITY_ID,
|
|
66
|
+
title: "Agent harness provider instructions",
|
|
67
|
+
description: "Provide the agent-harness file-tool contract and runtime-context instruction lines.",
|
|
68
|
+
run: async () => (await Promise.resolve().then(() => (init_service(), exports_service))).svc
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
function createProviderPlugin() {
|
|
74
|
+
return providerPlugin;
|
|
75
|
+
}
|
|
76
|
+
var plugin_default = providerPlugin;
|
|
77
|
+
export {
|
|
78
|
+
providerPlugin,
|
|
79
|
+
plugin_default as default,
|
|
80
|
+
createProviderPlugin,
|
|
81
|
+
PROVIDER_PLUGIN_NAME
|
|
82
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Return the rig-task-run skill body (markdown without frontmatter).
|
|
3
|
+
*
|
|
4
|
+
* The file is shipped at `packages/runtime/skills/rig-task-run.md`. We search
|
|
5
|
+
* a few paths so it resolves whether the caller is running from monorepo
|
|
6
|
+
* source, from a sibling import, or via the published @rig/runtime exports.
|
|
7
|
+
*/
|
|
8
|
+
export declare function loadRigTaskRunSkillBody(): string;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/provider-plugin/src/rig-task-run-skill.ts
|
|
3
|
+
import { existsSync, readFileSync } from "fs";
|
|
4
|
+
import { dirname, resolve } from "path";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
6
|
+
var SKILL_FILENAME = "rig-task-run.md";
|
|
7
|
+
var FRONTMATTER_RE = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/;
|
|
8
|
+
var cachedBody = null;
|
|
9
|
+
function loadRigTaskRunSkillBody() {
|
|
10
|
+
if (cachedBody !== null) {
|
|
11
|
+
return cachedBody;
|
|
12
|
+
}
|
|
13
|
+
const path = resolveSkillPath();
|
|
14
|
+
if (!path) {
|
|
15
|
+
cachedBody = "";
|
|
16
|
+
return cachedBody;
|
|
17
|
+
}
|
|
18
|
+
const raw = readFileSync(path, "utf-8");
|
|
19
|
+
const match = raw.match(FRONTMATTER_RE);
|
|
20
|
+
cachedBody = (match ? match[2] ?? raw : raw).trim();
|
|
21
|
+
return cachedBody;
|
|
22
|
+
}
|
|
23
|
+
function resolveSkillPath() {
|
|
24
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
25
|
+
const candidates = [
|
|
26
|
+
resolve(here, "..", "skills", SKILL_FILENAME),
|
|
27
|
+
resolve(here, "..", "..", "skills", SKILL_FILENAME),
|
|
28
|
+
resolve(here, "..", "..", "..", "skills", SKILL_FILENAME)
|
|
29
|
+
];
|
|
30
|
+
for (const candidate of candidates) {
|
|
31
|
+
if (existsSync(candidate)) {
|
|
32
|
+
return candidate;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
loadRigTaskRunSkillBody
|
|
39
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type RuntimeInstructionProvider = "pi";
|
|
2
|
+
export declare function normalizeRuntimeInstructionProvider(_value: string | undefined | null): RuntimeInstructionProvider;
|
|
3
|
+
export declare function buildProviderTaskRunInstructionLines(_provider: RuntimeInstructionProvider): string[];
|
|
4
|
+
export declare function buildProviderRuntimeContextLines(_provider: RuntimeInstructionProvider): string[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/provider-plugin/src/runtime-instructions.ts
|
|
3
|
+
function normalizeRuntimeInstructionProvider(_value) {
|
|
4
|
+
return "pi";
|
|
5
|
+
}
|
|
6
|
+
function buildProviderTaskRunInstructionLines(_provider) {
|
|
7
|
+
return [
|
|
8
|
+
"Use Pi's built-in `read`, `write`, `edit`, and `bash` tools from the isolated Rig task worktree.",
|
|
9
|
+
"Keep file writes inside the scoped task workspace unless Rig explicitly tells you a path is host/project metadata.",
|
|
10
|
+
"Prefer `read`, `write`, and `edit` over shell one-liners whenever those tools fit.",
|
|
11
|
+
"When shell access is needed, keep commands narrow and bounded; avoid repo-wide searches without an explicit path and output cap."
|
|
12
|
+
];
|
|
13
|
+
}
|
|
14
|
+
function buildProviderRuntimeContextLines(_provider) {
|
|
15
|
+
return [
|
|
16
|
+
"Pi runs from the isolated Rig task worktree with its built-in `read`, `write`, `edit`, and `bash` tools enabled.",
|
|
17
|
+
"Keep writes scoped to the task workspace unless Rig-provided instructions name an explicit metadata path.",
|
|
18
|
+
"Prefer Pi file tools over shell one-liners for file reads and edits.",
|
|
19
|
+
"Keep shell commands narrow and bounded; cap broad searches before widening."
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
normalizeRuntimeInstructionProvider,
|
|
24
|
+
buildProviderTaskRunInstructionLines,
|
|
25
|
+
buildProviderRuntimeContextLines
|
|
26
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* service.ts — the concrete agent-harness instruction service the runtime port
|
|
3
|
+
* resolves and consumes.
|
|
4
|
+
*
|
|
5
|
+
* CONFIG-LIGHT: this module top-level-imports the instruction-builder impl. It
|
|
6
|
+
* is loaded LAZILY by the capability `run()` in plugin.ts
|
|
7
|
+
* (`(await import("./service")).svc`), so merely evaluating rig.config.ts never
|
|
8
|
+
* drags the provider impl into scope.
|
|
9
|
+
*/
|
|
10
|
+
import type { RuntimeInstructionService } from "@rig/runtime/control-plane/provider-instruction-port";
|
|
11
|
+
/** The concrete agent-harness instruction service the runtime port resolves. */
|
|
12
|
+
export declare const svc: RuntimeInstructionService;
|
|
13
|
+
/** Back-compat alias. */
|
|
14
|
+
export declare const runtimeInstructionService: RuntimeInstructionService;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/provider-plugin/src/runtime-instructions.ts
|
|
3
|
+
function normalizeRuntimeInstructionProvider(_value) {
|
|
4
|
+
return "pi";
|
|
5
|
+
}
|
|
6
|
+
function buildProviderTaskRunInstructionLines(_provider) {
|
|
7
|
+
return [
|
|
8
|
+
"Use Pi's built-in `read`, `write`, `edit`, and `bash` tools from the isolated Rig task worktree.",
|
|
9
|
+
"Keep file writes inside the scoped task workspace unless Rig explicitly tells you a path is host/project metadata.",
|
|
10
|
+
"Prefer `read`, `write`, and `edit` over shell one-liners whenever those tools fit.",
|
|
11
|
+
"When shell access is needed, keep commands narrow and bounded; avoid repo-wide searches without an explicit path and output cap."
|
|
12
|
+
];
|
|
13
|
+
}
|
|
14
|
+
function buildProviderRuntimeContextLines(_provider) {
|
|
15
|
+
return [
|
|
16
|
+
"Pi runs from the isolated Rig task worktree with its built-in `read`, `write`, `edit`, and `bash` tools enabled.",
|
|
17
|
+
"Keep writes scoped to the task workspace unless Rig-provided instructions name an explicit metadata path.",
|
|
18
|
+
"Prefer Pi file tools over shell one-liners for file reads and edits.",
|
|
19
|
+
"Keep shell commands narrow and bounded; cap broad searches before widening."
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// packages/provider-plugin/src/service.ts
|
|
24
|
+
var svc = {
|
|
25
|
+
normalizeProvider: normalizeRuntimeInstructionProvider,
|
|
26
|
+
buildTaskRunInstructionLines: buildProviderTaskRunInstructionLines,
|
|
27
|
+
buildRuntimeContextLines: buildProviderRuntimeContextLines
|
|
28
|
+
};
|
|
29
|
+
var runtimeInstructionService = svc;
|
|
30
|
+
export {
|
|
31
|
+
svc,
|
|
32
|
+
runtimeInstructionService
|
|
33
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@h-rig/provider-plugin",
|
|
3
|
+
"version": "0.0.6-alpha.156",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "First-party agent-harness provider capability plugin for Rig.",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/src/plugin.d.ts",
|
|
14
|
+
"import": "./dist/src/plugin.js"
|
|
15
|
+
},
|
|
16
|
+
"./plugin": {
|
|
17
|
+
"types": "./dist/src/plugin.d.ts",
|
|
18
|
+
"import": "./dist/src/plugin.js"
|
|
19
|
+
},
|
|
20
|
+
"./index": {
|
|
21
|
+
"types": "./dist/src/index.d.ts",
|
|
22
|
+
"import": "./dist/src/index.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"bun": ">=1.3.11"
|
|
27
|
+
},
|
|
28
|
+
"main": "./dist/src/index.js",
|
|
29
|
+
"module": "./dist/src/index.js",
|
|
30
|
+
"types": "./dist/src/index.d.ts",
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.156",
|
|
33
|
+
"@rig/core": "npm:@h-rig/core@0.0.6-alpha.156",
|
|
34
|
+
"@rig/runtime": "npm:@h-rig/runtime@0.0.6-alpha.156"
|
|
35
|
+
}
|
|
36
|
+
}
|