@gea-ai/agent-sdk 0.1.260908-alpha.0 → 0.1.260910-alpha.0
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/README.md +291 -84
- package/THIRD_PARTY_NOTICES.md +40 -0
- package/dist/agent-computer-scope.d.ts.map +1 -1
- package/dist/agent-computer-scope.js +0 -5
- package/dist/agent-computer-scope.js.map +1 -1
- package/dist/agent-computer-session.d.ts +1 -5
- package/dist/agent-computer-session.d.ts.map +1 -1
- package/dist/agent-computer-session.js +0 -32
- package/dist/agent-computer-session.js.map +1 -1
- package/dist/agent-core-engine.d.ts +29 -0
- package/dist/agent-core-engine.d.ts.map +1 -0
- package/dist/agent-core-engine.js +2 -0
- package/dist/agent-core-engine.js.map +1 -0
- package/dist/agent-core-output.d.ts +6 -0
- package/dist/agent-core-output.d.ts.map +1 -0
- package/dist/agent-core-output.js +36 -0
- package/dist/agent-core-output.js.map +1 -0
- package/dist/agent-core.d.ts +12 -0
- package/dist/agent-core.d.ts.map +1 -0
- package/dist/agent-core.js +18 -0
- package/dist/agent-core.js.map +1 -0
- package/dist/agent-core.wasm +0 -0
- package/dist/agent-http.d.ts +26 -0
- package/dist/agent-http.d.ts.map +1 -0
- package/dist/agent-http.js +77 -0
- package/dist/agent-http.js.map +1 -0
- package/dist/agent-session-execution.d.ts.map +1 -1
- package/dist/agent-session-execution.js +23 -1
- package/dist/agent-session-execution.js.map +1 -1
- package/dist/agent-worker-context.d.ts +9 -9
- package/dist/agent-worker-context.d.ts.map +1 -1
- package/dist/agent-worker-context.js +34 -43
- package/dist/agent-worker-context.js.map +1 -1
- package/dist/agent-worker.d.ts +4 -4
- package/dist/agent-worker.d.ts.map +1 -1
- package/dist/agent-worker.js +899 -281
- package/dist/agent-worker.js.map +1 -1
- package/dist/artifacts.d.ts.map +1 -1
- package/dist/artifacts.js +1 -2
- package/dist/artifacts.js.map +1 -1
- package/dist/computer/just-bash.js +1 -1
- package/dist/computer/just-bash.js.map +1 -1
- package/dist/context-runtime.d.ts +27 -0
- package/dist/context-runtime.d.ts.map +1 -0
- package/dist/context-runtime.js +144 -0
- package/dist/context-runtime.js.map +1 -0
- package/dist/context.d.ts +11 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +33 -0
- package/dist/context.js.map +1 -0
- package/dist/experimental/agent-core-messages.d.ts +27 -0
- package/dist/experimental/agent-core-messages.d.ts.map +1 -0
- package/dist/experimental/agent-core-messages.js +291 -0
- package/dist/experimental/agent-core-messages.js.map +1 -0
- package/dist/experimental/agent-core-options.d.ts +4 -0
- package/dist/experimental/agent-core-options.d.ts.map +1 -0
- package/dist/experimental/agent-core-options.js +45 -0
- package/dist/experimental/agent-core-options.js.map +1 -0
- package/dist/experimental/agent-core-ui.d.ts +21 -0
- package/dist/experimental/agent-core-ui.d.ts.map +1 -0
- package/dist/experimental/agent-core-ui.js +311 -0
- package/dist/experimental/agent-core-ui.js.map +1 -0
- package/dist/experimental/agent-core-worker-tools.d.ts +25 -0
- package/dist/experimental/agent-core-worker-tools.d.ts.map +1 -0
- package/dist/experimental/agent-core-worker-tools.js +131 -0
- package/dist/experimental/agent-core-worker-tools.js.map +1 -0
- package/dist/experimental/agent-core.d.ts +53 -0
- package/dist/experimental/agent-core.d.ts.map +1 -0
- package/dist/experimental/agent-core.js +473 -0
- package/dist/experimental/agent-core.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/studio-client.d.ts +3 -0
- package/dist/studio-client.d.ts.map +1 -1
- package/dist/studio-client.js +7 -0
- package/dist/studio-client.js.map +1 -1
- package/dist/studio-stream-replay.d.ts +5 -0
- package/dist/studio-stream-replay.d.ts.map +1 -0
- package/dist/studio-stream-replay.js +63 -0
- package/dist/studio-stream-replay.js.map +1 -0
- package/dist/vendor/ai-ui/json-to-sse-transform-stream.d.ts +9 -0
- package/dist/vendor/ai-ui/json-to-sse-transform-stream.d.ts.map +1 -0
- package/dist/vendor/ai-ui/json-to-sse-transform-stream.js +20 -0
- package/dist/vendor/ai-ui/json-to-sse-transform-stream.js.map +1 -0
- package/dist/vendor/ai-ui/to-ui-message-chunk.d.ts +4 -0
- package/dist/vendor/ai-ui/to-ui-message-chunk.d.ts.map +1 -0
- package/dist/vendor/ai-ui/to-ui-message-chunk.js +301 -0
- package/dist/vendor/ai-ui/to-ui-message-chunk.js.map +1 -0
- package/dist/vendor/ai-ui/ui-message-stream-headers.d.ts +8 -0
- package/dist/vendor/ai-ui/ui-message-stream-headers.d.ts.map +1 -0
- package/dist/vendor/ai-ui/ui-message-stream-headers.js +10 -0
- package/dist/vendor/ai-ui/ui-message-stream-headers.js.map +1 -0
- package/package.json +14 -3
- package/third-party/agent-core/NOTICE +81 -0
- package/third-party/agent-core/ahash-0.8.12/LICENSE-APACHE +201 -0
- package/third-party/agent-core/ahash-0.8.12/LICENSE-MIT +25 -0
- package/third-party/agent-core/aho-corasick-1.1.5/COPYING +3 -0
- package/third-party/agent-core/aho-corasick-1.1.5/LICENSE-MIT +21 -0
- package/third-party/agent-core/allocator-api2-0.2.21/LICENSE-APACHE +176 -0
- package/third-party/agent-core/allocator-api2-0.2.21/LICENSE-MIT +23 -0
- package/third-party/agent-core/autocfg-1.5.1/LICENSE-APACHE +201 -0
- package/third-party/agent-core/autocfg-1.5.1/LICENSE-MIT +25 -0
- package/third-party/agent-core/bit-set-0.8.0/LICENSE-APACHE +201 -0
- package/third-party/agent-core/bit-set-0.8.0/LICENSE-MIT +25 -0
- package/third-party/agent-core/bit-vec-0.8.0/LICENSE-APACHE +201 -0
- package/third-party/agent-core/bit-vec-0.8.0/LICENSE-MIT +25 -0
- package/third-party/agent-core/borrow-or-share-0.2.4/LICENSE +18 -0
- package/third-party/agent-core/bumpalo-3.20.3/LICENSE-APACHE +201 -0
- package/third-party/agent-core/bumpalo-3.20.3/LICENSE-MIT +25 -0
- package/third-party/agent-core/bytecount-0.6.9/LICENSE.Apache2 +201 -0
- package/third-party/agent-core/bytecount-0.6.9/LICENSE.MIT +19 -0
- package/third-party/agent-core/cfg-if-1.0.4/LICENSE-APACHE +201 -0
- package/third-party/agent-core/cfg-if-1.0.4/LICENSE-MIT +25 -0
- package/third-party/agent-core/data-encoding-2.11.1/LICENSE +22 -0
- package/third-party/agent-core/email_address-0.2.9/LICENSE +21 -0
- package/third-party/agent-core/equivalent-1.0.2/LICENSE-APACHE +201 -0
- package/third-party/agent-core/equivalent-1.0.2/LICENSE-MIT +25 -0
- package/third-party/agent-core/fancy-regex-0.19.1/LICENSE +21 -0
- package/third-party/agent-core/fluent-uri-0.4.1/LICENSE +21 -0
- package/third-party/agent-core/foldhash-0.2.0/LICENSE +19 -0
- package/third-party/agent-core/fraction-0.17.0/LICENSE-APACHE +201 -0
- package/third-party/agent-core/fraction-0.17.0/LICENSE-MIT +25 -0
- package/third-party/agent-core/getrandom-0.3.4/LICENSE-APACHE +201 -0
- package/third-party/agent-core/getrandom-0.3.4/LICENSE-MIT +26 -0
- package/third-party/agent-core/hashbrown-0.17.1/LICENSE-APACHE +201 -0
- package/third-party/agent-core/hashbrown-0.17.1/LICENSE-MIT +25 -0
- package/third-party/agent-core/heck-0.5.0/LICENSE-APACHE +201 -0
- package/third-party/agent-core/heck-0.5.0/LICENSE-MIT +25 -0
- package/third-party/agent-core/httpdate-1.0.3/LICENSE-APACHE +201 -0
- package/third-party/agent-core/httpdate-1.0.3/LICENSE-MIT +19 -0
- package/third-party/agent-core/itoa-1.0.18/LICENSE-APACHE +176 -0
- package/third-party/agent-core/itoa-1.0.18/LICENSE-MIT +23 -0
- package/third-party/agent-core/jsonschema-0.55.1/LICENSE +21 -0
- package/third-party/agent-core/jsonschema-regex-0.55.1/LICENSE +21 -0
- package/third-party/agent-core/jsonschema-regex-0.55.1/PROVENANCE +2 -0
- package/third-party/agent-core/jsonschema-value-0.55.1/LICENSE +21 -0
- package/third-party/agent-core/jsonschema-value-0.55.1/PROVENANCE +2 -0
- package/third-party/agent-core/lock_api-0.4.14/LICENSE-APACHE +201 -0
- package/third-party/agent-core/lock_api-0.4.14/LICENSE-MIT +25 -0
- package/third-party/agent-core/memchr-2.8.3/COPYING +3 -0
- package/third-party/agent-core/memchr-2.8.3/LICENSE-MIT +21 -0
- package/third-party/agent-core/micromap-0.3.0/LICENSE.txt +19 -0
- package/third-party/agent-core/num-0.4.3/LICENSE-APACHE +201 -0
- package/third-party/agent-core/num-0.4.3/LICENSE-MIT +25 -0
- package/third-party/agent-core/num-bigint-0.4.8/LICENSE-APACHE +201 -0
- package/third-party/agent-core/num-bigint-0.4.8/LICENSE-MIT +25 -0
- package/third-party/agent-core/num-cmp-0.1.0/LICENSE.txt +390 -0
- package/third-party/agent-core/num-complex-0.4.6/LICENSE-APACHE +201 -0
- package/third-party/agent-core/num-complex-0.4.6/LICENSE-MIT +25 -0
- package/third-party/agent-core/num-integer-0.1.47/LICENSE-APACHE +201 -0
- package/third-party/agent-core/num-integer-0.1.47/LICENSE-MIT +25 -0
- package/third-party/agent-core/num-iter-0.1.46/LICENSE-APACHE +201 -0
- package/third-party/agent-core/num-iter-0.1.46/LICENSE-MIT +25 -0
- package/third-party/agent-core/num-rational-0.4.2/LICENSE-APACHE +201 -0
- package/third-party/agent-core/num-rational-0.4.2/LICENSE-MIT +25 -0
- package/third-party/agent-core/num-traits-0.2.19/LICENSE-APACHE +201 -0
- package/third-party/agent-core/num-traits-0.2.19/LICENSE-MIT +25 -0
- package/third-party/agent-core/once_cell-1.21.4/LICENSE-APACHE +201 -0
- package/third-party/agent-core/once_cell-1.21.4/LICENSE-MIT +23 -0
- package/third-party/agent-core/outref-0.5.2/LICENSE +21 -0
- package/third-party/agent-core/parking_lot-0.12.5/LICENSE-APACHE +201 -0
- package/third-party/agent-core/parking_lot-0.12.5/LICENSE-MIT +25 -0
- package/third-party/agent-core/parking_lot_core-0.9.12/LICENSE-APACHE +201 -0
- package/third-party/agent-core/parking_lot_core-0.9.12/LICENSE-MIT +25 -0
- package/third-party/agent-core/percent-encoding-2.3.2/LICENSE-APACHE +201 -0
- package/third-party/agent-core/percent-encoding-2.3.2/LICENSE-MIT +25 -0
- package/third-party/agent-core/proc-macro2-1.0.107/LICENSE-APACHE +176 -0
- package/third-party/agent-core/proc-macro2-1.0.107/LICENSE-MIT +23 -0
- package/third-party/agent-core/quote-1.0.47/LICENSE-APACHE +176 -0
- package/third-party/agent-core/quote-1.0.47/LICENSE-MIT +23 -0
- package/third-party/agent-core/ref-cast-1.0.27/LICENSE-APACHE +176 -0
- package/third-party/agent-core/ref-cast-1.0.27/LICENSE-MIT +23 -0
- package/third-party/agent-core/ref-cast-impl-1.0.27/LICENSE-APACHE +176 -0
- package/third-party/agent-core/ref-cast-impl-1.0.27/LICENSE-MIT +23 -0
- package/third-party/agent-core/referencing-0.55.1/LICENSE +21 -0
- package/third-party/agent-core/regex-1.13.1/LICENSE-APACHE +201 -0
- package/third-party/agent-core/regex-1.13.1/LICENSE-MIT +25 -0
- package/third-party/agent-core/regex-automata-0.4.18/LICENSE-APACHE +201 -0
- package/third-party/agent-core/regex-automata-0.4.18/LICENSE-MIT +25 -0
- package/third-party/agent-core/regex-syntax-0.8.11/LICENSE-APACHE +201 -0
- package/third-party/agent-core/regex-syntax-0.8.11/LICENSE-MIT +25 -0
- package/third-party/agent-core/rustversion-1.0.23/LICENSE-APACHE +176 -0
- package/third-party/agent-core/rustversion-1.0.23/LICENSE-MIT +23 -0
- package/third-party/agent-core/scopeguard-1.2.0/LICENSE-APACHE +201 -0
- package/third-party/agent-core/scopeguard-1.2.0/LICENSE-MIT +25 -0
- package/third-party/agent-core/serde-1.0.229/LICENSE-APACHE +176 -0
- package/third-party/agent-core/serde-1.0.229/LICENSE-MIT +23 -0
- package/third-party/agent-core/serde_core-1.0.229/LICENSE-APACHE +176 -0
- package/third-party/agent-core/serde_core-1.0.229/LICENSE-MIT +23 -0
- package/third-party/agent-core/serde_derive-1.0.229/LICENSE-APACHE +176 -0
- package/third-party/agent-core/serde_derive-1.0.229/LICENSE-MIT +23 -0
- package/third-party/agent-core/serde_json-1.0.151/LICENSE-APACHE +176 -0
- package/third-party/agent-core/serde_json-1.0.151/LICENSE-MIT +23 -0
- package/third-party/agent-core/smallvec-1.16.0/LICENSE-APACHE +201 -0
- package/third-party/agent-core/smallvec-1.16.0/LICENSE-MIT +25 -0
- package/third-party/agent-core/strum-0.28.0/LICENSE +21 -0
- package/third-party/agent-core/strum_macros-0.28.0/LICENSE +21 -0
- package/third-party/agent-core/syn-2.0.119/LICENSE-APACHE +176 -0
- package/third-party/agent-core/syn-2.0.119/LICENSE-MIT +23 -0
- package/third-party/agent-core/syn-3.0.5/LICENSE-APACHE +176 -0
- package/third-party/agent-core/syn-3.0.5/LICENSE-MIT +23 -0
- package/third-party/agent-core/unicode-general-category-1.1.0/LICENSE +201 -0
- package/third-party/agent-core/unicode-ident-1.0.24/LICENSE-APACHE +176 -0
- package/third-party/agent-core/unicode-ident-1.0.24/LICENSE-MIT +23 -0
- package/third-party/agent-core/unicode-ident-1.0.24/LICENSE-UNICODE +39 -0
- package/third-party/agent-core/uuid-simd-0.8.0/LICENSE +21 -0
- package/third-party/agent-core/uuid-simd-0.8.0/PROVENANCE +2 -0
- package/third-party/agent-core/version_check-0.9.5/LICENSE-APACHE +201 -0
- package/third-party/agent-core/version_check-0.9.5/LICENSE-MIT +19 -0
- package/third-party/agent-core/vsimd-0.8.0/LICENSE +21 -0
- package/third-party/agent-core/vsimd-0.8.0/PROVENANCE +2 -0
- package/third-party/agent-core/wasm-bindgen-0.2.128/LICENSE-APACHE +201 -0
- package/third-party/agent-core/wasm-bindgen-0.2.128/LICENSE-MIT +25 -0
- package/third-party/agent-core/wasm-bindgen-macro-0.2.128/LICENSE-APACHE +201 -0
- package/third-party/agent-core/wasm-bindgen-macro-0.2.128/LICENSE-MIT +25 -0
- package/third-party/agent-core/wasm-bindgen-macro-support-0.2.128/LICENSE-APACHE +201 -0
- package/third-party/agent-core/wasm-bindgen-macro-support-0.2.128/LICENSE-MIT +25 -0
- package/third-party/agent-core/wasm-bindgen-shared-0.2.128/LICENSE-APACHE +201 -0
- package/third-party/agent-core/wasm-bindgen-shared-0.2.128/LICENSE-MIT +25 -0
- package/third-party/agent-core/zerocopy-0.8.57/LICENSE-APACHE +202 -0
- package/third-party/agent-core/zerocopy-0.8.57/LICENSE-BSD +24 -0
- package/third-party/agent-core/zerocopy-0.8.57/LICENSE-MIT +26 -0
- package/third-party/agent-core/zmij-1.0.23/LICENSE-MIT +23 -0
- package/third-party/ai-ui/LICENSE-APACHE +201 -0
- package/third-party/ai-ui/NOTICE +15 -0
package/README.md
CHANGED
|
@@ -131,14 +131,52 @@ Generated code uses `createAgentApplicationFetch()`, which owns:
|
|
|
131
131
|
/gea/agents[/<agentKey>]/sessions/<sessionId>/v1/<operation>
|
|
132
132
|
```
|
|
133
133
|
|
|
134
|
+
Hosted Agent HTTP handlers require a Project API Key by default. This applies
|
|
135
|
+
to the Agent routes, while ordinary routes in `worker.ts` remain public.
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
// Inside defineAgent(...):
|
|
139
|
+
http: {
|
|
140
|
+
auth: false;
|
|
141
|
+
} // Explicit public access to this Agent's HTTP API.
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
An application can replace the default with its own Session authenticator:
|
|
145
|
+
|
|
146
|
+
```ts
|
|
147
|
+
http: {
|
|
148
|
+
auth: async (request, { environment }) => {
|
|
149
|
+
const session = await getSession(request, environment); // Your verified session.
|
|
150
|
+
return session
|
|
151
|
+
? { principalType: "user", principalId: session.userId }
|
|
152
|
+
: null;
|
|
153
|
+
},
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
The callback returns an external user, a `Response`, or `null` (401). It may
|
|
158
|
+
also return the result of `projectKeyAuth()` to explicitly compose key auth.
|
|
159
|
+
There is no implicit fallback after a custom authenticator rejects. Project
|
|
160
|
+
Keys stay on the backend; they never represent the creator's GEA user.
|
|
161
|
+
`authenticateProjectKey(request, environment.PROJECT)` also works in ordinary
|
|
162
|
+
Worker routes with a declared Project binding and a Project attachment.
|
|
163
|
+
|
|
164
|
+
Application pages and browser Sessions require the operator's isolated
|
|
165
|
+
`WORKER_APP_BASE_URL`. GEA-domain and path ingress preserve API access but strip
|
|
166
|
+
platform cookies and force CSP sandbox plus `nosniff`; Worker pages cannot run
|
|
167
|
+
scripts there. Application-domain pages retain their own CSP. Local `gea agent dev` uses its
|
|
168
|
+
existing trusted development identity. Raw AgentSession and Connector auth
|
|
169
|
+
operations remain private regardless of `http.auth`. Rebuild and republish old
|
|
170
|
+
Agent packages with the matching SDK/CLI to enable the new hosted handler.
|
|
171
|
+
|
|
134
172
|
The public run request is intentionally small:
|
|
135
173
|
|
|
136
174
|
```json
|
|
137
175
|
{ "chatId": "optional-continuation-id", "message": "Hello" }
|
|
138
176
|
```
|
|
139
177
|
|
|
140
|
-
If `chatId` is absent, the
|
|
141
|
-
response
|
|
178
|
+
If `chatId` is absent, the hosted managed API creates a Chat and Run and returns
|
|
179
|
+
their IDs in response headers. Local execution creates its local Session identity.
|
|
142
180
|
Callers cannot supply model-loop messages, instructions, provider options, or
|
|
143
181
|
platform-owned Run/message IDs. Each main Agent's exact `AGENTS.md` text is
|
|
144
182
|
compiled into the Worker and is never accepted from the run request.
|
|
@@ -151,6 +189,199 @@ Every main Agent declares one concrete public GEA model ID or the SDK-owned
|
|
|
151
189
|
active Model Gateway catalog; source and artifacts contain no provider
|
|
152
190
|
credential or target configuration.
|
|
153
191
|
|
|
192
|
+
## Context strategies
|
|
193
|
+
|
|
194
|
+
Agents use the existing tool-output offload and rolling summary by default.
|
|
195
|
+
Configure that recipe with `defaultContext`, replace it with a custom strategy,
|
|
196
|
+
or set `context: false` to disable automatic summaries, file writes and tool-result
|
|
197
|
+
replacement. Disabling compression preserves already committed summaries and
|
|
198
|
+
continues normal message persistence.
|
|
199
|
+
|
|
200
|
+
```ts
|
|
201
|
+
import { defineAgent } from "@gea-ai/agent-sdk";
|
|
202
|
+
import { defaultContext } from "@gea-ai/agent-sdk/context";
|
|
203
|
+
|
|
204
|
+
export default defineAgent({
|
|
205
|
+
name: "assistant",
|
|
206
|
+
slug: "assistant",
|
|
207
|
+
model: "gea-model-1",
|
|
208
|
+
context: defaultContext({
|
|
209
|
+
toolOutput: { offloadAtCharacters: 4_000, replaceAtCharacters: 8_000 },
|
|
210
|
+
preserveRecentGroups: 5,
|
|
211
|
+
summarization: {
|
|
212
|
+
triggerAtTotalTokens: 64_000,
|
|
213
|
+
// Optional: model, instructions, maxOutputTokens.
|
|
214
|
+
},
|
|
215
|
+
}),
|
|
216
|
+
});
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
`toolOutput: false` and `summarization: false` independently disable the two
|
|
220
|
+
parts of the default recipe. Thresholds use model-visible characters and the
|
|
221
|
+
last provider-reported `usage.totalTokens`; the SDK does not estimate tokens.
|
|
222
|
+
Recent groups keep tool calls and their results together. Without Computer
|
|
223
|
+
storage, the default recipe skips offload but can still summarize.
|
|
224
|
+
|
|
225
|
+
The optional Rust/WASM engine uses the same context strategies and host tools:
|
|
226
|
+
|
|
227
|
+
```ts
|
|
228
|
+
import { agentCore } from "@gea-ai/agent-sdk/agent-core";
|
|
229
|
+
|
|
230
|
+
export default defineAgent({
|
|
231
|
+
name: "assistant",
|
|
232
|
+
slug: "assistant",
|
|
233
|
+
model: "gea-model-1",
|
|
234
|
+
engine: agentCore({
|
|
235
|
+
maxToolConcurrency: 4,
|
|
236
|
+
maxSteps: 20,
|
|
237
|
+
maxRetries: 2,
|
|
238
|
+
timeout: {
|
|
239
|
+
totalMs: 120_000,
|
|
240
|
+
stepMs: 60_000,
|
|
241
|
+
chunkMs: 15_000,
|
|
242
|
+
toolMs: 30_000,
|
|
243
|
+
},
|
|
244
|
+
onError: ({ error }) => console.error(error.code, error.details),
|
|
245
|
+
guardrail: ({ call }) =>
|
|
246
|
+
call.name === "deleteAsset" ? "user-approval" : "not-applicable",
|
|
247
|
+
}),
|
|
248
|
+
});
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
`gea agent` bundles Core's WASM bytes with the Agent. The factory is an authoring
|
|
252
|
+
entry for that bundler; installed projects do not need Rust. The default engine
|
|
253
|
+
remains AI SDK. Core supports local TS tools, pre-execution guardrail and approval,
|
|
254
|
+
context strategies and the existing managed Session/Artifact lifecycle. An approval
|
|
255
|
+
pause skips custom `onEnd` until continuation completes. Guardrail is checked again
|
|
256
|
+
before dispatch and may deny or require approval; it cannot override a Tool denial.
|
|
257
|
+
Core initiates preparation, step-end and run-end callbacks into TS, and waits for
|
|
258
|
+
context settlement before returning its outcome. A failed final context commit
|
|
259
|
+
cannot report success; cancellation still waits for cleanup.
|
|
260
|
+
Declared Tools keep their typed `tool-<name>` UI parts and dynamic Tools keep
|
|
261
|
+
`dynamic-tool`, so existing Tool renderers and code Judges can use either engine.
|
|
262
|
+
Provider-hosted/custom and client-executed tools are outside the current Core subset.
|
|
263
|
+
The Worker Runtime must support WebAssembly JSPI. This optional engine supports
|
|
264
|
+
a subset of AI SDK model and output features.
|
|
265
|
+
Rust owns error classification, model request retries and timeout decisions. The
|
|
266
|
+
TS `onError` callback observes terminal failures once; recoverable Tool errors,
|
|
267
|
+
retry attempts and caller cancellation do not invoke it. `maxRetries` defaults to
|
|
268
|
+
2 and `timeout` also accepts a number for the total active execution budget.
|
|
269
|
+
Established streams and Tools are never replayed automatically. `maxSteps` stops
|
|
270
|
+
after a complete step. Cleanup remains awaited, so a timeout does not forcibly
|
|
271
|
+
terminate uncooperative host code or reverse an effect.
|
|
272
|
+
|
|
273
|
+
Dynamic step settings are supplied by TS callbacks and applied by Rust:
|
|
274
|
+
|
|
275
|
+
```ts
|
|
276
|
+
engine: agentCore({
|
|
277
|
+
models: ["gea-model-2"],
|
|
278
|
+
prepareStep: ({ stepNumber }) =>
|
|
279
|
+
stepNumber === 0
|
|
280
|
+
? { activeTools: ["lookup"], toolChoice: { type: "tool", toolName: "lookup" } }
|
|
281
|
+
: { model: "gea-model-2", activeTools: [], generation: { max_output_tokens: 2048 } },
|
|
282
|
+
stopWhen: ({ steps }) =>
|
|
283
|
+
steps.reduce((sum, step) => sum + (step.usage?.totalTokens ?? 0), 0) >= 10_000,
|
|
284
|
+
}),
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
Declare additional model IDs in `models` so the CLI can prepare their local routes.
|
|
288
|
+
`stepNumber` is zero-based. `prepareStep` receives current messages, available tools
|
|
289
|
+
and completed step summaries; it can also set `toolOrder`, `bodyOptions` or `stop`.
|
|
290
|
+
Model/tool/generation overrides apply only to that step. `generation` uses Core's
|
|
291
|
+
neutral snake_case keys; `bodyOptions` uses the selected protocol's raw option keys.
|
|
292
|
+
Omitted/undefined values leave provider defaults intact. `stopWhen` runs after a
|
|
293
|
+
completed tool step is committed; a final text response ends naturally. The
|
|
294
|
+
example's token threshold is checked between steps and may be exceeded by the
|
|
295
|
+
last completed call. Approval preserves selected tools/model and prior step
|
|
296
|
+
usage, then evaluates the predicate after continuation without another model call.
|
|
297
|
+
Both callbacks receive `signal`. Existing `context` strategies remain responsible
|
|
298
|
+
for replacing the durable message projection.
|
|
299
|
+
|
|
300
|
+
Final structured output accepts a convertible TS schema:
|
|
301
|
+
|
|
302
|
+
```ts
|
|
303
|
+
engine: agentCore({
|
|
304
|
+
output: z.object({ answer: z.number().int(), explanation: z.string() }),
|
|
305
|
+
}),
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
Zod 4 and libraries implementing Standard JSON Schema v1 are supported. TS converts
|
|
309
|
+
only the schema; Rust sends the protocol request, parses final JSON and validates
|
|
310
|
+
it. Consume the successful result from `message.metadata.output`. Intermediate
|
|
311
|
+
text is still a preview. Tool steps and approvals work normally, and output errors
|
|
312
|
+
retain model-call usage. TS-only refinements/transforms and lossy conversions are
|
|
313
|
+
unsupported; there is no partial-object stream or automatic repair.
|
|
314
|
+
|
|
315
|
+
This engine does not yet provide the complete AI SDK Agent/`streamText` contract.
|
|
316
|
+
The Worker engine uses built-in Rust HTTP/SSE protocols for the main model.
|
|
317
|
+
The host supplies raw fetch, credentials and scoped effects. Default compression
|
|
318
|
+
and custom context strategies remain TS hooks; `runtimeContext.model()` resolves
|
|
319
|
+
an ordinary AI SDK model lazily, and strategies can call `streamText` directly.
|
|
320
|
+
Their model features are independent of Core protocol coverage. The optional
|
|
321
|
+
Core-backed AI SDK model facade is an outward adapter. Hosted development requires
|
|
322
|
+
the matching raw proxy server for the main Core model.
|
|
323
|
+
|
|
324
|
+
A custom strategy is an object with optional `prepareStep`, `onStepEnd` and
|
|
325
|
+
`onEnd` callbacks, using the AI SDK 7 names. These callbacks replace the default
|
|
326
|
+
recipe. `prepareStep` receives durable `messages`, `contextSize`, `stepNumber`
|
|
327
|
+
and `runtimeContext`; returning `{ messages }` replaces the active projection
|
|
328
|
+
for subsequent steps and Runs. Returning nothing keeps it. `onStepEnd` also
|
|
329
|
+
receives that step's `usage` and `finishReason`; `onEnd` receives the main loop's
|
|
330
|
+
`totalUsage` and `finishReason`.
|
|
331
|
+
|
|
332
|
+
```ts
|
|
333
|
+
const context = {
|
|
334
|
+
async prepareStep({ messages, runtimeContext }) {
|
|
335
|
+
const memory = await loadCommittedMemory(runtimeContext);
|
|
336
|
+
return { messages: applyMemoryToCoveredPrefix(messages, memory) };
|
|
337
|
+
},
|
|
338
|
+
async onStepEnd({ messages, runtimeContext }) {
|
|
339
|
+
runtimeContext.waitUntil(precomputeMemory(messages, runtimeContext));
|
|
340
|
+
},
|
|
341
|
+
};
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
The functions in this short sketch are application-owned.
|
|
345
|
+
|
|
346
|
+
`runtimeContext` provides trusted `identity`, `auth`, declared `env`, execution
|
|
347
|
+
`environment`, typed `durableObjects`, `signal`, and the main public `modelId`.
|
|
348
|
+
Call `model(modelId?)` to resolve a model through the existing Host, then use AI
|
|
349
|
+
SDK `generateText` or `streamText` with that model and the cancellation signal.
|
|
350
|
+
Register each auxiliary call's `{ model, usage, label?, status? }` through
|
|
351
|
+
`recordUsage`. Status defaults to `completed`; use `failed` or `aborted` with
|
|
352
|
+
`usage: null` when the provider did not return usage. Register a successful call
|
|
353
|
+
before validating its text or committing memory, since those operations can fail
|
|
354
|
+
after the model has consumed tokens. The SDK assigns the call id and tracks its
|
|
355
|
+
Session write automatically.
|
|
356
|
+
`writeToolOutput` is a writer returning `{ artifactUri }`, or `null` if storage
|
|
357
|
+
is unavailable. Its input is `{ content, sha256, toolCallId, toolName }`.
|
|
358
|
+
|
|
359
|
+
`runtimeContext.updateMessages(messages)` persists a replacement from an awaited
|
|
360
|
+
foreground callback, including the final step or `onEnd`. Background work stores
|
|
361
|
+
candidate memory in a DO; a later foreground callback applies it. The Worker
|
|
362
|
+
waits for registered work before publishing its final success and usage, including
|
|
363
|
+
when Computer is disabled. `metadata.modelCalls` records each main-model step and
|
|
364
|
+
auxiliary call with a stable call id, Run id, model, source, optional label, status,
|
|
365
|
+
completion time and usage. `metadata.totalUsage` is their known usage sum;
|
|
366
|
+
`metadata.contextUsage` retains the auxiliary view. Hosted settlement prices each
|
|
367
|
+
call using its own catalog target and writes a separate idempotent usage event.
|
|
368
|
+
A completed model call stays completed even if the containing Run later fails.
|
|
369
|
+
Unhandled callback or background errors fail the Run; completed model messages
|
|
370
|
+
and registered usage survive that failure. Pass `signal` into external work so cancellation can finish promptly.
|
|
371
|
+
|
|
372
|
+
AgentSession owns the active projection and separate transcript. Custom
|
|
373
|
+
observations, reflection and coverage state belong in the application's chat DO.
|
|
374
|
+
Commit memory and coverage together before removing the covered message prefix.
|
|
375
|
+
Existing summary metadata is included when a custom callback reads messages, and
|
|
376
|
+
is no longer separately injected after that callback replaces the projection.
|
|
377
|
+
`stepNumber` is local to a Run, not a durable chat cursor.
|
|
378
|
+
|
|
379
|
+
Context callbacks execute in the Agent bundle; snapshots contain only serializable
|
|
380
|
+
descriptors and default recipe options. Ordinary imported modules are sufficient.
|
|
381
|
+
Upgrade the SDK and rebuild/publish existing Agents to use the API. `waitUntil`
|
|
382
|
+
covers the current invocation; it does not schedule future Runs or replay a model
|
|
383
|
+
call after a crash.
|
|
384
|
+
|
|
154
385
|
## CLI Workflow
|
|
155
386
|
|
|
156
387
|
Local validation, development, and packing need no hosted Agent record:
|
|
@@ -320,10 +551,8 @@ Custom Tools may omit `execute` to delegate execution to the calling application
|
|
|
320
551
|
These Tools are recorded as `execution: "client"` in the package snapshot and
|
|
321
552
|
pause with an `input-available` Tool part. The application returns the result
|
|
322
553
|
through AI SDK `addToolOutput`. Studio Tool approvals and client outputs use the
|
|
323
|
-
existing `/run` endpoint with the server's assistant message ID.
|
|
324
|
-
|
|
325
|
-
This source capability requires updated SDK, Web/ORPC and Agent deployments;
|
|
326
|
-
it has not been released or deployed.
|
|
554
|
+
existing `/run` endpoint with the server's assistant message ID.
|
|
555
|
+
This capability requires updated SDK, Web/ORPC and Agent deployments.
|
|
327
556
|
|
|
328
557
|
Package Tools may declare a static or input-dependent approval policy. A
|
|
329
558
|
`user-approval` decision pauses before execution and can be resumed from any
|
|
@@ -956,97 +1185,75 @@ computer: {
|
|
|
956
1185
|
|
|
957
1186
|
## Project Artifacts
|
|
958
1187
|
|
|
959
|
-
Declare `artifacts: {}` to enable
|
|
960
|
-
runtime principal
|
|
961
|
-
`artifacts: { tools: true }`
|
|
962
|
-
Computer with `file-transfer` also exposes `downloadFile`. `getArtifact` returns
|
|
963
|
-
a bounded text/JSON preview, shows images for the current user turn, and returns
|
|
964
|
-
metadata for other formats. These reads work without Computer. For example:
|
|
1188
|
+
Declare `artifacts: {}` to enable `ctx.artifacts` in custom Tools. The default scope
|
|
1189
|
+
is the runtime principal; Project and environment are always fixed by the host.
|
|
1190
|
+
Enable `artifacts: { tools: true }` for three standard model tools:
|
|
965
1191
|
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
1192
|
+
| Tool | Behavior |
|
|
1193
|
+
| ----------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
1194
|
+
| `listArtifacts({ query?, prefix?, cursor?, limit? })` | Case-insensitive filename substring search and scoped pagination. |
|
|
1195
|
+
| `getArtifact({ key })` | Metadata and a temporary download URL, bounded text/JSON preview, and current-turn image reads. |
|
|
1196
|
+
| `createUpload({ filename, contentType?, key? })` | A temporary HTTP upload target; optional key selects an output to replace. |
|
|
969
1197
|
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
input: z.object({ key: z.string(), markdown: z.string() }),
|
|
974
|
-
async execute({ key, markdown }, ctx) {
|
|
975
|
-
if (!ctx.artifacts) throw new Error("Enable Artifacts on this Agent.");
|
|
976
|
-
return await ctx.artifacts.put({
|
|
977
|
-
key,
|
|
978
|
-
content: markdown,
|
|
979
|
-
contentType: "text/markdown",
|
|
980
|
-
});
|
|
981
|
-
},
|
|
982
|
-
});
|
|
1198
|
+
A target includes `key`, `uploadUrl`, `method`, `headers`, `expiresAt`, and `maxBytes`.
|
|
1199
|
+
Use every returned header and upload original bytes with an ordinary HTTP client.
|
|
1200
|
+
For example, in a Computer with curl and network access:
|
|
983
1201
|
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
key: z.string(),
|
|
991
|
-
path: z.string(),
|
|
992
|
-
contentType: z.string(),
|
|
993
|
-
}),
|
|
994
|
-
async execute(input, ctx) {
|
|
995
|
-
if (!ctx.artifacts) throw new Error("Enable Artifacts on this Agent.");
|
|
996
|
-
return await ctx.artifacts.putFile(input);
|
|
997
|
-
},
|
|
998
|
-
});
|
|
1202
|
+
```bash
|
|
1203
|
+
curl --fail-with-body --silent --show-error -X PUT \
|
|
1204
|
+
-H 'Authorization: Bearer <returned authorization>' \
|
|
1205
|
+
-H 'Content-Type: application/pdf' \
|
|
1206
|
+
--upload-file /workspace/report.pdf '<uploadUrl>'
|
|
1207
|
+
```
|
|
999
1208
|
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1209
|
+
The server verifies and publishes in that request; HTTP success returns the
|
|
1210
|
+
Artifact. No completion tool is needed. To download, use the `downloadUrl` from
|
|
1211
|
+
`getArtifact`, or share that URL directly with the user. If optional text/image
|
|
1212
|
+
preview fails, `getArtifact` still returns metadata and the download URL together
|
|
1213
|
+
with `previewError`; lookup/authorization failures remain Tool errors. No Computer is allocated
|
|
1214
|
+
for Artifact metadata, image reads, or upload authorization. A network-disabled
|
|
1215
|
+
Computer cannot use these HTTP URLs; the tools do not bypass its network policy.
|
|
1216
|
+
|
|
1217
|
+
Custom Tools use `ctx.artifacts.createUpload`, `get`, `readText`, `list`, `delete`,
|
|
1218
|
+
and bounded text `put`. For example:
|
|
1219
|
+
|
|
1220
|
+
```ts
|
|
1221
|
+
const target = await ctx.artifacts.createUpload({
|
|
1222
|
+
filename: "report.pdf",
|
|
1223
|
+
contentType: "application/pdf",
|
|
1012
1224
|
});
|
|
1225
|
+
const files = await ctx.artifacts.list({ query: "report.pdf", limit: 20 });
|
|
1013
1226
|
```
|
|
1014
1227
|
|
|
1015
|
-
|
|
1228
|
+
`put({key, content, contentType?, title?, filename?, metadata?})` stores UTF-8 text
|
|
1229
|
+
up to 2 MiB. `readText(key)` accepts text/JSON up to 2 MiB. `getArtifact` limits its
|
|
1230
|
+
model text preview to 8,000 characters and keeps image bytes transient. The SDK's
|
|
1231
|
+
old Computer path-copy methods and dedicated transfer protocol have been removed.
|
|
1232
|
+
|
|
1233
|
+
A developer can share a scope with trusted code:
|
|
1016
1234
|
|
|
1017
1235
|
```ts
|
|
1018
1236
|
artifacts: {
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
? `customer:${metadata.customerId}`
|
|
1022
|
-
: null,
|
|
1237
|
+
tools: true,
|
|
1238
|
+
scope: ({ metadata }) => typeof metadata.customerId === "string" ? `customer:${metadata.customerId}` : null,
|
|
1023
1239
|
},
|
|
1024
1240
|
```
|
|
1025
1241
|
|
|
1026
|
-
Authorize
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
Relative file paths resolve inside the current `computer.roots.workspace`.
|
|
1042
|
-
`downloadFile({ key, path, overwrite: false })` restores an Artifact there and
|
|
1043
|
-
requires workspace write permission; `putFile` requires read permission. They
|
|
1044
|
-
operate on the same provider/session as shell and file Tools. Computer implementations copy files with bounded multipart uploads (Native for
|
|
1045
|
-
E2B, directly from first-party/developer services, or from Worker memory for just-bash),
|
|
1046
|
-
checksums and atomic download commit. just-bash crosses the native boundary in
|
|
1047
|
-
bounded chunks because its files live in Worker memory; other providers keep byte
|
|
1048
|
-
transfer outside the Worker. ORPC handles authorization and publication only. Finish writing the source before saving it. These are explicit copies;
|
|
1049
|
-
later edits do not synchronize automatically. Local dev persists in `.gea/artifacts`.
|
|
1242
|
+
Authorize customer membership in the application before using business metadata
|
|
1243
|
+
as a scope. Null/empty results fail closed. Matching scopes share across Agents
|
|
1244
|
+
and Chats. An omitted upload key is `files/<uuid>/<filename>`. Explicit repeated
|
|
1245
|
+
keys replace content while preserving Artifact ID and original creation provenance;
|
|
1246
|
+
last committed write wins. The reserved `uploads/` namespace is immutable message
|
|
1247
|
+
input and cannot be overwritten by Agent uploads. `createUpload` authority lasts
|
|
1248
|
+
one hour and can be reused for its same key until expiration. After an uncertain
|
|
1249
|
+
HTTP response, inspect the key; failure to receive a reply does not imply rollback.
|
|
1250
|
+
|
|
1251
|
+
Downloads use attachment disposition, including HTML/SVG. Temporary links are
|
|
1252
|
+
bearer access; get a fresh link from the persistent Artifact key when needed.
|
|
1253
|
+
Hosted uploads use bounded disk staging and streaming object-store writes, with a
|
|
1254
|
+
1 GiB default limit (configurable up to 10 GiB); local dev supports 1 GiB and stores
|
|
1255
|
+
files under `.gea/artifacts`. Ingress and client limits still apply. The saved copy
|
|
1256
|
+
is independent of later Computer edits.
|
|
1050
1257
|
|
|
1051
1258
|
For Agent authoring and local development, see the public
|
|
1052
1259
|
[Agent development guide](https://musegea.com/developers/agent-development).
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -25,3 +25,43 @@ from that Codex revision's `tests/fixtures/scenarios`, preserving patch and file
|
|
|
25
25
|
contents including line endings. The Worker integration tests compare actual
|
|
26
26
|
file contents and success/failure outcomes, including the upstream partial
|
|
27
27
|
success case. The fixtures share the Codex license and notice above.
|
|
28
|
+
|
|
29
|
+
## AI SDK UI stream helpers
|
|
30
|
+
|
|
31
|
+
The helpers under `src/vendor/ai-ui/` are copied from the published sources in
|
|
32
|
+
**ai@7.0.9** ([Vercel AI SDK](https://github.com/vercel/ai)), the version pinned
|
|
33
|
+
by this workspace. They are Apache-2.0 licensed; see
|
|
34
|
+
[LICENSE-APACHE](./third-party/ai-ui/LICENSE-APACHE) and
|
|
35
|
+
[NOTICE](./third-party/ai-ui/NOTICE).
|
|
36
|
+
|
|
37
|
+
Upstream paths are under `packages/ai/src/ui-message-stream/`. SHA-256 hashes
|
|
38
|
+
below identify the original npm source files before local adaptations:
|
|
39
|
+
|
|
40
|
+
| File | Upstream SHA-256 |
|
|
41
|
+
| --------------------------------- | ------------------------------------------------------------------ |
|
|
42
|
+
| `to-ui-message-chunk.ts` | `d7c2d6c85fca06cebb9eda0c1dad9c9667dd009dde8939cd46ab7b9f141b1a14` |
|
|
43
|
+
| `json-to-sse-transform-stream.ts` | `eff8b7832658d68fc2f45d3d60dceb684e1b21227f81eb179a6de17d7055a95c` |
|
|
44
|
+
| `ui-message-stream-headers.ts` | `716e62a47a325513af67a8677d973869486e9166a7c205e85ef9483628118814` |
|
|
45
|
+
|
|
46
|
+
Local adaptations: repository formatting, provenance headers, and public
|
|
47
|
+
type-only imports using the default `UIMessage` shape in the converter. The
|
|
48
|
+
conversion switch, SSE encoding and headers retain upstream behavior. The
|
|
49
|
+
vendored code imports no `ai` runtime; this keeps its Gateway/OIDC dependencies
|
|
50
|
+
out of the portable Worker fixture. Core-to-SDK event translation and execution
|
|
51
|
+
lifecycle remain in `src/experimental/agent-core-ui.ts`; the upstream Agent loop
|
|
52
|
+
is not copied. Only the Core's supported text/reasoning/JSON-tool subset is
|
|
53
|
+
exposed, even though the converter retains other upstream branches.
|
|
54
|
+
|
|
55
|
+
When upgrading, compare these three source files against the new pinned version,
|
|
56
|
+
refresh the hashes/notices and rerun the real AI SDK reader, Studio transport
|
|
57
|
+
and packaged Worker conformance fixtures before changing the pin.
|
|
58
|
+
|
|
59
|
+
## Agent Core WASM
|
|
60
|
+
|
|
61
|
+
The optional Agent Core asset is built from this repository's Apache-2.0 Rust
|
|
62
|
+
crate with Rust 1.94.1. Its Cargo dependencies are pinned in
|
|
63
|
+
`crates/agent-core/Cargo.lock`; exact-version license copies and a dependency
|
|
64
|
+
inventory ship in [third-party/agent-core](./third-party/agent-core/NOTICE).
|
|
65
|
+
This includes Serde/serde_json, httpdate, jsonschema and its validation/regex/hash
|
|
66
|
+
dependencies, plus build dependencies. The inventory records upstream repository
|
|
67
|
+
license provenance where a crate distribution omitted its license file. The Agent CLI embeds this asset into the immutable Worker bundle.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-computer-scope.d.ts","sourceRoot":"","sources":["../src/agent-computer-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC3B,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,KAAK,EACV,qBAAqB,EAErB,2BAA2B,EAC5B,MAAM,gB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B,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA6C9B;AAED,0FAA0F;AAC1F,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,2BAA2B,CAAC,UAAU,CAAC,EACjD,eAAe,EAAE,kBAAkB,GAClC,2BAA2B,CAAC,UAAU,CAAC,CA6EzC"}
|
|
@@ -58,11 +58,6 @@ export function bindAgentComputerScope(computer, filesystemScope) {
|
|
|
58
58
|
}),
|
|
59
59
|
}
|
|
60
60
|
: {}),
|
|
61
|
-
...(computer.transfer
|
|
62
|
-
? {
|
|
63
|
-
transfer: (id, input, options) => computer.transfer(id, input, { ...options, filesystemScope }),
|
|
64
|
-
}
|
|
65
|
-
: {}),
|
|
66
61
|
...(computer.create
|
|
67
62
|
? {
|
|
68
63
|
create: (id, options) => computer.create(id, { ...options, filesystemScope }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-computer-scope.js","sourceRoot":"","sources":["../src/agent-computer-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAGzB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,MAAM,gBAAgB,GAAG,CAAC;KACvB,MAAM,CAAC,EAAE,KAAK,EAAE,wBAAwB,CAAC,QAAQ,EAAE,EAAE,CAAC;KACtD,MAAM,EAAE,CAAC;AAEZ,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,KAQ/C;IACC,MAAM,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9E,MAAM,GAAG,GAAG,kDAAkD,CAAC;IAC/D,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,KAAK,CACjC,IAAI,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAC3C,CAAC;IACF,I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AE,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,eAAe,EAAE,CAAC;QAC9D,SAAS,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,eAAe,EAAE,CAAC;QACrE,GAAG,CAAC,QAAQ,CAAC,eAAe;YAC1B,CAAC,CAAC;gBACE,eAAe,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,CACtC,QAAQ,CAAC,eAAgB,CAAC,EAAE,EAAE,KAAK,EAAE;oBACnC,GAAG,OAAO;oBACV,eAAe;iBAChB,CAAC;aACL;YACH,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,QAAQ,CAAC,eAAe;YAC1B,CAAC,CAAC;gBACE,eAAe,EAAE,CAAC,EAAE,EAAE,WAAW,EAAE,EAAE,CACnC,QAAQ,CAAC,eAAgB,CAAC,EAAE,EAAE,WAAW,EAAE,EAAE,eAAe,EAAE,CAAC;aAClE;YACH,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,QAAQ,CAAC,eAAe;YAC1B,CAAC,CAAC;gBACE,eAAe,EAAE,CAAC,EAAE,EAAE,WAAW,EAAE,EAAE,CACnC,QAAQ,CAAC,eAAgB,CAAC,EAAE,EAAE,WAAW,EAAE,EAAE,eAAe,EAAE,CAAC;aAClE;YACH,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -13,7 +13,6 @@ export declare function createAgentComputerSession(input: {
|
|
|
13
13
|
}): Promise<{
|
|
14
14
|
computer: {
|
|
15
15
|
processRequest?(id: string, operation: import("@gea-ai/contract/computer-commands").ComputerProcessOperation, input: Record<string, unknown>, options?: AgentWorkerComputerOptions): Promise<unknown>;
|
|
16
|
-
transferRequest?(id: string, input: Record<string, unknown>, options?: AgentWorkerComputerOptions): Promise<Response>;
|
|
17
16
|
fileRequest?(id: string, operation: string, input: Record<string, unknown>, options?: AgentWorkerComputerOptions): Promise<Response>;
|
|
18
17
|
create?(id: string, options?: AgentWorkerComputerOptions): Promise<import("@gea-ai/contract/agent-computer").ComputerCreateResponse>;
|
|
19
18
|
finishInitialization?(id: string, input: {
|
|
@@ -21,9 +20,6 @@ export declare function createAgentComputerSession(input: {
|
|
|
21
20
|
success: boolean;
|
|
22
21
|
}, options?: AgentWorkerComputerOptions): Promise<unknown>;
|
|
23
22
|
stop?(id: string, options?: AgentWorkerComputerOptions): Promise<unknown>;
|
|
24
|
-
transfer?(id: string, input: {
|
|
25
|
-
transferId: string;
|
|
26
|
-
}, options?: AgentWorkerComputerOptions): Promise<unknown>;
|
|
27
23
|
createOperationId?(): string;
|
|
28
24
|
operationStatus?(id: string, operationId: string, options?: AgentWorkerComputerOptions): Promise<import("@gea-ai/contract/agent-worker-tools").ComputerOperationReceipt>;
|
|
29
25
|
cancelOperation?(id: string, operationId: string, options?: AgentWorkerComputerOptions): Promise<import("@gea-ai/contract/agent-worker-tools").ComputerOperationReceipt>;
|
|
@@ -42,7 +38,7 @@ export declare function createAgentComputerSession(input: {
|
|
|
42
38
|
skills: string;
|
|
43
39
|
tmp: string;
|
|
44
40
|
};
|
|
45
|
-
capabilities: readonly ("exec" | "
|
|
41
|
+
capabilities: readonly ("exec" | "files" | "gui" | "processes" | "readonly-mounts" | "shell")[];
|
|
46
42
|
stop: () => Promise<void>;
|
|
47
43
|
}>;
|
|
48
44
|
//# sourceMappingURL=agent-computer-session.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-computer-session.d.ts","sourceRoot":"","sources":["../src/agent-computer-session.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agent-computer-session.d.ts","sourceRoot":"","sources":["../src/agent-computer-session.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAChC,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACV,0BAA0B,EAC1B,2BAA2B,EAC3B,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AAExB,eAAO,MAAM,oBAAoB,EAAE,aAKlC,CAAC;AAYF,8FAA8F;AAC9F,wBAAsB,0BAA0B,CAAC,KAAK,EAAE;IACtD,QAAQ,EAAE,2BAA2B,CAAC,UAAU,CAAC,CAAC;IAClD,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,OAAO,EAAE,sBAAsB,CAAC;IAChC,SAAS,CAAC,EAAE,0BAA0B,CAAC;IACvC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACxC,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,MAAM,EAAE,WAAW,CAAC;CACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmPA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createComputerCommands } from "@gea-ai/contract/computer-commands";
|
|
2
|
-
import { executeComputerTransfer, computerTransferFiles, } from "@gea-ai/contract/computer-transfers";
|
|
3
2
|
import { createComputerFileTransport } from "@gea-ai/contract/computer-file-transport";
|
|
4
3
|
import { z } from "zod";
|
|
5
4
|
import { computerCreateResponseSchema, } from "@gea-ai/contract/agent-computer";
|
|
@@ -76,28 +75,6 @@ export async function createAgentComputerSession(input) {
|
|
|
76
75
|
await stop();
|
|
77
76
|
return { ok: true };
|
|
78
77
|
},
|
|
79
|
-
transfer: async (id, value, options) => {
|
|
80
|
-
if (!raw.transferRequest)
|
|
81
|
-
throw new Error("Worker file transfers require an updated Worker Runtime.");
|
|
82
|
-
const request = async (action, signal) => {
|
|
83
|
-
const response = await raw.transferRequest(id, { ...action, transferId: value.transferId }, { signal });
|
|
84
|
-
if (!response.ok)
|
|
85
|
-
throw new Error(`Computer transfer failed (${response.status}).`);
|
|
86
|
-
return response;
|
|
87
|
-
};
|
|
88
|
-
return executeComputerTransfer(computerTransferFiles(session), session.roots.workspace, value, options?.signal ?? input.signal, {
|
|
89
|
-
control: async (action, signal) => (await request(action, signal)).json(),
|
|
90
|
-
download: (signal) => request({ action: "read" }, signal),
|
|
91
|
-
upload: async ({ content, ...part }, signal) => {
|
|
92
|
-
let encoded = "";
|
|
93
|
-
for (let i = 0; i < content.length; i += 32768)
|
|
94
|
-
encoded += String.fromCharCode(...content.subarray(i, i + 32768));
|
|
95
|
-
return z
|
|
96
|
-
.object({ etag: z.string().min(1).max(512) })
|
|
97
|
-
.parse(await (await request({ action: "write", ...part, dataBase64: btoa(encoded) }, signal)).json());
|
|
98
|
-
},
|
|
99
|
-
});
|
|
100
|
-
},
|
|
101
78
|
};
|
|
102
79
|
return {
|
|
103
80
|
computer,
|
|
@@ -134,15 +111,6 @@ export async function createAgentComputerSession(input) {
|
|
|
134
111
|
fileRequest: (id, operation, input, opts) => raw.fileRequest(id, operation, input, options(opts)),
|
|
135
112
|
}
|
|
136
113
|
: {}),
|
|
137
|
-
...(raw.transfer
|
|
138
|
-
? {
|
|
139
|
-
transfer: (id, value, opts) => {
|
|
140
|
-
if (!opened.capabilities.includes("file-transfer"))
|
|
141
|
-
throw new Error("Computer session does not support file transfer.");
|
|
142
|
-
return raw.transfer(id, value, options(opts));
|
|
143
|
-
},
|
|
144
|
-
}
|
|
145
|
-
: {}),
|
|
146
114
|
...(opened.capabilities.includes("processes") && raw.processRequest
|
|
147
115
|
? {
|
|
148
116
|
processRequest: (id, operation, value, opts) => raw.processRequest(id, operation, value, options(opts)),
|