@myagentroam/node 0.9.9 → 0.9.11
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/capabilities.js +2 -92
- package/dist/claude-agent-sdk.js +2 -330
- package/dist/claude-channel.js +2 -44
- package/dist/codex-app-server.js +2 -503
- package/dist/config.js +2 -56
- package/dist/connector/node-connector-options.js +2 -1
- package/dist/connector/node-operation-router.js +2 -22
- package/dist/connector.js +2 -845
- package/dist/control-outbound-scheduler.js +2 -154
- package/dist/database.js +2 -1418
- package/dist/event-buffer.js +2 -19
- package/dist/fake-runner.js +2 -129
- package/dist/health.js +2 -3
- package/dist/main.js +2 -54
- package/dist/migrations/v001.js +3 -144
- package/dist/migrations/v002.js +2 -143
- package/dist/migrations/v003.js +2 -44
- package/dist/migrations/v004.js +34 -30
- package/dist/native-jsonl-reader.js +2 -186
- package/dist/native-session-history.js +2 -1119
- package/dist/opencode-runtime.js +2 -80
- package/dist/opencode-server.js +2 -263
- package/dist/operational.js +2 -122
- package/dist/process-tree.js +2 -18
- package/dist/rotating-log.js +2 -67
- package/dist/runner/abstract-runner.js +2 -232
- package/dist/runner/claude/managed-run-controller.js +2 -345
- package/dist/runner/claude-code-runner.js +2 -303
- package/dist/runner/codex/composer-image-markers.js +2 -0
- package/dist/runner/codex/conversation-parser.js +2 -861
- package/dist/runner/codex/managed-run-controller.js +2 -460
- package/dist/runner/codex-runner.js +2 -628
- package/dist/runner/fake-test-runner.js +2 -47
- package/dist/runner/opencode/conversation-parser.js +2 -221
- package/dist/runner/opencode/managed-run-controller.js +2 -537
- package/dist/runner/opencode-runner.js +2 -448
- package/dist/runner/runner-registry.js +2 -90
- package/dist/runner-command-engine.js +2 -70
- package/dist/runner-profiles.js +2 -215
- package/dist/runner-usage.js +2 -190
- package/dist/runtime-command-detector.js +2 -73
- package/dist/runtime-state.js +2 -982
- package/dist/service/attachment-domain-state.js +2 -7
- package/dist/service/conversation-history-service.js +2 -457
- package/dist/service/conversation-segment-service.js +2 -162
- package/dist/service/external-session-resume-service.js +2 -118
- package/dist/service/fake-managed-run-service.js +2 -60
- package/dist/service/managed-runner-session-service.js +2 -35
- package/dist/service/mcp-installation-verifier.js +2 -87
- package/dist/service/mcp-node-operation-service.js +2 -90
- package/dist/service/mcp-package-installer.js +2 -136
- package/dist/service/native-session-projection-service.js +2 -280
- package/dist/service/native-session-watch-service.js +2 -383
- package/dist/service/node-connection-lifecycle-service.js +2 -84
- package/dist/service/node-control-channel.js +2 -85
- package/dist/service/node-control-message-service.js +2 -107
- package/dist/service/node-request-service.js +2 -52
- package/dist/service/node-run-event-bridge.js +2 -83
- package/dist/service/node-terminal-channel.js +2 -182
- package/dist/service/node-upgrade-coordinator.js +2 -137
- package/dist/service/node-workspace-coordinator.js +2 -70
- package/dist/service/recent-run-projection-service.js +2 -78
- package/dist/service/run-attachment-service.js +2 -194
- package/dist/service/run-domain-state.js +2 -4
- package/dist/service/run-event-service.js +2 -193
- package/dist/service/run-workbench-service.js +2 -104
- package/dist/service/runner-channel-message-service.js +2 -20
- package/dist/service/runner-interaction-service.js +2 -243
- package/dist/service/runner-service.js +2 -71
- package/dist/service/session-catalog-service.js +2 -224
- package/dist/service/session-command-service.js +2 -76
- package/dist/service/session-context-service.js +2 -101
- package/dist/service/session-domain-state.js +2 -9
- package/dist/service/session-identity-service.js +2 -86
- package/dist/service/session-lifecycle-service.js +2 -240
- package/dist/service/session-message-service.js +2 -173
- package/dist/service/session-presentation-service.js +2 -43
- package/dist/service/session-query-service.js +2 -82
- package/dist/service/skill-directory-service.js +2 -238
- package/dist/service/skill-install-service.js +2 -434
- package/dist/service/skill-node-operation-service.js +2 -206
- package/dist/service/terminal-relay-state.js +2 -3
- package/dist/service/terminal-service.js +2 -52
- package/dist/service/workbench-event-service.js +2 -19
- package/dist/service/workbench-manifest-service.js +2 -69
- package/dist/service/workspace-change-service.js +2 -86
- package/dist/service/workspace-content-search-service.js +2 -477
- package/dist/service/workspace-domain-state.js +2 -41
- package/dist/service/workspace-file-service.js +2 -122
- package/dist/service/workspace-git-exclude-service.js +2 -119
- package/dist/service/workspace-queue-workbench-service.js +2 -304
- package/dist/service/workspace-service.js +2 -69
- package/dist/service/workspace-session-service.js +2 -139
- package/dist/service/workspace-upload-service.js +2 -262
- package/dist/service/workspace-watch-service.js +2 -146
- package/dist/service/workspace-workbench-service.js +2 -405
- package/dist/service.js +2 -38
- package/dist/storage.js +2 -32
- package/dist/supervisor.js +2 -136
- package/dist/terminal.js +2 -416
- package/dist/util/node-operation-parsers.js +2 -382
- package/dist/util/personal-instructions.js +2 -31
- package/dist/util/runner-error.js +2 -52
- package/dist/util/runner-native-session-parsers.js +2 -490
- package/dist/util/safe-error.js +2 -5
- package/dist/util/secret-environment.js +2 -25
- package/dist/workspace.js +2 -1519
- package/package.json +3 -3
- package/dist/capabilities.d.ts +0 -12
- package/dist/claude-agent-sdk.d.ts +0 -92
- package/dist/claude-channel.d.ts +0 -28
- package/dist/codex-app-server.d.ts +0 -133
- package/dist/config.d.ts +0 -18
- package/dist/connector/node-connector-options.d.ts +0 -27
- package/dist/connector/node-operation-router.d.ts +0 -9
- package/dist/connector.d.ts +0 -94
- package/dist/control-outbound-scheduler.d.ts +0 -29
- package/dist/database.d.ts +0 -305
- package/dist/event-buffer.d.ts +0 -9
- package/dist/fake-runner.d.ts +0 -42
- package/dist/health.d.ts +0 -4
- package/dist/main.d.ts +0 -2
- package/dist/migrations/v001.d.ts +0 -3
- package/dist/migrations/v002.d.ts +0 -4
- package/dist/migrations/v003.d.ts +0 -4
- package/dist/migrations/v004.d.ts +0 -4
- package/dist/native-jsonl-reader.d.ts +0 -35
- package/dist/native-session-history.d.ts +0 -126
- package/dist/opencode-runtime.d.ts +0 -33
- package/dist/opencode-server.d.ts +0 -49
- package/dist/operational.d.ts +0 -39
- package/dist/process-tree.d.ts +0 -9
- package/dist/rotating-log.d.ts +0 -17
- package/dist/runner/abstract-runner.d.ts +0 -172
- package/dist/runner/claude/managed-run-controller.d.ts +0 -51
- package/dist/runner/claude-code-runner.d.ts +0 -72
- package/dist/runner/codex/conversation-parser.d.ts +0 -59
- package/dist/runner/codex/managed-run-controller.d.ts +0 -90
- package/dist/runner/codex-runner.d.ts +0 -103
- package/dist/runner/fake-test-runner.d.ts +0 -26
- package/dist/runner/opencode/conversation-parser.d.ts +0 -31
- package/dist/runner/opencode/managed-run-controller.d.ts +0 -82
- package/dist/runner/opencode-runner.d.ts +0 -71
- package/dist/runner/runner-registry.d.ts +0 -19
- package/dist/runner-command-engine.d.ts +0 -28
- package/dist/runner-profiles.d.ts +0 -15
- package/dist/runner-usage.d.ts +0 -33
- package/dist/runtime-command-detector.d.ts +0 -3
- package/dist/runtime-state.d.ts +0 -171
- package/dist/service/attachment-domain-state.d.ts +0 -7
- package/dist/service/conversation-history-service.d.ts +0 -43
- package/dist/service/conversation-segment-service.d.ts +0 -20
- package/dist/service/external-session-resume-service.d.ts +0 -34
- package/dist/service/fake-managed-run-service.d.ts +0 -28
- package/dist/service/managed-runner-session-service.d.ts +0 -12
- package/dist/service/mcp-installation-verifier.d.ts +0 -9
- package/dist/service/mcp-node-operation-service.d.ts +0 -11
- package/dist/service/mcp-package-installer.d.ts +0 -8
- package/dist/service/native-session-projection-service.d.ts +0 -52
- package/dist/service/native-session-watch-service.d.ts +0 -62
- package/dist/service/node-connection-lifecycle-service.d.ts +0 -36
- package/dist/service/node-control-channel.d.ts +0 -32
- package/dist/service/node-control-message-service.d.ts +0 -27
- package/dist/service/node-request-service.d.ts +0 -14
- package/dist/service/node-run-event-bridge.d.ts +0 -40
- package/dist/service/node-terminal-channel.d.ts +0 -29
- package/dist/service/node-upgrade-coordinator.d.ts +0 -29
- package/dist/service/node-workspace-coordinator.d.ts +0 -29
- package/dist/service/recent-run-projection-service.d.ts +0 -14
- package/dist/service/run-attachment-service.d.ts +0 -38
- package/dist/service/run-domain-state.d.ts +0 -4
- package/dist/service/run-event-service.d.ts +0 -33
- package/dist/service/run-workbench-service.d.ts +0 -25
- package/dist/service/runner-channel-message-service.d.ts +0 -13
- package/dist/service/runner-interaction-service.d.ts +0 -39
- package/dist/service/runner-service.d.ts +0 -46
- package/dist/service/session-catalog-service.d.ts +0 -45
- package/dist/service/session-command-service.d.ts +0 -24
- package/dist/service/session-context-service.d.ts +0 -35
- package/dist/service/session-domain-state.d.ts +0 -9
- package/dist/service/session-identity-service.d.ts +0 -24
- package/dist/service/session-lifecycle-service.d.ts +0 -31
- package/dist/service/session-message-service.d.ts +0 -33
- package/dist/service/session-presentation-service.d.ts +0 -34
- package/dist/service/session-query-service.d.ts +0 -35
- package/dist/service/skill-directory-service.d.ts +0 -20
- package/dist/service/skill-install-service.d.ts +0 -21
- package/dist/service/skill-node-operation-service.d.ts +0 -44
- package/dist/service/terminal-relay-state.d.ts +0 -6
- package/dist/service/terminal-service.d.ts +0 -12
- package/dist/service/workbench-event-service.d.ts +0 -9
- package/dist/service/workbench-manifest-service.d.ts +0 -90
- package/dist/service/workspace-change-service.d.ts +0 -9
- package/dist/service/workspace-content-search-service.d.ts +0 -14
- package/dist/service/workspace-domain-state.d.ts +0 -79
- package/dist/service/workspace-file-service.d.ts +0 -18
- package/dist/service/workspace-git-exclude-service.d.ts +0 -4
- package/dist/service/workspace-queue-workbench-service.d.ts +0 -86
- package/dist/service/workspace-service.d.ts +0 -15
- package/dist/service/workspace-session-service.d.ts +0 -23
- package/dist/service/workspace-upload-service.d.ts +0 -39
- package/dist/service/workspace-watch-service.d.ts +0 -23
- package/dist/service/workspace-workbench-service.d.ts +0 -58
- package/dist/service.d.ts +0 -4
- package/dist/storage.d.ts +0 -2
- package/dist/supervisor.d.ts +0 -1
- package/dist/terminal.d.ts +0 -133
- package/dist/util/node-operation-parsers.d.ts +0 -92
- package/dist/util/personal-instructions.d.ts +0 -2
- package/dist/util/runner-error.d.ts +0 -6
- package/dist/util/runner-native-session-parsers.d.ts +0 -74
- package/dist/util/safe-error.d.ts +0 -2
- package/dist/util/secret-environment.d.ts +0 -1
- package/dist/workspace.d.ts +0 -217
|
@@ -1,382 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
const MAX_COMPOSER_ATTACHMENT_BYTES = 5 * 1024 * 1024;
|
|
3
|
-
const MAX_COMPOSER_ATTACHMENTS_BYTES = 10 * 1024 * 1024;
|
|
4
|
-
const USER_AUTHORIZATION_CLOCK_SKEW_MS = 5_000;
|
|
5
|
-
const NON_IMAGE_ATTACHMENT_PROMPT_PREFIX = '\n\nNon-image attachments for this turn were uploaded to the Workspace. Read these files as needed:\n';
|
|
6
|
-
const COMPOSER_IMAGE_MIME_TYPES = new Set([
|
|
7
|
-
'image/png',
|
|
8
|
-
'image/jpeg',
|
|
9
|
-
'image/gif',
|
|
10
|
-
'image/webp'
|
|
11
|
-
]);
|
|
12
|
-
export const DEFAULT_SESSION_PAGE_SIZE = 10;
|
|
13
|
-
export const MAX_SESSION_PAGE_SIZE = 100;
|
|
14
|
-
export function sessionPage(sessions, input) {
|
|
15
|
-
const limit = typeof input.limit === 'number' &&
|
|
16
|
-
Number.isInteger(input.limit) &&
|
|
17
|
-
input.limit >= 1 &&
|
|
18
|
-
input.limit <= MAX_SESSION_PAGE_SIZE
|
|
19
|
-
? input.limit
|
|
20
|
-
: DEFAULT_SESSION_PAGE_SIZE;
|
|
21
|
-
const cursor = typeof input.cursor === 'string' ? input.cursor : undefined;
|
|
22
|
-
const ordered = [...sessions].sort(compareSessionPageEntries);
|
|
23
|
-
const cursorEntry = cursor === undefined ? undefined : parseSessionPageCursor(cursor);
|
|
24
|
-
const afterCursor = cursor === undefined
|
|
25
|
-
? ordered
|
|
26
|
-
: cursorEntry === undefined
|
|
27
|
-
? []
|
|
28
|
-
: ordered.filter((session) => compareSessionPageEntries(session, cursorEntry) > 0);
|
|
29
|
-
const pinned = ordered.filter((session) => session.pinOrder !== null && session.pinOrder !== undefined);
|
|
30
|
-
const pinnedIndexes = new Map(pinned.map((session, index) => [session.id, index]));
|
|
31
|
-
const page = afterCursor.slice(0, limit).map((session) => {
|
|
32
|
-
const pinIndex = pinnedIndexes.get(session.id);
|
|
33
|
-
if (pinIndex === undefined)
|
|
34
|
-
return session;
|
|
35
|
-
return {
|
|
36
|
-
...session,
|
|
37
|
-
canMovePinUp: pinIndex > 0,
|
|
38
|
-
canMovePinDown: pinIndex < pinned.length - 1
|
|
39
|
-
};
|
|
40
|
-
});
|
|
41
|
-
const last = page.at(-1);
|
|
42
|
-
return {
|
|
43
|
-
sessions: page,
|
|
44
|
-
nextCursor: last !== undefined && afterCursor.length > page.length ? createSessionPageCursor(last) : null
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
export function parseSessionPageCursor(cursor) {
|
|
48
|
-
try {
|
|
49
|
-
const value = JSON.parse(decodeURIComponent(cursor));
|
|
50
|
-
if (!Array.isArray(value) || value.length !== 3)
|
|
51
|
-
return undefined;
|
|
52
|
-
const [pinOrder, lastActivityAt, id] = value;
|
|
53
|
-
if ((pinOrder !== null && (typeof pinOrder !== 'number' || !Number.isFinite(pinOrder))) ||
|
|
54
|
-
(lastActivityAt !== null &&
|
|
55
|
-
(typeof lastActivityAt !== 'number' || !Number.isFinite(lastActivityAt))) ||
|
|
56
|
-
typeof id !== 'string')
|
|
57
|
-
return undefined;
|
|
58
|
-
return {
|
|
59
|
-
id,
|
|
60
|
-
lastActivityAt: lastActivityAt ?? 0,
|
|
61
|
-
pinOrder,
|
|
62
|
-
externalDiscovered: lastActivityAt !== null
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
catch {
|
|
66
|
-
return undefined;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
export function createSessionPageCursor(session) {
|
|
70
|
-
return encodeURIComponent(JSON.stringify([
|
|
71
|
-
session.pinOrder ?? null,
|
|
72
|
-
session.externalDiscovered === false ? null : session.lastActivityAt,
|
|
73
|
-
session.id
|
|
74
|
-
]));
|
|
75
|
-
}
|
|
76
|
-
export function compareSessionPageEntries(left, right) {
|
|
77
|
-
const leftPinned = left.pinOrder !== null && left.pinOrder !== undefined;
|
|
78
|
-
const rightPinned = right.pinOrder !== null && right.pinOrder !== undefined;
|
|
79
|
-
if (leftPinned !== rightPinned)
|
|
80
|
-
return leftPinned ? -1 : 1;
|
|
81
|
-
if (leftPinned && rightPinned)
|
|
82
|
-
return (left.pinOrder - right.pinOrder || left.id.localeCompare(right.id));
|
|
83
|
-
const leftFound = left.externalDiscovered !== false;
|
|
84
|
-
const rightFound = right.externalDiscovered !== false;
|
|
85
|
-
if (leftFound !== rightFound)
|
|
86
|
-
return leftFound ? -1 : 1;
|
|
87
|
-
return right.lastActivityAt - left.lastActivityAt || left.id.localeCompare(right.id, 'en');
|
|
88
|
-
}
|
|
89
|
-
export function compactRunnerText(value, limit) {
|
|
90
|
-
return value.length <= limit ? value : `${value.slice(0, Math.max(0, limit - 1))}…`;
|
|
91
|
-
}
|
|
92
|
-
export function compactRunnerValue(value, limit) {
|
|
93
|
-
if (value === undefined || value === null)
|
|
94
|
-
return { text: '', truncated: false };
|
|
95
|
-
let text;
|
|
96
|
-
if (typeof value === 'string')
|
|
97
|
-
text = value;
|
|
98
|
-
else {
|
|
99
|
-
try {
|
|
100
|
-
text = JSON.stringify(value);
|
|
101
|
-
}
|
|
102
|
-
catch {
|
|
103
|
-
return { text: '(Unable to display)', truncated: false };
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return { text: compactRunnerText(text, limit), truncated: text.length > limit };
|
|
107
|
-
}
|
|
108
|
-
export function codexTimestamp(value) {
|
|
109
|
-
if (typeof value === 'number' && Number.isFinite(value))
|
|
110
|
-
return value < 10_000_000_000 ? value * 1_000 : value;
|
|
111
|
-
if (typeof value === 'string') {
|
|
112
|
-
const timestamp = Date.parse(value);
|
|
113
|
-
return Number.isNaN(timestamp) ? null : timestamp;
|
|
114
|
-
}
|
|
115
|
-
return null;
|
|
116
|
-
}
|
|
117
|
-
export function nativePageEnd(cursor, sessionId, fallback) {
|
|
118
|
-
if (cursor === undefined)
|
|
119
|
-
return fallback;
|
|
120
|
-
try {
|
|
121
|
-
const value = JSON.parse(Buffer.from(cursor, 'base64url').toString('utf8'));
|
|
122
|
-
return value.sessionId === sessionId &&
|
|
123
|
-
Number.isInteger(value.end) &&
|
|
124
|
-
value.end >= 0
|
|
125
|
-
? Math.min(value.end, fallback)
|
|
126
|
-
: fallback;
|
|
127
|
-
}
|
|
128
|
-
catch {
|
|
129
|
-
return fallback;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
export function extractClaudeText(message) {
|
|
133
|
-
return claudeContentBlocks(message)
|
|
134
|
-
.flatMap((block) => block.type === 'text' && typeof block.text === 'string' ? [block.text] : [])
|
|
135
|
-
.join('');
|
|
136
|
-
}
|
|
137
|
-
export function extractClaudeThinkingSummaries(message) {
|
|
138
|
-
return claudeContentBlocks(message).flatMap((block) => {
|
|
139
|
-
// `showThinkingSummaries` asks the SDK/API for exactly these public
|
|
140
|
-
// summaries. Partial raw thinking events are intentionally not read.
|
|
141
|
-
if (block.type !== 'thinking' || typeof block.thinking !== 'string')
|
|
142
|
-
return [];
|
|
143
|
-
const text = compactRunnerText(block.thinking.trim(), 10_000);
|
|
144
|
-
return text.length === 0 ? [] : [text];
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
export function extractClaudeToolUses(message) {
|
|
148
|
-
return claudeContentBlocks(message).flatMap((block) => {
|
|
149
|
-
if (block.type !== 'tool_use' || typeof block.id !== 'string' || typeof block.name !== 'string')
|
|
150
|
-
return [];
|
|
151
|
-
const input = block.input;
|
|
152
|
-
const command = isPlainRecord(input) && typeof input.command === 'string' ? input.command : undefined;
|
|
153
|
-
return [
|
|
154
|
-
{
|
|
155
|
-
id: block.id,
|
|
156
|
-
name: block.name,
|
|
157
|
-
input,
|
|
158
|
-
...(command === undefined ? {} : { command }),
|
|
159
|
-
inputTruncated: compactRunnerValue(input, 10_000).truncated
|
|
160
|
-
}
|
|
161
|
-
];
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
export function extractClaudeToolResults(message) {
|
|
165
|
-
const parentId = typeof message.parent_tool_use_id === 'string' ? message.parent_tool_use_id : null;
|
|
166
|
-
const direct = compactRunnerValue(message.tool_use_result, 10_000);
|
|
167
|
-
if (parentId !== null && direct.text.length > 0)
|
|
168
|
-
return [
|
|
169
|
-
{ toolUseId: parentId, output: direct.text, failed: false, truncated: direct.truncated }
|
|
170
|
-
];
|
|
171
|
-
return claudeContentBlocks(message).flatMap((block) => {
|
|
172
|
-
if (block.type !== 'tool_result' || typeof block.tool_use_id !== 'string')
|
|
173
|
-
return [];
|
|
174
|
-
const result = compactRunnerValue(block.content, 10_000);
|
|
175
|
-
return [
|
|
176
|
-
{
|
|
177
|
-
toolUseId: block.tool_use_id,
|
|
178
|
-
output: result.text,
|
|
179
|
-
failed: block.is_error === true,
|
|
180
|
-
truncated: result.truncated
|
|
181
|
-
}
|
|
182
|
-
];
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
export function claudeContentBlocks(message) {
|
|
186
|
-
const content = message.message;
|
|
187
|
-
if (!isPlainRecord(content) || !Array.isArray(content.content))
|
|
188
|
-
return [];
|
|
189
|
-
return content.content.filter(isPlainRecord);
|
|
190
|
-
}
|
|
191
|
-
export function isClaudeCommandTool(name) {
|
|
192
|
-
return name === 'Bash' || name === 'bash' || name === 'Shell';
|
|
193
|
-
}
|
|
194
|
-
export function nativeClaudeCommand(entry) {
|
|
195
|
-
if (isPlainRecord(entry.input) && typeof entry.input.command === 'string')
|
|
196
|
-
return compactRunnerText(entry.input.command, 10_000);
|
|
197
|
-
return entry.inputSummary ?? entry.toolName;
|
|
198
|
-
}
|
|
199
|
-
export function boundedConversationItemId(prefix, value) {
|
|
200
|
-
const candidate = `${prefix}:${value}`;
|
|
201
|
-
if (candidate.length <= 88)
|
|
202
|
-
return candidate;
|
|
203
|
-
return `${prefix}:${Buffer.from(value)
|
|
204
|
-
.toString('base64url')
|
|
205
|
-
.slice(0, 88 - prefix.length - 1)}`;
|
|
206
|
-
}
|
|
207
|
-
export function validUserAuthorization(value, envelope, operation, nodeId, now = Date.now()) {
|
|
208
|
-
if (typeof value !== 'object' || value === null || nodeId === undefined)
|
|
209
|
-
return false;
|
|
210
|
-
const authorization = value;
|
|
211
|
-
return (typeof authorization.userId === 'number' &&
|
|
212
|
-
Number.isSafeInteger(authorization.userId) &&
|
|
213
|
-
authorization.userId > 0 &&
|
|
214
|
-
typeof authorization.sessionHash === 'string' &&
|
|
215
|
-
/^[A-Za-z0-9_-]{43}$/.test(authorization.sessionHash) &&
|
|
216
|
-
authorization.nodeId === nodeId &&
|
|
217
|
-
authorization.operation === operation &&
|
|
218
|
-
authorization.requestId === envelope.id &&
|
|
219
|
-
typeof authorization.issuedAt === 'number' &&
|
|
220
|
-
typeof authorization.expiresAt === 'number' &&
|
|
221
|
-
Number.isSafeInteger(authorization.issuedAt) &&
|
|
222
|
-
Number.isSafeInteger(authorization.expiresAt) &&
|
|
223
|
-
authorization.issuedAt <= now + USER_AUTHORIZATION_CLOCK_SKEW_MS &&
|
|
224
|
-
authorization.expiresAt >= now - USER_AUTHORIZATION_CLOCK_SKEW_MS &&
|
|
225
|
-
authorization.expiresAt - authorization.issuedAt <= 15_000);
|
|
226
|
-
}
|
|
227
|
-
export function isTerminalRunStatus(status) {
|
|
228
|
-
return (status === 'SUCCEEDED' ||
|
|
229
|
-
status === 'FAILED' ||
|
|
230
|
-
status === 'CANCELLED' ||
|
|
231
|
-
status === 'INTERRUPTED');
|
|
232
|
-
}
|
|
233
|
-
export function validSessionOption(value) {
|
|
234
|
-
return (value === undefined ||
|
|
235
|
-
(typeof value === 'string' && value.trim().length > 0 && value.length <= 120));
|
|
236
|
-
}
|
|
237
|
-
export function validSessionEffort(value) {
|
|
238
|
-
return value === undefined || (typeof value === 'string' && value.length <= 120);
|
|
239
|
-
}
|
|
240
|
-
export function validSessionTitle(value) {
|
|
241
|
-
return (value === undefined ||
|
|
242
|
-
(typeof value === 'string' && value.trim().length > 0 && value.length <= 160));
|
|
243
|
-
}
|
|
244
|
-
export function sessionTitleFromFirstMessage(content) {
|
|
245
|
-
return content.trim().replace(/\s+/g, ' ').slice(0, 160);
|
|
246
|
-
}
|
|
247
|
-
export function parseComposerAttachmentUpload(input) {
|
|
248
|
-
if (input.composerAttachmentId === undefined && input.mime === undefined)
|
|
249
|
-
return undefined;
|
|
250
|
-
if (typeof input.composerAttachmentId !== 'string' ||
|
|
251
|
-
!isUuid(input.composerAttachmentId) ||
|
|
252
|
-
typeof input.name !== 'string' ||
|
|
253
|
-
!validComposerAttachmentName(input.name) ||
|
|
254
|
-
typeof input.mime !== 'string' ||
|
|
255
|
-
input.mime.length === 0 ||
|
|
256
|
-
input.mime.length > 120)
|
|
257
|
-
throw new Error('COMPOSER_ATTACHMENT_INVALID');
|
|
258
|
-
return { id: input.composerAttachmentId, name: input.name, mime: input.mime };
|
|
259
|
-
}
|
|
260
|
-
export function parseComposerAttachmentIds(value) {
|
|
261
|
-
if (value === undefined)
|
|
262
|
-
return [];
|
|
263
|
-
if (!Array.isArray(value) || value.length > 5 || value.some((id) => typeof id !== 'string'))
|
|
264
|
-
throw new Error('MESSAGE_ATTACHMENTS_INVALID');
|
|
265
|
-
const ids = value;
|
|
266
|
-
if (ids.some((id) => !isUuid(id)) || new Set(ids).size !== ids.length)
|
|
267
|
-
throw new Error('MESSAGE_ATTACHMENTS_INVALID');
|
|
268
|
-
return ids;
|
|
269
|
-
}
|
|
270
|
-
export function validComposerAttachmentName(name) {
|
|
271
|
-
return (name.trim().length > 0 &&
|
|
272
|
-
name.length <= 255 &&
|
|
273
|
-
name !== '.' &&
|
|
274
|
-
name !== '..' &&
|
|
275
|
-
!name.includes('/') &&
|
|
276
|
-
!name.includes('\\') &&
|
|
277
|
-
!Array.from(name).some((character) => {
|
|
278
|
-
const code = character.charCodeAt(0);
|
|
279
|
-
return code <= 31 || code === 127 || '<>:"|?*'.includes(character);
|
|
280
|
-
}));
|
|
281
|
-
}
|
|
282
|
-
export function isUuid(value) {
|
|
283
|
-
return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value);
|
|
284
|
-
}
|
|
285
|
-
export function parseMessageAttachments(value) {
|
|
286
|
-
if (value === undefined)
|
|
287
|
-
return [];
|
|
288
|
-
if (!Array.isArray(value) || value.length > 5)
|
|
289
|
-
throw new Error('MESSAGE_ATTACHMENTS_INVALID');
|
|
290
|
-
let totalBytes = 0;
|
|
291
|
-
return value.map((attachment) => {
|
|
292
|
-
if (!isPlainRecord(attachment))
|
|
293
|
-
throw new Error('MESSAGE_ATTACHMENTS_INVALID');
|
|
294
|
-
if (typeof attachment.name !== 'string' ||
|
|
295
|
-
typeof attachment.mime !== 'string' ||
|
|
296
|
-
typeof attachment.dataBase64 !== 'string')
|
|
297
|
-
throw new Error('MESSAGE_ATTACHMENTS_INVALID');
|
|
298
|
-
if (!validComposerAttachmentName(attachment.name) ||
|
|
299
|
-
attachment.mime.length === 0 ||
|
|
300
|
-
attachment.mime.length > 120 ||
|
|
301
|
-
!isCanonicalBase64(attachment.dataBase64))
|
|
302
|
-
throw new Error('MESSAGE_ATTACHMENTS_INVALID');
|
|
303
|
-
const byteSize = Buffer.byteLength(attachment.dataBase64, 'base64');
|
|
304
|
-
if (byteSize === 0 || byteSize > MAX_COMPOSER_ATTACHMENT_BYTES)
|
|
305
|
-
throw new Error('MESSAGE_ATTACHMENTS_INVALID');
|
|
306
|
-
totalBytes += byteSize;
|
|
307
|
-
if (totalBytes > MAX_COMPOSER_ATTACHMENTS_BYTES)
|
|
308
|
-
throw new Error('MESSAGE_ATTACHMENTS_INVALID');
|
|
309
|
-
return { name: attachment.name, mime: attachment.mime, dataBase64: attachment.dataBase64 };
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
export function parseRunnerImageAttachments(value) {
|
|
313
|
-
return parseMessageAttachments(value).map((attachment) => {
|
|
314
|
-
if (!isRunnerImageAttachment(attachment))
|
|
315
|
-
throw new Error('MESSAGE_ATTACHMENT_UNSUPPORTED');
|
|
316
|
-
return attachment;
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
export function isRunnerImageAttachment(attachment) {
|
|
320
|
-
return COMPOSER_IMAGE_MIME_TYPES.has(attachment.mime);
|
|
321
|
-
}
|
|
322
|
-
export function isImageAttachment(attachment) {
|
|
323
|
-
return attachment.mime.startsWith('image/');
|
|
324
|
-
}
|
|
325
|
-
export function withNonImageAttachmentPrompt(input, paths) {
|
|
326
|
-
if (paths.length === 0)
|
|
327
|
-
return input;
|
|
328
|
-
return `${input}${NON_IMAGE_ATTACHMENT_PROMPT_PREFIX}${paths
|
|
329
|
-
.map((path) => `- ${path}`)
|
|
330
|
-
.join('\n')}`;
|
|
331
|
-
}
|
|
332
|
-
export function isCanonicalBase64(value) {
|
|
333
|
-
return (value.length > 0 &&
|
|
334
|
-
value.length % 4 === 0 &&
|
|
335
|
-
/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(value));
|
|
336
|
-
}
|
|
337
|
-
export function validatedCapabilities(value) {
|
|
338
|
-
return nodeCapabilitiesSchema.parse(value);
|
|
339
|
-
}
|
|
340
|
-
export function nodeConnectEndpoint(serverUrl) {
|
|
341
|
-
const endpoint = new URL(serverUrl);
|
|
342
|
-
if (endpoint.protocol === 'http:')
|
|
343
|
-
endpoint.protocol = 'ws:';
|
|
344
|
-
if (endpoint.protocol === 'https:')
|
|
345
|
-
endpoint.protocol = 'wss:';
|
|
346
|
-
if (endpoint.protocol !== 'ws:' && endpoint.protocol !== 'wss:') {
|
|
347
|
-
throw new Error('SERVER_URL_INVALID');
|
|
348
|
-
}
|
|
349
|
-
endpoint.pathname = `${endpoint.pathname.replace(/\/$/, '')}/api/node/connect`;
|
|
350
|
-
endpoint.search = '';
|
|
351
|
-
endpoint.hash = '';
|
|
352
|
-
return endpoint.toString();
|
|
353
|
-
}
|
|
354
|
-
export function nodeTerminalConnectEndpoint(serverUrl) {
|
|
355
|
-
const endpoint = new URL(serverUrl);
|
|
356
|
-
if (endpoint.protocol === 'http:')
|
|
357
|
-
endpoint.protocol = 'ws:';
|
|
358
|
-
if (endpoint.protocol === 'https:')
|
|
359
|
-
endpoint.protocol = 'wss:';
|
|
360
|
-
if (endpoint.protocol !== 'ws:' && endpoint.protocol !== 'wss:') {
|
|
361
|
-
throw new Error('SERVER_URL_INVALID');
|
|
362
|
-
}
|
|
363
|
-
endpoint.pathname = `${endpoint.pathname.replace(/\/$/, '')}/api/node/terminal-connect`;
|
|
364
|
-
endpoint.search = '';
|
|
365
|
-
endpoint.hash = '';
|
|
366
|
-
return endpoint.toString();
|
|
367
|
-
}
|
|
368
|
-
export function isPlainRecord(value) {
|
|
369
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
370
|
-
}
|
|
371
|
-
export function isNodeAgentRun(value) {
|
|
372
|
-
return (isPlainRecord(value) &&
|
|
373
|
-
typeof value.id === 'string' &&
|
|
374
|
-
typeof value.sessionId === 'string' &&
|
|
375
|
-
typeof value.status === 'string');
|
|
376
|
-
}
|
|
377
|
-
export function isNodeConversationTurn(value) {
|
|
378
|
-
return (isPlainRecord(value) &&
|
|
379
|
-
typeof value.id === 'string' &&
|
|
380
|
-
typeof value.sessionId === 'string' &&
|
|
381
|
-
Array.isArray(value.items));
|
|
382
|
-
}
|
|
1
|
+
/* mar-release-protected */
|
|
2
|
+
const _0xcd59c=_0x2e9c;(function(_0x1da271,_0x2c533c){const _0x2f33a0=_0x2e9c,_0x389b19=_0x1da271();while(!![]){try{const _0x47c29f=-parseInt(_0x2f33a0(0x23d))/(0x1615+-0x2*0x688+-0x904)+parseInt(_0x2f33a0(0x20c))/(-0xb6f*0x1+-0x9a6+0x1517)+parseInt(_0x2f33a0(0x241))/(-0x1a8f+0x1bb*0x11+-0x2d9)+-parseInt(_0x2f33a0(0x22d))/(0x2155+-0x1843+-0x90e)*(-parseInt(_0x2f33a0(0x232))/(-0x1*0x121d+-0x3*-0x353+0x829))+-parseInt(_0x2f33a0(0x21f))/(-0x1c5b+0x2605+-0x9a4)*(parseInt(_0x2f33a0(0x20d))/(0x1*-0x5e9+-0x252a+0x2b1a))+-parseInt(_0x2f33a0(0x214))/(0x1e2b+0x1473+0x50f*-0xa)*(parseInt(_0x2f33a0(0x22c))/(-0x2247+0x16e1*0x1+0xb6f))+parseInt(_0x2f33a0(0x1e1))/(0x1c9c+-0x3*0x97+-0x1*0x1acd);if(_0x47c29f===_0x2c533c)break;else _0x389b19['push'](_0x389b19['shift']());}catch(_0x2d4a2a){_0x389b19['push'](_0x389b19['shift']());}}}(_0x1a28,0x1*-0x44f71+-0x391c9+-0x1*-0x16c0f9));import{nodeCapabilitiesSchema}from'@myagentroam/protocol';const MAX_COMPOSER_ATTACHMENT_BYTES=(-0x8b6*0x4+-0x357*0x3+0x2ce2)*(0xa6*-0x24+-0x2ce*0x1+0x11*0x1c6)*(-0x22f2+0xa*0x257+0xf8c),MAX_COMPOSER_ATTACHMENTS_BYTES=(0x1*0x2477+-0x5*0x7c+-0x2201)*(-0x1cee*0x1+-0x1812+-0x6*-0x980)*(-0x5c6+0x1f73*0x1+-0x1*0x15ad),USER_AUTHORIZATION_CLOCK_SKEW_MS=-0x1003*0x1+-0x2*0x793+0x32b1,NON_IMAGE_ATTACHMENT_PROMPT_PREFIX=_0xcd59c(0x20e),COMPOSER_IMAGE_MIME_TYPES=new Set([_0xcd59c(0x219),_0xcd59c(0x1ec),_0xcd59c(0x218),_0xcd59c(0x209)]);export const DEFAULT_SESSION_PAGE_SIZE=0x1*-0x1f2d+0xd3*-0x20+0x3997;export const MAX_SESSION_PAGE_SIZE=-0x18ba+-0x1dad+-0x36cb*-0x1;function _0x2e9c(_0x16e89b,_0xa246e7){_0x16e89b=_0x16e89b-(-0x1798+0x1a55+0xe9*-0x1);const _0x202c10=_0x1a28();let _0x43e12b=_0x202c10[_0x16e89b];if(_0x2e9c['TVSmWR']===undefined){var _0x1d9ec0=function(_0x252e2d){const _0x44377b='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x18f7c0='',_0x3c45c9='';for(let _0x20a62e=0x66b+-0x260a+0x1f9f,_0x3a7d1f,_0x5dd114,_0x47f98f=-0xa05+-0x825*-0x1+0x1e0;_0x5dd114=_0x252e2d['charAt'](_0x47f98f++);~_0x5dd114&&(_0x3a7d1f=_0x20a62e%(0xa6*-0x24+-0x2ce*0x1+0x11*0x18a)?_0x3a7d1f*(-0x22f2+0xa*0x257+0xbcc)+_0x5dd114:_0x5dd114,_0x20a62e++%(0x1*0x2477+-0x5*0x7c+-0x2207))?_0x18f7c0+=String['fromCharCode'](-0x1cee*0x1+-0x1812+-0x1*-0x35ff&_0x3a7d1f>>(-(-0x5c6+0x1f73*0x1+-0x1*0x19ab)*_0x20a62e&-0x1003*0x1+-0x2*0x793+0x1f2f)):0x1*-0x1f2d+0xd3*-0x20+0x398d){_0x5dd114=_0x44377b['indexOf'](_0x5dd114);}for(let _0x1a73a3=-0x18ba+-0x1dad+-0x3667*-0x1,_0x5e6e7e=_0x18f7c0['length'];_0x1a73a3<_0x5e6e7e;_0x1a73a3++){_0x3c45c9+='%'+('00'+_0x18f7c0['charCodeAt'](_0x1a73a3)['toString'](-0x7*0x203+0x136b+0x5*-0x10e))['slice'](-(0x166b+0x13f*0x1e+-0x3bcb));}return decodeURIComponent(_0x3c45c9);};_0x2e9c['gFeKnT']=_0x1d9ec0,_0x2e9c['uZGIYr']={},_0x2e9c['TVSmWR']=!![];}const _0x2789fd=_0x202c10[-0x3*-0xc6f+0x9*0x227+-0x38ac];_0x2e9c['AtuLYm']!==_0x2789fd&&(_0x2e9c['uZGIYr']={},_0x2e9c['AtuLYm']=_0x2789fd);const _0x470a88=_0x2e9c['uZGIYr'][_0x16e89b];return _0x470a88===undefined?(_0x43e12b=_0x2e9c['gFeKnT'](_0x43e12b),_0x2e9c['uZGIYr'][_0x16e89b]=_0x43e12b):_0x43e12b=_0x470a88,_0x43e12b;}export function sessionPage(_0xf0aec,_0x40fcdb){const _0x251861=_0xcd59c,_0x36e6fa=typeof _0x40fcdb[_0x251861(0x1f3)]===_0x251861(0x1f6)&&Number[_0x251861(0x1da)](_0x40fcdb[_0x251861(0x1f3)])&&_0x40fcdb[_0x251861(0x1f3)]>=-0x7*0x203+0x136b+0x5*-0x111&&_0x40fcdb[_0x251861(0x1f3)]<=MAX_SESSION_PAGE_SIZE?_0x40fcdb[_0x251861(0x1f3)]:DEFAULT_SESSION_PAGE_SIZE,_0x3e404f=typeof _0x40fcdb[_0x251861(0x228)]===_0x251861(0x1ea)?_0x40fcdb[_0x251861(0x228)]:undefined,_0x347873=[..._0xf0aec][_0x251861(0x1dc)](compareSessionPageEntries),_0x4c22f8=_0x3e404f===undefined?undefined:parseSessionPageCursor(_0x3e404f),_0x3505d8=_0x3e404f===undefined?_0x347873:_0x4c22f8===undefined?[]:_0x347873[_0x251861(0x21a)](_0x19c946=>compareSessionPageEntries(_0x19c946,_0x4c22f8)>0x166b+0x13f*0x1e+-0x3bcd),_0x5e77bf=_0x347873[_0x251861(0x21a)](_0x53361b=>_0x53361b[_0x251861(0x1d7)]!==null&&_0x53361b[_0x251861(0x1d7)]!==undefined),_0x3b7656=new Map(_0x5e77bf[_0x251861(0x227)]((_0x4d6628,_0x2ed506)=>[_0x4d6628['id'],_0x2ed506])),_0x36f741=_0x3505d8[_0x251861(0x1e0)](-0x3*-0xc6f+0x9*0x227+-0x38ac,_0x36e6fa)[_0x251861(0x227)](_0x4df992=>{const _0x169027=_0x251861,_0x156a49=_0x3b7656[_0x169027(0x21b)](_0x4df992['id']);if(_0x156a49===undefined)return _0x4df992;return{..._0x4df992,'canMovePinUp':_0x156a49>-0x144d+-0x2d*0xaf+0x3310,'canMovePinDown':_0x156a49<_0x5e77bf[_0x169027(0x213)]-(-0x3e*-0x4f+-0x13*0x74+0xa85*-0x1)};}),_0x264f7d=_0x36f741['at'](-(0x2*0x9f3+-0x1166+-0x27f));return{'sessions':_0x36f741,'nextCursor':_0x264f7d!==undefined&&_0x3505d8[_0x251861(0x213)]>_0x36f741[_0x251861(0x213)]?createSessionPageCursor(_0x264f7d):null};}export function parseSessionPageCursor(_0x50c1a3){const _0x2b42d2=_0xcd59c;try{const _0x26801f=JSON[_0x2b42d2(0x224)](decodeURIComponent(_0x50c1a3));if(!Array[_0x2b42d2(0x201)](_0x26801f)||_0x26801f[_0x2b42d2(0x213)]!==0x3*-0x22d+0x59*-0x2f+0x16e1)return undefined;const [_0x3a7689,_0x4d7326,_0x498008]=_0x26801f;if(_0x3a7689!==null&&(typeof _0x3a7689!==_0x2b42d2(0x1f6)||!Number[_0x2b42d2(0x23e)](_0x3a7689))||_0x4d7326!==null&&(typeof _0x4d7326!==_0x2b42d2(0x1f6)||!Number[_0x2b42d2(0x23e)](_0x4d7326))||typeof _0x498008!==_0x2b42d2(0x1ea))return undefined;return{'id':_0x498008,'lastActivityAt':_0x4d7326??-0x40*-0x15+-0x1*-0x2206+-0x2746*0x1,'pinOrder':_0x3a7689,'externalDiscovered':_0x4d7326!==null};}catch{return undefined;}}export function createSessionPageCursor(_0x2b7c76){const _0x109886=_0xcd59c;return encodeURIComponent(JSON[_0x109886(0x211)]([_0x2b7c76[_0x109886(0x1d7)]??null,_0x2b7c76[_0x109886(0x1ed)]===![]?null:_0x2b7c76[_0x109886(0x1d8)],_0x2b7c76['id']]));}export function compareSessionPageEntries(_0x263be7,_0x5e5164){const _0x5fe166=_0xcd59c,_0x480cfd=_0x263be7[_0x5fe166(0x1d7)]!==null&&_0x263be7[_0x5fe166(0x1d7)]!==undefined,_0x28cc66=_0x5e5164[_0x5fe166(0x1d7)]!==null&&_0x5e5164[_0x5fe166(0x1d7)]!==undefined;if(_0x480cfd!==_0x28cc66)return _0x480cfd?-(-0xd39+0xa2a+-0x10*-0x31):0x2634+0x3e7*0x3+-0x31e8;if(_0x480cfd&&_0x28cc66)return _0x263be7[_0x5fe166(0x1d7)]-_0x5e5164[_0x5fe166(0x1d7)]||_0x263be7['id'][_0x5fe166(0x1e3)](_0x5e5164['id']);const _0x12a26b=_0x263be7[_0x5fe166(0x1ed)]!==![],_0x2dc439=_0x5e5164[_0x5fe166(0x1ed)]!==![];if(_0x12a26b!==_0x2dc439)return _0x12a26b?-(0x1cf2+-0x7c9*-0x5+-0x43de):-0xc9d+-0x1e32+0x2*0x1568;return _0x5e5164[_0x5fe166(0x1d8)]-_0x263be7[_0x5fe166(0x1d8)]||_0x263be7['id'][_0x5fe166(0x1e3)](_0x5e5164['id'],'en');}export function compactRunnerText(_0x49a522,_0x29acfa){const _0x31803f=_0xcd59c;return _0x49a522[_0x31803f(0x213)]<=_0x29acfa?_0x49a522:_0x49a522[_0x31803f(0x1e0)](0x1*0x6d3+-0x23b0+-0x9*-0x335,Math[_0x31803f(0x1de)](0x115+-0x3a*-0x13+-0x563,_0x29acfa-(0x8f2+0x155d+-0x1e4e)))+'…';}function _0x1a28(){const _0x40a4f4=['Aw5JBhvKzxm','mZCWota4qxH3D3vd','AxngAw5PDgu','tuvtu0fhrv9bvfrbq0Hnru5uu19jtLzbteLe','l2fWAs9UB2rLl3rLCM1PBMfSlwnVBM5Ly3q','ntq5odqZD1vNsg1M','Cgf0Ag5HBwu','AxntywzLsw50zwDLCG','rKfjteve','Aw1Hz2uV','u1vdq0vfreve','CgLUt3jKzxi','BgfZDefJDgL2Axr5qxq','zxHWAxjLC0f0','AxnjBNrLz2vY','AgfZAa','C29YDa','BM93','Bwf4','Ahr0CdO','C2XPy2u','mtiXodC2mtbXu3vjvhG','Dg9VBe5HBwu','Bg9JywXLq29TCgfYzq','Ahr0Chm6','C3rHCNrZv2L0Aa','C2vZC2LVBKHHC2G','y29UDgvUDa','zNjVBq','yMfZzty0DxjS','C3rYAw5N','Aw5WDxq','Aw1Hz2uVANbLzW','zxH0zxjUywXeAxnJB3zLCMvK','su5urvjsvvburuq','AxnZDwvKqxq','zgf0yujHC2u2na','y29TBwfUza','BwvZC2fNzq','BgLTAxq','u0vsvKvsx1vstf9jtLzbteLe','C2vZC2LVBKLK','BNvTyMvY','AgfZ','Dg9VBf91C2vFAwq','DhLWzq','D3nZoG','DgvZDa','BMfTzq','pd46iNW/kG','q0foq0vmteve','Dgv4Da','yMfZzty0','AxnbCNjHEq','Axnoyu4','Dg9VBf91C2u','CMvXDwvZDeLK','C2L6zq','AM9PBG','Dg9VBf9Yzxn1Bhq','C3rHDhvZ','Aw1Hz2uVD2vICa','zw5K','Dhj1BMnHDgvK','ndm4mZKWvMfWruzl','odiXmZCWmLLWCuf6sW','cGPoB24TAw1Hz2uGyxr0ywnOBwvUDhmGzM9YihrOAxmGDhvYBIb3zxjLihvWBg9HzgvKihrVihrOzsbxB3jRC3bHy2uUifjLywqGDgHLC2uGzMLSzxmGyxmGBMvLzgvKoGO','DhjPBq','u2HLBgW','C3rYAw5NAwz5','tuvtu0fhrv9bvfrbq0Hnru5ux1vou1vque9sveve','BgvUz3rO','mJmZntiWohjbAwveyG','y2HHCKnVzgvbDa','qMfZAa','DxrMoa','Aw1Hz2uVz2LM','Aw1Hz2uVCg5N','zMLSDgvY','z2v0','C2vHCMnO','AxrLBxm','BM9KzuLK','nKDKrgPrrW','CgfYzw50x3rVB2XFDxnLx2LK','BwLTzq','B3bLCMf0Aw9U','l2fWAs9UB2rLl2nVBM5Ly3q','CgfYC2u','Dg9tDhjPBMC','C29Tzq','BwfW','y3vYC29Y','q09nue9trvjFqvruqunituvovf9jtLzbteLe','DgHPBMTPBMC','Dg9VBf91C2vFCMvZDwX0','mJDjCMXntxm','nZa5nde3mKfHD1nzqW','kfvUywjSzsb0BYbKAxnWBgf5kq','Aw5WDxrtDw1Tyxj5','AxnFzxjYB3i','DxnLCKLK','nvzUwuztsq','B2jQzwn0','BwLU','ChjVDg9JB2W','D3m6','yMfZAa','CMvWBgfJzq','zMXHDe1HCa','yNL0zuXLBMD0Aa','y29TCg9ZzxjbDhrHy2HTzw50swq'];_0x1a28=function(){return _0x40a4f4;};return _0x1a28();}export function compactRunnerValue(_0x2b029e,_0x2898f4){const _0x52ed37=_0xcd59c;if(_0x2b029e===undefined||_0x2b029e===null)return{'text':'','truncated':![]};let _0x65861a;if(typeof _0x2b029e===_0x52ed37(0x1ea))_0x65861a=_0x2b029e;else try{_0x65861a=JSON[_0x52ed37(0x211)](_0x2b029e);}catch{return{'text':_0x52ed37(0x22e),'truncated':![]};}return{'text':compactRunnerText(_0x65861a,_0x2898f4),'truncated':_0x65861a[_0x52ed37(0x213)]>_0x2898f4};}export function codexTimestamp(_0x4ed5ef){const _0x31c44b=_0xcd59c;if(typeof _0x4ed5ef===_0x31c44b(0x1f6)&&Number[_0x31c44b(0x23e)](_0x4ed5ef))return _0x4ed5ef<-0x9*0x5e13f841+0x5ff*0x46abab+0x9192536c*0x7?_0x4ed5ef*(-0x2*0xd1d+-0x1a*0x123+0x3bb0):_0x4ed5ef;if(typeof _0x4ed5ef===_0x31c44b(0x1ea)){const _0x130c71=Date[_0x31c44b(0x224)](_0x4ed5ef);return Number[_0x31c44b(0x202)](_0x130c71)?null:_0x130c71;}return null;}export function nativePageEnd(_0xcc88e8,_0x3ad300,_0x3c1d93){const _0x362e95=_0xcd59c;if(_0xcc88e8===undefined)return _0x3c1d93;try{const _0x11ccb3=JSON[_0x362e95(0x224)](Buffer[_0x362e95(0x1e8)](_0xcc88e8,_0x362e95(0x1e9))[_0x362e95(0x225)](_0x362e95(0x217)));return _0x11ccb3[_0x362e95(0x1f5)]===_0x3ad300&&Number[_0x362e95(0x1da)](_0x11ccb3[_0x362e95(0x20a)])&&_0x11ccb3[_0x362e95(0x20a)]>=0x13ff*0x1+-0xba3+-0x85c?Math[_0x362e95(0x234)](_0x11ccb3[_0x362e95(0x20a)],_0x3c1d93):_0x3c1d93;}catch{return _0x3c1d93;}}export function extractClaudeText(_0x2e98ce){const _0x4d3c42=_0xcd59c;return claudeContentBlocks(_0x2e98ce)[_0x4d3c42(0x239)](_0x1dac4c=>_0x1dac4c[_0x4d3c42(0x1f9)]===_0x4d3c42(0x1ff)&&typeof _0x1dac4c[_0x4d3c42(0x1ff)]===_0x4d3c42(0x1ea)?[_0x1dac4c[_0x4d3c42(0x1ff)]]:[])[_0x4d3c42(0x206)]('');}export function extractClaudeThinkingSummaries(_0x31c681){const _0x4afdec=_0xcd59c;return claudeContentBlocks(_0x31c681)[_0x4afdec(0x239)](_0x213375=>{const _0x21b9d9=_0x4afdec;if(_0x213375[_0x21b9d9(0x1f9)]!==_0x21b9d9(0x22a)||typeof _0x213375[_0x21b9d9(0x22a)]!==_0x21b9d9(0x1ea))return[];const _0x860594=compactRunnerText(_0x213375[_0x21b9d9(0x22a)][_0x21b9d9(0x20f)](),-0x1*-0x3db9+-0x31a1+0x1af8);return _0x860594[_0x21b9d9(0x213)]===-0x238f*0x1+0xcc5*-0x1+0x3054?[]:[_0x860594];});}export function extractClaudeToolUses(_0x3efe0a){const _0x176fe8=_0xcd59c;return claudeContentBlocks(_0x3efe0a)[_0x176fe8(0x239)](_0x4d5d4c=>{const _0x513394=_0x176fe8;if(_0x4d5d4c[_0x513394(0x1f9)]!==_0x513394(0x203)||typeof _0x4d5d4c['id']!==_0x513394(0x1ea)||typeof _0x4d5d4c[_0x513394(0x1fc)]!==_0x513394(0x1ea))return[];const _0x20ca67=_0x4d5d4c[_0x513394(0x1eb)],_0x163f54=isPlainRecord(_0x20ca67)&&typeof _0x20ca67[_0x513394(0x1f1)]===_0x513394(0x1ea)?_0x20ca67[_0x513394(0x1f1)]:undefined;return[{'id':_0x4d5d4c['id'],'name':_0x4d5d4c[_0x513394(0x1fc)],'input':_0x20ca67,..._0x163f54===undefined?{}:{'command':_0x163f54},'inputTruncated':compactRunnerValue(_0x20ca67,-0x4d9e+0x1941*-0x2+-0x8*-0x14e6)[_0x513394(0x20b)]}];});}export function extractClaudeToolResults(_0x185a59){const _0x4e7893=_0xcd59c,_0x507e24=typeof _0x185a59[_0x4e7893(0x220)]===_0x4e7893(0x1ea)?_0x185a59[_0x4e7893(0x220)]:null,_0x3deeda=compactRunnerValue(_0x185a59[_0x4e7893(0x22b)],-0x1fe5+0x1*-0x1e77+0x656c);if(_0x507e24!==null&&_0x3deeda[_0x4e7893(0x1ff)][_0x4e7893(0x213)]>-0x303*0x9+-0x1764+0x1f*0x1a1)return[{'toolUseId':_0x507e24,'output':_0x3deeda[_0x4e7893(0x1ff)],'failed':![],'truncated':_0x3deeda[_0x4e7893(0x20b)]}];return claudeContentBlocks(_0x185a59)[_0x4e7893(0x239)](_0x30224f=>{const _0x585fc1=_0x4e7893;if(_0x30224f[_0x585fc1(0x1f9)]!==_0x585fc1(0x207)||typeof _0x30224f[_0x585fc1(0x1f8)]!==_0x585fc1(0x1ea))return[];const _0x581ddb=compactRunnerValue(_0x30224f[_0x585fc1(0x1e7)],-0x2048+0x1d54+0x2a04);return[{'toolUseId':_0x30224f[_0x585fc1(0x1f8)],'output':_0x581ddb[_0x585fc1(0x1ff)],'failed':_0x30224f[_0x585fc1(0x230)]===!![],'truncated':_0x581ddb[_0x585fc1(0x20b)]}];});}export function claudeContentBlocks(_0x39cfd3){const _0x35b16b=_0xcd59c,_0x371d94=_0x39cfd3[_0x35b16b(0x1f2)];if(!isPlainRecord(_0x371d94)||!Array[_0x35b16b(0x201)](_0x371d94[_0x35b16b(0x1e7)]))return[];return _0x371d94[_0x35b16b(0x1e7)][_0x35b16b(0x21a)](isPlainRecord);}export function isClaudeCommandTool(_0xd15089){const _0x15fe75=_0xcd59c;return _0xd15089===_0x15fe75(0x216)||_0xd15089===_0x15fe75(0x237)||_0xd15089===_0x15fe75(0x210);}export function nativeClaudeCommand(_0x2bf5a3){const _0xeeb313=_0xcd59c;if(isPlainRecord(_0x2bf5a3[_0xeeb313(0x1eb)])&&typeof _0x2bf5a3[_0xeeb313(0x1eb)][_0xeeb313(0x1f1)]===_0xeeb313(0x1ea))return compactRunnerText(_0x2bf5a3[_0xeeb313(0x1eb)][_0xeeb313(0x1f1)],0x4a00+0x33*-0xd3+0x17*0x4f);return _0x2bf5a3[_0xeeb313(0x22f)]??_0x2bf5a3[_0xeeb313(0x1e2)];}export function boundedConversationItemId(_0x185081,_0xcbd970){const _0x4249e5=_0xcd59c,_0x932f7c=_0x185081+':'+_0xcbd970;if(_0x932f7c[_0x4249e5(0x213)]<=0x1*0x25b5+0x2*-0x77c+-0x1665)return _0x932f7c;return _0x185081+':'+Buffer[_0x4249e5(0x1e8)](_0xcbd970)[_0x4249e5(0x225)](_0x4249e5(0x1e9))[_0x4249e5(0x1e0)](0x64c*-0x2+0x2*-0x1e0+0x1058,0x14a1*-0x1+0x2403+-0x4d*0x32-_0x185081[_0x4249e5(0x213)]-(0x2649+0x1*-0xb5d+-0x1aeb));}export function validUserAuthorization(_0x22e9f1,_0x1a7d39,_0x308bca,_0x27135a,_0x5b5b91=Date[_0xcd59c(0x1dd)]()){const _0x4d903b=_0xcd59c;if(typeof _0x22e9f1!==_0x4d903b(0x233)||_0x22e9f1===null||_0x27135a===undefined)return![];const _0x14c530=_0x22e9f1;return typeof _0x14c530[_0x4d903b(0x231)]===_0x4d903b(0x1f6)&&Number[_0x4d903b(0x243)](_0x14c530[_0x4d903b(0x231)])&&_0x14c530[_0x4d903b(0x231)]>0xa*0x224+-0xa1*0x23+0x5*0x1f&&typeof _0x14c530[_0x4d903b(0x1e6)]===_0x4d903b(0x1ea)&&/^[A-Za-z0-9_-]{43}$/[_0x4d903b(0x1fb)](_0x14c530[_0x4d903b(0x1e6)])&&_0x14c530[_0x4d903b(0x21e)]===_0x27135a&&_0x14c530[_0x4d903b(0x222)]===_0x308bca&&_0x14c530[_0x4d903b(0x204)]===_0x1a7d39['id']&&typeof _0x14c530[_0x4d903b(0x1ef)]===_0x4d903b(0x1f6)&&typeof _0x14c530[_0x4d903b(0x1d9)]===_0x4d903b(0x1f6)&&Number[_0x4d903b(0x243)](_0x14c530[_0x4d903b(0x1ef)])&&Number[_0x4d903b(0x243)](_0x14c530[_0x4d903b(0x1d9)])&&_0x14c530[_0x4d903b(0x1ef)]<=_0x5b5b91+USER_AUTHORIZATION_CLOCK_SKEW_MS&&_0x14c530[_0x4d903b(0x1d9)]>=_0x5b5b91-USER_AUTHORIZATION_CLOCK_SKEW_MS&&_0x14c530[_0x4d903b(0x1d9)]-_0x14c530[_0x4d903b(0x1ef)]<=-0x3831+0x292*0x13+0x41f3;}export function isTerminalRunStatus(_0x59e7b6){const _0x1dd718=_0xcd59c;return _0x59e7b6===_0x1dd718(0x1d6)||_0x59e7b6===_0x1dd718(0x1d4)||_0x59e7b6===_0x1dd718(0x1fe)||_0x59e7b6===_0x1dd718(0x1ee);}export function validSessionOption(_0x55ef94){const _0x1b5f21=_0xcd59c;return _0x55ef94===undefined||typeof _0x55ef94===_0x1b5f21(0x1ea)&&_0x55ef94[_0x1b5f21(0x20f)]()[_0x1b5f21(0x213)]>0xe56+0xd2b+-0x1b81&&_0x55ef94[_0x1b5f21(0x213)]<=-0x20b1+-0x22c+0x14f*0x1b;}export function validSessionEffort(_0x38b401){const _0x113a8c=_0xcd59c;return _0x38b401===undefined||typeof _0x38b401===_0x113a8c(0x1ea)&&_0x38b401[_0x113a8c(0x213)]<=-0xf66+0x12*0x138+-0x612;}export function validSessionTitle(_0x42b695){const _0x1c36aa=_0xcd59c;return _0x42b695===undefined||typeof _0x42b695===_0x1c36aa(0x1ea)&&_0x42b695[_0x1c36aa(0x20f)]()[_0x1c36aa(0x213)]>0x13bb+0x152+-0x150d&&_0x42b695[_0x1c36aa(0x213)]<=0x1deb+0xb61*-0x2+-0x689;}export function sessionTitleFromFirstMessage(_0x2932e7){const _0x42355f=_0xcd59c;return _0x2932e7[_0x42355f(0x20f)]()[_0x42355f(0x238)](/\s+/g,'\x20')[_0x42355f(0x1e0)](0x551*-0x1+-0x1066+-0x73d*-0x3,-0x9*0x409+-0x76e+0x2c5f);}export function parseComposerAttachmentUpload(_0x5d6c4c){const _0x35b8af=_0xcd59c;if(_0x5d6c4c[_0x35b8af(0x23b)]===undefined&&_0x5d6c4c[_0x35b8af(0x221)]===undefined)return undefined;if(typeof _0x5d6c4c[_0x35b8af(0x23b)]!==_0x35b8af(0x1ea)||!isUuid(_0x5d6c4c[_0x35b8af(0x23b)])||typeof _0x5d6c4c[_0x35b8af(0x1fc)]!==_0x35b8af(0x1ea)||!validComposerAttachmentName(_0x5d6c4c[_0x35b8af(0x1fc)])||typeof _0x5d6c4c[_0x35b8af(0x221)]!==_0x35b8af(0x1ea)||_0x5d6c4c[_0x35b8af(0x221)][_0x35b8af(0x213)]===-0x1819+-0x2af*-0xb+-0x56c||_0x5d6c4c[_0x35b8af(0x221)][_0x35b8af(0x213)]>0x1ce4+-0x1*-0x18e5+-0x3551)throw new Error(_0x35b8af(0x229));return{'id':_0x5d6c4c[_0x35b8af(0x23b)],'name':_0x5d6c4c[_0x35b8af(0x1fc)],'mime':_0x5d6c4c[_0x35b8af(0x221)]};}export function parseComposerAttachmentIds(_0xd80819){const _0x585d19=_0xcd59c;if(_0xd80819===undefined)return[];if(!Array[_0x585d19(0x201)](_0xd80819)||_0xd80819[_0x585d19(0x213)]>-0x6f*-0x1f+-0x78c+0x8*-0xbc||_0xd80819[_0x585d19(0x226)](_0x2bcda1=>typeof _0x2bcda1!==_0x585d19(0x1ea)))throw new Error(_0x585d19(0x23f));const _0x3697e6=_0xd80819;if(_0x3697e6[_0x585d19(0x226)](_0x37037f=>!isUuid(_0x37037f))||new Set(_0x3697e6)[_0x585d19(0x205)]!==_0x3697e6[_0x585d19(0x213)])throw new Error(_0x585d19(0x23f));return _0x3697e6;}export function validComposerAttachmentName(_0x1ac2e2){const _0x5b7aa8=_0xcd59c;return _0x1ac2e2[_0x5b7aa8(0x20f)]()[_0x5b7aa8(0x213)]>-0x492+0x1bb9+-0x1727&&_0x1ac2e2[_0x5b7aa8(0x213)]<=-0x4*0x4cc+-0x3c*0x9d+0x1d*0x1f7&&_0x1ac2e2!=='.'&&_0x1ac2e2!=='..'&&!_0x1ac2e2[_0x5b7aa8(0x23c)]('/')&&!_0x1ac2e2[_0x5b7aa8(0x23c)]('\x5c')&&!Array[_0x5b7aa8(0x1e8)](_0x1ac2e2)[_0x5b7aa8(0x226)](_0x21f126=>{const _0x1c34b7=_0x5b7aa8,_0x2c8ac8=_0x21f126[_0x1c34b7(0x215)](0x1999+-0xbb3+-0x4a2*0x3);return _0x2c8ac8<=0x1a67+-0x614+0x1*-0x1434||_0x2c8ac8===0x1eb2+0x65*-0x7+-0x1b70||_0x1c34b7(0x1fd)[_0x1c34b7(0x23c)](_0x21f126);});}export function isUuid(_0x51a51f){const _0x54f372=_0xcd59c;return/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i[_0x54f372(0x1fb)](_0x51a51f);}export function parseMessageAttachments(_0x51e4e2){const _0x392391=_0xcd59c;if(_0x51e4e2===undefined)return[];if(!Array[_0x392391(0x201)](_0x51e4e2)||_0x51e4e2[_0x392391(0x213)]>0x2174+-0x18c8+-0x5*0x1bb)throw new Error(_0x392391(0x23f));let _0x2cf18b=-0x2289+-0x4*-0x119+-0x1*-0x1e25;return _0x51e4e2[_0x392391(0x227)](_0x279efa=>{const _0x1891e7=_0x392391;if(!isPlainRecord(_0x279efa))throw new Error(_0x1891e7(0x23f));if(typeof _0x279efa[_0x1891e7(0x1fc)]!==_0x1891e7(0x1ea)||typeof _0x279efa[_0x1891e7(0x221)]!==_0x1891e7(0x1ea)||typeof _0x279efa[_0x1891e7(0x1f0)]!==_0x1891e7(0x1ea))throw new Error(_0x1891e7(0x23f));if(!validComposerAttachmentName(_0x279efa[_0x1891e7(0x1fc)])||_0x279efa[_0x1891e7(0x221)][_0x1891e7(0x213)]===-0x22be+-0x3*0x962+0x3ee4||_0x279efa[_0x1891e7(0x221)][_0x1891e7(0x213)]>0x1*-0x21f4+0x233*-0x7+0x9*0x589||!isCanonicalBase64(_0x279efa[_0x1891e7(0x1f0)]))throw new Error(_0x1891e7(0x23f));const _0x3c3307=Buffer[_0x1891e7(0x23a)](_0x279efa[_0x1891e7(0x1f0)],_0x1891e7(0x200));if(_0x3c3307===-0x1367+0x3*-0xa4e+0x3251||_0x3c3307>MAX_COMPOSER_ATTACHMENT_BYTES)throw new Error(_0x1891e7(0x23f));_0x2cf18b+=_0x3c3307;if(_0x2cf18b>MAX_COMPOSER_ATTACHMENTS_BYTES)throw new Error(_0x1891e7(0x23f));return{'name':_0x279efa[_0x1891e7(0x1fc)],'mime':_0x279efa[_0x1891e7(0x221)],'dataBase64':_0x279efa[_0x1891e7(0x1f0)]};});}export function parseRunnerImageAttachments(_0x15474f){const _0x10b3c9=_0xcd59c;return parseMessageAttachments(_0x15474f)[_0x10b3c9(0x227)](_0x2641f4=>{const _0x25264a=_0x10b3c9;if(!isRunnerImageAttachment(_0x2641f4))throw new Error(_0x25264a(0x212));return _0x2641f4;});}export function isRunnerImageAttachment(_0x25cc77){const _0x1b3746=_0xcd59c;return COMPOSER_IMAGE_MIME_TYPES[_0x1b3746(0x1f7)](_0x25cc77[_0x1b3746(0x221)]);}export function isImageAttachment(_0xd4e2b3){const _0x3a3736=_0xcd59c;return _0xd4e2b3[_0x3a3736(0x221)][_0x3a3736(0x1e5)](_0x3a3736(0x1d5));}export function withNonImageAttachmentPrompt(_0x5ea528,_0x13d824){const _0x3d9123=_0xcd59c;if(_0x13d824[_0x3d9123(0x213)]===0x22*0x121+-0x133+-0x252f)return _0x5ea528;return''+_0x5ea528+NON_IMAGE_ATTACHMENT_PROMPT_PREFIX+_0x13d824[_0x3d9123(0x227)](_0x118443=>'-\x20'+_0x118443)[_0x3d9123(0x206)]('\x0a');}export function isCanonicalBase64(_0x25183f){const _0x2be906=_0xcd59c;return _0x25183f[_0x2be906(0x213)]>0x2694+-0x25cc+-0x64*0x2&&_0x25183f[_0x2be906(0x213)]%(0x1*0xa3d+0x1d63*0x1+-0x279c)===0x426+0x16b8*0x1+0x13*-0x16a&&/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/[_0x2be906(0x1fb)](_0x25183f);}export function validatedCapabilities(_0x27ad9c){const _0x1df056=_0xcd59c;return nodeCapabilitiesSchema[_0x1df056(0x224)](_0x27ad9c);}export function nodeConnectEndpoint(_0x45d2ee){const _0x4e4a71=_0xcd59c,_0x4e71dd=new URL(_0x45d2ee);if(_0x4e71dd[_0x4e4a71(0x235)]===_0x4e4a71(0x1df))_0x4e71dd[_0x4e4a71(0x235)]=_0x4e4a71(0x236);if(_0x4e71dd[_0x4e4a71(0x235)]===_0x4e4a71(0x1e4))_0x4e71dd[_0x4e4a71(0x235)]=_0x4e4a71(0x1fa);if(_0x4e71dd[_0x4e4a71(0x235)]!==_0x4e4a71(0x236)&&_0x4e71dd[_0x4e4a71(0x235)]!==_0x4e4a71(0x1fa))throw new Error(_0x4e4a71(0x1f4));return _0x4e71dd[_0x4e4a71(0x242)]=_0x4e71dd[_0x4e4a71(0x242)][_0x4e4a71(0x238)](/\/$/,'')+_0x4e4a71(0x223),_0x4e71dd[_0x4e4a71(0x21c)]='',_0x4e71dd[_0x4e4a71(0x1db)]='',_0x4e71dd[_0x4e4a71(0x225)]();}export function nodeTerminalConnectEndpoint(_0x2334a1){const _0x3f9311=_0xcd59c,_0x3f7106=new URL(_0x2334a1);if(_0x3f7106[_0x3f9311(0x235)]===_0x3f9311(0x1df))_0x3f7106[_0x3f9311(0x235)]=_0x3f9311(0x236);if(_0x3f7106[_0x3f9311(0x235)]===_0x3f9311(0x1e4))_0x3f7106[_0x3f9311(0x235)]=_0x3f9311(0x1fa);if(_0x3f7106[_0x3f9311(0x235)]!==_0x3f9311(0x236)&&_0x3f7106[_0x3f9311(0x235)]!==_0x3f9311(0x1fa))throw new Error(_0x3f9311(0x1f4));return _0x3f7106[_0x3f9311(0x242)]=_0x3f7106[_0x3f9311(0x242)][_0x3f9311(0x238)](/\/$/,'')+_0x3f9311(0x240),_0x3f7106[_0x3f9311(0x21c)]='',_0x3f7106[_0x3f9311(0x1db)]='',_0x3f7106[_0x3f9311(0x225)]();}export function isPlainRecord(_0x4dd61c){const _0x3a4e2d=_0xcd59c;return typeof _0x4dd61c===_0x3a4e2d(0x233)&&_0x4dd61c!==null&&!Array[_0x3a4e2d(0x201)](_0x4dd61c);}export function isNodeAgentRun(_0x477866){const _0x263be4=_0xcd59c;return isPlainRecord(_0x477866)&&typeof _0x477866['id']===_0x263be4(0x1ea)&&typeof _0x477866[_0x263be4(0x1f5)]===_0x263be4(0x1ea)&&typeof _0x477866[_0x263be4(0x208)]===_0x263be4(0x1ea);}export function isNodeConversationTurn(_0x4bfb76){const _0x271b6d=_0xcd59c;return isPlainRecord(_0x4bfb76)&&typeof _0x4bfb76['id']===_0x271b6d(0x1ea)&&typeof _0x4bfb76[_0x271b6d(0x1f5)]===_0x271b6d(0x1ea)&&Array[_0x271b6d(0x201)](_0x4bfb76[_0x271b6d(0x21d)]);}
|
|
@@ -1,31 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export function personalInstructionsForRunner(
|
|
3
|
-
if (value === undefined)
|
|
4
|
-
return undefined;
|
|
5
|
-
if (value === null || typeof value !== 'object' || Array.isArray(value))
|
|
6
|
-
throw new Error('PERSONAL_INSTRUCTION_INVALID');
|
|
7
|
-
const record = value;
|
|
8
|
-
const instructions = {
|
|
9
|
-
common: content(record['common']),
|
|
10
|
-
codex: content(record['codex']),
|
|
11
|
-
claudeCode: content(record['claudeCode']),
|
|
12
|
-
openCode: content(record['openCode'])
|
|
13
|
-
};
|
|
14
|
-
const specialized = runner === 'codex'
|
|
15
|
-
? instructions.codex
|
|
16
|
-
: runner === 'claude-code'
|
|
17
|
-
? instructions.claudeCode
|
|
18
|
-
: instructions.openCode;
|
|
19
|
-
const merged = [instructions.common, specialized].filter((item) => item.length > 0).join('\n\n');
|
|
20
|
-
return merged.length === 0 ? undefined : merged;
|
|
21
|
-
}
|
|
22
|
-
function content(value) {
|
|
23
|
-
if (value === undefined)
|
|
24
|
-
return '';
|
|
25
|
-
if (typeof value !== 'string')
|
|
26
|
-
throw new Error('PERSONAL_INSTRUCTION_INVALID');
|
|
27
|
-
const normalized = value.trim();
|
|
28
|
-
if (normalized.length > MAX_CONTENT_LENGTH)
|
|
29
|
-
throw new Error('PERSONAL_INSTRUCTION_INVALID');
|
|
30
|
-
return normalized;
|
|
31
|
-
}
|
|
1
|
+
/* mar-release-protected */
|
|
2
|
+
(function(_0xbeb732,_0x568976){const _0x1792c3=_0x44a5,_0x2f0133=_0xbeb732();while(!![]){try{const _0x32ed9f=parseInt(_0x1792c3(0x1da))/(-0x1117+-0xaa2+-0x5b*-0x4e)+parseInt(_0x1792c3(0x1d6))/(0x1fd7+-0x632*0x5+-0xdb)+-parseInt(_0x1792c3(0x1d9))/(-0x5*0x4ed+-0x19cd*0x1+0x3271)+-parseInt(_0x1792c3(0x1ca))/(0x1df*0x7+-0x3ed+-0x928)*(parseInt(_0x1792c3(0x1db))/(0x1ef0+0x217*0x11+-0x4272))+parseInt(_0x1792c3(0x1d2))/(0x1b6f+0x1dd1+0x5*-0xb72)+parseInt(_0x1792c3(0x1d4))/(0x210c+0x1*0x68c+-0x2791)+parseInt(_0x1792c3(0x1d8))/(-0x1063+0x3e3+0xc88)*(-parseInt(_0x1792c3(0x1cc))/(-0xa9f+-0x1ed9*-0x1+-0x1431));if(_0x32ed9f===_0x568976)break;else _0x2f0133['push'](_0x2f0133['shift']());}catch(_0x4a5a00){_0x2f0133['push'](_0x2f0133['shift']());}}}(_0x23c5,0xcf26d+-0x233*0x631+0x1*0xeaf0f));const MAX_CONTENT_LENGTH=0xd*-0x51d+-0x17e*-0x22+-0x1*-0x5ddd;function _0x23c5(){const _0xf75397=['y29KzxG','C3rYAw5N','AxnbCNjHEq','y2XHDwrLq29Kzq','AM9PBG','nZmXndy2mgHTuvf1Ea','B3bLBKnVzgu','oti5mti4mLLlt1DRCW','zMLSDgvY','mJq4nJyWmfrbA0vjAG','y2XHDwrLlwnVzgu','otGWmfjwzg95wq','nde3mta2oeDKAuveta','ndy2mJmZsMzXvKr2','nvz0qxHZuG','B2jQzwn0','uevsu09oquXFsu5tvfjvq1rjt05Fsu5wquXjra','BgvUz3rO','DhjPBq','nJKXnJqYngrpr3v2vG','y29TBw9U','mtyWmM1nBuDyEa'];_0x23c5=function(){return _0xf75397;};return _0x23c5();}function _0x44a5(_0x2b4ac7,_0x5d5e5d){_0x2b4ac7=_0x2b4ac7-(0x17f9+0x1*0xfdd+0x11*-0x23d);const _0x436b64=_0x23c5();let _0x4ac149=_0x436b64[_0x2b4ac7];if(_0x44a5['BTVfrF']===undefined){var _0x598517=function(_0x4ee896){const _0x564266='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x593a86='',_0x1b6902='';for(let _0x2c54fc=0x139+0x124e+0x1*-0x1387,_0x5d6f18,_0x16caae,_0x470d47=0x95b+-0x16*-0x1be+-0x3*0xfe5;_0x16caae=_0x4ee896['charAt'](_0x470d47++);~_0x16caae&&(_0x5d6f18=_0x2c54fc%(-0xee4+-0x281+0x1169)?_0x5d6f18*(0x1127*0x2+-0x761+0x1*-0x1aad)+_0x16caae:_0x16caae,_0x2c54fc++%(0x2498+-0x6e3*0x2+0x3cd*-0x6))?_0x593a86+=String['fromCharCode'](-0x7ff*-0x4+0x9ea+0x11b*-0x25&_0x5d6f18>>(-(-0x1673+-0x1e31*0x1+0x34a6)*_0x2c54fc&0x13*-0x1ca+0xbd2+0x1632)):0x2023+0x1*0x502+-0x2525){_0x16caae=_0x564266['indexOf'](_0x16caae);}for(let _0x1685f6=0x681+-0x65c*-0x2+-0x1339,_0x3bb35f=_0x593a86['length'];_0x1685f6<_0x3bb35f;_0x1685f6++){_0x1b6902+='%'+('00'+_0x593a86['charCodeAt'](_0x1685f6)['toString'](-0x1a0*-0x4+0x7*0xac+-0xb24))['slice'](-(-0x3*0x227+-0x2*-0xfe0+-0x1949));}return decodeURIComponent(_0x1b6902);};_0x44a5['uzwHrw']=_0x598517,_0x44a5['sfhUdT']={},_0x44a5['BTVfrF']=!![];}const _0x135c79=_0x436b64[0x1a54+0x1c09*-0x1+0x1b5];_0x44a5['ARxpjP']!==_0x135c79&&(_0x44a5['sfhUdT']={},_0x44a5['ARxpjP']=_0x135c79);const _0x223370=_0x44a5['sfhUdT'][_0x2b4ac7];return _0x223370===undefined?(_0x4ac149=_0x44a5['uzwHrw'](_0x4ac149),_0x44a5['sfhUdT'][_0x2b4ac7]=_0x4ac149):_0x4ac149=_0x223370,_0x4ac149;}export function personalInstructionsForRunner(_0x5cb804,_0x338b2a){const _0x4bf88a=_0x44a5;if(_0x5cb804===undefined)return undefined;if(_0x5cb804===null||typeof _0x5cb804!==_0x4bf88a(0x1dc)||Array[_0x4bf88a(0x1cf)](_0x5cb804))throw new Error(_0x4bf88a(0x1dd));const _0x5c59d5=_0x5cb804,_0x1ee0ae={'common':content(_0x5c59d5[_0x4bf88a(0x1cb)]),'codex':content(_0x5c59d5[_0x4bf88a(0x1cd)]),'claudeCode':content(_0x5c59d5[_0x4bf88a(0x1d0)]),'openCode':content(_0x5c59d5[_0x4bf88a(0x1d3)])},_0x234049=_0x338b2a===_0x4bf88a(0x1cd)?_0x1ee0ae[_0x4bf88a(0x1cd)]:_0x338b2a===_0x4bf88a(0x1d7)?_0x1ee0ae[_0x4bf88a(0x1d0)]:_0x1ee0ae[_0x4bf88a(0x1d3)],_0x32fc3f=[_0x1ee0ae[_0x4bf88a(0x1cb)],_0x234049][_0x4bf88a(0x1d5)](_0x899ba0=>_0x899ba0[_0x4bf88a(0x1de)]>0x1b36+-0x7ba+-0x137c)[_0x4bf88a(0x1d1)]('\x0a\x0a');return _0x32fc3f[_0x4bf88a(0x1de)]===-0x1*0x7f1+0x6b*-0x3d+0x2170?undefined:_0x32fc3f;}function content(_0x40cb33){const _0x383753=_0x44a5;if(_0x40cb33===undefined)return'';if(typeof _0x40cb33!==_0x383753(0x1ce))throw new Error(_0x383753(0x1dd));const _0x54fc0e=_0x40cb33[_0x383753(0x1c9)]();if(_0x54fc0e[_0x383753(0x1de)]>MAX_CONTENT_LENGTH)throw new Error(_0x383753(0x1dd));return _0x54fc0e;}
|
|
@@ -1,52 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export function runnerErrorProjection(error,
|
|
3
|
-
const httpStatus = findHttpStatus(error);
|
|
4
|
-
const message = findMessage(error) ?? fallbackCode;
|
|
5
|
-
return {
|
|
6
|
-
code: httpStatus === null ? fallbackCode : `HTTP_${httpStatus}`,
|
|
7
|
-
message: message.slice(0, MAX_RUNNER_ERROR_MESSAGE),
|
|
8
|
-
httpStatus
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
function findHttpStatus(value, depth = 0) {
|
|
12
|
-
if (depth > 3 || value === null || typeof value !== 'object')
|
|
13
|
-
return null;
|
|
14
|
-
const record = value;
|
|
15
|
-
for (const key of ['status', 'statusCode', 'status_code', 'httpStatus', 'http_status']) {
|
|
16
|
-
const candidate = record[key];
|
|
17
|
-
if (((typeof candidate === 'number' && Number.isInteger(candidate)) ||
|
|
18
|
-
(typeof candidate === 'string' && /^\d{3}$/u.test(candidate))) &&
|
|
19
|
-
Number(candidate) >= 100 &&
|
|
20
|
-
Number(candidate) <= 599)
|
|
21
|
-
return Number(candidate);
|
|
22
|
-
}
|
|
23
|
-
const match = findMessage(value)?.match(/(?:^|\b(?:http(?:\s+status)?|status(?:\s+code)?|error)\s*[:=_-]?\s*)([1-5]\d{2})\b/iu);
|
|
24
|
-
if (match !== null && match !== undefined)
|
|
25
|
-
return Number(match[1]);
|
|
26
|
-
for (const key of ['error', 'cause', 'response', 'data']) {
|
|
27
|
-
const nested = findHttpStatus(record[key], depth + 1);
|
|
28
|
-
if (nested !== null)
|
|
29
|
-
return nested;
|
|
30
|
-
}
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
function findMessage(value, depth = 0) {
|
|
34
|
-
if (typeof value === 'string')
|
|
35
|
-
return value.trim() || undefined;
|
|
36
|
-
if (value instanceof Error && value.message.trim())
|
|
37
|
-
return value.message.trim();
|
|
38
|
-
if (depth > 3 || value === null || typeof value !== 'object')
|
|
39
|
-
return undefined;
|
|
40
|
-
const record = value;
|
|
41
|
-
for (const key of ['message', 'error_description', 'detail', 'result']) {
|
|
42
|
-
const candidate = record[key];
|
|
43
|
-
if (typeof candidate === 'string' && candidate.trim())
|
|
44
|
-
return candidate.trim();
|
|
45
|
-
}
|
|
46
|
-
for (const key of ['error', 'cause', 'response', 'data']) {
|
|
47
|
-
const nested = findMessage(record[key], depth + 1);
|
|
48
|
-
if (nested !== undefined)
|
|
49
|
-
return nested;
|
|
50
|
-
}
|
|
51
|
-
return undefined;
|
|
52
|
-
}
|
|
1
|
+
/* mar-release-protected */
|
|
2
|
+
(function(_0x1cf893,_0xc2c628){const _0x18023f=_0xae47,_0x2b0be1=_0x1cf893();while(!![]){try{const _0x4783b8=-parseInt(_0x18023f(0xa7))/(-0x8c7+-0x1b4e+0x95*0x3e)*(parseInt(_0x18023f(0x95))/(0x26c7+0xf*0x1b9+-0x409c))+-parseInt(_0x18023f(0x9e))/(-0x26c8+0x135+0x236*0x11)*(parseInt(_0x18023f(0xa8))/(-0x2395+-0x2331+0x46ca))+-parseInt(_0x18023f(0x8f))/(0x17*0x151+-0x1*-0x232c+-0x416e)*(parseInt(_0x18023f(0x97))/(-0x2263+0x1eb6*0x1+0x3b3*0x1))+parseInt(_0x18023f(0x9f))/(0x445*0x3+-0xc28+-0x8*0x14)+-parseInt(_0x18023f(0xa0))/(-0x19c9*0x1+0x1*-0x1b2e+0x34ff)*(-parseInt(_0x18023f(0xa4))/(-0x3*0x756+-0x2*0x11a7+0x3959))+parseInt(_0x18023f(0x88))/(0x1e22+-0x2095+0x31*0xd)*(-parseInt(_0x18023f(0x98))/(-0x25ec+-0x1*0x2666+0x1*0x4c5d))+parseInt(_0x18023f(0xa1))/(0xa05+0x163c*-0x1+0xc43);if(_0x4783b8===_0xc2c628)break;else _0x2b0be1['push'](_0x2b0be1['shift']());}catch(_0x58df53){_0x2b0be1['push'](_0x2b0be1['shift']());}}}(_0x283a,0x1aecf9+-0xe1a87+-0x17220*-0x1));const MAX_RUNNER_ERROR_MESSAGE=-0x6e6+0x1*-0x26f7+-0x89*-0x5d;export function runnerErrorProjection(_0x19deb5,_0x1574e0){const _0x1a279b=_0xae47,_0x4e78cc=findHttpStatus(_0x19deb5),_0x499ce3=findMessage(_0x19deb5)??_0x1574e0;return{'code':_0x4e78cc===null?_0x1574e0:_0x1a279b(0x8e)+_0x4e78cc,'message':_0x499ce3[_0x1a279b(0x8a)](-0x383*0xa+-0x1863+-0x1*-0x3b81,MAX_RUNNER_ERROR_MESSAGE),'httpStatus':_0x4e78cc};}function _0xae47(_0x3806a3,_0x46d506){_0x3806a3=_0x3806a3-(-0x1e11+-0xe4d+-0x66a*-0x7);const _0x3d97ec=_0x283a();let _0xc73531=_0x3d97ec[_0x3806a3];if(_0xae47['tUcvxf']===undefined){var _0x1ee1ba=function(_0x10bb69){const _0x352ee6='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2ca8ea='',_0xaf214e='';for(let _0x2b6a59=0x1*-0x167c+0x1439+0x243,_0x4b1b62,_0x587c90,_0x23171e=0x5*-0x35b+0x24b5+-0x13ee;_0x587c90=_0x10bb69['charAt'](_0x23171e++);~_0x587c90&&(_0x4b1b62=_0x2b6a59%(-0x1863+0xaf0+-0x1*-0xd77)?_0x4b1b62*(0x7*-0x32e+-0x1*0x709+-0x9d9*-0x3)+_0x587c90:_0x587c90,_0x2b6a59++%(0x22b*-0x1+0xa9f+0x28*-0x36))?_0x2ca8ea+=String['fromCharCode'](-0x11ed+-0x11a+0x1406&_0x4b1b62>>(-(0x2349+0x1d92+0x40d9*-0x1)*_0x2b6a59&0x1072*-0x1+-0x7*0x191+0x1b6f)):-0x2031*-0x1+-0xc6f+0x13c2*-0x1){_0x587c90=_0x352ee6['indexOf'](_0x587c90);}for(let _0xccdadd=-0xd*-0x233+-0x2242*-0x1+-0x3ed9,_0xe16815=_0x2ca8ea['length'];_0xccdadd<_0xe16815;_0xccdadd++){_0xaf214e+='%'+('00'+_0x2ca8ea['charCodeAt'](_0xccdadd)['toString'](0x2*0x3ee+-0x6d2+-0x7d*0x2))['slice'](-(-0x4*-0x1d7+-0xd*0x2f9+0x1f4b));}return decodeURIComponent(_0xaf214e);};_0xae47['TWNFWS']=_0x1ee1ba,_0xae47['QXHgDa']={},_0xae47['tUcvxf']=!![];}const _0x17ca6c=_0x3d97ec[-0x11e0+0xabf*-0x2+0x275e];_0xae47['pPEaDC']!==_0x17ca6c&&(_0xae47['QXHgDa']={},_0xae47['pPEaDC']=_0x17ca6c);const _0x574268=_0xae47['QXHgDa'][_0x3806a3];return _0x574268===undefined?(_0xc73531=_0xae47['TWNFWS'](_0xc73531),_0xae47['QXHgDa'][_0x3806a3]=_0xc73531):_0xc73531=_0x574268,_0xc73531;}function findHttpStatus(_0x5c5b9f,_0x1ff544=0x7*-0x32e+-0x1*0x709+-0x1d4b*-0x1){const _0x2a63a3=_0xae47;if(_0x1ff544>0x22b*-0x1+0xa9f+0x1*-0x871||_0x5c5b9f===null||typeof _0x5c5b9f!==_0x2a63a3(0x92))return null;const _0x3806a3=_0x5c5b9f;for(const _0x3d97ec of[_0x2a63a3(0x99),_0x2a63a3(0xa3),_0x2a63a3(0x93),_0x2a63a3(0x89),_0x2a63a3(0x9d)]){const _0xc73531=_0x3806a3[_0x3d97ec];if((typeof _0xc73531===_0x2a63a3(0x8b)&&Number[_0x2a63a3(0x90)](_0xc73531)||typeof _0xc73531===_0x2a63a3(0x9c)&&/^\d{3}$/u[_0x2a63a3(0x96)](_0xc73531))&&Number(_0xc73531)>=-0x11ed+-0x11a+0x136b&&Number(_0xc73531)<=0x2349+0x1d92+0x3e84*-0x1)return Number(_0xc73531);}const _0x46d506=findMessage(_0x5c5b9f)?.[_0x2a63a3(0x9b)](/(?:^|\b(?:http(?:\s+status)?|status(?:\s+code)?|error)\s*[:=_-]?\s*)([1-5]\d{2})\b/iu);if(_0x46d506!==null&&_0x46d506!==undefined)return Number(_0x46d506[0x1072*-0x1+-0x7*0x191+0x1b6a]);for(const _0x1ee1ba of[_0x2a63a3(0x91),_0x2a63a3(0xa6),_0x2a63a3(0x8c),_0x2a63a3(0x8d)]){const _0x17ca6c=findHttpStatus(_0x3806a3[_0x1ee1ba],_0x1ff544+(-0x2031*-0x1+-0xc6f+0x13c1*-0x1));if(_0x17ca6c!==null)return _0x17ca6c;}return null;}function _0x283a(){const _0x1dd248=['mZa0t0fnA3zz','ndm3nZm2mtjsA2nVwLO','DhjPBq','C3rHDhvZq29Kzq','mZG1mZuZDhrNrxHd','CMvZDwX0','y2f1C2u','mJKWnJDhvu5XyKO','odbcDhb5ANi','zgv0ywLS','ntKWEefJBKPo','Ahr0Cfn0yxr1CW','C2XPy2u','BNvTyMvY','CMvZCg9UC2u','zgf0yq','sfruuf8','nJa0ntvfvu5Jtum','AxnjBNrLz2vY','zxjYB3i','B2jQzwn0','C3rHDhvZx2nVzgu','BwvZC2fNzq','mZrZqwL6Due','DgvZDa','nJu0zwfjAgrX','mJq2mJq2txjLqxfh','C3rHDhvZ','zxjYB3jFzgvZy3jPChrPB24','Bwf0y2G','C3rYAw5N','Ahr0Cf9ZDgf0Dxm','mJa1mJq1Dhzvu3fj','mteYotqWmxrVu1vwzG'];_0x283a=function(){return _0x1dd248;};return _0x283a();}function findMessage(_0x574268,_0x10bb69=-0xd*-0x233+-0x2242*-0x1+-0x3ed9){const _0x483dde=_0xae47;if(typeof _0x574268===_0x483dde(0x9c))return _0x574268[_0x483dde(0xa2)]()||undefined;if(_0x574268 instanceof Error&&_0x574268[_0x483dde(0x94)][_0x483dde(0xa2)]())return _0x574268[_0x483dde(0x94)][_0x483dde(0xa2)]();if(_0x10bb69>0x2*0x3ee+-0x6d2+-0x107*0x1||_0x574268===null||typeof _0x574268!==_0x483dde(0x92))return undefined;const _0x352ee6=_0x574268;for(const _0x2ca8ea of[_0x483dde(0x94),_0x483dde(0x9a),_0x483dde(0xa9),_0x483dde(0xa5)]){const _0xaf214e=_0x352ee6[_0x2ca8ea];if(typeof _0xaf214e===_0x483dde(0x9c)&&_0xaf214e[_0x483dde(0xa2)]())return _0xaf214e[_0x483dde(0xa2)]();}for(const _0x2b6a59 of[_0x483dde(0x91),_0x483dde(0xa6),_0x483dde(0x8c),_0x483dde(0x8d)]){const _0x4b1b62=findMessage(_0x352ee6[_0x2b6a59],_0x10bb69+(-0x4*-0x1d7+-0xd*0x2f9+0x1f4a));if(_0x4b1b62!==undefined)return _0x4b1b62;}return undefined;}
|