@h-rig/provider-plugin 0.0.6-alpha.157 → 0.0.6-alpha.158
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/rig-agent-dispatch.d.ts +2 -0
- package/dist/bin/rig-agent-dispatch.js +863 -0
- package/dist/src/agent-harness/agent-mode.d.ts +1 -0
- package/dist/src/agent-harness/agent-mode.js +48 -0
- package/dist/src/agent-harness/agent-wrapper.d.ts +53 -0
- package/dist/src/agent-harness/agent-wrapper.js +916 -0
- package/dist/src/agent-harness/controlled-bash.d.ts +3 -0
- package/dist/src/agent-harness/controlled-bash.js +45 -0
- package/dist/src/agent-harness/git-ops.d.ts +2 -0
- package/dist/src/agent-harness/git-ops.js +27 -0
- package/dist/src/agent-harness/repo-ops.d.ts +8 -0
- package/dist/src/agent-harness/repo-ops.js +471 -0
- package/dist/src/agent-harness/rig-agent-entrypoint.d.ts +1 -0
- package/dist/src/agent-harness/rig-agent-entrypoint.js +1277 -0
- package/dist/src/agent-harness/rig-agent.d.ts +2 -0
- package/dist/src/agent-harness/rig-agent.js +1244 -0
- package/dist/src/agent-harness/runtime-snapshot-config.d.ts +2 -0
- package/dist/src/agent-harness/runtime-snapshot-config.js +25 -0
- package/dist/src/agent-harness/task-data.d.ts +2 -0
- package/dist/src/agent-harness/task-data.js +12 -0
- package/dist/src/agent-harness/task-ops.d.ts +10 -0
- package/dist/src/agent-harness/task-ops.js +53 -0
- package/dist/src/index.js +3366 -16
- package/dist/src/pi-settings-materializer.d.ts +10 -0
- package/dist/src/pi-settings-materializer.js +52 -0
- package/dist/src/plugin.d.ts +9 -2
- package/dist/src/plugin.js +3360 -8
- package/dist/src/service.d.ts +1 -1
- package/dist/src/session-asset-materializer-service.d.ts +13 -0
- package/dist/src/session-asset-materializer-service.js +124 -0
- package/dist/src/skill-materializer.d.ts +25 -0
- package/dist/src/skill-materializer.js +46 -0
- package/dist/src/tooling/binary-build-worker.d.ts +1 -0
- package/dist/src/tooling/binary-build-worker.js +323 -0
- package/dist/src/tooling/browser-tool-entrypoint.d.ts +2 -0
- package/dist/src/tooling/browser-tool-entrypoint.js +125 -0
- package/dist/src/tooling/browser-tools.d.ts +3 -0
- package/dist/src/tooling/browser-tools.js +27 -0
- package/dist/src/tooling/claude-router-binary.d.ts +3 -0
- package/dist/src/tooling/claude-router-binary.js +381 -0
- package/dist/src/tooling/claude-router.d.ts +22 -0
- package/dist/src/tooling/claude-router.js +524 -0
- package/dist/src/tooling/embedded-native-assets.d.ts +7 -0
- package/dist/src/tooling/embedded-native-assets.js +6 -0
- package/dist/src/tooling/file-tools.d.ts +5 -0
- package/dist/src/tooling/file-tools.js +224 -0
- package/dist/src/tooling/gateway.d.ts +4 -0
- package/dist/src/tooling/gateway.js +430 -0
- package/dist/src/tooling/native-extract.d.ts +2 -0
- package/dist/src/tooling/native-extract.js +44 -0
- package/dist/src/tooling/runtime-binary-build.d.ts +88 -0
- package/dist/src/tooling/runtime-binary-build.js +480 -0
- package/dist/src/tooling/shell-tools.d.ts +5 -0
- package/dist/src/tooling/shell-tools.js +217 -0
- package/native/darwin-arm64/rig-shell +0 -0
- package/native/darwin-arm64/rig-shell.build-manifest.json +4 -0
- package/native/darwin-arm64/rig-tools +0 -0
- package/native/darwin-arm64/rig-tools.build-manifest.json +4 -0
- package/native/darwin-x64/rig-shell +0 -0
- package/native/darwin-x64/rig-tools +0 -0
- package/native/linux-arm64/rig-shell +0 -0
- package/native/linux-arm64/rig-tools +0 -0
- package/native/linux-x64/rig-shell +0 -0
- package/native/linux-x64/rig-tools +0 -0
- package/native/win32-x64/rig-shell.exe +0 -0
- package/native/win32-x64/rig-tools.exe +0 -0
- package/package.json +54 -5
- package/dist/src/claude-stream-records.d.ts +0 -24
- package/dist/src/claude-stream-records.js +0 -158
- package/dist/src/codex-app-server.d.ts +0 -16
- package/dist/src/codex-app-server.js +0 -548
- package/dist/src/codex-exec-records.d.ts +0 -27
- package/dist/src/codex-exec-records.js +0 -203
|
@@ -1,203 +0,0 @@
|
|
|
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
|
-
};
|