@opengeni/runtime 4.6.0 → 4.7.0-canary.37090756480001
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/agent-instructions/modules/media.d.ts +3 -0
- package/dist/anthropic-messages.d.ts +13 -3
- package/dist/anthropic-request-error.d.ts +10 -0
- package/dist/assets/codemode-client.json +1 -1
- package/dist/{chunk-A22BKN4P.js → chunk-LJNCGUMB.js} +3 -3
- package/dist/chunk-LJNCGUMB.js.map +1 -0
- package/dist/{chunk-GTWKWJ67.js → chunk-P2OVGKDG.js} +505 -100
- package/dist/chunk-P2OVGKDG.js.map +1 -0
- package/dist/{chunk-D5DPVA2C.js → chunk-R25L27T3.js} +2047 -1275
- package/dist/chunk-R25L27T3.js.map +1 -0
- package/dist/claude-subscription-usage.d.ts +14 -4
- package/dist/context-compaction.d.ts +7 -7
- package/dist/index.d.ts +2 -0
- package/dist/index.js +13 -3
- package/dist/interaction-tools.d.ts +1 -1
- package/dist/mcp-network.js +1 -1
- package/dist/runtime-skills.d.ts +1 -0
- package/dist/sandbox/channel-a.d.ts +3 -0
- package/dist/sandbox/index.d.ts +3 -1
- package/dist/sandbox/index.js +7 -1
- package/dist/sandbox/provider-command-session.d.ts +21 -0
- package/dist/sandbox/providers/modal-command-argv.d.ts +4 -0
- package/dist/sandbox/providers/modal-command-control.d.ts +17 -5
- package/dist/sandbox/providers/modal-command-observation-errors.d.ts +3 -0
- package/dist/sandbox/providers/modal-command-raw-page.d.ts +100 -0
- package/dist/sandbox/providers/modal-command-router-wire.d.ts +17 -0
- package/dist/sandbox/routing/routing-session.d.ts +10 -0
- package/dist/sandbox/turn-tool-cancellation.d.ts +4 -0
- package/dist/workspace-tool-gateway.js +3 -3
- package/package.json +12 -12
- package/src/agent-instructions/PROMPT_CHANGELOG.md +23 -1
- package/src/agent-instructions/compose.ts +2 -0
- package/src/agent-instructions/modules/media.ts +20 -0
- package/src/agent-instructions/runtime-mechanics.ts +8 -0
- package/src/anthropic-messages.ts +223 -31
- package/src/anthropic-request-error.ts +45 -0
- package/src/bundled_default_skills/opengeni-client/SKILL.md +9 -7
- package/src/bundled_default_skills/opengeni-client/references/agent-recipes.md +1 -1
- package/src/bundled_default_skills/opengeni-client/references/api-workflows.md +61 -0
- package/src/bundled_default_skills/opengeni-client/references/compatibility-and-troubleshooting.md +86 -0
- package/src/bundled_default_skills/opengeni-client/references/data-tools-and-credentials.md +82 -0
- package/src/bundled_default_skills/opengeni-client/references/discovery-and-autonomy.md +32 -25
- package/src/bundled_default_skills/opengeni-client/references/external-users-and-connect.md +17 -0
- package/src/bundled_default_skills/opengeni-client/references/product-shapes-and-ui.md +156 -0
- package/src/bundled_schedule_skills/opengeni-schedules/SKILL.md +56 -0
- package/src/claude-subscription-usage.ts +55 -9
- package/src/context-compaction.ts +16 -9
- package/src/index.ts +85 -18
- package/src/interaction-tools.ts +113 -3
- package/src/lazy-tool-transport.ts +26 -10
- package/src/mcp-network.ts +4 -2
- package/src/model-provider-client.ts +11 -3
- package/src/model-provider-routing.ts +4 -0
- package/src/runtime-skills.ts +8 -0
- package/src/sandbox/channel-a.ts +3 -0
- package/src/sandbox/index.ts +11 -1
- package/src/sandbox/provider-command-session.ts +58 -0
- package/src/sandbox/provider-errors.ts +43 -9
- package/src/sandbox/providers/modal-command-argv.ts +20 -0
- package/src/sandbox/providers/modal-command-control.ts +422 -116
- package/src/sandbox/providers/modal-command-observation-errors.ts +65 -0
- package/src/sandbox/providers/modal-command-raw-page.ts +147 -0
- package/src/sandbox/providers/modal-command-router-wire.ts +104 -12
- package/src/sandbox/providers/modal-command-session.ts +26 -4
- package/src/sandbox/providers/modal-legacy-command-control.ts +2 -9
- package/src/sandbox/providers/modal-materialization-verification.ts +70 -6
- package/src/sandbox/routing/routing-session.ts +140 -41
- package/src/sandbox/run-credentials.ts +62 -19
- package/src/sandbox/turn-tool-cancellation.ts +159 -42
- package/dist/chunk-A22BKN4P.js.map +0 -1
- package/dist/chunk-D5DPVA2C.js.map +0 -1
- package/dist/chunk-GTWKWJ67.js.map +0 -1
|
@@ -54,6 +54,64 @@ export class ProviderCommandStartOutcomeUnknownError extends Error {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
/** A reserved stdin byte range was sent once but its acknowledgement was lost.
|
|
58
|
+
* The original process remains observation authority, never input replay authority. */
|
|
59
|
+
export class ProviderCommandInputOutcomeUnknownError extends Error {
|
|
60
|
+
constructor(
|
|
61
|
+
readonly command: SandboxProviderCommand,
|
|
62
|
+
readonly byteOffset: number,
|
|
63
|
+
readonly byteLength: number,
|
|
64
|
+
cause: unknown,
|
|
65
|
+
) {
|
|
66
|
+
super(
|
|
67
|
+
"Provider command stdin outcome is unknown; the input was not resent. Do not resend stdin; inspect the original command with empty input.",
|
|
68
|
+
{ cause },
|
|
69
|
+
);
|
|
70
|
+
this.name = "ProviderCommandInputOutcomeUnknownError";
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** An already-dispatched invocation could not be observed within this read's
|
|
75
|
+
* budget. The exact locator is read authority, never Start/input replay authority. */
|
|
76
|
+
export class ProviderCommandObservationUnavailableError extends Error {
|
|
77
|
+
constructor(
|
|
78
|
+
readonly command: SandboxProviderCommand,
|
|
79
|
+
cause: unknown,
|
|
80
|
+
/** Mixed or unreadable provider graphs can contain observation failure
|
|
81
|
+
* without proving that an automatic read retry is safe. */
|
|
82
|
+
readonly readRetryAllowed = true,
|
|
83
|
+
) {
|
|
84
|
+
super("Provider command observation unavailable; do not replay the invocation", { cause });
|
|
85
|
+
this.name = "ProviderCommandObservationUnavailableError";
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function isProviderCommandObservationUnavailableError(error: unknown): boolean {
|
|
90
|
+
const pending = [error];
|
|
91
|
+
const seen = new Set<object>();
|
|
92
|
+
for (let count = 0; pending.length && count < 32; count++) {
|
|
93
|
+
const current = pending.pop();
|
|
94
|
+
if (!current || typeof current !== "object" || seen.has(current)) continue;
|
|
95
|
+
seen.add(current);
|
|
96
|
+
if (current instanceof ProviderCommandObservationUnavailableError) return true;
|
|
97
|
+
try {
|
|
98
|
+
for (const key of ["cause", "error"] as const) {
|
|
99
|
+
const property = Object.getOwnPropertyDescriptor(current, key);
|
|
100
|
+
if (property && "value" in property) pending.push(property.value);
|
|
101
|
+
}
|
|
102
|
+
const errors = Object.getOwnPropertyDescriptor(current, "errors");
|
|
103
|
+
if (errors && "value" in errors && Array.isArray(errors.value) && errors.value.length <= 16)
|
|
104
|
+
for (let index = 0; index < errors.value.length; index++) {
|
|
105
|
+
const item = Object.getOwnPropertyDescriptor(errors.value, String(index));
|
|
106
|
+
if (item && "value" in item) pending.push(item.value);
|
|
107
|
+
}
|
|
108
|
+
} catch {
|
|
109
|
+
/* Unknown error graphs do not acquire observation authority. */
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
|
|
57
115
|
export type ProviderCommandSession = {
|
|
58
116
|
verifyCommandSupervisionCapability?(): Promise<{ sandboxId: string; taskId: string }>;
|
|
59
117
|
releaseSupervisedCommand?(handle: number): Promise<void>;
|
|
@@ -18,6 +18,11 @@ export type ProviderSandboxFailure = {
|
|
|
18
18
|
|
|
19
19
|
const GRPC_TRANSIENT = new Set([1, 2, 4, 13, 14]);
|
|
20
20
|
const TRANSIENT_CODES = new Set([
|
|
21
|
+
"1",
|
|
22
|
+
"2",
|
|
23
|
+
"4",
|
|
24
|
+
"13",
|
|
25
|
+
"14",
|
|
21
26
|
"CANCELLED",
|
|
22
27
|
"UNKNOWN",
|
|
23
28
|
"DEADLINE_EXCEEDED",
|
|
@@ -36,21 +41,39 @@ type ErrorSignals = {
|
|
|
36
41
|
numbers: number[];
|
|
37
42
|
codes: string[];
|
|
38
43
|
messages: string[];
|
|
44
|
+
incomplete: boolean;
|
|
39
45
|
};
|
|
40
46
|
|
|
47
|
+
const UNREADABLE_ERROR_SIGNAL = Symbol("unreadable-error-signal");
|
|
48
|
+
|
|
41
49
|
function safeRead(record: object, key: string): unknown {
|
|
42
50
|
try {
|
|
43
|
-
|
|
51
|
+
const descriptor = Object.getOwnPropertyDescriptor(record, key);
|
|
52
|
+
return descriptor
|
|
53
|
+
? "value" in descriptor
|
|
54
|
+
? descriptor.value
|
|
55
|
+
: UNREADABLE_ERROR_SIGNAL
|
|
56
|
+
: undefined;
|
|
44
57
|
} catch {
|
|
45
|
-
return
|
|
58
|
+
return UNREADABLE_ERROR_SIGNAL;
|
|
46
59
|
}
|
|
47
60
|
}
|
|
48
61
|
|
|
49
62
|
function collectSignals(value: unknown): ErrorSignals {
|
|
50
|
-
const out: ErrorSignals = { numbers: [], codes: [], messages: [] };
|
|
63
|
+
const out: ErrorSignals = { numbers: [], codes: [], messages: [], incomplete: false };
|
|
51
64
|
const seen = new Set<object>();
|
|
65
|
+
const read = (record: object, key: string): unknown => {
|
|
66
|
+
const signal = safeRead(record, key);
|
|
67
|
+
if (signal !== UNREADABLE_ERROR_SIGNAL) return signal;
|
|
68
|
+
out.incomplete = true;
|
|
69
|
+
return undefined;
|
|
70
|
+
};
|
|
52
71
|
const visit = (current: unknown, depth: number): void => {
|
|
53
|
-
if (
|
|
72
|
+
if (current === null || current === undefined) return;
|
|
73
|
+
if (depth > 6 || seen.size >= 64) {
|
|
74
|
+
out.incomplete = true;
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
54
77
|
if (typeof current === "string") {
|
|
55
78
|
if (current.length <= 512) out.messages.push(current);
|
|
56
79
|
return;
|
|
@@ -66,7 +89,7 @@ function collectSignals(value: unknown): ErrorSignals {
|
|
|
66
89
|
"errorCode",
|
|
67
90
|
"code",
|
|
68
91
|
]) {
|
|
69
|
-
const signal =
|
|
92
|
+
const signal = read(current, key);
|
|
70
93
|
if (typeof signal === "number" && Number.isFinite(signal)) out.numbers.push(signal);
|
|
71
94
|
if (typeof signal === "string") {
|
|
72
95
|
const code = signal.trim().toUpperCase();
|
|
@@ -74,12 +97,22 @@ function collectSignals(value: unknown): ErrorSignals {
|
|
|
74
97
|
}
|
|
75
98
|
}
|
|
76
99
|
for (const key of ["name", "message", "details", "cause"]) {
|
|
77
|
-
const signal =
|
|
100
|
+
const signal = read(current, key);
|
|
78
101
|
if (typeof signal === "string" && signal.length <= 512) out.messages.push(signal);
|
|
79
102
|
else visit(signal, depth + 1);
|
|
80
103
|
}
|
|
81
|
-
visit(
|
|
82
|
-
visit(
|
|
104
|
+
visit(read(current, "response"), depth + 1);
|
|
105
|
+
visit(read(current, "error"), depth + 1);
|
|
106
|
+
const errors = read(current, "errors");
|
|
107
|
+
if (errors !== undefined) {
|
|
108
|
+
if (!Array.isArray(errors) || !errors.length || errors.length > 16) out.incomplete = true;
|
|
109
|
+
else
|
|
110
|
+
for (let index = 0; index < errors.length; index++) {
|
|
111
|
+
const nested = read(errors, String(index));
|
|
112
|
+
if (!nested || typeof nested !== "object") out.incomplete = true;
|
|
113
|
+
visit(nested, depth + 1);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
83
116
|
};
|
|
84
117
|
visit(value, 0);
|
|
85
118
|
return out;
|
|
@@ -140,6 +173,7 @@ export function classifyProviderSandboxFailure(
|
|
|
140
173
|
if (hasTransientSignal(signals)) {
|
|
141
174
|
return { kind: "transient_transport", diagnostic };
|
|
142
175
|
}
|
|
176
|
+
if (signals.incomplete) return { kind: "other", diagnostic };
|
|
143
177
|
if (
|
|
144
178
|
signals.numbers.some((status) => status === 404) ||
|
|
145
179
|
signals.codes.some((code) => NOT_FOUND_CODES.has(code))
|
|
@@ -233,7 +267,7 @@ export function isProviderSandboxGoneDuringRoutedOperation(
|
|
|
233
267
|
): boolean {
|
|
234
268
|
if (backendId === "selfhosted" || !error) return false;
|
|
235
269
|
const signals = collectSignals(error);
|
|
236
|
-
if (hasTransientSignal(signals)) return false;
|
|
270
|
+
if (hasTransientSignal(signals) || signals.incomplete) return false;
|
|
237
271
|
if (signals.codes.includes("SANDBOX_NOT_FOUND")) return true;
|
|
238
272
|
return backendId === "modal" && hasModalTerminalSandboxMessage(signals);
|
|
239
273
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ChannelAExecArgs } from "../channel-a";
|
|
2
|
+
|
|
3
|
+
/** Keep the command payload once in argv. Embedding it in each run-as branch
|
|
4
|
+
* multiplies large lifecycle scripts past the provider's aggregate limit. */
|
|
5
|
+
export function modalCommandArgv(args: ChannelAExecArgs): string[] {
|
|
6
|
+
const command = [
|
|
7
|
+
args.shell ?? "/bin/sh",
|
|
8
|
+
args.shell && (args.login ?? true) ? "-lc" : "-c",
|
|
9
|
+
args.cmd,
|
|
10
|
+
];
|
|
11
|
+
if (!args.runAs) return command;
|
|
12
|
+
return [
|
|
13
|
+
"/bin/sh",
|
|
14
|
+
"-c",
|
|
15
|
+
'user=$1; shift; if [ "$(id -u)" = "$user" ] || [ "$(id -un 2>/dev/null)" = "$user" ]; then exec "$@"; elif [ "$(id -u)" = 0 ]; then exec su -s /bin/sh -c \'exec "$@"\' -- "$user" sh "$@"; else exec sudo -n -u "$user" -- "$@"; fi',
|
|
16
|
+
"opengeni-run-as",
|
|
17
|
+
args.runAs,
|
|
18
|
+
...command,
|
|
19
|
+
];
|
|
20
|
+
}
|