@desplega.ai/agent-swarm 1.152.2 → 1.154.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 +2 -2
- package/dist/{acp-adapter-pfeje2v5.js → acp-adapter-eb2aj8xy.js} +4 -4
- package/dist/{actions-0sttc7f5.js → actions-kpnwp1kz.js} +31 -27
- package/dist/{anthropic-messages-2y8nktar.js → anthropic-messages-9vqsbznt.js} +112 -84
- package/dist/{app-p8teva95.js → app-zk1apkf6.js} +10 -7
- package/dist/{assistant-r45jnsrt.js → assistant-kwq4y50q.js} +32 -28
- package/dist/{azure-openai-responses-f38x2avq.js → azure-openai-responses-04qwdwfq.js} +27 -13
- package/dist/{boot-reembed-je26h5y7.js → boot-reembed-22hd3jjn.js} +9 -7
- package/dist/{boot-reembed-1qmybsd4.js → boot-reembed-qe168424.js} +10 -8
- package/dist/{boot-scrub-logs-gte3h1mm.js → boot-scrub-logs-pkdpsrjd.js} +7 -5
- package/dist/{claude-adapter-csc1mzka.js → claude-adapter-3fx90nww.js} +18 -16
- package/dist/{claude-managed-adapter-dsmkcrjy.js → claude-managed-adapter-ea2aga6w.js} +3 -3
- package/dist/{claude-sdk-session-fcd6f078.js → claude-sdk-session-z7fahf1k.js} +18 -16
- package/dist/{cli-r2fpe7cx.js → cli-00w2c66p.js} +61 -55
- package/dist/{cli-wbyk465z.js → cli-09y3tjxz.js} +1 -1
- package/dist/{cli-ht5rs63n.js → cli-0e31nm4n.js} +16 -7
- package/dist/cli-0x5qzvkg.js +4279 -0
- package/dist/{cli-d3p82erb.js → cli-18amys3y.js} +9 -9
- package/dist/{cli-4ahpr4sw.js → cli-1jpjafw4.js} +5 -5
- package/dist/{cli-jbmc0r7r.js → cli-243tzws8.js} +1 -1
- package/dist/{cli-ch38q5z4.js → cli-24k806sc.js} +6789 -2542
- package/dist/cli-3bkz2p7j.js +2828 -0
- package/dist/cli-3er6gcsn.js +1849 -0
- package/dist/cli-4k7jazkq.js +3339 -0
- package/dist/{cli-c4eeb5q2.js → cli-5b6b62tz.js} +1 -1
- package/dist/{cli-qd65dvr6.js → cli-5vs0nh43.js} +65 -44
- package/dist/{cli-z3wkng35.js → cli-6r3cgpk2.js} +224 -156
- package/dist/{cli-pgj4a5fb.js → cli-71cj99hx.js} +4 -3
- package/dist/cli-8sea27q4.js +14075 -0
- package/dist/{cli-jvy9qgjs.js → cli-913yakhv.js} +22 -7
- package/dist/{cli-pf9q3696.js → cli-927erqqt.js} +5 -2
- package/dist/cli-95jnpnqg.js +230 -0
- package/dist/{cli-wpv5rgg2.js → cli-abp3g4ax.js} +15 -2
- package/dist/{cli-ckz5t2hb.js → cli-acy6bfhr.js} +10 -7
- package/dist/{cli-4yc5d8fk.js → cli-avkd6mqv.js} +50 -0
- package/dist/{cli-8wrympd7.js → cli-bzr0ftht.js} +26 -7
- package/dist/{cli-qn042eh7.js → cli-c1v10xb2.js} +194 -1913
- package/dist/cli-cgj4hc12.js +18902 -0
- package/dist/{cli-2nnd56zt.js → cli-e0pg4zeh.js} +3 -2
- package/dist/{cli-r84ctdxn.js → cli-e31ehqwy.js} +2 -2
- package/dist/{cli-gphgnvpf.js → cli-e3229na9.js} +3 -3
- package/dist/{cli-gpqcs935.js → cli-e3cyf59d.js} +2 -2
- package/dist/{cli-s25avqg9.js → cli-e781c6f9.js} +1 -0
- package/dist/{cli-s2qjdd6z.js → cli-eetrvv91.js} +1 -1
- package/dist/{cli-j4nv2wqy.js → cli-fdzg6jhf.js} +10 -4
- package/dist/{cli-fm4ytsdk.js → cli-g2h29qar.js} +2 -2
- package/dist/{cli-zvgj5zg8.js → cli-ge67p080.js} +302 -3497
- package/dist/cli-h38x0qhg.js +6912 -0
- package/dist/{cli-9xvdm3bx.js → cli-h60qfasa.js} +742 -278
- package/dist/{cli-jew3jda5.js → cli-hws0vn86.js} +2 -2
- package/dist/{cli-j8dggbcr.js → cli-k0g1sjzm.js} +23 -31
- package/dist/{cli-xw7vak96.js → cli-kp3qs53m.js} +5 -5
- package/dist/{cli-rgvp6r2x.js → cli-mcnhgnn1.js} +193 -4
- package/dist/{cli-zvkq5csn.js → cli-myaxtgh8.js} +7 -6
- package/dist/{cli-56h18ng2.js → cli-n62atwh9.js} +1 -1
- package/dist/cli-n7h1kqpf.js +29 -0
- package/dist/{cli-fmy65jdn.js → cli-pf1v8xhb.js} +7 -5
- package/dist/{cli-xy1cchaf.js → cli-q85qhckh.js} +238 -11
- package/dist/{cli-3bpzj8me.js → cli-r1d3dzt6.js} +2 -2
- package/dist/{pi-mono-adapter-jcqt71cg.js → cli-rxkqvngf.js} +67343 -101083
- package/dist/{cli-kj76p1ez.js → cli-scwq51gn.js} +13 -7
- package/dist/{cli-b9dd0h3k.js → cli-stwsmd6k.js} +3 -2
- package/dist/{cli-c2mk1kgf.js → cli-v4en75c5.js} +8 -1
- package/dist/{cli-z61ykvam.js → cli-wg04s9kr.js} +4 -3
- package/dist/cli-yn0a417a.js +4069 -0
- package/dist/{cli-zfzznn7c.js → cli-ytxs7mn1.js} +26 -2
- package/dist/{cli-4j8k1m4w.js → cli-zt1227k1.js} +1162 -192
- package/dist/cli.js +28 -35
- package/dist/{codex-adapter-fxmpsabw.js → codex-adapter-ttdm995v.js} +12 -11
- package/dist/{codex-hook-8jexc34x.js → codex-hook-8gx7bcz0.js} +3 -3
- package/dist/{codex-session-runner-rr1e47ea.js → codex-session-runner-3v8nh4c8.js} +12 -11
- package/dist/{commands-0f5rxz51.js → commands-1cxwbhhq.js} +7 -5
- package/dist/{db-r3jxf3wy.js → db-y9zwsr79.js} +25 -5
- package/dist/{dispatcher-06vph6q4.js → dispatcher-9m9zss36.js} +30 -26
- package/dist/dsh-adapter-gsb2qqf9.js +19 -0
- package/dist/{e2b-413b8t4v.js → e2b-93x1k0j5.js} +6 -7
- package/dist/{google-generative-ai-ndjmj5fa.js → google-generative-ai-gwwrnzqn.js} +33 -73
- package/dist/{google-vertex-fr665tqs.js → google-vertex-5wfawpwz.js} +38 -68
- package/dist/{handlers-0hgtc910.js → handlers-36fm1bwn.js} +33 -29
- package/dist/{hook-9kvrv1er.js → hook-pntw4r8h.js} +12 -10
- package/dist/{hook-fbfhkat3.js → hook-vwq8y26p.js} +13 -11
- package/dist/{http-xbyx8k5j.js → http-20jesakk.js} +357 -261
- package/dist/{index-jsw3aynb.js → index-6artrehg.js} +30 -26
- package/dist/{cli-pdz9qde4.js → index-9ch1n761.js} +10 -11
- package/dist/{index-rnyahfn5.js → index-9n5z2492.js} +30 -26
- package/dist/{index-66xz5e9j.js → index-h5gs261z.js} +521 -9
- package/dist/{index-tfsdxyv6.js → index-j5wrf1yw.js} +40 -25
- package/dist/{index-2sp0384z.js → index-kkeftv5h.js} +738 -21
- package/dist/{index-sgk50mbg.js → index-m2xqpz5r.js} +31 -27
- package/dist/{index-gpfn1741.js → index-m9ks8a7t.js} +9 -7
- package/dist/index-w097eg0x.js +5 -0
- package/dist/jiti-loader-b4837mtm.js +34 -0
- package/dist/jiti-static-loader-q2g5ds0y.js +31267 -0
- package/dist/{keepalive-s3xpr7sw.js → keepalive-pwxvxd2c.js} +9 -7
- package/dist/{lead-rq4n5r16.js → lead-m789wqa3.js} +46 -41
- package/dist/{maintenance-f0atj1ab.js → maintenance-bvg6w7e2.js} +10 -8
- package/dist/{mistral-conversations-qhr84ph3.js → mistral-conversations-zx0kn554.js} +24 -18
- package/dist/{node-x1g4v0pq.js → node-5qtycf6a.js} +16 -11
- package/dist/{oauth-refresh-sweep-q0t3bxre.js → oauth-refresh-sweep-6v4bd737.js} +8 -6
- package/dist/{onboard-br5j1kch.js → onboard-snckpcj1.js} +115 -35
- package/dist/{openai-codex-responses-wy6a43wd.js → openai-codex-responses-4vjqzvjp.js} +33 -27
- package/dist/{openai-completions-32rdwmze.js → openai-completions-pxsmym7g.js} +52 -64
- package/dist/{openai-responses-6xwf7bzg.js → openai-responses-tmn0rqp0.js} +23 -24
- package/dist/{opencode-adapter-28axqa09.js → opencode-adapter-qbmv4tpy.js} +6 -6
- package/dist/{otel-impl-vdqge2nt.js → otel-impl-e0ytens5.js} +4 -4
- package/dist/{pi-messages-b1mbr6gp.js → pi-messages-txpjj39q.js} +3 -3
- package/dist/pi-mono-adapter-c4ggemhz.js +1316 -0
- package/dist/{pricing-refresh-hb3691fd.js → pricing-refresh-52g2ywrw.js} +9 -7
- package/dist/{rbac-roles-t78xt39b.js → rbac-roles-5455kfdn.js} +8 -6
- package/dist/{rbac-roles-jh280k9g.js → rbac-roles-hbf0xa52.js} +9 -7
- package/dist/{render-v2-7p8r2ymg.js → render-v2-npm8xdzh.js} +16 -9
- package/dist/{seed-pricing-hf889enh.js → seed-pricing-650wbr1n.js} +8 -6
- package/dist/{setup-w6mb03jv.js → setup-k1mew5rf.js} +4 -5
- package/dist/virtual-modules-2q5b2pk4.js +54 -0
- package/dist/{work-objects-nt8gy1kj.js → work-objects-2ea3kvwg.js} +33 -29
- package/dist/{worker-dwy617t0.js → worker-ec6hvc4m.js} +46 -41
- package/openapi.json +109 -16
- package/package.json +7 -6
- package/plugin/opencode-plugins/lib/memory-raters.ts +7 -0
- package/src/be/automation-preflight.ts +6 -4
- package/src/be/db/agents.ts +75 -2
- package/src/be/db/tasks/read.ts +2 -0
- package/src/be/db/tasks/write.ts +7 -1
- package/src/be/db.ts +140 -18
- package/src/be/extensions/db.ts +35 -4
- package/src/be/memory/raters/llm.ts +2 -6
- package/src/be/memory/raters/noop.ts +2 -3
- package/src/be/memory/raters/registry.ts +4 -10
- package/src/be/migrations/157_defer_provenance_and_marker.sql +27 -0
- package/src/be/models-catalog.ts +2 -0
- package/src/be/modelsdev-cache.json +213 -0
- package/src/be/rbac-audit.ts +2 -0
- package/src/be/seed/agent-fs-provision.ts +23 -0
- package/src/be/seed-pricing.ts +3 -1
- package/src/be/swarm-config-guard.ts +1 -0
- package/src/commands/onboard/compose-generator.ts +16 -1
- package/src/commands/onboard/env-generator.ts +14 -1
- package/src/commands/onboard/manifest.ts +1 -0
- package/src/commands/onboard/steps/integration-slack.tsx +56 -16
- package/src/commands/onboard/steps/review.tsx +5 -0
- package/src/commands/onboard/types.ts +6 -0
- package/src/commands/onboard.tsx +5 -1
- package/src/commands/provider-credentials.ts +14 -2
- package/src/commands/runner.ts +18 -2
- package/src/extensions/identity.ts +15 -7
- package/src/extensions/lifecycle.ts +15 -21
- package/src/hooks/codex-hook.ts +7 -1
- package/src/http/agents.ts +12 -4
- package/src/http/config.ts +1 -1
- package/src/http/core.ts +5 -3
- package/src/http/extensions.ts +108 -34
- package/src/http/poll.ts +7 -0
- package/src/http/schedules.ts +10 -0
- package/src/http/script-runs.ts +35 -26
- package/src/http/status.ts +24 -11
- package/src/http/tasks.ts +6 -1
- package/src/prompts/base-prompt.ts +15 -7
- package/src/prompts/memories.ts +5 -7
- package/src/prompts/session-templates.ts +3 -2
- package/src/prompts/steering-delivery.ts +2 -0
- package/src/providers/claude-managed-models.ts +8 -0
- package/src/providers/codex-adapter.ts +3 -6
- package/src/providers/codex-models.ts +15 -1
- package/src/providers/dsh-adapter.ts +248 -0
- package/src/providers/index.ts +5 -1
- package/src/providers/modelsdev-reasoning.json +50 -0
- package/src/providers/pi-mono-extension.ts +2 -5
- package/src/rbac/legacy-policy.ts +15 -1
- package/src/rbac/types.ts +2 -0
- package/src/server.ts +7 -1
- package/src/slack/ack.ts +43 -8
- package/src/slack/app.ts +32 -10
- package/src/slack/config.ts +29 -0
- package/src/slack/handlers.ts +7 -1
- package/src/slack/render-v2.ts +186 -17
- package/src/slack/responses.ts +1 -3
- package/src/slack/task-output.ts +66 -8
- package/src/slack/thread-buffer.ts +27 -3
- package/src/telemetry.ts +2 -3
- package/src/tests/agent-fs-provision-seeder.test.ts +56 -2
- package/src/tests/agents-harness-provider.test.ts +19 -0
- package/src/tests/agents-list-model-display.test.ts +60 -1
- package/src/tests/base-prompt.test.ts +25 -0
- package/src/tests/claude-managed-adapter.test.ts +6 -0
- package/src/tests/codex-gpt6-release.test.ts +97 -0
- package/src/tests/codex-steering-hook.test.ts +2 -2
- package/src/tests/config-api-only-keys.test.ts +9 -0
- package/src/tests/context-window.test.ts +1 -0
- package/src/tests/db-task-read-contract.test.ts +9 -0
- package/src/tests/db-task-write-contract.test.ts +9 -0
- package/src/tests/defer-task.test.ts +115 -16
- package/src/tests/dsh-adapter.test.ts +276 -0
- package/src/tests/e2e-nightly-report.test.ts +3 -3
- package/src/tests/e2e-redact.test.ts +2 -0
- package/src/tests/env-flag.test.ts +6 -0
- package/src/tests/extension-agent-visibility.test.ts +474 -0
- package/src/tests/extensions-db.test.ts +41 -0
- package/src/tests/extensions-http.test.ts +148 -4
- package/src/tests/extensions-lifecycle.test.ts +21 -1
- package/src/tests/extensions-mcp-tools.test.ts +9 -5
- package/src/tests/fetch-resolved-env.test.ts +43 -0
- package/src/tests/internal-ai/complete-structured.test.ts +32 -9
- package/src/tests/internal-ai/credentials.test.ts +4 -4
- package/src/tests/internal-ai/models.test.ts +20 -0
- package/src/tests/memory-rate-tool.test.ts +7 -10
- package/src/tests/memory-rater-defaults.test.ts +23 -0
- package/src/tests/memory-rater-e2e.test.ts +2 -3
- package/src/tests/migration-046-budgets.test.ts +2 -0
- package/src/tests/model-control.test.ts +2 -2
- package/src/tests/onboard-compose.test.ts +14 -0
- package/src/tests/onboard-env.test.ts +17 -0
- package/src/tests/onboard-manifest.test.ts +12 -0
- package/src/tests/opus-5-5-registry.test.ts +48 -0
- package/src/tests/pricing-refresh.test.ts +1 -1
- package/src/tests/pricing-routes.test.ts +15 -3
- package/src/tests/provider-registration.test.ts +5 -2
- package/src/tests/rbac-admission-e2e.test.ts +54 -0
- package/src/tests/rbac-e2e-helpers.ts +2 -0
- package/src/tests/rbac-engine.test.ts +32 -0
- package/src/tests/rbac-wire-e2e.test.ts +33 -0
- package/src/tests/reasoning-effort.test.ts +8 -0
- package/src/tests/reload-config.test.ts +33 -0
- package/src/tests/script-connections.test.ts +3 -0
- package/src/tests/session-costs-model-key-normalize.test.ts +1 -0
- package/src/tests/slack-config.test.ts +136 -0
- package/src/tests/slack-mode-lifecycle.test.ts +69 -0
- package/src/tests/slack-render-v2.test.ts +446 -16
- package/src/tests/slack-steering.test.ts +69 -1
- package/src/tests/slack-task-output.test.ts +33 -12
- package/src/tests/status.test.ts +22 -2
- package/src/tests/steering-core.test.ts +35 -0
- package/src/tests/steering-delivery.test.ts +39 -0
- package/src/tests/steering-transport.test.ts +2 -2
- package/src/tests/task-tool-preload-mcp.test.ts +3 -1
- package/src/tests/telemetry-init.test.ts +18 -0
- package/src/tests/workflow-live-recovery.test.ts +126 -0
- package/src/tests/workflow-llm.test.ts +3 -3
- package/src/tools/defer-task.ts +64 -26
- package/src/tools/extension-common.ts +4 -0
- package/src/tools/extension-install.ts +1 -1
- package/src/tools/extension-list.ts +4 -3
- package/src/tools/join-swarm.ts +1 -1
- package/src/tools/schedules/create-schedule.ts +11 -1
- package/src/tools/schedules/patch-schedule.ts +5 -0
- package/src/tools/schedules/update-schedule.ts +5 -0
- package/src/tools/send-task.ts +6 -0
- package/src/tools/utils.ts +1 -1
- package/src/types.ts +30 -8
- package/src/utils/context-window.ts +1 -0
- package/src/utils/credentials.ts +8 -0
- package/src/utils/internal-ai/complete-structured.ts +8 -0
- package/src/utils/internal-ai/models.ts +5 -5
- package/src/utils/memory-raters.ts +3 -0
- package/src/workflows/engine.ts +28 -0
- package/src/workflows/recovery.ts +7 -4
- package/templates/schedules/daily-status-report/content.md +25 -12
- package/templates/schedules/daily-workflow-health-audit/content.md +1 -1
- package/templates/skills/swarm-extensions/content.md +9 -5
- package/dist/cli-4wppfkcm.js +0 -16384
- package/dist/cli-55qrx3q8.js +0 -6041
- package/dist/cli-cg4vnyh4.js +0 -305
- package/dist/cli-jyetr64j.js +0 -52
- package/dist/cli-pp9ax9pa.js +0 -520
- package/dist/cli-qa66qaf0.js +0 -6076
- package/dist/cli-qghpvca2.js +0 -590
- package/dist/cli-rembwgt8.js +0 -861
- package/dist/cli-tcvj7j2r.js +0 -1971
- package/dist/cli-vfcth11k.js +0 -36
- package/dist/cli-w1d1bgkk.js +0 -1422
- package/dist/cli-y6x0gqtg.js +0 -5977
- package/dist/es5-tj3tn4jj.js +0 -844
- package/dist/index-1kq5hw2p.js +0 -467
- package/dist/index-1p8wdstt.js +0 -7
- package/dist/index-8fdjzb2f.js +0 -100
- package/dist/index-bxmwzbgw.js +0 -365
- package/dist/index-nzerxd5z.js +0 -7
- package/dist/index-pyymnzat.js +0 -1168
- package/dist/index-qv6atbab.js +0 -619
- package/dist/index-rja32qa7.js +0 -801
- package/dist/index-tzg5srfp.js +0 -211
- package/dist/index-vhncw983.js +0 -90
- package/dist/index-xk036zsk.js +0 -859
- package/dist/index-zyazbzcb.js +0 -6
- package/dist/{claude-managed-setup-48dwg9bv.js → claude-managed-setup-f5pmsyrp.js} +3 -3
package/dist/index-bxmwzbgw.js
DELETED
|
@@ -1,365 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
require_config,
|
|
3
|
-
require_protocols
|
|
4
|
-
} from "./cli-qa66qaf0.js";
|
|
5
|
-
import {
|
|
6
|
-
__esm,
|
|
7
|
-
__require
|
|
8
|
-
} from "./cli-bc05qbss.js";
|
|
9
|
-
|
|
10
|
-
// node_modules/@smithy/credential-provider-imds/dist-cjs/index.js
|
|
11
|
-
function httpRequest(options) {
|
|
12
|
-
return new Promise((resolve, reject) => {
|
|
13
|
-
const req = node_http.request({
|
|
14
|
-
method: "GET",
|
|
15
|
-
...options,
|
|
16
|
-
hostname: options.hostname?.replace(/^\[(.+)\]$/, "$1")
|
|
17
|
-
});
|
|
18
|
-
req.on("error", (err) => {
|
|
19
|
-
reject(Object.assign(new config.ProviderError("Unable to connect to instance metadata service"), err));
|
|
20
|
-
req.destroy();
|
|
21
|
-
});
|
|
22
|
-
req.on("timeout", () => {
|
|
23
|
-
reject(new config.ProviderError("TimeoutError from instance metadata service"));
|
|
24
|
-
req.destroy();
|
|
25
|
-
});
|
|
26
|
-
req.on("response", (res) => {
|
|
27
|
-
const { statusCode = 400 } = res;
|
|
28
|
-
if (statusCode < 200 || 300 <= statusCode) {
|
|
29
|
-
reject(Object.assign(new config.ProviderError("Error response received from instance metadata service"), { statusCode }));
|
|
30
|
-
req.destroy();
|
|
31
|
-
}
|
|
32
|
-
const chunks = [];
|
|
33
|
-
res.on("data", (chunk) => {
|
|
34
|
-
chunks.push(chunk);
|
|
35
|
-
});
|
|
36
|
-
res.on("end", () => {
|
|
37
|
-
resolve(Buffer.concat(chunks));
|
|
38
|
-
req.destroy();
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
req.end();
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
var node_url, config, node_http, protocols, isImdsCredentials = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.AccessKeyId === "string" && typeof arg.SecretAccessKey === "string" && typeof arg.Token === "string" && typeof arg.Expiration === "string", fromImdsCredentials = (creds) => ({
|
|
45
|
-
accessKeyId: creds.AccessKeyId,
|
|
46
|
-
secretAccessKey: creds.SecretAccessKey,
|
|
47
|
-
sessionToken: creds.Token,
|
|
48
|
-
expiration: new Date(creds.Expiration),
|
|
49
|
-
...creds.AccountId && { accountId: creds.AccountId }
|
|
50
|
-
}), DEFAULT_TIMEOUT = 1000, DEFAULT_MAX_RETRIES = 0, providerConfigFromInit = ({ maxRetries = DEFAULT_MAX_RETRIES, timeout = DEFAULT_TIMEOUT }) => ({ maxRetries, timeout }), retry = (toRetry, maxRetries) => {
|
|
51
|
-
let promise = toRetry();
|
|
52
|
-
for (let i = 0;i < maxRetries; i++) {
|
|
53
|
-
promise = promise.catch(toRetry);
|
|
54
|
-
}
|
|
55
|
-
return promise;
|
|
56
|
-
}, ENV_CMDS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI", ENV_CMDS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI", ENV_CMDS_AUTH_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN", fromContainerMetadata = (init = {}) => {
|
|
57
|
-
const { timeout, maxRetries } = providerConfigFromInit(init);
|
|
58
|
-
return () => retry(async () => {
|
|
59
|
-
const requestOptions = await getCmdsUri({ logger: init.logger });
|
|
60
|
-
const credsResponse = JSON.parse(await requestFromEcsImds(timeout, requestOptions));
|
|
61
|
-
if (!isImdsCredentials(credsResponse)) {
|
|
62
|
-
throw new config.CredentialsProviderError("Invalid response received from instance metadata service.", {
|
|
63
|
-
logger: init.logger
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
return fromImdsCredentials(credsResponse);
|
|
67
|
-
}, maxRetries);
|
|
68
|
-
}, requestFromEcsImds = async (timeout, options) => {
|
|
69
|
-
if (process.env[ENV_CMDS_AUTH_TOKEN]) {
|
|
70
|
-
options.headers = {
|
|
71
|
-
...options.headers,
|
|
72
|
-
Authorization: process.env[ENV_CMDS_AUTH_TOKEN]
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
const buffer = await httpRequest({
|
|
76
|
-
...options,
|
|
77
|
-
timeout
|
|
78
|
-
});
|
|
79
|
-
return buffer.toString();
|
|
80
|
-
}, CMDS_IP = "169.254.170.2", GREENGRASS_HOSTS, GREENGRASS_PROTOCOLS, getCmdsUri = async ({ logger }) => {
|
|
81
|
-
if (process.env[ENV_CMDS_RELATIVE_URI]) {
|
|
82
|
-
return {
|
|
83
|
-
hostname: CMDS_IP,
|
|
84
|
-
path: process.env[ENV_CMDS_RELATIVE_URI]
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
if (process.env[ENV_CMDS_FULL_URI]) {
|
|
88
|
-
const parsed = node_url.parse(process.env[ENV_CMDS_FULL_URI]);
|
|
89
|
-
if (!parsed.hostname || !(parsed.hostname in GREENGRASS_HOSTS)) {
|
|
90
|
-
throw new config.CredentialsProviderError(`${parsed.hostname} is not a valid container metadata service hostname`, {
|
|
91
|
-
tryNextLink: false,
|
|
92
|
-
logger
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
if (!parsed.protocol || !(parsed.protocol in GREENGRASS_PROTOCOLS)) {
|
|
96
|
-
throw new config.CredentialsProviderError(`${parsed.protocol} is not a valid container metadata service protocol`, {
|
|
97
|
-
tryNextLink: false,
|
|
98
|
-
logger
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
return {
|
|
102
|
-
...parsed,
|
|
103
|
-
port: parsed.port ? parseInt(parsed.port, 10) : undefined
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
throw new config.CredentialsProviderError("The container metadata credential provider cannot be used unless" + ` the ${ENV_CMDS_RELATIVE_URI} or ${ENV_CMDS_FULL_URI} environment` + " variable is set", {
|
|
107
|
-
tryNextLink: false,
|
|
108
|
-
logger
|
|
109
|
-
});
|
|
110
|
-
}, InstanceMetadataV1FallbackError, $Endpoint = undefined, ENV_ENDPOINT_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT", CONFIG_ENDPOINT_NAME = "ec2_metadata_service_endpoint", ENDPOINT_CONFIG_OPTIONS, EndpointMode, ENV_ENDPOINT_MODE_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE", CONFIG_ENDPOINT_MODE_NAME = "ec2_metadata_service_endpoint_mode", ENDPOINT_MODE_CONFIG_OPTIONS, getInstanceMetadataEndpoint = async () => protocols.parseUrl(await getFromEndpointConfig() || await getFromEndpointModeConfig()), getFromEndpointConfig = async () => config.loadConfig(ENDPOINT_CONFIG_OPTIONS)(), getFromEndpointModeConfig = async () => {
|
|
111
|
-
const endpointMode = await config.loadConfig(ENDPOINT_MODE_CONFIG_OPTIONS)();
|
|
112
|
-
switch (endpointMode) {
|
|
113
|
-
case EndpointMode.IPv4:
|
|
114
|
-
return $Endpoint.IPv4;
|
|
115
|
-
case EndpointMode.IPv6:
|
|
116
|
-
return $Endpoint.IPv6;
|
|
117
|
-
default:
|
|
118
|
-
throw new Error(`Unsupported endpoint mode: ${endpointMode}.` + ` Select from ${Object.values(EndpointMode)}`);
|
|
119
|
-
}
|
|
120
|
-
}, STATIC_STABILITY_REFRESH_INTERVAL_SECONDS, STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS, STATIC_STABILITY_DOC_URL = "https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html", getExtendedInstanceMetadataCredentials = (credentials, logger) => {
|
|
121
|
-
const refreshInterval = STATIC_STABILITY_REFRESH_INTERVAL_SECONDS + Math.floor(Math.random() * STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS);
|
|
122
|
-
const newExpiration = new Date(Date.now() + refreshInterval * 1000);
|
|
123
|
-
logger.warn("Attempting credential expiration extension due to a credential service availability issue. A refresh of these " + `credentials will be attempted after ${new Date(newExpiration)}.
|
|
124
|
-
For more information, please visit: ` + STATIC_STABILITY_DOC_URL);
|
|
125
|
-
const originalExpiration = credentials.originalExpiration ?? credentials.expiration;
|
|
126
|
-
return {
|
|
127
|
-
...credentials,
|
|
128
|
-
...originalExpiration ? { originalExpiration } : {},
|
|
129
|
-
expiration: newExpiration
|
|
130
|
-
};
|
|
131
|
-
}, staticStabilityProvider = (provider, options = {}) => {
|
|
132
|
-
const logger = options?.logger || console;
|
|
133
|
-
let pastCredentials;
|
|
134
|
-
return async () => {
|
|
135
|
-
let credentials;
|
|
136
|
-
try {
|
|
137
|
-
credentials = await provider();
|
|
138
|
-
if (credentials.expiration && credentials.expiration.getTime() < Date.now()) {
|
|
139
|
-
credentials = getExtendedInstanceMetadataCredentials(credentials, logger);
|
|
140
|
-
}
|
|
141
|
-
} catch (e) {
|
|
142
|
-
if (pastCredentials) {
|
|
143
|
-
logger.warn("Credential renew failed: ", e);
|
|
144
|
-
credentials = getExtendedInstanceMetadataCredentials(pastCredentials, logger);
|
|
145
|
-
} else {
|
|
146
|
-
throw e;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
pastCredentials = credentials;
|
|
150
|
-
return credentials;
|
|
151
|
-
};
|
|
152
|
-
}, IMDS_PATH = "/latest/meta-data/iam/security-credentials/", IMDS_TOKEN_PATH = "/latest/api/token", AWS_EC2_METADATA_V1_DISABLED = "AWS_EC2_METADATA_V1_DISABLED", PROFILE_AWS_EC2_METADATA_V1_DISABLED = "ec2_metadata_v1_disabled", X_AWS_EC2_METADATA_TOKEN = "x-aws-ec2-metadata-token", fromInstanceMetadata = (init = {}) => staticStabilityProvider(getInstanceMetadataProvider(init), { logger: init.logger }), getInstanceMetadataProvider = (init = {}) => {
|
|
153
|
-
let disableFetchToken = false;
|
|
154
|
-
const { logger, profile } = init;
|
|
155
|
-
const { timeout, maxRetries } = providerConfigFromInit(init);
|
|
156
|
-
const getCredentials = async (maxRetries2, options) => {
|
|
157
|
-
const isImdsV1Fallback = disableFetchToken || options.headers?.[X_AWS_EC2_METADATA_TOKEN] == null;
|
|
158
|
-
if (isImdsV1Fallback) {
|
|
159
|
-
let fallbackBlockedFromProfile = false;
|
|
160
|
-
let fallbackBlockedFromProcessEnv = false;
|
|
161
|
-
const configValue = await config.loadConfig({
|
|
162
|
-
environmentVariableSelector: (env) => {
|
|
163
|
-
const envValue = env[AWS_EC2_METADATA_V1_DISABLED];
|
|
164
|
-
fallbackBlockedFromProcessEnv = !!envValue && envValue !== "false";
|
|
165
|
-
if (envValue === undefined) {
|
|
166
|
-
throw new config.CredentialsProviderError(`${AWS_EC2_METADATA_V1_DISABLED} not set in env, checking config file next.`, { logger: init.logger });
|
|
167
|
-
}
|
|
168
|
-
return fallbackBlockedFromProcessEnv;
|
|
169
|
-
},
|
|
170
|
-
configFileSelector: (profile2) => {
|
|
171
|
-
const profileValue = profile2[PROFILE_AWS_EC2_METADATA_V1_DISABLED];
|
|
172
|
-
fallbackBlockedFromProfile = !!profileValue && profileValue !== "false";
|
|
173
|
-
return fallbackBlockedFromProfile;
|
|
174
|
-
},
|
|
175
|
-
default: false
|
|
176
|
-
}, {
|
|
177
|
-
profile
|
|
178
|
-
})();
|
|
179
|
-
if (init.ec2MetadataV1Disabled || configValue) {
|
|
180
|
-
const causes = [];
|
|
181
|
-
if (init.ec2MetadataV1Disabled)
|
|
182
|
-
causes.push("credential provider initialization (runtime option ec2MetadataV1Disabled)");
|
|
183
|
-
if (fallbackBlockedFromProfile)
|
|
184
|
-
causes.push(`config file profile (${PROFILE_AWS_EC2_METADATA_V1_DISABLED})`);
|
|
185
|
-
if (fallbackBlockedFromProcessEnv)
|
|
186
|
-
causes.push(`process environment variable (${AWS_EC2_METADATA_V1_DISABLED})`);
|
|
187
|
-
throw new InstanceMetadataV1FallbackError(`AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${causes.join(", ")}].`);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
const imdsProfile = (await retry(async () => {
|
|
191
|
-
let profile2;
|
|
192
|
-
try {
|
|
193
|
-
profile2 = await getProfile(options);
|
|
194
|
-
} catch (err) {
|
|
195
|
-
if (err.statusCode === 401) {
|
|
196
|
-
disableFetchToken = false;
|
|
197
|
-
}
|
|
198
|
-
throw err;
|
|
199
|
-
}
|
|
200
|
-
return profile2;
|
|
201
|
-
}, maxRetries2)).trim();
|
|
202
|
-
return retry(async () => {
|
|
203
|
-
let creds;
|
|
204
|
-
try {
|
|
205
|
-
creds = await getCredentialsFromProfile(imdsProfile, options, init);
|
|
206
|
-
} catch (err) {
|
|
207
|
-
if (err.statusCode === 401) {
|
|
208
|
-
disableFetchToken = false;
|
|
209
|
-
}
|
|
210
|
-
throw err;
|
|
211
|
-
}
|
|
212
|
-
return creds;
|
|
213
|
-
}, maxRetries2);
|
|
214
|
-
};
|
|
215
|
-
return async () => {
|
|
216
|
-
const endpoint = await getInstanceMetadataEndpoint();
|
|
217
|
-
if (disableFetchToken) {
|
|
218
|
-
logger?.debug("AWS SDK Instance Metadata", "using v1 fallback (no token fetch)");
|
|
219
|
-
return getCredentials(maxRetries, { ...endpoint, timeout });
|
|
220
|
-
} else {
|
|
221
|
-
let token;
|
|
222
|
-
try {
|
|
223
|
-
token = (await getMetadataToken({ ...endpoint, timeout })).toString();
|
|
224
|
-
} catch (error) {
|
|
225
|
-
if (error?.statusCode === 400) {
|
|
226
|
-
throw Object.assign(error, {
|
|
227
|
-
message: "EC2 Metadata token request returned error"
|
|
228
|
-
});
|
|
229
|
-
} else if (error.message === "TimeoutError" || [403, 404, 405].includes(error.statusCode)) {
|
|
230
|
-
disableFetchToken = true;
|
|
231
|
-
}
|
|
232
|
-
logger?.debug("AWS SDK Instance Metadata", "using v1 fallback (initial)");
|
|
233
|
-
return getCredentials(maxRetries, { ...endpoint, timeout });
|
|
234
|
-
}
|
|
235
|
-
return getCredentials(maxRetries, {
|
|
236
|
-
...endpoint,
|
|
237
|
-
headers: {
|
|
238
|
-
[X_AWS_EC2_METADATA_TOKEN]: token
|
|
239
|
-
},
|
|
240
|
-
timeout
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
}, getMetadataToken = async (options) => httpRequest({
|
|
245
|
-
...options,
|
|
246
|
-
path: IMDS_TOKEN_PATH,
|
|
247
|
-
method: "PUT",
|
|
248
|
-
headers: {
|
|
249
|
-
"x-aws-ec2-metadata-token-ttl-seconds": "21600"
|
|
250
|
-
}
|
|
251
|
-
}), getProfile = async (options) => (await httpRequest({ ...options, path: IMDS_PATH })).toString(), getCredentialsFromProfile = async (profile, options, init) => {
|
|
252
|
-
const credentialsResponse = JSON.parse((await httpRequest({
|
|
253
|
-
...options,
|
|
254
|
-
path: IMDS_PATH + profile
|
|
255
|
-
})).toString());
|
|
256
|
-
if (!isImdsCredentials(credentialsResponse)) {
|
|
257
|
-
throw new config.CredentialsProviderError("Invalid response received from instance metadata service.", {
|
|
258
|
-
logger: init.logger
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
return fromImdsCredentials(credentialsResponse);
|
|
262
|
-
}, $DEFAULT_MAX_RETRIES, $DEFAULT_TIMEOUT, $ENV_CMDS_AUTH_TOKEN, $ENV_CMDS_FULL_URI, $ENV_CMDS_RELATIVE_URI, $fromContainerMetadata, $fromInstanceMetadata, $getInstanceMetadataEndpoint, $httpRequest, $providerConfigFromInit;
|
|
263
|
-
var init_dist_cjs = __esm(() => {
|
|
264
|
-
node_url = __require("node:url");
|
|
265
|
-
config = require_config();
|
|
266
|
-
node_http = __require("node:http");
|
|
267
|
-
protocols = require_protocols();
|
|
268
|
-
GREENGRASS_HOSTS = {
|
|
269
|
-
localhost: true,
|
|
270
|
-
"127.0.0.1": true
|
|
271
|
-
};
|
|
272
|
-
GREENGRASS_PROTOCOLS = {
|
|
273
|
-
"http:": true,
|
|
274
|
-
"https:": true
|
|
275
|
-
};
|
|
276
|
-
InstanceMetadataV1FallbackError = class InstanceMetadataV1FallbackError extends config.CredentialsProviderError {
|
|
277
|
-
tryNextLink;
|
|
278
|
-
name = "InstanceMetadataV1FallbackError";
|
|
279
|
-
constructor(message, tryNextLink = true) {
|
|
280
|
-
super(message, tryNextLink);
|
|
281
|
-
this.tryNextLink = tryNextLink;
|
|
282
|
-
Object.setPrototypeOf(this, InstanceMetadataV1FallbackError.prototype);
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
(function(Endpoint) {
|
|
286
|
-
Endpoint["IPv4"] = "http://169.254.169.254";
|
|
287
|
-
Endpoint["IPv6"] = "http://[fd00:ec2::254]";
|
|
288
|
-
})($Endpoint || ($Endpoint = {}));
|
|
289
|
-
ENDPOINT_CONFIG_OPTIONS = {
|
|
290
|
-
environmentVariableSelector: (env) => env[ENV_ENDPOINT_NAME],
|
|
291
|
-
configFileSelector: (profile) => profile[CONFIG_ENDPOINT_NAME],
|
|
292
|
-
default: undefined
|
|
293
|
-
};
|
|
294
|
-
(function(EndpointMode2) {
|
|
295
|
-
EndpointMode2["IPv4"] = "IPv4";
|
|
296
|
-
EndpointMode2["IPv6"] = "IPv6";
|
|
297
|
-
})(EndpointMode || (EndpointMode = {}));
|
|
298
|
-
ENDPOINT_MODE_CONFIG_OPTIONS = {
|
|
299
|
-
environmentVariableSelector: (env) => env[ENV_ENDPOINT_MODE_NAME],
|
|
300
|
-
configFileSelector: (profile) => profile[CONFIG_ENDPOINT_MODE_NAME],
|
|
301
|
-
default: EndpointMode.IPv4
|
|
302
|
-
};
|
|
303
|
-
STATIC_STABILITY_REFRESH_INTERVAL_SECONDS = 5 * 60;
|
|
304
|
-
STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS = 5 * 60;
|
|
305
|
-
$DEFAULT_MAX_RETRIES = DEFAULT_MAX_RETRIES;
|
|
306
|
-
$DEFAULT_TIMEOUT = DEFAULT_TIMEOUT;
|
|
307
|
-
$ENV_CMDS_AUTH_TOKEN = ENV_CMDS_AUTH_TOKEN;
|
|
308
|
-
$ENV_CMDS_FULL_URI = ENV_CMDS_FULL_URI;
|
|
309
|
-
$ENV_CMDS_RELATIVE_URI = ENV_CMDS_RELATIVE_URI;
|
|
310
|
-
$fromContainerMetadata = fromContainerMetadata;
|
|
311
|
-
$fromInstanceMetadata = fromInstanceMetadata;
|
|
312
|
-
$getInstanceMetadataEndpoint = getInstanceMetadataEndpoint;
|
|
313
|
-
$httpRequest = httpRequest;
|
|
314
|
-
$providerConfigFromInit = providerConfigFromInit;
|
|
315
|
-
});
|
|
316
|
-
init_dist_cjs();
|
|
317
|
-
|
|
318
|
-
export {
|
|
319
|
-
$DEFAULT_MAX_RETRIES as DEFAULT_MAX_RETRIES,
|
|
320
|
-
$DEFAULT_TIMEOUT as DEFAULT_TIMEOUT,
|
|
321
|
-
$ENV_CMDS_AUTH_TOKEN as ENV_CMDS_AUTH_TOKEN,
|
|
322
|
-
$ENV_CMDS_FULL_URI as ENV_CMDS_FULL_URI,
|
|
323
|
-
$ENV_CMDS_RELATIVE_URI as ENV_CMDS_RELATIVE_URI,
|
|
324
|
-
$Endpoint as Endpoint,
|
|
325
|
-
$fromContainerMetadata as fromContainerMetadata,
|
|
326
|
-
$fromInstanceMetadata as fromInstanceMetadata,
|
|
327
|
-
$getInstanceMetadataEndpoint as getInstanceMetadataEndpoint,
|
|
328
|
-
$httpRequest as httpRequest,
|
|
329
|
-
$providerConfigFromInit as providerConfigFromInit
|
|
330
|
-
};
|
|
331
|
-
export default {
|
|
332
|
-
get DEFAULT_MAX_RETRIES() {
|
|
333
|
-
return $DEFAULT_MAX_RETRIES;
|
|
334
|
-
},
|
|
335
|
-
get DEFAULT_TIMEOUT() {
|
|
336
|
-
return $DEFAULT_TIMEOUT;
|
|
337
|
-
},
|
|
338
|
-
get ENV_CMDS_AUTH_TOKEN() {
|
|
339
|
-
return $ENV_CMDS_AUTH_TOKEN;
|
|
340
|
-
},
|
|
341
|
-
get ENV_CMDS_FULL_URI() {
|
|
342
|
-
return $ENV_CMDS_FULL_URI;
|
|
343
|
-
},
|
|
344
|
-
get ENV_CMDS_RELATIVE_URI() {
|
|
345
|
-
return $ENV_CMDS_RELATIVE_URI;
|
|
346
|
-
},
|
|
347
|
-
get Endpoint() {
|
|
348
|
-
return $Endpoint;
|
|
349
|
-
},
|
|
350
|
-
get fromContainerMetadata() {
|
|
351
|
-
return $fromContainerMetadata;
|
|
352
|
-
},
|
|
353
|
-
get fromInstanceMetadata() {
|
|
354
|
-
return $fromInstanceMetadata;
|
|
355
|
-
},
|
|
356
|
-
get getInstanceMetadataEndpoint() {
|
|
357
|
-
return $getInstanceMetadataEndpoint;
|
|
358
|
-
},
|
|
359
|
-
get httpRequest() {
|
|
360
|
-
return $httpRequest;
|
|
361
|
-
},
|
|
362
|
-
get providerConfigFromInit() {
|
|
363
|
-
return $providerConfigFromInit;
|
|
364
|
-
}
|
|
365
|
-
};
|