@desplega.ai/agent-swarm 2.4.3 → 2.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{acp-adapter-1885dpr7.js → acp-adapter-thq04adh.js} +1 -2
- package/dist/{actions-pn76n32q.js → actions-j6ywh6x5.js} +17 -17
- package/dist/{amp-adapter-af84rx1d.js → amp-adapter-k8b5xmj8.js} +2 -2
- package/dist/{app-6sv8mhzm.js → app-rb7vc02s.js} +3 -3
- package/dist/{assistant-sc2tf825.js → assistant-ftta1zjf.js} +18 -18
- package/dist/{boot-reembed-y3m0ydzj.js → boot-reembed-srp6v6af.js} +1 -1
- package/dist/{boot-reembed-gvxjs2py.js → boot-reembed-xns7h5h9.js} +1 -1
- package/dist/{boot-scrub-sweep-1j9mk05f.js → boot-scrub-sweep-3qqrh2mz.js} +2 -2
- package/dist/{boot-seeds-37sp626b.js → boot-seeds-9ks8hce7.js} +4 -4
- package/dist/{claude-adapter-rp0jtnwr.js → claude-adapter-k5ksyres.js} +2 -2
- package/dist/{claude-managed-setup-rdt248k7.js → claude-managed-setup-n5a5eqks.js} +1 -1
- package/dist/{claude-sdk-session-53rcw5we.js → claude-sdk-session-2j3j4kwn.js} +2 -2
- package/dist/{cli-v87dr6e3.js → cli-1d70crsy.js} +1 -1
- package/dist/{cli-1ma335fz.js → cli-1ephgwnq.js} +2 -2
- package/dist/{cli-4yef8ghv.js → cli-2v045xyf.js} +3 -3
- package/dist/{cli-73ezfhha.js → cli-2y91wnbh.js} +10 -5
- package/dist/{cli-1eszr343.js → cli-2zqpkvtt.js} +1 -1
- package/dist/{cli-e4d78xsv.js → cli-37yb7307.js} +1 -1
- package/dist/{cli-8y99kfey.js → cli-3cgngyd8.js} +9 -9
- package/dist/{cli-wk28hzqn.js → cli-44159k28.js} +1 -1
- package/dist/{cli-qp2m4btv.js → cli-4dg55wsk.js} +2 -2
- package/dist/{cli-0dxxwfkt.js → cli-51y09c6p.js} +17 -14
- package/dist/{cli-aa3tb29r.js → cli-55qmbp6z.js} +1 -1
- package/dist/{cli-mzkwkbdy.js → cli-82d3nkc3.js} +1 -1
- package/dist/{cli-sds5zzs8.js → cli-9fhkkpj5.js} +78 -12
- package/dist/{cli-vq9gqarq.js → cli-amyhm3gj.js} +1 -1
- package/dist/{cli-bxrqvpg5.js → cli-b8k7epj1.js} +5 -5
- package/dist/{cli-8vverzf7.js → cli-ba8ne1es.js} +5 -0
- package/dist/{cli-58vwn100.js → cli-bnz0r3kc.js} +1 -1
- package/dist/{cli-6eyncg0y.js → cli-cynvc9fj.js} +34 -6
- package/dist/{cli-f0p0f6ja.js → cli-dqb4n629.js} +7 -7
- package/dist/{cli-pygdsgh8.js → cli-esxerzg7.js} +1 -1
- package/dist/{cli-dm8p2dpf.js → cli-gqvh8d8a.js} +6 -6
- package/dist/{cli-p0qerd2r.js → cli-hj3debgw.js} +1 -1
- package/dist/{cli-836ehxmt.js → cli-nc35pxb7.js} +2 -2
- package/dist/{cli-vcgscaan.js → cli-p20r8w42.js} +8 -6
- package/dist/{cli-1xsraagq.js → cli-pccfmtb5.js} +4 -4
- package/dist/{cli-s9rr4gr2.js → cli-q6r7t299.js} +1036 -298
- package/dist/{cli-tkf4x6ha.js → cli-qkhc5aqy.js} +11 -11
- package/dist/{cli-1n9gdg56.js → cli-t7cyef5g.js} +4 -4
- package/dist/{cli-038fga5k.js → cli-te6b5wvg.js} +148 -183
- package/dist/{cli-kgnkyabk.js → cli-v3yr2gbg.js} +109 -35
- package/dist/{cli-h0mgxann.js → cli-vdm20wej.js} +2 -2
- package/dist/{cli-zvbb4n0e.js → cli-vq97g1jq.js} +2 -2
- package/dist/{cli-gx0j2khs.js → cli-w6nadkh4.js} +3 -3
- package/dist/{cli-99jez72r.js → cli-w9etnnxk.js} +6 -1
- package/dist/{cli-npfe9t1s.js → cli-xc27fwzg.js} +2 -2
- package/dist/{cli-6aen3ezb.js → cli-xj0re5tm.js} +1 -1
- package/dist/{cli-aypbg9r2.js → cli-zrk6jxv8.js} +1 -1
- package/dist/{cli-1012xb7j.js → cli-zrwpctp4.js} +20 -20
- package/dist/cli.js +41 -16
- package/dist/{codex-adapter-2zrmab9b.js → codex-adapter-968xwfy7.js} +1 -1
- package/dist/{codex-session-runner-kbkz62vc.js → codex-session-runner-ht4z99fa.js} +1 -1
- package/dist/{commands-hd574th6.js → commands-pcymaeg9.js} +2 -2
- package/dist/{controller-pz5mcfg4.js → controller-fpjyk46r.js} +2 -2
- package/dist/{controllers-connect-5rgq2hfk.js → controllers-connect-mwzx1fh6.js} +18 -18
- package/dist/{cursor-adapter-mgaprq0j.js → cursor-adapter-cp4s2e2f.js} +1 -1
- package/dist/{db-h06dxp05.js → db-sgd12bt9.js} +3 -3
- package/dist/{db-6nf1207q.js → db-xsjg9jqq.js} +1 -1
- package/dist/{dispatcher-zthpy4m1.js → dispatcher-x0jfw2c9.js} +16 -16
- package/dist/{dsh-adapter-64dhw0j7.js → dsh-adapter-jrq7ma7h.js} +1 -1
- package/dist/{external-channel-x01t7ke6.js → external-channel-8njj4h3b.js} +2 -2
- package/dist/{grok-adapter-h21jv594.js → grok-adapter-kkr97v2f.js} +2 -3
- package/dist/handlers-0pvee9nw.js +39 -0
- package/dist/{heartbeat-zzfksckz.js → heartbeat-wd03zhn0.js} +19 -19
- package/dist/{hook-z4zhzj1f.js → hook-f0vghj42.js} +1 -1
- package/dist/{hook-3xfqhh2s.js → hook-xzj2ts2p.js} +1 -1
- package/dist/{http-q813tmya.js → http-4hwxv62p.js} +255 -117
- package/dist/{index-va3y63es.js → index-6srwvd5b.js} +1 -2
- package/dist/{index-220tk9bw.js → index-97q4xn03.js} +19 -10
- package/dist/{index-s98037v0.js → index-cbxkmfc5.js} +1 -2
- package/dist/{index-m0a4ydqj.js → index-gdh8jrdm.js} +16 -16
- package/dist/{index-wbbs14c5.js → index-hg0x2cdv.js} +16 -16
- package/dist/{index-d0g18bax.js → index-thm0y6a8.js} +19 -19
- package/dist/{index-x8xbyn1t.js → index-ww2vznkp.js} +1 -1
- package/dist/{keepalive-y5t1my7m.js → keepalive-hrh7xnr9.js} +3 -3
- package/dist/{lead-2xwtq66b.js → lead-ee8vazz2.js} +26 -27
- package/dist/{maintenance-ybfsaedv.js → maintenance-e8wnwnqx.js} +1 -1
- package/dist/{oauth-refresh-sweep-909jmn12.js → oauth-refresh-sweep-zm0yj4sj.js} +2 -2
- package/dist/{onboard-xn6fkkys.js → onboard-dtwcq603.js} +2 -2
- package/dist/{otel-impl-e6mn0z13.js → otel-impl-w3fbhpn0.js} +1 -1
- package/dist/{pricing-refresh-ygd362ep.js → pricing-refresh-j38dehfs.js} +3 -3
- package/dist/{rbac-roles-c9axvfnz.js → rbac-roles-ae8yttq4.js} +2 -2
- package/dist/{rbac-roles-mb470p4e.js → rbac-roles-ejxx9b35.js} +2 -2
- package/dist/{render-v2-g0306nh1.js → render-v2-n16n0phe.js} +3 -3
- package/dist/{resume-v315hnq6.js → resume-z0fgjc38.js} +5 -5
- package/dist/{session-access-2zg285a1.js → session-access-cv3mq6mc.js} +6 -4
- package/dist/{setup-a4mtf02k.js → setup-mafhj3yt.js} +1 -1
- package/dist/{work-objects-9fr0fgtn.js → work-objects-8b86mgjp.js} +19 -19
- package/dist/{worker-qae22jeb.js → worker-16s75hm5.js} +26 -27
- package/dist/worker-token-xf11yyds.js +136 -0
- package/openapi.json +295 -12
- package/package.json +4 -4
- package/src/apps/action-runner.ts +4 -0
- package/src/apps/catalog.generated.json +3 -0
- package/src/apps/page-validator.ts +8 -2
- package/src/be/migrations/232_agent_session_tokens.sql +41 -0
- package/src/be/seed-scripts/catalog/heartbeat-jev-gate.ts +10 -1
- package/src/be/swarm-config-guard.ts +16 -0
- package/src/be/users.ts +169 -12
- package/src/cli.tsx +24 -0
- package/src/commands/worker-token.ts +164 -0
- package/src/http/apps.ts +43 -5
- package/src/http/codex-oauth-keep-warm.ts +27 -9
- package/src/http/config.ts +5 -3
- package/src/http/core.ts +2 -0
- package/src/http/session-access.ts +51 -2
- package/src/http/sessions.ts +249 -10
- package/src/http/tasks.ts +4 -32
- package/src/providers/acp-adapter.ts +33 -13
- package/src/providers/acp-swarm-events.ts +1 -1
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/codex-oauth/storage.ts +1 -1
- package/src/rbac/legacy-policy.ts +3 -1
- package/src/rbac/permissions.ts +4 -0
- package/src/tests/acp-adapter.test.ts +10 -23
- package/src/tests/acp-fake-agent.ts +36 -0
- package/src/tests/acp-swarm-events.test.ts +1 -1
- package/src/tests/agent-session-tokens.test.ts +452 -0
- package/src/tests/apps-action-parent-task.test.ts +295 -0
- package/src/tests/codex-oauth-keep-warm.test.ts +85 -1
- package/src/tests/config-session-auth.test.ts +14 -0
- package/src/tests/docs-index-footprint.test.js +2 -2
- package/src/tests/grok-adapter.test.ts +3 -3
- package/src/tests/heartbeat-jev-gate.test.ts +23 -0
- package/src/tests/migration-232-agent-session-tokens.test.ts +67 -0
- package/src/tests/rbac-engine.test.ts +1 -0
- package/src/tests/runtime-child-token-cleanup.test.ts +3 -3
- package/src/tests/script-connections.test.ts +2 -0
- package/src/tests/session-route-posture.test.ts +2 -0
- package/src/tests/worker-token-cli.test.ts +76 -0
- package/src/tests/workflow-executors.test.ts +4 -2
- package/src/tests/workflow-system-one-extraction.test.ts +805 -0
- package/src/types.ts +2 -1
- package/src/utils/request-auth-context.ts +2 -1
- package/src/workflows/definition.ts +7 -1
- package/src/workflows/engine.ts +18 -12
- package/src/workflows/executors/index.ts +1 -0
- package/src/workflows/executors/registry.ts +2 -0
- package/src/workflows/executors/system-one-decision.ts +56 -255
- package/src/workflows/executors/system-one-extract-wire.ts +57 -0
- package/src/workflows/executors/system-one-extraction.ts +830 -0
- package/src/workflows/executors/system-one-providers.ts +277 -110
- package/src/workflows/executors/system-one-transport.ts +264 -0
- package/templates/official/lead/HEARTBEAT.md +1 -1
- package/templates/skills/apps/SKILL.md +3 -1
- package/templates/skills/apps/content.md +3 -1
- package/templates/skills/heartbeat-runbook/content.md +3 -3
- package/dist/cli-v1sjhn52.js +0 -7
- package/dist/handlers-2qjw434w.js +0 -39
|
@@ -47,10 +47,10 @@ import {
|
|
|
47
47
|
checkDependencies2,
|
|
48
48
|
emitBuiltInIntegrationConnectedOnce2,
|
|
49
49
|
init_db3
|
|
50
|
-
} from "./cli-
|
|
50
|
+
} from "./cli-p20r8w42.js";
|
|
51
51
|
import {
|
|
52
52
|
getChannelBlockReason2
|
|
53
|
-
} from "./cli-
|
|
53
|
+
} from "./cli-1d70crsy.js";
|
|
54
54
|
import {
|
|
55
55
|
require_dist5,
|
|
56
56
|
require_axios,
|
|
@@ -67,7 +67,7 @@ import {
|
|
|
67
67
|
import {
|
|
68
68
|
isTerminalTaskStatus,
|
|
69
69
|
init_types
|
|
70
|
-
} from "./cli-
|
|
70
|
+
} from "./cli-nc35pxb7.js";
|
|
71
71
|
import {
|
|
72
72
|
taskAttachmentDisplayUrl,
|
|
73
73
|
init_task_attachment_links
|
|
@@ -6235,7 +6235,7 @@ async function initOtel(serviceRole = process.env.AGENT_ROLE || "api") {
|
|
|
6235
6235
|
return;
|
|
6236
6236
|
initialized = true;
|
|
6237
6237
|
try {
|
|
6238
|
-
const impl = await import("./otel-impl-
|
|
6238
|
+
const impl = await import("./otel-impl-w3fbhpn0.js");
|
|
6239
6239
|
await impl.boot(serviceRole, {
|
|
6240
6240
|
exportConsoleLogs: serviceRole === "api" && isApiLogExportEnabled()
|
|
6241
6241
|
});
|
|
@@ -10080,17 +10080,17 @@ async function initSlackApp2() {
|
|
|
10080
10080
|
});
|
|
10081
10081
|
initialized2 = true;
|
|
10082
10082
|
app.use(slackInboundOutcomeMiddleware());
|
|
10083
|
-
const { registerMessageHandler } = await import("./handlers-
|
|
10084
|
-
const { registerCommandHandler } = await import("./commands-
|
|
10085
|
-
const { registerActionHandlers } = await import("./actions-
|
|
10086
|
-
const { registerWorkObjectHandlers } = await import("./work-objects-
|
|
10083
|
+
const { registerMessageHandler } = await import("./handlers-0pvee9nw.js");
|
|
10084
|
+
const { registerCommandHandler } = await import("./commands-pcymaeg9.js");
|
|
10085
|
+
const { registerActionHandlers } = await import("./actions-j6ywh6x5.js");
|
|
10086
|
+
const { registerWorkObjectHandlers } = await import("./work-objects-8b86mgjp.js");
|
|
10087
10087
|
registerMessageHandler(app);
|
|
10088
10088
|
registerCommandHandler(app);
|
|
10089
10089
|
registerActionHandlers(app);
|
|
10090
10090
|
registerWorkObjectHandlers(app);
|
|
10091
|
-
const { createAssistant } = await import("./assistant-
|
|
10091
|
+
const { createAssistant } = await import("./assistant-ftta1zjf.js");
|
|
10092
10092
|
app.assistant(createAssistant());
|
|
10093
|
-
const { isBlockExternalEnabled, scanExternalChannelsOnBoot } = await import("./external-channel-
|
|
10093
|
+
const { isBlockExternalEnabled, scanExternalChannelsOnBoot } = await import("./external-channel-8njj4h3b.js");
|
|
10094
10094
|
if (isBlockExternalEnabled()) {
|
|
10095
10095
|
scanExternalChannelsOnBoot(app.client).catch((error) => {
|
|
10096
10096
|
console.error("[Slack] External channel boot scan failed:", error);
|
|
@@ -10103,7 +10103,7 @@ async function startSlackApp2() {
|
|
|
10103
10103
|
await initSlackApp2();
|
|
10104
10104
|
}
|
|
10105
10105
|
if (app) {
|
|
10106
|
-
const { isSlackRenderV2Enabled } = await import("./render-v2-
|
|
10106
|
+
const { isSlackRenderV2Enabled } = await import("./render-v2-n16n0phe.js");
|
|
10107
10107
|
if (isSlackRenderV2Enabled())
|
|
10108
10108
|
await ensureSlackRenderV2Activation2();
|
|
10109
10109
|
await app.start();
|
|
@@ -7,20 +7,20 @@ import {
|
|
|
7
7
|
tierConfigKey,
|
|
8
8
|
init_model_tier_keys,
|
|
9
9
|
init_db3
|
|
10
|
-
} from "./cli-
|
|
10
|
+
} from "./cli-p20r8w42.js";
|
|
11
11
|
import {
|
|
12
12
|
ensureRbacSeedsSynced2,
|
|
13
13
|
init_rbac_roles
|
|
14
|
-
} from "./cli-
|
|
14
|
+
} from "./cli-4dg55wsk.js";
|
|
15
15
|
import {
|
|
16
16
|
seedPricingFromModelsDev
|
|
17
|
-
} from "./cli-
|
|
17
|
+
} from "./cli-amyhm3gj.js";
|
|
18
18
|
import {
|
|
19
19
|
MODEL_TIERS,
|
|
20
20
|
DEFAULT_MODEL_TIER_MAP,
|
|
21
21
|
ProviderNameSchema,
|
|
22
22
|
init_types
|
|
23
|
-
} from "./cli-
|
|
23
|
+
} from "./cli-nc35pxb7.js";
|
|
24
24
|
|
|
25
25
|
// src/be/boot-seeds.ts
|
|
26
26
|
init_db3();
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
import {
|
|
44
44
|
init_package,
|
|
45
45
|
package_default
|
|
46
|
-
} from "./cli-
|
|
46
|
+
} from "./cli-pccfmtb5.js";
|
|
47
47
|
import {
|
|
48
48
|
scrubSecrets,
|
|
49
49
|
init_secret_scrubber
|
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
init_src2
|
|
57
57
|
} from "./cli-nwyw3zhg.js";
|
|
58
58
|
|
|
59
|
-
// node_modules/@agentclientprotocol/sdk/dist/schema/index.js
|
|
59
|
+
// node_modules/@agentclientprotocol/sdk/dist/v1/unstable/schema/index.js
|
|
60
60
|
var AGENT_METHODS = {
|
|
61
61
|
initialize: "initialize",
|
|
62
62
|
authenticate: "authenticate",
|
|
@@ -96,7 +96,7 @@ var PROTOCOL_METHODS = {
|
|
|
96
96
|
};
|
|
97
97
|
var PROTOCOL_VERSION = 1;
|
|
98
98
|
|
|
99
|
-
// node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.js
|
|
99
|
+
// node_modules/@agentclientprotocol/sdk/dist/core/schema-deserialize.js
|
|
100
100
|
var skippedItem = Symbol("skippedItem");
|
|
101
101
|
function defaultOnError(schema, fallback) {
|
|
102
102
|
return schema.catch(fallback);
|
|
@@ -174,7 +174,7 @@ function vecSkipError(itemSchema) {
|
|
|
174
174
|
return array2(itemSchema.catch(skippedItem)).transform((items) => items.filter((item) => item !== skippedItem));
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
// node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.js
|
|
177
|
+
// node_modules/@agentclientprotocol/sdk/dist/v1/unstable/schema/zod.gen.js
|
|
178
178
|
var zRequestId = union2([number2(), string2()]).nullable();
|
|
179
179
|
var zSessionId = string2();
|
|
180
180
|
var zWriteTextFileRequest = object2({
|
|
@@ -2156,7 +2156,7 @@ var zCancelRequestNotification = object2({
|
|
|
2156
2156
|
})
|
|
2157
2157
|
});
|
|
2158
2158
|
|
|
2159
|
-
// node_modules/@agentclientprotocol/sdk/dist/jsonrpc.js
|
|
2159
|
+
// node_modules/@agentclientprotocol/sdk/dist/core/jsonrpc.js
|
|
2160
2160
|
var CANCEL_REQUEST_METHOD = "$/cancel_request";
|
|
2161
2161
|
function isRequestMessage(value) {
|
|
2162
2162
|
return isJsonRpcEnvelope(value) && "id" in value && typeof value["method"] === "string" && isJsonRpcId(value["id"]);
|
|
@@ -2372,6 +2372,7 @@ class Connection {
|
|
|
2372
2372
|
nextRequestId = 0;
|
|
2373
2373
|
staticHandlers = [];
|
|
2374
2374
|
dynamicHandlers = new Set;
|
|
2375
|
+
fallbackHandlers = [];
|
|
2375
2376
|
stream;
|
|
2376
2377
|
writeQueue = Promise.resolve();
|
|
2377
2378
|
abortController = new AbortController;
|
|
@@ -2555,6 +2556,7 @@ class Connection {
|
|
|
2555
2556
|
initialize(stream, handlers, options) {
|
|
2556
2557
|
this.stream = stream;
|
|
2557
2558
|
this.staticHandlers = handlers;
|
|
2559
|
+
this.fallbackHandlers = [...options?.fallbackHandlers ?? []];
|
|
2558
2560
|
this.allowBatches = options?.allowBatches ?? true;
|
|
2559
2561
|
this.closedPromise = new Promise((resolve) => {
|
|
2560
2562
|
this.abortController.signal.addEventListener("abort", () => resolve());
|
|
@@ -2689,7 +2691,8 @@ class Connection {
|
|
|
2689
2691
|
try {
|
|
2690
2692
|
for (const handler of [
|
|
2691
2693
|
...this.staticHandlers,
|
|
2692
|
-
...this.dynamicHandlers.values()
|
|
2694
|
+
...this.dynamicHandlers.values(),
|
|
2695
|
+
...this.fallbackHandlers
|
|
2693
2696
|
]) {
|
|
2694
2697
|
if (this.abortController.signal.aborted) {
|
|
2695
2698
|
return;
|
|
@@ -2816,6 +2819,7 @@ class Connection {
|
|
|
2816
2819
|
|
|
2817
2820
|
class ConnectionBuilder {
|
|
2818
2821
|
handlers = [];
|
|
2822
|
+
fallbackHandlers = [];
|
|
2819
2823
|
connectionName;
|
|
2820
2824
|
name(name) {
|
|
2821
2825
|
this.connectionName = name;
|
|
@@ -2825,6 +2829,10 @@ class ConnectionBuilder {
|
|
|
2825
2829
|
this.handlers.push(handler);
|
|
2826
2830
|
return this;
|
|
2827
2831
|
}
|
|
2832
|
+
withFallbackHandler(handler) {
|
|
2833
|
+
this.fallbackHandlers.push(handler);
|
|
2834
|
+
return this;
|
|
2835
|
+
}
|
|
2828
2836
|
onReceiveMessage(handler) {
|
|
2829
2837
|
return this.withHandler({
|
|
2830
2838
|
handleMessage: async (message, cx) => await handler(message, cx) ?? Handled.no(message),
|
|
@@ -2856,7 +2864,13 @@ class ConnectionBuilder {
|
|
|
2856
2864
|
});
|
|
2857
2865
|
}
|
|
2858
2866
|
connect(stream, options) {
|
|
2859
|
-
return new Connection(stream, this.handlers,
|
|
2867
|
+
return new Connection(stream, this.handlers, {
|
|
2868
|
+
...options,
|
|
2869
|
+
fallbackHandlers: [
|
|
2870
|
+
...options?.fallbackHandlers ?? [],
|
|
2871
|
+
...this.fallbackHandlers
|
|
2872
|
+
]
|
|
2873
|
+
});
|
|
2860
2874
|
}
|
|
2861
2875
|
connectWith(stream, op, options) {
|
|
2862
2876
|
return this.connect(stream, options).runUntil(op);
|
|
@@ -2929,7 +2943,7 @@ function protocolErrorResponse(error) {
|
|
|
2929
2943
|
};
|
|
2930
2944
|
}
|
|
2931
2945
|
|
|
2932
|
-
// node_modules/@agentclientprotocol/sdk/dist/stream-limits.js
|
|
2946
|
+
// node_modules/@agentclientprotocol/sdk/dist/core/stream-limits.js
|
|
2933
2947
|
var DEFAULT_MAX_MESSAGE_BYTES = 32 * 1024 * 1024;
|
|
2934
2948
|
|
|
2935
2949
|
class MessageTooLargeError extends Error {
|
|
@@ -2990,7 +3004,7 @@ class MessageBuffer {
|
|
|
2990
3004
|
}
|
|
2991
3005
|
}
|
|
2992
3006
|
|
|
2993
|
-
// node_modules/@agentclientprotocol/sdk/dist/line-buffer.js
|
|
3007
|
+
// node_modules/@agentclientprotocol/sdk/dist/core/line-buffer.js
|
|
2994
3008
|
var newline = 10;
|
|
2995
3009
|
|
|
2996
3010
|
class LineBuffer {
|
|
@@ -3044,7 +3058,7 @@ function stripCarriageReturn(line) {
|
|
|
3044
3058
|
return line[line.byteLength - 1] === 13 ? line.subarray(0, -1) : line;
|
|
3045
3059
|
}
|
|
3046
3060
|
|
|
3047
|
-
// node_modules/@agentclientprotocol/sdk/dist/stream.js
|
|
3061
|
+
// node_modules/@agentclientprotocol/sdk/dist/core/stream.js
|
|
3048
3062
|
function ndJsonStream(output, input, options = {}) {
|
|
3049
3063
|
const maxMessageBytes = resolveMaxMessageBytes(options.maxMessageBytes);
|
|
3050
3064
|
const textEncoder = new TextEncoder;
|
|
@@ -3147,7 +3161,7 @@ function ndJsonStream(output, input, options = {}) {
|
|
|
3147
3161
|
return { readable, writable };
|
|
3148
3162
|
}
|
|
3149
3163
|
|
|
3150
|
-
// node_modules/@agentclientprotocol/sdk/dist/schema/guards.gen.js
|
|
3164
|
+
// node_modules/@agentclientprotocol/sdk/dist/v1/unstable/schema/guards.gen.js
|
|
3151
3165
|
var zGuardCreateElicitationRequestForm = zElicitationFormMode.and(object2({ mode: literal2("form") })).and(object2({ message: string2() }));
|
|
3152
3166
|
var zGuardCreateElicitationRequestUrl = zElicitationUrlMode.and(object2({ mode: literal2("url") })).and(object2({ message: string2() }));
|
|
3153
3167
|
var zGuardCreateElicitationRequestCustom = union2([zElicitationSessionScope, zElicitationRequestScope]).and(object2({ message: string2() }));
|
|
@@ -3185,7 +3199,57 @@ var zGuardCreateElicitationResponseDecline = object2({
|
|
|
3185
3199
|
var zGuardCreateElicitationResponseCancel = object2({
|
|
3186
3200
|
action: literal2("cancel")
|
|
3187
3201
|
});
|
|
3188
|
-
// node_modules/@agentclientprotocol/sdk/dist/
|
|
3202
|
+
// node_modules/@agentclientprotocol/sdk/dist/core/app-handlers.js
|
|
3203
|
+
function parseParams(parser, params) {
|
|
3204
|
+
if (!parser) {
|
|
3205
|
+
return params;
|
|
3206
|
+
}
|
|
3207
|
+
if (typeof parser === "function") {
|
|
3208
|
+
return parser(params);
|
|
3209
|
+
}
|
|
3210
|
+
return parser.parse(params);
|
|
3211
|
+
}
|
|
3212
|
+
function registerAppRequest(builder, spec, context, handler, serializeResponse, lifecycle) {
|
|
3213
|
+
const handle = async (params, responder, cx, method) => {
|
|
3214
|
+
try {
|
|
3215
|
+
const response = await handler(context(params, cx, responder.signal, responder.id, method));
|
|
3216
|
+
const sentResponse = serializeResponse ? serializeResponse(response) : response;
|
|
3217
|
+
await responder.respond(sentResponse);
|
|
3218
|
+
lifecycle?.afterResponse(params, sentResponse, cx);
|
|
3219
|
+
} catch (error) {
|
|
3220
|
+
lifecycle?.onError(cx, error);
|
|
3221
|
+
throw error;
|
|
3222
|
+
}
|
|
3223
|
+
};
|
|
3224
|
+
if (spec.method === "*") {
|
|
3225
|
+
builder.withFallbackHandler({
|
|
3226
|
+
handleMessage: async (message, cx) => {
|
|
3227
|
+
if (message.kind !== "request")
|
|
3228
|
+
return Handled.no(message);
|
|
3229
|
+
await handle(message.params, message.responder, cx, message.method);
|
|
3230
|
+
return Handled.yes();
|
|
3231
|
+
}
|
|
3232
|
+
});
|
|
3233
|
+
} else {
|
|
3234
|
+
builder.onReceiveRequest(spec.method, (params) => parseParams(spec.params, params), (params, responder, cx) => handle(params, responder, cx, spec.method));
|
|
3235
|
+
}
|
|
3236
|
+
}
|
|
3237
|
+
function registerAppNotification(builder, spec, context, handler) {
|
|
3238
|
+
if (spec.method === "*") {
|
|
3239
|
+
builder.withFallbackHandler({
|
|
3240
|
+
handleMessage: async (message, cx) => {
|
|
3241
|
+
if (message.kind !== "notification")
|
|
3242
|
+
return Handled.no(message);
|
|
3243
|
+
await handler(context(message.params, cx, cx.signal, message.method));
|
|
3244
|
+
return Handled.yes();
|
|
3245
|
+
}
|
|
3246
|
+
});
|
|
3247
|
+
} else {
|
|
3248
|
+
builder.onReceiveNotification(spec.method, (params) => parseParams(spec.params, params), (params, cx) => handler(context(params, cx, cx.signal, spec.method)));
|
|
3249
|
+
}
|
|
3250
|
+
}
|
|
3251
|
+
|
|
3252
|
+
// node_modules/@agentclientprotocol/sdk/dist/v1/acp.js
|
|
3189
3253
|
function ndJsonStream2(output, input, options) {
|
|
3190
3254
|
return ndJsonStream(output, input, options);
|
|
3191
3255
|
}
|
|
@@ -3291,6 +3355,10 @@ class AgentContext extends AcpContext {
|
|
|
3291
3355
|
static create(cx, requestId) {
|
|
3292
3356
|
return new AgentContext(cx, requestId);
|
|
3293
3357
|
}
|
|
3358
|
+
async createTerminal(params, options) {
|
|
3359
|
+
const response = await this.request(CLIENT_METHODS.terminal_create, params, options);
|
|
3360
|
+
return TerminalHandle.create(response.terminalId, params.sessionId, this.connectionContext);
|
|
3361
|
+
}
|
|
3294
3362
|
request(method, params, options) {
|
|
3295
3363
|
const spec = clientRequestSpecsByMethod[method];
|
|
3296
3364
|
return this.sendRequest(method, params, spec?.mapResponse, options);
|
|
@@ -3589,15 +3657,6 @@ class ActiveSession {
|
|
|
3589
3657
|
return [prompt];
|
|
3590
3658
|
}
|
|
3591
3659
|
}
|
|
3592
|
-
function parseParams(parser, params) {
|
|
3593
|
-
if (!parser) {
|
|
3594
|
-
return params;
|
|
3595
|
-
}
|
|
3596
|
-
if (typeof parser === "function") {
|
|
3597
|
-
return parser(params);
|
|
3598
|
-
}
|
|
3599
|
-
return parser.parse(params);
|
|
3600
|
-
}
|
|
3601
3660
|
function requestSpec(method, params, mapResponse) {
|
|
3602
3661
|
return {
|
|
3603
3662
|
method,
|
|
@@ -3608,15 +3667,6 @@ function requestSpec(method, params, mapResponse) {
|
|
|
3608
3667
|
function notificationSpec(method, params) {
|
|
3609
3668
|
return { method, params };
|
|
3610
3669
|
}
|
|
3611
|
-
function registerAppRequest(builder, spec, context, handler) {
|
|
3612
|
-
builder.onReceiveRequest(spec.method, (params) => parseParams(spec.params, params), async (params, responder, cx) => {
|
|
3613
|
-
const response = await handler(context(params, cx, responder.signal, responder.id));
|
|
3614
|
-
await responder.respond(spec.mapResponse ? spec.mapResponse(response) : response);
|
|
3615
|
-
});
|
|
3616
|
-
}
|
|
3617
|
-
function registerAppNotification(builder, spec, context, handler) {
|
|
3618
|
-
builder.onReceiveNotification(spec.method, (params) => parseParams(spec.params, params), (params, cx) => handler(context(params, cx, cx.signal)));
|
|
3619
|
-
}
|
|
3620
3670
|
function specsByMethod(specs) {
|
|
3621
3671
|
const byMethod = {};
|
|
3622
3672
|
for (const spec of Object.values(specs)) {
|
|
@@ -3664,16 +3714,18 @@ var agentRequestSpecsByMethod = specsByMethod(agentRequestSpecs);
|
|
|
3664
3714
|
var agentNotificationSpecsByMethod = specsByMethod(agentNotificationSpecs);
|
|
3665
3715
|
var clientRequestSpecsByMethod = specsByMethod(clientRequestSpecs);
|
|
3666
3716
|
var clientNotificationSpecsByMethod = specsByMethod(clientNotificationSpecs);
|
|
3667
|
-
function clientRequestContext(params, agent, signal, requestId) {
|
|
3717
|
+
function clientRequestContext(params, agent, signal, requestId, method) {
|
|
3668
3718
|
return {
|
|
3719
|
+
method,
|
|
3669
3720
|
params,
|
|
3670
3721
|
requestId,
|
|
3671
3722
|
signal,
|
|
3672
3723
|
agent
|
|
3673
3724
|
};
|
|
3674
3725
|
}
|
|
3675
|
-
function clientNotificationContext(params, agent, signal) {
|
|
3726
|
+
function clientNotificationContext(params, agent, signal, method) {
|
|
3676
3727
|
return {
|
|
3728
|
+
method,
|
|
3677
3729
|
params,
|
|
3678
3730
|
signal,
|
|
3679
3731
|
agent
|
|
@@ -3746,6 +3798,7 @@ function client(options) {
|
|
|
3746
3798
|
class ClientApp {
|
|
3747
3799
|
builder = Connection.builder();
|
|
3748
3800
|
connectHandlers = [];
|
|
3801
|
+
fallbackKinds = new Set;
|
|
3749
3802
|
constructor(options = {}) {
|
|
3750
3803
|
if (options.name) {
|
|
3751
3804
|
this.builder.name(options.name);
|
|
@@ -3773,6 +3826,14 @@ class ClientApp {
|
|
|
3773
3826
|
return this;
|
|
3774
3827
|
}
|
|
3775
3828
|
onRequest(method, handlerOrParams, handler) {
|
|
3829
|
+
if (method === "*") {
|
|
3830
|
+
if (handler)
|
|
3831
|
+
throw new Error("Wildcard handlers receive raw params; omit the parser.");
|
|
3832
|
+
if (this.fallbackKinds.has("request"))
|
|
3833
|
+
throw new Error("A request fallback is already registered.");
|
|
3834
|
+
this.fallbackKinds.add("request");
|
|
3835
|
+
return this.request({ method }, handlerOrParams);
|
|
3836
|
+
}
|
|
3776
3837
|
if (handler) {
|
|
3777
3838
|
return this.request({ method, params: handlerOrParams }, handler);
|
|
3778
3839
|
}
|
|
@@ -3783,6 +3844,14 @@ class ClientApp {
|
|
|
3783
3844
|
return this.request(spec, handlerOrParams);
|
|
3784
3845
|
}
|
|
3785
3846
|
onNotification(method, handlerOrParams, handler) {
|
|
3847
|
+
if (method === "*") {
|
|
3848
|
+
if (handler)
|
|
3849
|
+
throw new Error("Wildcard handlers receive raw params; omit the parser.");
|
|
3850
|
+
if (this.fallbackKinds.has("notification"))
|
|
3851
|
+
throw new Error("A notification fallback is already registered.");
|
|
3852
|
+
this.fallbackKinds.add("notification");
|
|
3853
|
+
return this.notification({ method }, handlerOrParams);
|
|
3854
|
+
}
|
|
3786
3855
|
if (handler) {
|
|
3787
3856
|
return this.notification({ method, params: handlerOrParams }, handler);
|
|
3788
3857
|
}
|
|
@@ -3793,11 +3862,11 @@ class ClientApp {
|
|
|
3793
3862
|
return this.notification(spec, handlerOrParams);
|
|
3794
3863
|
}
|
|
3795
3864
|
request(spec, handler) {
|
|
3796
|
-
registerAppRequest(this.builder, spec, (params, cx, signal, requestId) => clientRequestContext(params, ClientContext.create(cx, requestId), signal, requestId), handler);
|
|
3865
|
+
registerAppRequest(this.builder, spec, (params, cx, signal, requestId, method) => clientRequestContext(params, ClientContext.create(cx, requestId), signal, requestId, method), handler, spec.mapResponse);
|
|
3797
3866
|
return this;
|
|
3798
3867
|
}
|
|
3799
3868
|
notification(spec, handler) {
|
|
3800
|
-
registerAppNotification(this.builder, spec, (params, cx, signal) => clientNotificationContext(params, ClientContext.create(cx), signal), handler);
|
|
3869
|
+
registerAppNotification(this.builder, spec, (params, cx, signal, method) => clientNotificationContext(params, ClientContext.create(cx), signal, method), handler);
|
|
3801
3870
|
return this;
|
|
3802
3871
|
}
|
|
3803
3872
|
connectConnection(target) {
|
|
@@ -3830,153 +3899,47 @@ class ClientApp {
|
|
|
3830
3899
|
};
|
|
3831
3900
|
}
|
|
3832
3901
|
}
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
AGENT_METHODS.providers_set,
|
|
3838
|
-
AGENT_METHODS.providers_disable,
|
|
3839
|
-
AGENT_METHODS.session_new,
|
|
3840
|
-
AGENT_METHODS.session_load,
|
|
3841
|
-
AGENT_METHODS.session_set_mode,
|
|
3842
|
-
AGENT_METHODS.session_set_config_option,
|
|
3843
|
-
AGENT_METHODS.session_prompt,
|
|
3844
|
-
AGENT_METHODS.session_list,
|
|
3845
|
-
AGENT_METHODS.session_delete,
|
|
3846
|
-
AGENT_METHODS.session_fork,
|
|
3847
|
-
AGENT_METHODS.session_resume,
|
|
3848
|
-
AGENT_METHODS.session_close,
|
|
3849
|
-
AGENT_METHODS.logout
|
|
3850
|
-
]);
|
|
3851
|
-
var legacyAgentNotificationMethods = new Set([
|
|
3852
|
-
AGENT_METHODS.session_cancel
|
|
3853
|
-
]);
|
|
3854
|
-
var legacyClientRequestMethods = new Set([
|
|
3855
|
-
CLIENT_METHODS.session_request_permission,
|
|
3856
|
-
CLIENT_METHODS.fs_write_text_file,
|
|
3857
|
-
CLIENT_METHODS.fs_read_text_file,
|
|
3858
|
-
CLIENT_METHODS.terminal_create,
|
|
3859
|
-
CLIENT_METHODS.terminal_output,
|
|
3860
|
-
CLIENT_METHODS.terminal_release,
|
|
3861
|
-
CLIENT_METHODS.terminal_wait_for_exit,
|
|
3862
|
-
CLIENT_METHODS.terminal_kill,
|
|
3863
|
-
CLIENT_METHODS.elicitation_create
|
|
3864
|
-
]);
|
|
3865
|
-
var legacyClientNotificationMethods = new Set([
|
|
3866
|
-
CLIENT_METHODS.session_update,
|
|
3867
|
-
CLIENT_METHODS.elicitation_complete
|
|
3868
|
-
]);
|
|
3869
|
-
function legacyClientApp(implementation) {
|
|
3870
|
-
const app = client().onRequest(CLIENT_METHODS.session_request_permission, (ctx) => implementation.requestPermission(ctx.params)).onNotification(CLIENT_METHODS.session_update, (ctx) => implementation.sessionUpdate(ctx.params)).onRequest(CLIENT_METHODS.fs_write_text_file, async (ctx) => await implementation.writeTextFile?.(ctx.params) ?? {}).onRequest(CLIENT_METHODS.fs_read_text_file, async (ctx) => await implementation.readTextFile?.(ctx.params)).onRequest(CLIENT_METHODS.terminal_create, async (ctx) => await implementation.createTerminal?.(ctx.params)).onRequest(CLIENT_METHODS.terminal_output, async (ctx) => await implementation.terminalOutput?.(ctx.params)).onRequest(CLIENT_METHODS.terminal_release, async (ctx) => await implementation.releaseTerminal?.(ctx.params) ?? {}).onRequest(CLIENT_METHODS.terminal_wait_for_exit, async (ctx) => await implementation.waitForTerminalExit?.(ctx.params)).onRequest(CLIENT_METHODS.terminal_kill, async (ctx) => await implementation.killTerminal?.(ctx.params) ?? {});
|
|
3871
|
-
if (implementation.createElicitation) {
|
|
3872
|
-
app.onRequest(CLIENT_METHODS.elicitation_create, (ctx) => implementation.createElicitation(ctx.params));
|
|
3873
|
-
}
|
|
3874
|
-
if (implementation.completeElicitation) {
|
|
3875
|
-
app.onNotification(CLIENT_METHODS.elicitation_complete, (ctx) => implementation.completeElicitation(ctx.params));
|
|
3876
|
-
}
|
|
3877
|
-
if (implementation.extMethod) {
|
|
3878
|
-
app[appBuilder]().withHandler({
|
|
3879
|
-
handleMessage: async (message) => {
|
|
3880
|
-
if (message.kind !== "request" || legacyClientRequestMethods.has(message.method)) {
|
|
3881
|
-
return Handled.no(message);
|
|
3882
|
-
}
|
|
3883
|
-
await message.responder.respond(await implementation.extMethod(message.method, message.params));
|
|
3884
|
-
return Handled.yes();
|
|
3885
|
-
},
|
|
3886
|
-
describe: () => "legacy-client-extension-request"
|
|
3887
|
-
});
|
|
3888
|
-
}
|
|
3889
|
-
if (implementation.extNotification) {
|
|
3890
|
-
app[appBuilder]().withHandler({
|
|
3891
|
-
handleMessage: async (message) => {
|
|
3892
|
-
if (message.kind !== "notification" || legacyClientNotificationMethods.has(message.method)) {
|
|
3893
|
-
return Handled.no(message);
|
|
3894
|
-
}
|
|
3895
|
-
await implementation.extNotification(message.method, message.params);
|
|
3896
|
-
return Handled.yes();
|
|
3897
|
-
},
|
|
3898
|
-
describe: () => "legacy-client-extension-notification"
|
|
3899
|
-
});
|
|
3900
|
-
}
|
|
3901
|
-
return app;
|
|
3902
|
-
}
|
|
3903
|
-
class ClientSideConnection {
|
|
3902
|
+
|
|
3903
|
+
class TerminalHandle {
|
|
3904
|
+
id;
|
|
3905
|
+
sessionId;
|
|
3904
3906
|
connection;
|
|
3905
|
-
constructor(
|
|
3906
|
-
this.
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
return this.connection.sendRequest(AGENT_METHODS.initialize, params);
|
|
3910
|
-
}
|
|
3911
|
-
newSession(params) {
|
|
3912
|
-
return this.connection.sendRequest(AGENT_METHODS.session_new, params);
|
|
3913
|
-
}
|
|
3914
|
-
loadSession(params) {
|
|
3915
|
-
return this.connection.sendRequest(AGENT_METHODS.session_load, params, emptyObjectResponse);
|
|
3916
|
-
}
|
|
3917
|
-
unstable_forkSession(params) {
|
|
3918
|
-
return this.connection.sendRequest(AGENT_METHODS.session_fork, params);
|
|
3919
|
-
}
|
|
3920
|
-
listSessions(params) {
|
|
3921
|
-
return this.connection.sendRequest(AGENT_METHODS.session_list, params);
|
|
3922
|
-
}
|
|
3923
|
-
deleteSession(params) {
|
|
3924
|
-
return this.connection.sendRequest(AGENT_METHODS.session_delete, params, emptyObjectResponse);
|
|
3925
|
-
}
|
|
3926
|
-
resumeSession(params) {
|
|
3927
|
-
return this.connection.sendRequest(AGENT_METHODS.session_resume, params);
|
|
3928
|
-
}
|
|
3929
|
-
closeSession(params) {
|
|
3930
|
-
return this.connection.sendRequest(AGENT_METHODS.session_close, params, emptyObjectResponse);
|
|
3931
|
-
}
|
|
3932
|
-
setSessionMode(params) {
|
|
3933
|
-
return this.connection.sendRequest(AGENT_METHODS.session_set_mode, params, emptyObjectResponse);
|
|
3934
|
-
}
|
|
3935
|
-
setSessionConfigOption(params) {
|
|
3936
|
-
return this.connection.sendRequest(AGENT_METHODS.session_set_config_option, params);
|
|
3937
|
-
}
|
|
3938
|
-
authenticate(params) {
|
|
3939
|
-
return this.connection.sendRequest(AGENT_METHODS.authenticate, params, emptyObjectResponse);
|
|
3940
|
-
}
|
|
3941
|
-
unstable_listProviders(params) {
|
|
3942
|
-
return this.connection.sendRequest(AGENT_METHODS.providers_list, params);
|
|
3943
|
-
}
|
|
3944
|
-
unstable_setProvider(params) {
|
|
3945
|
-
return this.connection.sendRequest(AGENT_METHODS.providers_set, params, emptyObjectResponse);
|
|
3946
|
-
}
|
|
3947
|
-
unstable_disableProvider(params) {
|
|
3948
|
-
return this.connection.sendRequest(AGENT_METHODS.providers_disable, params, emptyObjectResponse);
|
|
3949
|
-
}
|
|
3950
|
-
logout(params) {
|
|
3951
|
-
return this.connection.sendRequest(AGENT_METHODS.logout, params, emptyObjectResponse);
|
|
3952
|
-
}
|
|
3953
|
-
prompt(params) {
|
|
3954
|
-
return this.connection.sendRequest(AGENT_METHODS.session_prompt, params);
|
|
3955
|
-
}
|
|
3956
|
-
cancel(params) {
|
|
3957
|
-
return this.connection.sendNotification(AGENT_METHODS.session_cancel, params);
|
|
3907
|
+
constructor(id, sessionId, conn) {
|
|
3908
|
+
this.id = id;
|
|
3909
|
+
this.sessionId = sessionId;
|
|
3910
|
+
this.connection = conn;
|
|
3958
3911
|
}
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
return this.connection.sendRequest(method, params, spec?.mapResponse, options);
|
|
3912
|
+
static create(id, sessionId, conn) {
|
|
3913
|
+
return new TerminalHandle(id, sessionId, conn);
|
|
3962
3914
|
}
|
|
3963
|
-
|
|
3964
|
-
return this.connection.
|
|
3915
|
+
currentOutput() {
|
|
3916
|
+
return this.connection.sendRequest(CLIENT_METHODS.terminal_output, {
|
|
3917
|
+
sessionId: this.sessionId,
|
|
3918
|
+
terminalId: this.id
|
|
3919
|
+
});
|
|
3965
3920
|
}
|
|
3966
|
-
|
|
3967
|
-
return this.
|
|
3921
|
+
waitForExit() {
|
|
3922
|
+
return this.connection.sendRequest(CLIENT_METHODS.terminal_wait_for_exit, {
|
|
3923
|
+
sessionId: this.sessionId,
|
|
3924
|
+
terminalId: this.id
|
|
3925
|
+
});
|
|
3968
3926
|
}
|
|
3969
|
-
|
|
3970
|
-
return this.
|
|
3927
|
+
kill() {
|
|
3928
|
+
return this.connection.sendRequest(CLIENT_METHODS.terminal_kill, {
|
|
3929
|
+
sessionId: this.sessionId,
|
|
3930
|
+
terminalId: this.id
|
|
3931
|
+
}, emptyObjectResponse);
|
|
3971
3932
|
}
|
|
3972
|
-
|
|
3973
|
-
return this.connection.
|
|
3933
|
+
release() {
|
|
3934
|
+
return this.connection.sendRequest(CLIENT_METHODS.terminal_release, {
|
|
3935
|
+
sessionId: this.sessionId,
|
|
3936
|
+
terminalId: this.id
|
|
3937
|
+
}, emptyObjectResponse);
|
|
3974
3938
|
}
|
|
3975
|
-
|
|
3976
|
-
|
|
3939
|
+
async[Symbol.asyncDispose]() {
|
|
3940
|
+
await this.release();
|
|
3977
3941
|
}
|
|
3978
3942
|
}
|
|
3979
|
-
|
|
3980
3943
|
// src/providers/acp-adapter.ts
|
|
3981
3944
|
init_package();
|
|
3982
3945
|
|
|
@@ -4784,7 +4747,7 @@ class SwarmAcpClient {
|
|
|
4784
4747
|
}
|
|
4785
4748
|
|
|
4786
4749
|
class ACPSession {
|
|
4787
|
-
|
|
4750
|
+
agent;
|
|
4788
4751
|
client;
|
|
4789
4752
|
process;
|
|
4790
4753
|
config;
|
|
@@ -4800,8 +4763,8 @@ class ACPSession {
|
|
|
4800
4763
|
completionPromise;
|
|
4801
4764
|
completionResolve;
|
|
4802
4765
|
ephemeralTokenId = null;
|
|
4803
|
-
constructor(
|
|
4804
|
-
this.
|
|
4766
|
+
constructor(agent, client, process2, config, sessionId, providerName, target, providerMeta, ephemeralTokenId) {
|
|
4767
|
+
this.agent = agent;
|
|
4805
4768
|
this.client = client;
|
|
4806
4769
|
this.process = process2;
|
|
4807
4770
|
this.config = config;
|
|
@@ -4830,7 +4793,7 @@ class ACPSession {
|
|
|
4830
4793
|
return;
|
|
4831
4794
|
this.aborted = true;
|
|
4832
4795
|
try {
|
|
4833
|
-
await this.
|
|
4796
|
+
await this.agent.notify(methods.agent.session.cancel, { sessionId: this.sessionId });
|
|
4834
4797
|
await Promise.race([this.completionPromise, Bun.sleep(ACP_CANCEL_SETTLE_MS)]);
|
|
4835
4798
|
} catch (err) {
|
|
4836
4799
|
this.emit({
|
|
@@ -4874,7 +4837,7 @@ class ACPSession {
|
|
|
4874
4837
|
async runPrompt() {
|
|
4875
4838
|
let result;
|
|
4876
4839
|
try {
|
|
4877
|
-
const response = await this.
|
|
4840
|
+
const response = await this.agent.request(methods.agent.session.prompt, {
|
|
4878
4841
|
sessionId: this.sessionId,
|
|
4879
4842
|
prompt: [{ type: "text", text: this.config.prompt }]
|
|
4880
4843
|
});
|
|
@@ -5007,17 +4970,17 @@ class ACPAdapter2 {
|
|
|
5007
4970
|
}
|
|
5008
4971
|
let session = null;
|
|
5009
4972
|
const preSessionEvents = [];
|
|
5010
|
-
const
|
|
4973
|
+
const client2 = new SwarmAcpClient((event) => {
|
|
5011
4974
|
if (session)
|
|
5012
4975
|
session.emitFromAcp(event);
|
|
5013
4976
|
else
|
|
5014
4977
|
preSessionEvents.push(event);
|
|
5015
4978
|
}, target);
|
|
5016
4979
|
const stream = ndJsonStream2(fileSinkWritableStream(proc.stdin), proc.stdout);
|
|
5017
|
-
const
|
|
4980
|
+
const agent = client().onRequest(methods.client.session.requestPermission, ({ params }) => client2.requestPermission(params)).onNotification(methods.client.session.update, ({ params }) => client2.sessionUpdate(params)).connect(stream).agent;
|
|
5018
4981
|
let ephemeralToken = null;
|
|
5019
4982
|
try {
|
|
5020
|
-
await
|
|
4983
|
+
await agent.request(methods.agent.initialize, {
|
|
5021
4984
|
protocolVersion: PROTOCOL_VERSION,
|
|
5022
4985
|
clientInfo: { name: "agent-swarm", version: package_default.version },
|
|
5023
4986
|
clientCapabilities: { session: { configOptions: { boolean: {} } } }
|
|
@@ -5025,7 +4988,7 @@ class ACPAdapter2 {
|
|
|
5025
4988
|
ephemeralToken = await mintAcpSessionToken(config.apiUrl, config.apiKey, config.agentId, config.taskId);
|
|
5026
4989
|
const installedServers = await fetchInstalledMcpServers(config.apiUrl, config.apiKey, config.agentId, "claude");
|
|
5027
4990
|
const sessionMeta = target.sessionMeta?.(config);
|
|
5028
|
-
const newSession = await
|
|
4991
|
+
const newSession = await agent.request(methods.agent.session.new, {
|
|
5029
4992
|
...sessionMeta ? { _meta: sessionMeta } : {},
|
|
5030
4993
|
cwd: config.cwd,
|
|
5031
4994
|
mcpServers: [
|
|
@@ -5042,8 +5005,10 @@ class ACPAdapter2 {
|
|
|
5042
5005
|
...toAcpMcpServers(installedServers)
|
|
5043
5006
|
]
|
|
5044
5007
|
});
|
|
5045
|
-
const configOptions = await applyConfiguredOptions(
|
|
5046
|
-
|
|
5008
|
+
const configOptions = await applyConfiguredOptions({
|
|
5009
|
+
setSessionConfigOption: (params) => agent.request(methods.agent.session.setConfigOption, params)
|
|
5010
|
+
}, newSession.sessionId, newSession.configOptions ?? [], target.configuredOptions(config));
|
|
5011
|
+
session = new ACPSession(agent, client2, proc, config, newSession.sessionId, this.name, target, {
|
|
5047
5012
|
target: target.target,
|
|
5048
5013
|
configOptions: sanitizeAcpConfigOptions(configOptions)
|
|
5049
5014
|
}, ephemeralToken.tokenId);
|