@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.
Files changed (73) hide show
  1. package/dist/bin/rig-agent-dispatch.d.ts +2 -0
  2. package/dist/bin/rig-agent-dispatch.js +863 -0
  3. package/dist/src/agent-harness/agent-mode.d.ts +1 -0
  4. package/dist/src/agent-harness/agent-mode.js +48 -0
  5. package/dist/src/agent-harness/agent-wrapper.d.ts +53 -0
  6. package/dist/src/agent-harness/agent-wrapper.js +916 -0
  7. package/dist/src/agent-harness/controlled-bash.d.ts +3 -0
  8. package/dist/src/agent-harness/controlled-bash.js +45 -0
  9. package/dist/src/agent-harness/git-ops.d.ts +2 -0
  10. package/dist/src/agent-harness/git-ops.js +27 -0
  11. package/dist/src/agent-harness/repo-ops.d.ts +8 -0
  12. package/dist/src/agent-harness/repo-ops.js +471 -0
  13. package/dist/src/agent-harness/rig-agent-entrypoint.d.ts +1 -0
  14. package/dist/src/agent-harness/rig-agent-entrypoint.js +1277 -0
  15. package/dist/src/agent-harness/rig-agent.d.ts +2 -0
  16. package/dist/src/agent-harness/rig-agent.js +1244 -0
  17. package/dist/src/agent-harness/runtime-snapshot-config.d.ts +2 -0
  18. package/dist/src/agent-harness/runtime-snapshot-config.js +25 -0
  19. package/dist/src/agent-harness/task-data.d.ts +2 -0
  20. package/dist/src/agent-harness/task-data.js +12 -0
  21. package/dist/src/agent-harness/task-ops.d.ts +10 -0
  22. package/dist/src/agent-harness/task-ops.js +53 -0
  23. package/dist/src/index.js +3366 -16
  24. package/dist/src/pi-settings-materializer.d.ts +10 -0
  25. package/dist/src/pi-settings-materializer.js +52 -0
  26. package/dist/src/plugin.d.ts +9 -2
  27. package/dist/src/plugin.js +3360 -8
  28. package/dist/src/service.d.ts +1 -1
  29. package/dist/src/session-asset-materializer-service.d.ts +13 -0
  30. package/dist/src/session-asset-materializer-service.js +124 -0
  31. package/dist/src/skill-materializer.d.ts +25 -0
  32. package/dist/src/skill-materializer.js +46 -0
  33. package/dist/src/tooling/binary-build-worker.d.ts +1 -0
  34. package/dist/src/tooling/binary-build-worker.js +323 -0
  35. package/dist/src/tooling/browser-tool-entrypoint.d.ts +2 -0
  36. package/dist/src/tooling/browser-tool-entrypoint.js +125 -0
  37. package/dist/src/tooling/browser-tools.d.ts +3 -0
  38. package/dist/src/tooling/browser-tools.js +27 -0
  39. package/dist/src/tooling/claude-router-binary.d.ts +3 -0
  40. package/dist/src/tooling/claude-router-binary.js +381 -0
  41. package/dist/src/tooling/claude-router.d.ts +22 -0
  42. package/dist/src/tooling/claude-router.js +524 -0
  43. package/dist/src/tooling/embedded-native-assets.d.ts +7 -0
  44. package/dist/src/tooling/embedded-native-assets.js +6 -0
  45. package/dist/src/tooling/file-tools.d.ts +5 -0
  46. package/dist/src/tooling/file-tools.js +224 -0
  47. package/dist/src/tooling/gateway.d.ts +4 -0
  48. package/dist/src/tooling/gateway.js +430 -0
  49. package/dist/src/tooling/native-extract.d.ts +2 -0
  50. package/dist/src/tooling/native-extract.js +44 -0
  51. package/dist/src/tooling/runtime-binary-build.d.ts +88 -0
  52. package/dist/src/tooling/runtime-binary-build.js +480 -0
  53. package/dist/src/tooling/shell-tools.d.ts +5 -0
  54. package/dist/src/tooling/shell-tools.js +217 -0
  55. package/native/darwin-arm64/rig-shell +0 -0
  56. package/native/darwin-arm64/rig-shell.build-manifest.json +4 -0
  57. package/native/darwin-arm64/rig-tools +0 -0
  58. package/native/darwin-arm64/rig-tools.build-manifest.json +4 -0
  59. package/native/darwin-x64/rig-shell +0 -0
  60. package/native/darwin-x64/rig-tools +0 -0
  61. package/native/linux-arm64/rig-shell +0 -0
  62. package/native/linux-arm64/rig-tools +0 -0
  63. package/native/linux-x64/rig-shell +0 -0
  64. package/native/linux-x64/rig-tools +0 -0
  65. package/native/win32-x64/rig-shell.exe +0 -0
  66. package/native/win32-x64/rig-tools.exe +0 -0
  67. package/package.json +54 -5
  68. package/dist/src/claude-stream-records.d.ts +0 -24
  69. package/dist/src/claude-stream-records.js +0 -158
  70. package/dist/src/codex-app-server.d.ts +0 -16
  71. package/dist/src/codex-app-server.js +0 -548
  72. package/dist/src/codex-exec-records.d.ts +0 -27
  73. 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
- };