@opengeni/runtime 4.6.0 → 4.7.0-canary.37111190284001

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 (75) hide show
  1. package/dist/agent-instructions/modules/media.d.ts +3 -0
  2. package/dist/anthropic-messages.d.ts +13 -3
  3. package/dist/anthropic-request-error.d.ts +10 -0
  4. package/dist/assets/codemode-client.json +1 -1
  5. package/dist/{chunk-D5DPVA2C.js → chunk-3QG5IL64.js} +2436 -1355
  6. package/dist/chunk-3QG5IL64.js.map +1 -0
  7. package/dist/{chunk-A22BKN4P.js → chunk-LJNCGUMB.js} +3 -3
  8. package/dist/chunk-LJNCGUMB.js.map +1 -0
  9. package/dist/{chunk-GTWKWJ67.js → chunk-YLRVEUJ7.js} +527 -103
  10. package/dist/chunk-YLRVEUJ7.js.map +1 -0
  11. package/dist/claude-subscription-usage.d.ts +14 -4
  12. package/dist/context-compaction.d.ts +7 -7
  13. package/dist/index.d.ts +2 -0
  14. package/dist/index.js +17 -3
  15. package/dist/interaction-tools.d.ts +1 -1
  16. package/dist/mcp-network.js +1 -1
  17. package/dist/runtime-skills.d.ts +1 -0
  18. package/dist/sandbox/channel-a.d.ts +3 -0
  19. package/dist/sandbox/index.d.ts +4 -1
  20. package/dist/sandbox/index.js +11 -1
  21. package/dist/sandbox/provider-command-session.d.ts +21 -0
  22. package/dist/sandbox/providers/modal-command-argv.d.ts +4 -0
  23. package/dist/sandbox/providers/modal-command-control.d.ts +17 -5
  24. package/dist/sandbox/providers/modal-command-observation-errors.d.ts +3 -0
  25. package/dist/sandbox/providers/modal-command-raw-page.d.ts +100 -0
  26. package/dist/sandbox/providers/modal-command-router-wire.d.ts +40 -0
  27. package/dist/sandbox/providers/modal-native-create-preparation.d.ts +208 -0
  28. package/dist/sandbox/routing/routing-session.d.ts +10 -0
  29. package/dist/sandbox/turn-tool-cancellation.d.ts +4 -0
  30. package/dist/workspace-tool-gateway.js +3 -3
  31. package/package.json +12 -12
  32. package/src/agent-instructions/PROMPT_CHANGELOG.md +23 -1
  33. package/src/agent-instructions/compose.ts +2 -0
  34. package/src/agent-instructions/modules/media.ts +20 -0
  35. package/src/agent-instructions/runtime-mechanics.ts +8 -0
  36. package/src/anthropic-messages.ts +223 -31
  37. package/src/anthropic-request-error.ts +45 -0
  38. package/src/bundled_default_skills/opengeni-client/SKILL.md +14 -9
  39. package/src/bundled_default_skills/opengeni-client/references/agent-recipes.md +17 -1
  40. package/src/bundled_default_skills/opengeni-client/references/api-workflows.md +61 -0
  41. package/src/bundled_default_skills/opengeni-client/references/compatibility-and-troubleshooting.md +86 -0
  42. package/src/bundled_default_skills/opengeni-client/references/configure-the-agent.md +19 -0
  43. package/src/bundled_default_skills/opengeni-client/references/data-tools-and-credentials.md +82 -0
  44. package/src/bundled_default_skills/opengeni-client/references/discovery-and-autonomy.md +32 -25
  45. package/src/bundled_default_skills/opengeni-client/references/external-users-and-connect.md +17 -0
  46. package/src/bundled_default_skills/opengeni-client/references/product-shapes-and-ui.md +157 -1
  47. package/src/bundled_schedule_skills/opengeni-schedules/SKILL.md +56 -0
  48. package/src/claude-subscription-usage.ts +55 -9
  49. package/src/context-compaction.ts +16 -9
  50. package/src/index.ts +120 -21
  51. package/src/interaction-tools.ts +113 -3
  52. package/src/lazy-tool-transport.ts +26 -10
  53. package/src/mcp-network.ts +4 -2
  54. package/src/model-provider-client.ts +11 -3
  55. package/src/model-provider-routing.ts +4 -0
  56. package/src/runtime-skills.ts +8 -0
  57. package/src/sandbox/channel-a.ts +3 -0
  58. package/src/sandbox/index.ts +19 -1
  59. package/src/sandbox/provider-command-session.ts +58 -0
  60. package/src/sandbox/provider-errors.ts +43 -9
  61. package/src/sandbox/providers/modal-command-argv.ts +20 -0
  62. package/src/sandbox/providers/modal-command-control.ts +422 -116
  63. package/src/sandbox/providers/modal-command-observation-errors.ts +65 -0
  64. package/src/sandbox/providers/modal-command-raw-page.ts +147 -0
  65. package/src/sandbox/providers/modal-command-router-wire.ts +202 -12
  66. package/src/sandbox/providers/modal-command-session.ts +26 -4
  67. package/src/sandbox/providers/modal-legacy-command-control.ts +2 -9
  68. package/src/sandbox/providers/modal-materialization-verification.ts +70 -6
  69. package/src/sandbox/providers/modal-native-create-preparation.ts +338 -0
  70. package/src/sandbox/routing/routing-session.ts +140 -41
  71. package/src/sandbox/run-credentials.ts +62 -19
  72. package/src/sandbox/turn-tool-cancellation.ts +159 -42
  73. package/dist/chunk-A22BKN4P.js.map +0 -1
  74. package/dist/chunk-D5DPVA2C.js.map +0 -1
  75. package/dist/chunk-GTWKWJ67.js.map +0 -1
@@ -0,0 +1,208 @@
1
+ import { z } from "zod";
2
+ /** A new wrapper around the unchanged reservation vocabulary. These additional
3
+ * fields MUST NOT be passed as extra keys to the reservation-v1 DB API. */
4
+ declare const specSchema: z.ZodObject<{
5
+ version: z.ZodLiteral<1>;
6
+ recipeId: z.ZodLiteral<"modal-native-fresh-v1">;
7
+ recipeRevision: z.ZodLiteral<1>;
8
+ createWorkdir: z.ZodLiteral<"/tmp">;
9
+ entrypoint: z.ZodTuple<[z.ZodLiteral<"sleep">, z.ZodLiteral<"infinity">], null>;
10
+ origin: z.ZodObject<{
11
+ version: z.ZodLiteral<1>;
12
+ planId: z.ZodString;
13
+ creatorId: z.ZodString;
14
+ accountId: z.ZodString;
15
+ workspaceId: z.ZodString;
16
+ sessionId: z.ZodString;
17
+ turnId: z.ZodString;
18
+ attemptId: z.ZodString;
19
+ executionGeneration: z.ZodNumber;
20
+ triggerEventId: z.ZodString;
21
+ sandboxGroupId: z.ZodString;
22
+ routeKind: z.ZodLiteral<"home">;
23
+ routeTargetId: z.ZodNull;
24
+ routeEpoch: z.ZodNumber;
25
+ providerBindingKey: z.ZodString;
26
+ providerBinding: z.ZodObject<{
27
+ version: z.ZodLiteral<1>;
28
+ serverUrl: z.ZodString;
29
+ workspaceName: z.ZodString;
30
+ environment: z.ZodString;
31
+ }, z.core.$strict>;
32
+ }, z.core.$strict>;
33
+ blueprint: z.ZodObject<{
34
+ version: z.ZodLiteral<1>;
35
+ adapterId: z.ZodLiteral<"modal-native-fresh-creator-reservation-v1">;
36
+ create: z.ZodObject<{
37
+ operationId: z.ZodString;
38
+ appId: z.ZodString;
39
+ imageId: z.ZodString;
40
+ cpu: z.ZodNumber;
41
+ memoryMiB: z.ZodNumber;
42
+ timeoutSeconds: z.ZodNumber;
43
+ env: z.ZodObject<{}, z.core.$strict>;
44
+ mounts: z.ZodTuple<[], null>;
45
+ }, z.core.$strict>;
46
+ restore: z.ZodNull;
47
+ readiness: z.ZodObject<{
48
+ operationId: z.ZodString;
49
+ execId: z.ZodString;
50
+ commandArgs: z.ZodTuple<[z.ZodLiteral<"/bin/true">], null>;
51
+ workdir: z.ZodLiteral<"/tmp">;
52
+ env: z.ZodObject<{}, z.core.$strict>;
53
+ }, z.core.$strict>;
54
+ publishOperationId: z.ZodString;
55
+ cleanup: z.ZodObject<{
56
+ operationId: z.ZodString;
57
+ requires: z.ZodLiteral<"physical-terminal-proof">;
58
+ }, z.core.$strict>;
59
+ }, z.core.$strict>;
60
+ }, z.core.$strict>;
61
+ export type NativeFreshCreateSpec = z.infer<typeof specSchema>;
62
+ type Immutable<T> = T extends readonly unknown[] ? {
63
+ readonly [K in keyof T]: Immutable<T[K]>;
64
+ } : T extends object ? {
65
+ readonly [K in keyof T]: Immutable<T[K]>;
66
+ } : T;
67
+ declare const normalization: {
68
+ readonly recipeId: "modal-native-fresh-v1";
69
+ readonly recipeRevision: 1;
70
+ readonly schema: "modal.client.ModalClient/SandboxCreate";
71
+ readonly encoding: "modal-create-json-v1";
72
+ readonly sdkVersion: "0.9.0";
73
+ readonly sdkSourceSha256: "bb830ded1925e1d927d1fc221b2329d961f9a57eafdd9a85bf13fb7cfc982599";
74
+ readonly entrypoint: readonly ["sleep", "infinity"];
75
+ readonly createWorkdir: "/tmp";
76
+ readonly env: {};
77
+ readonly mounts: readonly [];
78
+ readonly restore: null;
79
+ readonly idleTimeout: "unset";
80
+ readonly gpu: "unset";
81
+ readonly gpuProto: {
82
+ readonly type: 0;
83
+ readonly count: 0;
84
+ readonly gpuType: "";
85
+ };
86
+ readonly cpuLimit: "unset";
87
+ readonly memoryLimit: "unset";
88
+ readonly pty: "unset";
89
+ readonly regions: "unset";
90
+ readonly proxy: "unset";
91
+ readonly readinessProbe: "unset";
92
+ readonly environmentVariables: "unset";
93
+ readonly network: {
94
+ readonly access: "OPEN";
95
+ readonly outboundCidrs: readonly [];
96
+ readonly outboundDomains: readonly [];
97
+ readonly inboundCidrs: readonly [];
98
+ readonly i6pn: false;
99
+ };
100
+ readonly volumes: readonly [];
101
+ readonly cloudBucketMounts: readonly [];
102
+ readonly secrets: readonly [];
103
+ readonly ports: readonly [];
104
+ readonly cloud: "";
105
+ readonly verbose: false;
106
+ readonly includeOidcIdentityToken: false;
107
+ readonly experimentalOptions: {};
108
+ readonly experimentalOptionsV2: {};
109
+ readonly customDomain: "";
110
+ };
111
+ /** Modal 0.9.0 buildSandboxCreateRequestProto + generated fromPartial defaults,
112
+ * followed by the atomic name/tag injection of modal-create-boundary. Property
113
+ * order and intentionally undefined fields are part of this JSON correlation
114
+ * recipe. Pinned-SDK parity tests, not generic SDK reentry, guard this mirror. */
115
+ declare function normalizedRequest(spec: NativeFreshCreateSpec): {
116
+ appId: string;
117
+ definition: {
118
+ entrypointArgs: ("infinity" | "sleep")[];
119
+ mountIds: never[];
120
+ imageId: string;
121
+ secretIds: never[];
122
+ resources: {
123
+ memoryMb: number;
124
+ milliCpu: number;
125
+ gpuConfig: {
126
+ type: number;
127
+ count: number;
128
+ gpuType: string;
129
+ };
130
+ memoryMbMax: number;
131
+ ephemeralDiskMb: number;
132
+ milliCpuMax: number;
133
+ rdma: boolean;
134
+ };
135
+ cloudProvider: number;
136
+ timeoutSecs: number;
137
+ workdir: "/tmp";
138
+ nfsMounts: never[];
139
+ runtimeDebug: boolean;
140
+ blockNetwork: boolean;
141
+ s3Mounts: never[];
142
+ cloudBucketMounts: never[];
143
+ volumeMounts: never[];
144
+ ptyInfo: undefined;
145
+ schedulerPlacement: undefined;
146
+ workerId: string;
147
+ openPorts: {
148
+ ports: never[];
149
+ };
150
+ i6pnEnabled: boolean;
151
+ networkAccess: {
152
+ networkAccessType: number;
153
+ allowedCidrs: never[];
154
+ allowedDomains: never[];
155
+ };
156
+ proxyId: undefined;
157
+ enableSnapshot: boolean;
158
+ snapshotVersion: undefined;
159
+ cloudProviderStr: string;
160
+ runscRuntimeVersion: undefined;
161
+ runtime: undefined;
162
+ verbose: boolean;
163
+ name: string;
164
+ experimentalOptions: {};
165
+ experimentalOptionsV2: {};
166
+ preloadPathPrefixes: never[];
167
+ idleTimeoutSecs: undefined;
168
+ directSandboxCommandsEnabled: boolean;
169
+ RestoreInstanceType: string;
170
+ customDomain: string;
171
+ includeOidcIdentityToken: boolean;
172
+ readinessProbe: undefined;
173
+ inboundCidrAllowlist: never[];
174
+ environmentVariables: undefined;
175
+ };
176
+ environmentName: string;
177
+ tags: {
178
+ tagName: string;
179
+ tagValue: string;
180
+ }[];
181
+ };
182
+ export type NativeFreshCreateCompilation = Immutable<{
183
+ version: 1;
184
+ recipeId: "modal-native-fresh-v1";
185
+ recipeRevision: 1;
186
+ compilerFingerprint: string;
187
+ normalization: typeof normalization;
188
+ spec: NativeFreshCreateSpec;
189
+ normalizedRequest: ReturnType<typeof normalizedRequest>;
190
+ requestJson: string;
191
+ request: {
192
+ encoding: "modal-create-json-v1";
193
+ sha256: string;
194
+ byteLength: number;
195
+ encoderFingerprint: string;
196
+ };
197
+ }>;
198
+ /** Opaque local compilation handle. It is correlation data, never an accepted
199
+ * operation, authenticated principal, reservation or fresh dispatch grant. */
200
+ export type NativeFreshCreatePreparation = Readonly<object>;
201
+ /** Synchronous, credentials-free and zero provider/DB/config I/O. Requires all
202
+ * IDs and the complete known fresh recipe before election. Never creates IDs,
203
+ * resolves apps/images, invokes SDK helpers or consumes dispatch authority. */
204
+ export declare function compileNativeFreshCreate(input: NativeFreshCreateSpec): NativeFreshCreatePreparation;
205
+ /** Authenticates ONLY local compiler issuance. The full frozen record contains
206
+ * no credential/JWT, grant, DB receipt or transmitted-byte attestation. */
207
+ export declare function describeNativeFreshCreate(handle: NativeFreshCreatePreparation): NativeFreshCreateCompilation;
208
+ export {};
@@ -205,6 +205,12 @@ export interface RoutingSandboxSessionDeps {
205
205
  process: RoutingRetainedProcess;
206
206
  proof: RoutingRetainedProcessTerminalProof;
207
207
  }) => Promise<void>;
208
+ /** Read terminal truth for this exact copied process/backend. Missing rows,
209
+ * failed observations and active rows must never count as physical proof. */
210
+ isProcessSettled?: (input: {
211
+ backend: ResolvedActiveBackend;
212
+ process: RoutingRetainedProcess;
213
+ }) => Promise<boolean>;
208
214
  /** A terminal result is being returned to the model, not merely drained by
209
215
  * control/reaper work. Never invoke this for a running receipt. */
210
216
  observeProcessTerminal?: (input: {
@@ -486,6 +492,10 @@ export declare class RoutingSandboxSession implements RoutableBackendSession {
486
492
  * backend that yielded it. This synchronous probe is used only to select the
487
493
  * process-aware routing surface; it is not itself durable authority. */
488
494
  hasRetainedProcess(providerSessionId: number): boolean;
495
+ /** A reaper may have settled the command while a local capture/control receipt
496
+ * remained pending. Cleanup may consume that same durable proof without
497
+ * replaying a provider operation or accepting pending output into the model. */
498
+ reconcileRetainedProcess(providerSessionId: number): Promise<boolean>;
489
499
  /** Local, Docker, and OpenSandbox process ids address an in-memory table on one worker
490
500
  * session object. They are not valid durable locators for the independently
491
501
  * scheduled reaper, so their yielded handles stay turn-owned until terminal
@@ -9,6 +9,7 @@ type CommandCancellationSession = {
9
9
  supportsPty?(): boolean;
10
10
  supportsCommandInput?(providerSessionId: number): boolean;
11
11
  hasRetainedProcess?(providerSessionId: number): boolean;
12
+ reconcileRetainedProcess?(providerSessionId: number): Promise<boolean>;
12
13
  retainedProcessHasTypedHandleLoss?(providerSessionId: number): boolean;
13
14
  /** Whether the provider locator remains controllable from another worker
14
15
  * process after this turn returns. */
@@ -23,18 +24,21 @@ type CommandCancellationSession = {
23
24
  chars?: string;
24
25
  yieldTimeMs?: number;
25
26
  maxOutputTokens?: number;
27
+ signal?: AbortSignal;
26
28
  }): Promise<string>;
27
29
  writeStdinForProcessMutation?(args: {
28
30
  sessionId: number;
29
31
  chars?: string;
30
32
  yieldTimeMs?: number;
31
33
  maxOutputTokens?: number;
34
+ signal?: AbortSignal;
32
35
  }): Promise<string>;
33
36
  writeStdinForProcessControl?(args: {
34
37
  sessionId: number;
35
38
  chars?: string;
36
39
  yieldTimeMs?: number;
37
40
  maxOutputTokens?: number;
41
+ signal?: AbortSignal;
38
42
  }): Promise<string>;
39
43
  execCommandForProcessControl?(providerSessionId: number, args: TurnSandboxCommandArgs): Promise<string>;
40
44
  };
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  prepareAgentTools
3
- } from "./chunk-GTWKWJ67.js";
4
- import "./chunk-D5DPVA2C.js";
3
+ } from "./chunk-YLRVEUJ7.js";
4
+ import "./chunk-3QG5IL64.js";
5
5
  import "./chunk-7KVMU7O3.js";
6
6
  import "./chunk-4A4XTKKX.js";
7
7
  import "./chunk-GUJMCB7F.js";
8
8
  import "./chunk-KAPAZSUC.js";
9
- import "./chunk-A22BKN4P.js";
9
+ import "./chunk-LJNCGUMB.js";
10
10
  import "./chunk-YU4VRTR4.js";
11
11
  import "./chunk-ISNIWRWB.js";
12
12
  import "./chunk-PZ5AY32C.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeni/runtime",
3
- "version": "4.6.0",
3
+ "version": "4.7.0-canary.37111190284001",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -63,17 +63,17 @@
63
63
  "@openai/agents": "0.14.3",
64
64
  "@openai/agents-core": "0.14.3",
65
65
  "@openai/agents-extensions": "0.14.3",
66
- "@opengeni/agent-proto": "^0.6.1",
67
- "@opengeni/capabilities": "^0.3.5",
68
- "@opengeni/codemode": "^0.6.8",
69
- "@opengeni/codex": "^0.2.31",
70
- "@opengeni/config": "^3.2.1",
71
- "@opengeni/contracts": "^5.6.0",
72
- "@opengeni/network": "^0.3.1",
73
- "@opengeni/observability": "^0.8.37",
74
- "@opengeni/sdk": "^7.6.1",
75
- "@opengeni/tool-gateway": "^0.1.18",
76
- "@opengeni/xai-subscription": "^0.1.5",
66
+ "@opengeni/agent-proto": "^0.6.1-canary.37111190284001",
67
+ "@opengeni/capabilities": "^0.3.6-canary.37111190284001",
68
+ "@opengeni/codemode": "^0.7.0-canary.37111190284001",
69
+ "@opengeni/codex": "^0.2.32-canary.37111190284001",
70
+ "@opengeni/config": "^3.3.0-canary.37111190284001",
71
+ "@opengeni/contracts": "^5.7.0-canary.37111190284001",
72
+ "@opengeni/network": "^0.3.1-canary.37111190284001",
73
+ "@opengeni/observability": "^0.8.38-canary.37111190284001",
74
+ "@opengeni/sdk": "^7.7.0-canary.37111190284001",
75
+ "@opengeni/tool-gateway": "^0.1.19-canary.37111190284001",
76
+ "@opengeni/xai-subscription": "^0.1.5-canary.37111190284001",
77
77
  "debug": "4.4.3",
78
78
  "modal": "0.9.0",
79
79
  "openai": "6.47.0",
@@ -43,7 +43,7 @@ Composition order (each part separated by a blank line):
43
43
  waiting and `wait_for_input`, compaction, background commands.
44
44
  - Conditional modules, in this order: `renderer_markdown`, `sandbox`,
45
45
  `connected_machine`, `repositories`, `workspace_environment`, `rig`,
46
- `artifacts`, `goals`, `subagents`, `knowledge`, `skills`, `admin`,
46
+ `artifacts`, `media`, `goals`, `subagents`, `knowledge`, `skills`, `admin`,
47
47
  `attachments` (last because it varies per turn).
48
48
  3. Attempt directives, unchanged text: Codemode, code search, Git credential
49
49
  bindings.
@@ -82,6 +82,28 @@ Headings that moved or were added (layout only, not diffed):
82
82
 
83
83
  ## Sentence edits (modular "all" vs legacy)
84
84
 
85
+ Tool discovery and media. Deferred schemas must remain behind the existing
86
+ search router, while modular agents need to distinguish missing disclosure
87
+ from missing execution authority. Runtime mechanics explains ranked discovery
88
+ and literal-prefix recovery; the new `media` capability module directs image
89
+ and video requests to runtime/provider tools rather than integration setup.
90
+ Disabled media removes that module. The legacy prompt remains unchanged.
91
+
92
+ ```diff
93
+ + Deferred tool schemas are omitted from the first request; absence there does not prove a tool is unavailable.
94
+ + When deferred tools are attached, use `tool_search` for one focused capability at a time; broad searches with small limits can omit a relevant tool.
95
+ + If a search misses, use `tool_list` and follow `nextCursor` until the relevant authorized names are covered, then load exact names with `tool_search`.
96
+ + `namePrefix` is a literal tool-name prefix, not a capability keyword; an empty filtered page does not prove the capability is unavailable.
97
+ + Discovery never grants authority, and remembered tool names must still resolve against the current authorized catalog.
98
+ + Use an attached image-generation tool when the user requests generated images or edits.
99
+ + If it is deferred, use a focused image-generation query with `tool_search`, or request the exact `generate_image` name before concluding no image tool exists.
100
+ + `generate_image` is a runtime tool; integration catalogs and sandbox CLI lists do not enumerate it.
101
+ + A hosted `image_generation` tool may instead be visible directly on supported provider routes.
102
+ + The media capability permits discovery, but does not prove a provider adapter is attached; establish availability from the current authorized tool catalog.
103
+ + Use the returned tool schema for references and output controls; do not invent model names or provider-specific options.
104
+ + For video, discover `get_video_generation_capabilities` and `generate_video`, read current capabilities before selecting a model, and follow the available video-generation Skill.
105
+ ```
106
+
85
107
  Identity. The legacy text opened with two identity statements (the contract's
86
108
  generic line and the template's OpenGeni line). The default identity keeps the
87
109
  more specific one and adds the contract's collaboration and voice sentences,
@@ -13,6 +13,7 @@ import { rigModule, workspaceEnvironmentModule } from "./modules/environment";
13
13
  import { goalsModule } from "./modules/goals";
14
14
  import { knowledgeModule } from "./modules/knowledge";
15
15
  import { connectedMachineModule } from "./modules/machines";
16
+ import { mediaModule } from "./modules/media";
16
17
  import { rendererMarkdownModule } from "./modules/renderer-markdown";
17
18
  import { repositoriesModule } from "./modules/repositories";
18
19
  import { sandboxModule } from "./modules/sandbox";
@@ -33,6 +34,7 @@ export const AGENT_PROMPT_MODULES: readonly AgentPromptModule[] = [
33
34
  workspaceEnvironmentModule,
34
35
  rigModule,
35
36
  artifactsModule,
37
+ mediaModule,
36
38
  goalsModule,
37
39
  subagentsModule,
38
40
  knowledgeModule,
@@ -0,0 +1,20 @@
1
+ import { blocks, sentences, type AgentPromptModule } from "../types";
2
+
3
+ /** Media authorization is separate from provider attachment and tool disclosure. */
4
+ export const mediaModule: AgentPromptModule = {
5
+ id: "media",
6
+ applies: (context) => context.capabilities.media,
7
+ render: () =>
8
+ blocks(
9
+ "# Images and video",
10
+ sentences(
11
+ "Use an attached image-generation tool when the user requests generated images or edits.",
12
+ "If it is deferred, use a focused image-generation query with `tool_search`, or request the exact `generate_image` name before concluding no image tool exists.",
13
+ "`generate_image` is a runtime tool; integration catalogs and sandbox CLI lists do not enumerate it.",
14
+ "A hosted `image_generation` tool may instead be visible directly on supported provider routes.",
15
+ "The media capability permits discovery, but does not prove a provider adapter is attached; establish availability from the current authorized tool catalog.",
16
+ "Use the returned tool schema for references and output controls; do not invent model names or provider-specific options.",
17
+ "For video, discover `get_video_generation_capabilities` and `generate_video`, read current capabilities before selecting a model, and follow the available video-generation Skill.",
18
+ ),
19
+ ),
20
+ };
@@ -43,6 +43,14 @@ Command completion alone resumes you only while you have an explicit \`wait_for_
43
43
  export function renderRuntimeMechanics(context: AgentPromptContext): string {
44
44
  return blocks(
45
45
  "# Runtime mechanics",
46
+ "## Tool discovery",
47
+ sentences(
48
+ "Deferred tool schemas are omitted from the first request; absence there does not prove a tool is unavailable.",
49
+ "When deferred tools are attached, use `tool_search` for one focused capability at a time; broad searches with small limits can omit a relevant tool.",
50
+ "If a search misses, use `tool_list` and follow `nextCursor` until the relevant authorized names are covered, then load exact names with `tool_search`.",
51
+ "`namePrefix` is a literal tool-name prefix, not a capability keyword; an empty filtered page does not prove the capability is unavailable.",
52
+ "Discovery never grants authority, and remembered tool names must still resolve against the current authorized catalog.",
53
+ ),
46
54
  "## New messages while you work",
47
55
  newMessages(context),
48
56
  "## Waiting",