@beeos-ai/device-agent 0.4.2 → 0.5.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/.pi/extensions/android-tools.ts +146 -15
- package/LICENSE +201 -0
- package/dist/adapters/agent-gateway-client.d.ts +37 -0
- package/dist/adapters/agent-gateway-client.js +45 -0
- package/dist/adapters/agent-gateway-client.js.map +1 -1
- package/dist/adapters/agentcore-pi.d.ts +22 -0
- package/dist/adapters/agentcore-pi.js +48 -0
- package/dist/adapters/agentcore-pi.js.map +1 -1
- package/dist/adapters/device-android-adb.d.ts +47 -0
- package/dist/adapters/device-android-adb.js +50 -0
- package/dist/adapters/device-android-adb.js.map +1 -1
- package/dist/adapters/device-desktop.d.ts +12 -0
- package/dist/adapters/device-desktop.js +31 -0
- package/dist/adapters/device-desktop.js.map +1 -1
- package/dist/agent-runtime/adapters/base.d.ts +20 -0
- package/dist/agent-runtime/adapters/base.js.map +1 -1
- package/dist/agent-runtime/agent-runner.d.ts +4 -2
- package/dist/agent-runtime/agent-runner.js.map +1 -1
- package/dist/agent-runtime/core.d.ts +60 -0
- package/dist/agent-runtime/core.js +190 -9
- package/dist/agent-runtime/core.js.map +1 -1
- package/dist/agent-runtime/feedback.d.ts +56 -0
- package/dist/agent-runtime/feedback.js +54 -0
- package/dist/agent-runtime/feedback.js.map +1 -0
- package/dist/agent-runtime/index.d.ts +1 -0
- package/dist/agent-runtime/index.js +1 -0
- package/dist/agent-runtime/index.js.map +1 -1
- package/dist/agent-runtime/plan-executor.js +24 -0
- package/dist/agent-runtime/plan-executor.js.map +1 -1
- package/dist/agent-runtime/planner/base.d.ts +10 -0
- package/dist/agent-runtime/planner/base.js.map +1 -1
- package/dist/agent-runtime/planner/llm-planner.js +1 -0
- package/dist/agent-runtime/planner/llm-planner.js.map +1 -1
- package/dist/agent-runtime/planner/prompts.d.ts +3 -0
- package/dist/agent-runtime/planner/prompts.js +12 -0
- package/dist/agent-runtime/planner/prompts.js.map +1 -1
- package/dist/agent-runtime/reflection.d.ts +25 -6
- package/dist/agent-runtime/reflection.js +64 -22
- package/dist/agent-runtime/reflection.js.map +1 -1
- package/dist/agent-runtime/reflectors/policy.d.ts +10 -4
- package/dist/agent-runtime/reflectors/policy.js +19 -6
- package/dist/agent-runtime/reflectors/policy.js.map +1 -1
- package/dist/agent-runtime/shortcuts/fs-store.d.ts +41 -0
- package/dist/agent-runtime/shortcuts/fs-store.js +122 -0
- package/dist/agent-runtime/shortcuts/fs-store.js.map +1 -0
- package/dist/agent-runtime/shortcuts/in-memory-store.d.ts +20 -0
- package/dist/agent-runtime/shortcuts/in-memory-store.js +64 -0
- package/dist/agent-runtime/shortcuts/in-memory-store.js.map +1 -0
- package/dist/agent-runtime/shortcuts/index.d.ts +10 -0
- package/dist/agent-runtime/shortcuts/index.js +10 -0
- package/dist/agent-runtime/shortcuts/index.js.map +1 -0
- package/dist/agent-runtime/shortcuts/types.d.ts +69 -0
- package/dist/agent-runtime/shortcuts/types.js +17 -0
- package/dist/agent-runtime/shortcuts/types.js.map +1 -0
- package/dist/app/agent-host.d.ts +83 -0
- package/dist/app/agent-host.js +345 -32
- package/dist/app/agent-host.js.map +1 -1
- package/dist/app/session-manager.d.ts +33 -4
- package/dist/app/session-manager.js +27 -5
- package/dist/app/session-manager.js.map +1 -1
- package/dist/bootstrap.js +187 -3
- package/dist/bootstrap.js.map +1 -1
- package/dist/config/loader.js +22 -0
- package/dist/config/loader.js.map +1 -1
- package/dist/config/schema.d.ts +18 -0
- package/dist/config/schema.js +118 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/inbound/acp/handlers/session.js.map +1 -1
- package/dist/mcp-client/client.d.ts +6 -0
- package/dist/mcp-client/client.js +11 -0
- package/dist/mcp-client/client.js.map +1 -1
- package/dist/mcp-client/runtime.d.ts +13 -0
- package/dist/orchestrator-system-prompt.d.ts +26 -0
- package/dist/orchestrator-system-prompt.js +118 -2
- package/dist/orchestrator-system-prompt.js.map +1 -1
- package/dist/pi-context.d.ts +50 -0
- package/dist/pi-context.js.map +1 -1
- package/dist/ports/device.d.ts +18 -0
- package/dist/resources/augmenter.d.ts +48 -0
- package/dist/resources/augmenter.js +126 -0
- package/dist/resources/augmenter.js.map +1 -0
- package/dist/resources/cache.d.ts +57 -0
- package/dist/resources/cache.js +107 -0
- package/dist/resources/cache.js.map +1 -0
- package/dist/resources/index.d.ts +17 -0
- package/dist/resources/index.js +15 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/resources/lifecycle/disk-pressure.d.ts +75 -0
- package/dist/resources/lifecycle/disk-pressure.js +148 -0
- package/dist/resources/lifecycle/disk-pressure.js.map +1 -0
- package/dist/resources/lifecycle/index.d.ts +7 -0
- package/dist/resources/lifecycle/index.js +7 -0
- package/dist/resources/lifecycle/index.js.map +1 -0
- package/dist/resources/lifecycle/manager.d.ts +38 -0
- package/dist/resources/lifecycle/manager.js +205 -0
- package/dist/resources/lifecycle/manager.js.map +1 -0
- package/dist/resources/lifecycle/sweeper.d.ts +36 -0
- package/dist/resources/lifecycle/sweeper.js +179 -0
- package/dist/resources/lifecycle/sweeper.js.map +1 -0
- package/dist/resources/lifecycle/types.d.ts +180 -0
- package/dist/resources/lifecycle/types.js +46 -0
- package/dist/resources/lifecycle/types.js.map +1 -0
- package/dist/resources/parsers.d.ts +28 -0
- package/dist/resources/parsers.js +88 -0
- package/dist/resources/parsers.js.map +1 -0
- package/dist/resources/registry.d.ts +47 -0
- package/dist/resources/registry.js +107 -0
- package/dist/resources/registry.js.map +1 -0
- package/dist/resources/resolvers/beeos-file-resolver.d.ts +62 -0
- package/dist/resources/resolvers/beeos-file-resolver.js +109 -0
- package/dist/resources/resolvers/beeos-file-resolver.js.map +1 -0
- package/dist/resources/resolvers/errors.d.ts +11 -0
- package/dist/resources/resolvers/errors.js +23 -0
- package/dist/resources/resolvers/errors.js.map +1 -0
- package/dist/resources/resolvers/mime-table.d.ts +41 -0
- package/dist/resources/resolvers/mime-table.js +92 -0
- package/dist/resources/resolvers/mime-table.js.map +1 -0
- package/dist/resources/resolvers/url-resolver.d.ts +85 -0
- package/dist/resources/resolvers/url-resolver.js +495 -0
- package/dist/resources/resolvers/url-resolver.js.map +1 -0
- package/dist/resources/shortcut-facade.d.ts +51 -0
- package/dist/resources/shortcut-facade.js +72 -0
- package/dist/resources/shortcut-facade.js.map +1 -0
- package/dist/resources/telemetry.d.ts +52 -0
- package/dist/resources/telemetry.js +59 -0
- package/dist/resources/telemetry.js.map +1 -0
- package/dist/resources/types.d.ts +249 -0
- package/dist/resources/types.js +29 -0
- package/dist/resources/types.js.map +1 -0
- package/dist/shortcuts/builtins/download-to-device.d.ts +83 -0
- package/dist/shortcuts/builtins/download-to-device.js +125 -0
- package/dist/shortcuts/builtins/download-to-device.js.map +1 -0
- package/dist/shortcuts/builtins/find-app-package.d.ts +79 -0
- package/dist/shortcuts/builtins/find-app-package.js +168 -0
- package/dist/shortcuts/builtins/find-app-package.js.map +1 -0
- package/dist/shortcuts/builtins/index.d.ts +32 -0
- package/dist/shortcuts/builtins/index.js +37 -0
- package/dist/shortcuts/builtins/index.js.map +1 -0
- package/dist/shortcuts/builtins/open-deeplink.d.ts +68 -0
- package/dist/shortcuts/builtins/open-deeplink.js +142 -0
- package/dist/shortcuts/builtins/open-deeplink.js.map +1 -0
- package/dist/shortcuts/builtins/set-clipboard.d.ts +65 -0
- package/dist/shortcuts/builtins/set-clipboard.js +112 -0
- package/dist/shortcuts/builtins/set-clipboard.js.map +1 -0
- package/dist/shortcuts/index.d.ts +11 -0
- package/dist/shortcuts/index.js +11 -0
- package/dist/shortcuts/index.js.map +1 -0
- package/dist/shortcuts/registry.d.ts +56 -0
- package/dist/shortcuts/registry.js +70 -0
- package/dist/shortcuts/registry.js.map +1 -0
- package/dist/shortcuts/router.d.ts +91 -0
- package/dist/shortcuts/router.js +158 -0
- package/dist/shortcuts/router.js.map +1 -0
- package/dist/shortcuts/types.d.ts +219 -0
- package/dist/shortcuts/types.js +46 -0
- package/dist/shortcuts/types.js.map +1 -0
- package/package.json +24 -25
- package/dist/agent-runtime/skills/sqlite-store.d.ts +0 -60
- package/dist/agent-runtime/skills/sqlite-store.js +0 -234
- package/dist/agent-runtime/skills/sqlite-store.js.map +0 -1
- package/dist/test-lan-autoglm.d.ts +0 -7
- package/dist/test-lan-autoglm.js +0 -46
- package/dist/test-lan-autoglm.js.map +0 -1
- package/dist/test-mem-breakdown.d.ts +0 -1
- package/dist/test-mem-breakdown.js +0 -103
- package/dist/test-mem-breakdown.js.map +0 -1
- package/dist/test-mem.d.ts +0 -1
- package/dist/test-mem.js +0 -60
- package/dist/test-mem.js.map +0 -1
- package/dist/test-mobile-use.d.ts +0 -1
- package/dist/test-mobile-use.js +0 -18
- package/dist/test-mobile-use.js.map +0 -1
- package/dist/test-screenshot-loop.d.ts +0 -1
- package/dist/test-screenshot-loop.js +0 -43
- package/dist/test-screenshot-loop.js.map +0 -1
- package/dist/test-screenshot.d.ts +0 -1
- package/dist/test-screenshot.js +0 -10
- package/dist/test-screenshot.js.map +0 -1
- package/dist/test-ui-xml-dump.d.ts +0 -15
- package/dist/test-ui-xml-dump.js +0 -49
- package/dist/test-ui-xml-dump.js.map +0 -1
|
@@ -1,16 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Pi extension: registers
|
|
2
|
+
* Pi extension: registers tools for the **outer** orchestrator.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* - `ground` — **Atomic**: NL → pixel coords; the outer agent must decide *when* to call it.
|
|
6
|
-
* - `ui_xml` — **Atomic**: dump/search UI hierarchy; the outer agent composes it with bash / ground / mobile_use.
|
|
4
|
+
* Two layers of tools coexist:
|
|
7
5
|
*
|
|
8
|
-
*
|
|
6
|
+
* - **Legacy GUI primitives** — `mobile_use`, `ground`, `ui_xml`.
|
|
7
|
+
* These wrap the inner VLM loop and visual grounder; they are
|
|
8
|
+
* always present and don't depend on the shortcut runtime.
|
|
9
|
+
*
|
|
10
|
+
* - **Hybrid Action Space (Phase 2)** — one outer-LLM tool per
|
|
11
|
+
* shortcut registered with `ShortcutKB`. Each shortcut's
|
|
12
|
+
* descriptor (id, displayName, description, jsonSchema) is
|
|
13
|
+
* mapped to a pi `registerTool({...})` call here. The LLM never
|
|
14
|
+
* sees raw `runShell` / `pushFile` — those are explicitly hidden
|
|
15
|
+
* behind the `Shortcut.execute` boundary (see D9 in the plan and
|
|
16
|
+
* the comment block in `pi-context.ts`).
|
|
17
|
+
*
|
|
18
|
+
* Why register dynamically instead of hard-coding 4 tools?
|
|
19
|
+
*
|
|
20
|
+
* The shortcut KB is the source of truth — the bootstrap layer
|
|
21
|
+
* decides which shortcuts to register, and the extension picks up
|
|
22
|
+
* whatever is there at session-start. New shortcuts (or future
|
|
23
|
+
* plugin packages) auto-light up without an extension code change.
|
|
24
|
+
* The trade-off is that the descriptor *cannot* depend on context
|
|
25
|
+
* that varies per call — but JSON Schema + display name + free-form
|
|
26
|
+
* description is exactly that, so we don't lose anything.
|
|
9
27
|
*
|
|
10
28
|
* Extension lifecycle (since the dual-layer + MCP refactor):
|
|
11
29
|
*
|
|
12
30
|
* PiOrchestratorAgent.ensureSession()
|
|
13
|
-
* └─ setPiExtensionContext({ getMcpClient, getGrounder, runMobileUse,
|
|
31
|
+
* └─ setPiExtensionContext({ getMcpClient, getGrounder, runMobileUse,
|
|
32
|
+
* getUiXml, getShortcutKB, runShell, pushFile })
|
|
14
33
|
* └─ pi.loader.reload() → loads this file → pi.registerTool(...)
|
|
15
34
|
* └─ pi.session.prompt(...) → tools execute → context.* invoked
|
|
16
35
|
*
|
|
@@ -18,20 +37,15 @@
|
|
|
18
37
|
* └─ setPiExtensionContext(null)
|
|
19
38
|
*
|
|
20
39
|
* The extension is the ONLY pi-coupling point. Bootstrap supplies the
|
|
21
|
-
* concrete dependencies
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* runtime) — this file stays free of process.env reads, ad-hoc
|
|
25
|
-
* `new AndroidDevice()` / `new HTTPGrounder()` calls, and direct MCP
|
|
26
|
-
* HTTP knowledge.
|
|
27
|
-
*
|
|
28
|
-
* Authoring custom extensions follows the same pattern: import
|
|
29
|
-
* `getPiExtensionContext()` and trust the bootstrap to populate it.
|
|
40
|
+
* concrete dependencies — this file stays free of process.env reads,
|
|
41
|
+
* ad-hoc `new AndroidDevice()` / `new HTTPGrounder()` calls, and direct
|
|
42
|
+
* MCP HTTP knowledge.
|
|
30
43
|
*/
|
|
31
44
|
|
|
32
45
|
import type { ExtensionAPI, ExtensionContext } from "@mariozechner/pi-coding-agent";
|
|
33
46
|
import { Type } from "@sinclair/typebox";
|
|
34
47
|
import { getPiExtensionContext } from "../../src/pi-context.js";
|
|
48
|
+
import type { Shortcut, ShortcutResult } from "../../src/shortcuts/index.js";
|
|
35
49
|
|
|
36
50
|
export default function (pi: ExtensionAPI) {
|
|
37
51
|
// ── mobile_use ─────────────────────────────────────────────────────────────
|
|
@@ -131,9 +145,126 @@ export default function (pi: ExtensionAPI) {
|
|
|
131
145
|
},
|
|
132
146
|
});
|
|
133
147
|
|
|
148
|
+
// ── Hybrid Action Space (Phase 2): one tool per shortcut ─────────────────
|
|
149
|
+
// The shortcut KB may not be wired (legacy bootstrap, tests). When it
|
|
150
|
+
// isn't, we silently skip — the legacy primitives above remain
|
|
151
|
+
// functional, the orchestrator just doesn't see any shortcut tools.
|
|
152
|
+
// Failing loud here would block every legacy path that doesn't need
|
|
153
|
+
// the hybrid layer.
|
|
154
|
+
let shortcuts: Shortcut<unknown, unknown>[] = [];
|
|
155
|
+
try {
|
|
156
|
+
const ctx = getPiExtensionContext();
|
|
157
|
+
shortcuts = ctx.getShortcutKB().registry.list();
|
|
158
|
+
} catch {
|
|
159
|
+
shortcuts = [];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
for (const shortcut of shortcuts) {
|
|
163
|
+
registerShortcutAsTool(pi, shortcut);
|
|
164
|
+
}
|
|
165
|
+
|
|
134
166
|
// ── mobile_use_brain_actor ─ (commented out, not exposed to orchestrator)
|
|
135
167
|
// pi.registerTool({ name: "mobile_use_brain_actor", ... execute: mobileUseBrainActor })
|
|
136
168
|
|
|
137
169
|
// ── mobile_use_grounding ─ (commented out, not exposed to orchestrator)
|
|
138
170
|
// pi.registerTool({ name: "mobile_use_grounding", ... execute: mobileUseGrounding })
|
|
139
171
|
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Map a `Shortcut` descriptor onto a pi `registerTool({...})` call.
|
|
175
|
+
*
|
|
176
|
+
* Each tool's `execute(...)` body forwards into the shortcut runtime
|
|
177
|
+
* (`ctx.getShortcutKB().invoke(...)`), translating the structured
|
|
178
|
+
* `ShortcutResult` into the LLM-visible content array. Failures are
|
|
179
|
+
* **not** thrown — instead we return `{ content: [{type:"text", text}],
|
|
180
|
+
* details: { error_code } }` so the LLM sees a structured failure code
|
|
181
|
+
* (for example `"app_not_found"`) and can fall back to `mobile_use`
|
|
182
|
+
* without a stack trace.
|
|
183
|
+
*/
|
|
184
|
+
function registerShortcutAsTool(
|
|
185
|
+
pi: ExtensionAPI,
|
|
186
|
+
shortcut: Shortcut<unknown, unknown>,
|
|
187
|
+
): void {
|
|
188
|
+
const d = shortcut.descriptor;
|
|
189
|
+
pi.registerTool({
|
|
190
|
+
name: d.id,
|
|
191
|
+
label: d.displayName,
|
|
192
|
+
description: d.description,
|
|
193
|
+
promptSnippet: `${d.id}: ${d.displayName.toLowerCase()} (${d.kind})`,
|
|
194
|
+
// pi-coding-agent accepts JSON-Schema-shaped objects directly —
|
|
195
|
+
// TypeBox's `Type.Object` returns one anyway. Forwarding the raw
|
|
196
|
+
// schema lets shortcut authors describe parameters without
|
|
197
|
+
// requiring a TypeBox dependency.
|
|
198
|
+
parameters: d.jsonSchema as never,
|
|
199
|
+
async execute(_id, params, signal, onUpdate, _ctx: ExtensionContext) {
|
|
200
|
+
onUpdate?.({
|
|
201
|
+
content: [{ type: "text", text: `[${d.id}] invoke\n` }],
|
|
202
|
+
details: null,
|
|
203
|
+
});
|
|
204
|
+
const ctx = getPiExtensionContext();
|
|
205
|
+
const invoker = ctx.getShortcutKB();
|
|
206
|
+
const log = (await import("../../src/logger/index.js")).getLogger();
|
|
207
|
+
// Pull the shared resource facade so shortcuts that need
|
|
208
|
+
// `ctx.resources.resolveUrl` (e.g. `download_to_device`) see
|
|
209
|
+
// the same registry+cache as the AgentHost auto-trigger. The
|
|
210
|
+
// accessor is optional; tests / standalone bootstraps that
|
|
211
|
+
// don't wire a facade get `undefined` and the shortcut surfaces
|
|
212
|
+
// `permission_denied` to the LLM (intentional fail-soft).
|
|
213
|
+
const resources = ctx.getShortcutResources?.();
|
|
214
|
+
const callerCtx = {
|
|
215
|
+
abortSignal: signal ?? new AbortController().signal,
|
|
216
|
+
log,
|
|
217
|
+
...(resources ? { resources } : {}),
|
|
218
|
+
};
|
|
219
|
+
const res: ShortcutResult<unknown> = await invoker.invoke(d.id, params, callerCtx);
|
|
220
|
+
return formatShortcutResult(d.id, res);
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Translate a `ShortcutResult` into a pi tool result. We return a
|
|
227
|
+
* **single text block** containing JSON the LLM can parse, plus a
|
|
228
|
+
* `details` blob for the orchestrator-side hooks. Errors NEVER throw —
|
|
229
|
+
* the LLM should be able to inspect the failure and choose a fallback
|
|
230
|
+
* path (typically `mobile_use`). Throwing would skip pi's tool-error
|
|
231
|
+
* recovery and bubble up as an unhandled exception in the chat.
|
|
232
|
+
*/
|
|
233
|
+
function formatShortcutResult(
|
|
234
|
+
id: string,
|
|
235
|
+
res: ShortcutResult<unknown>,
|
|
236
|
+
): { content: Array<{ type: "text"; text: string }>; details: unknown } {
|
|
237
|
+
if (res.ok) {
|
|
238
|
+
return {
|
|
239
|
+
content: [
|
|
240
|
+
{
|
|
241
|
+
type: "text",
|
|
242
|
+
text: JSON.stringify({ ok: true, output: res.output }, null, 2),
|
|
243
|
+
},
|
|
244
|
+
],
|
|
245
|
+
details: { shortcut_id: id, ok: true, durationMs: res.durationMs ?? null },
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
return {
|
|
249
|
+
content: [
|
|
250
|
+
{
|
|
251
|
+
type: "text",
|
|
252
|
+
text: JSON.stringify(
|
|
253
|
+
{
|
|
254
|
+
ok: false,
|
|
255
|
+
code: res.code,
|
|
256
|
+
message: res.message,
|
|
257
|
+
},
|
|
258
|
+
null,
|
|
259
|
+
2,
|
|
260
|
+
),
|
|
261
|
+
},
|
|
262
|
+
],
|
|
263
|
+
details: {
|
|
264
|
+
shortcut_id: id,
|
|
265
|
+
ok: false,
|
|
266
|
+
code: res.code,
|
|
267
|
+
durationMs: res.durationMs ?? null,
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 BeeOS AI
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
200
|
+
implied. See the License for the specific language governing permissions
|
|
201
|
+
and limitations under the License.
|
|
@@ -242,6 +242,43 @@ export declare function putPresignedBytes(opts: {
|
|
|
242
242
|
timeoutMs?: number;
|
|
243
243
|
fetchImpl?: typeof fetch;
|
|
244
244
|
}): Promise<void>;
|
|
245
|
+
/**
|
|
246
|
+
* Result of `GET /api/v1/agent/files/{fileId}/resolve`. Mirrors the
|
|
247
|
+
* Go DTO at `backend/services/agent-gateway/internal/dto/response.go`
|
|
248
|
+
* (`FileMetaResponse`).
|
|
249
|
+
*/
|
|
250
|
+
export interface ResolvedAgentFile {
|
|
251
|
+
fileId: string;
|
|
252
|
+
fileName: string;
|
|
253
|
+
mimeType: string;
|
|
254
|
+
size: number;
|
|
255
|
+
downloadUrl: string;
|
|
256
|
+
}
|
|
257
|
+
export interface ResolveAgentFileOptions {
|
|
258
|
+
agentGatewayUrl: string;
|
|
259
|
+
identity: AgentGatewayIdentity;
|
|
260
|
+
fileId: string;
|
|
261
|
+
timeoutMs?: number;
|
|
262
|
+
fetchImpl?: typeof fetch;
|
|
263
|
+
now?: () => number;
|
|
264
|
+
randomUUID?: () => string;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Look up file metadata + a fresh short-lived presigned download URL
|
|
268
|
+
* for an upload that already lives in the platform's file storage
|
|
269
|
+
* (S3 / MinIO). Used by the `BeeosFileResolver` to convert a
|
|
270
|
+
* `beeos-file://<fileId>` ref into a fetchable URL before delegating
|
|
271
|
+
* the actual download to the same pipeline used by `UrlResolver`.
|
|
272
|
+
*
|
|
273
|
+
* The Agent Gateway resolves the calling agent's `instanceId`/`ownerId`
|
|
274
|
+
* from the Ed25519 signature and forwards both to Runtime FileService;
|
|
275
|
+
* the device-agent never needs to know either.
|
|
276
|
+
*
|
|
277
|
+
* Throws `AgentGatewayError` on non-2xx (including 404 if the fileId
|
|
278
|
+
* doesn't belong to the calling agent's owner). Throws if the response
|
|
279
|
+
* is missing the required `downloadUrl` field.
|
|
280
|
+
*/
|
|
281
|
+
export declare function resolveAgentFile(opts: ResolveAgentFileOptions): Promise<ResolvedAgentFile>;
|
|
245
282
|
/**
|
|
246
283
|
* Build the four `X-Agent-*` Ed25519 auth headers for an HTTP request.
|
|
247
284
|
* Exposed for unit tests and adapters that talk to other AGW endpoints.
|
|
@@ -259,6 +259,51 @@ export async function putPresignedBytes(opts) {
|
|
|
259
259
|
clearTimeout(timer);
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* Look up file metadata + a fresh short-lived presigned download URL
|
|
264
|
+
* for an upload that already lives in the platform's file storage
|
|
265
|
+
* (S3 / MinIO). Used by the `BeeosFileResolver` to convert a
|
|
266
|
+
* `beeos-file://<fileId>` ref into a fetchable URL before delegating
|
|
267
|
+
* the actual download to the same pipeline used by `UrlResolver`.
|
|
268
|
+
*
|
|
269
|
+
* The Agent Gateway resolves the calling agent's `instanceId`/`ownerId`
|
|
270
|
+
* from the Ed25519 signature and forwards both to Runtime FileService;
|
|
271
|
+
* the device-agent never needs to know either.
|
|
272
|
+
*
|
|
273
|
+
* Throws `AgentGatewayError` on non-2xx (including 404 if the fileId
|
|
274
|
+
* doesn't belong to the calling agent's owner). Throws if the response
|
|
275
|
+
* is missing the required `downloadUrl` field.
|
|
276
|
+
*/
|
|
277
|
+
export async function resolveAgentFile(opts) {
|
|
278
|
+
if (!opts.fileId)
|
|
279
|
+
throw new AgentGatewayError("resolveAgentFile: empty fileId");
|
|
280
|
+
const path = `/api/v1/agent/files/${encodeURIComponent(opts.fileId)}/resolve`;
|
|
281
|
+
const url = `${trimSlash(opts.agentGatewayUrl)}${path}`;
|
|
282
|
+
const headers = buildAuthHeaders({
|
|
283
|
+
method: "GET",
|
|
284
|
+
path,
|
|
285
|
+
identity: opts.identity,
|
|
286
|
+
now: opts.now,
|
|
287
|
+
randomUUID: opts.randomUUID,
|
|
288
|
+
});
|
|
289
|
+
const data = (await gwGet(url, headers, opts.timeoutMs ?? 10_000, opts.fetchImpl));
|
|
290
|
+
const obj = (data ?? {});
|
|
291
|
+
const fileId = typeof obj.fileId === "string" ? obj.fileId : "";
|
|
292
|
+
const fileName = typeof obj.fileName === "string" ? obj.fileName : "";
|
|
293
|
+
const mimeType = typeof obj.mimeType === "string" ? obj.mimeType : "";
|
|
294
|
+
const size = typeof obj.size === "number" ? obj.size : 0;
|
|
295
|
+
const downloadUrl = typeof obj.downloadUrl === "string" ? obj.downloadUrl : "";
|
|
296
|
+
if (!downloadUrl) {
|
|
297
|
+
throw new AgentGatewayError(`files/${opts.fileId}/resolve: missing downloadUrl (got ${JSON.stringify(data)})`);
|
|
298
|
+
}
|
|
299
|
+
return {
|
|
300
|
+
fileId: fileId || opts.fileId,
|
|
301
|
+
fileName,
|
|
302
|
+
mimeType,
|
|
303
|
+
size,
|
|
304
|
+
downloadUrl,
|
|
305
|
+
};
|
|
306
|
+
}
|
|
262
307
|
/**
|
|
263
308
|
* Build the four `X-Agent-*` Ed25519 auth headers for an HTTP request.
|
|
264
309
|
* Exposed for unit tests and adapters that talk to other AGW endpoints.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-gateway-client.js","sourceRoot":"","sources":["../../src/adapters/agent-gateway-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AA6B/C,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAGxB;IACA;IAHlB,YACE,OAAe,EACC,MAAe,EACf,IAAa;QAE7B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,WAAM,GAAN,MAAM,CAAS;QACf,SAAI,GAAJ,IAAI,CAAS;QAG7B,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,IAA8B;IAE9B,MAAM,IAAI,GAAG,uBAAuB,CAAC;IACrC,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9E,MAAM,GAAG,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,IAAI,GAAG,KAAK,EAAE,CAAC;IAEhE,MAAM,OAAO,GAAG,gBAAgB,CAAC;QAC/B,MAAM,EAAE,KAAK;QACb,IAAI;QACJ,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,GAAG,EAA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EAAE,CAAC;QAC/B,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;QACvB,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,YAAY,iBAAiB;YAAE,MAAM,CAAC,CAAC;QAC5C,IAAK,CAAW,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;YACvC,MAAM,IAAI,iBAAiB,CAAC,yCAAyC,SAAS,IAAI,CAAC,CAAC;QACtF,CAAC;QACD,MAAM,IAAI,iBAAiB,CAAC,iCAAkC,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;IACvF,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;AACH,CAAC;AAED,KAAK,UAAU,YAAY,CAAC,IAAc;IACxC,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAC5B,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,CAAS;IAC1B,OAAO,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -33,6 +33,7 @@ import type { AgentCoreRunOptions, AgentCoreRunResult, IAgentCore } from "../por
|
|
|
33
33
|
import type { Logger } from "../logger/index.js";
|
|
34
34
|
import type { IGrounder } from "../grounding/grounder.js";
|
|
35
35
|
import type { IMcpRuntime } from "../mcp-client/runtime.js";
|
|
36
|
+
import type { ShortcutInvoker, ShortcutResourceFacade } from "../shortcuts/index.js";
|
|
36
37
|
export interface PiOuterConfig {
|
|
37
38
|
/** API key for the outer LLM. Mapped to `OPENROUTER_API_KEY` etc. */
|
|
38
39
|
apiKey?: string;
|
|
@@ -169,6 +170,25 @@ export interface PiOrchestratorAgentOptions {
|
|
|
169
170
|
* skip the dump path entirely.
|
|
170
171
|
*/
|
|
171
172
|
uiXmlRunner?: (query?: string) => Promise<string>;
|
|
173
|
+
/**
|
|
174
|
+
* Active shortcut runtime (Phase 2 of the GUI-Shortcut Hybrid Plan).
|
|
175
|
+
* When set, the orchestrator extension renders one outer-LLM tool
|
|
176
|
+
* per registered shortcut. When omitted, only the legacy
|
|
177
|
+
* `mobile_use` / `ground` / `ui_xml` triad is exposed and any
|
|
178
|
+
* extension that calls `getShortcutKB()` will throw — that's
|
|
179
|
+
* intentional, the bootstrap layer is responsible for wiring this.
|
|
180
|
+
*/
|
|
181
|
+
shortcutInvoker?: ShortcutInvoker;
|
|
182
|
+
/**
|
|
183
|
+
* Optional resource facade used by `ShortcutInvoker` callers (the
|
|
184
|
+
* `download_to_device` builtin in particular). The bootstrap layer
|
|
185
|
+
* supplies a lazy factory because the resource layer is constructed
|
|
186
|
+
* AFTER the agent core in `bootstrap.ts`. Returning `undefined`
|
|
187
|
+
* means the `download_to_device` shortcut will surface
|
|
188
|
+
* `permission_denied` to the LLM, which is preferable to silently
|
|
189
|
+
* misbehaving — but bootstrap should normally wire a facade.
|
|
190
|
+
*/
|
|
191
|
+
shortcutResourcesFactory?: () => ShortcutResourceFacade | undefined;
|
|
172
192
|
}
|
|
173
193
|
export interface ModelResolver {
|
|
174
194
|
(provider: string, modelId: string, baseUrl: string): unknown | undefined;
|
|
@@ -186,6 +206,8 @@ export declare class PiOrchestratorAgent implements IAgentCore {
|
|
|
186
206
|
private readonly grounderFactory?;
|
|
187
207
|
private readonly mobileUseRunner?;
|
|
188
208
|
private readonly uiXmlRunner?;
|
|
209
|
+
private readonly shortcutInvoker?;
|
|
210
|
+
private readonly shortcutResourcesFactory?;
|
|
189
211
|
private cachedGrounder;
|
|
190
212
|
constructor(opts: PiOrchestratorAgentOptions);
|
|
191
213
|
get modelName(): string;
|
|
@@ -46,6 +46,8 @@ export class PiOrchestratorAgent {
|
|
|
46
46
|
grounderFactory;
|
|
47
47
|
mobileUseRunner;
|
|
48
48
|
uiXmlRunner;
|
|
49
|
+
shortcutInvoker;
|
|
50
|
+
shortcutResourcesFactory;
|
|
49
51
|
cachedGrounder = null;
|
|
50
52
|
constructor(opts) {
|
|
51
53
|
this.projectRoot = opts.projectRoot;
|
|
@@ -62,6 +64,8 @@ export class PiOrchestratorAgent {
|
|
|
62
64
|
this.grounderFactory = opts.grounderFactory;
|
|
63
65
|
this.mobileUseRunner = opts.mobileUseRunner;
|
|
64
66
|
this.uiXmlRunner = opts.uiXmlRunner;
|
|
67
|
+
this.shortcutInvoker = opts.shortcutInvoker;
|
|
68
|
+
this.shortcutResourcesFactory = opts.shortcutResourcesFactory;
|
|
65
69
|
applyOuterEnvMapping(this.outer);
|
|
66
70
|
}
|
|
67
71
|
get modelName() {
|
|
@@ -240,6 +244,8 @@ export class PiOrchestratorAgent {
|
|
|
240
244
|
const grounderFactory = this.grounderFactory;
|
|
241
245
|
const mobileUseRunner = this.mobileUseRunner;
|
|
242
246
|
const uiXmlRunner = this.uiXmlRunner;
|
|
247
|
+
const shortcutInvoker = this.shortcutInvoker;
|
|
248
|
+
const shortcutResourcesFactory = this.shortcutResourcesFactory;
|
|
243
249
|
return {
|
|
244
250
|
getMcpClient: () => mcpProvider(),
|
|
245
251
|
getGrounder: () => {
|
|
@@ -274,6 +280,48 @@ export class PiOrchestratorAgent {
|
|
|
274
280
|
const xml = dump.content ?? "";
|
|
275
281
|
return formatUiXmlToolOutput(xml, query);
|
|
276
282
|
},
|
|
283
|
+
// Shortcut KB — outer-LLM-visible. Throws when not wired so a
|
|
284
|
+
// mis-bootstrapped extension fails loud instead of silently
|
|
285
|
+
// exposing zero shortcuts (which the orchestrator would interpret
|
|
286
|
+
// as "no hybrid action space available", causing it to default to
|
|
287
|
+
// mobile_use + manual GUI navigation).
|
|
288
|
+
getShortcutKB: () => {
|
|
289
|
+
if (!shortcutInvoker) {
|
|
290
|
+
throw new Error("PiOrchestratorAgent: getShortcutKB() invoked but no shortcutInvoker was provided " +
|
|
291
|
+
"(bootstrap must wire `shortcutInvoker: new ShortcutRouter(reg)`).");
|
|
292
|
+
}
|
|
293
|
+
return shortcutInvoker;
|
|
294
|
+
},
|
|
295
|
+
getShortcutResources: () => shortcutResourcesFactory?.(),
|
|
296
|
+
// INTERNAL-ONLY (D9). See pi-context.ts comment block.
|
|
297
|
+
// We keep the implementation simple — go straight through the MCP
|
|
298
|
+
// runtime — because shortcuts are always called from inside a
|
|
299
|
+
// structured `ShortcutContext`, never re-exposed to the LLM.
|
|
300
|
+
runShell: async (command, opts) => {
|
|
301
|
+
const mcp = mcpProvider();
|
|
302
|
+
if (typeof mcp.executeCommand !== "function") {
|
|
303
|
+
throw new Error("PiOrchestratorAgent.runShell: active MCP runtime does not implement executeCommand");
|
|
304
|
+
}
|
|
305
|
+
const tCallOpts = {};
|
|
306
|
+
if (opts?.timeoutMs !== undefined) {
|
|
307
|
+
tCallOpts.timeoutS = Math.ceil(opts.timeoutMs / 1000);
|
|
308
|
+
}
|
|
309
|
+
// The MCP runtime does not currently expose AbortSignal —
|
|
310
|
+
// we can't preempt mid-call. The router's wrapper enforces a
|
|
311
|
+
// ceiling, so the caller's signal is honored end-to-end on
|
|
312
|
+
// the loop boundary even if the in-flight `executeCommand`
|
|
313
|
+
// can't be cancelled mid-stream. (D2 keeps task:start early
|
|
314
|
+
// enough that this is a non-issue for Phase 2.)
|
|
315
|
+
const res = await mcp.executeCommand(command, tCallOpts);
|
|
316
|
+
return res;
|
|
317
|
+
},
|
|
318
|
+
pushFile: async (path, bytes) => {
|
|
319
|
+
const mcp = mcpProvider();
|
|
320
|
+
if (typeof mcp.fileWrite !== "function") {
|
|
321
|
+
throw new Error("PiOrchestratorAgent.pushFile: active MCP runtime does not implement fileWrite");
|
|
322
|
+
}
|
|
323
|
+
await mcp.fileWrite(path, bytes);
|
|
324
|
+
},
|
|
277
325
|
};
|
|
278
326
|
}
|
|
279
327
|
ensureSession() {
|