@psnext/slingcli 2.5.20260719-2 → 2.5.20260722-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/bin/sling-default-package-policy.js +26 -0
  2. package/bin/sling.js +18 -23
  3. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/experimental/BufferJsonShapeDeserializer.js +182 -0
  4. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/experimental/ByteJsonShapeSerializer.js +473 -0
  5. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/experimental/BufferJsonShapeDeserializer.d.ts +29 -0
  6. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/experimental/ByteJsonShapeSerializer.d.ts +59 -0
  7. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/experimental/BufferJsonShapeDeserializer.d.ts +14 -0
  8. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/experimental/ByteJsonShapeSerializer.d.ts +30 -0
  9. package/node_modules/@aws-sdk/core/package.json +2 -1
  10. package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
  11. package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/package.json +33 -33
  12. package/node_modules/@aws-sdk/credential-provider-http/package.json +2 -2
  13. package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
  14. package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
  15. package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
  16. package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
  17. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/package.json +3 -3
  18. package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
  19. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
  20. package/node_modules/@aws-sdk/middleware-websocket/package.json +2 -2
  21. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
  22. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
  23. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
  24. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
  25. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
  26. package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/package.json +33 -33
  27. package/node_modules/@aws-sdk/nested-clients/package.json +2 -2
  28. package/node_modules/@earendil-works/pi-ai/dist/providers/data/google.json +1 -1
  29. package/node_modules/@earendil-works/pi-ai/dist/providers/data/kimi-coding.json +1 -1
  30. package/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
  31. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  32. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  33. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  34. package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.browser.js +3 -1
  35. package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js +28 -10
  36. package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.browser.js +34 -11
  37. package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +34 -11
  38. package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +1 -0
  39. package/node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/getEndpointFromConfig.js +8 -1
  40. package/node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/getEndpointFromInstructions.js +2 -1
  41. package/node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/getEndpointUrlConfig.js +11 -9
  42. package/node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/getIgnoreConfiguredEndpointUrls.js +8 -0
  43. package/node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/resolveEndpointConfig.js +1 -0
  44. package/node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js +34 -11
  45. package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +1 -0
  46. package/node_modules/@smithy/core/dist-types/submodules/endpoints/middleware-endpoint/adaptors/getEndpointUrlConfig.d.ts +11 -0
  47. package/node_modules/@smithy/core/dist-types/submodules/endpoints/middleware-endpoint/adaptors/getIgnoreConfiguredEndpointUrls.d.ts +17 -0
  48. package/node_modules/@smithy/core/dist-types/submodules/endpoints/middleware-endpoint/resolveEndpointConfig.d.ts +12 -0
  49. package/node_modules/@smithy/core/dist-types/submodules/event-streams/EventStreamSerde.d.ts +10 -2
  50. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/endpoints/middleware-endpoint/adaptors/getEndpointUrlConfig.d.ts +11 -0
  51. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/endpoints/middleware-endpoint/adaptors/getIgnoreConfiguredEndpointUrls.d.ts +17 -0
  52. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/endpoints/middleware-endpoint/resolveEndpointConfig.d.ts +12 -0
  53. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/event-streams/EventStreamSerde.d.ts +10 -2
  54. package/node_modules/@smithy/core/package.json +91 -91
  55. package/node_modules/@smithy/credential-provider-imds/package.json +34 -34
  56. package/node_modules/@smithy/fetch-http-handler/package.json +30 -30
  57. package/node_modules/@smithy/signature-v4/package.json +29 -29
  58. package/package.json +2 -2
  59. package/slingshot/index.js +105 -105
  60. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/experimental/SinglePassJsonShapeSerializer.js +0 -135
  61. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/experimental/SinglePassJsonShapeSerializer.d.ts +0 -27
  62. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/experimental/SinglePassJsonShapeSerializer.d.ts +0 -17
  63. package/node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/getEndpointUrlConfig.js +0 -21
  64. package/node_modules/@smithy/core/dist-types/submodules/endpoints/util-endpoints/getEndpointUrlConfig.d.ts +0 -12
  65. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/endpoints/util-endpoints/getEndpointUrlConfig.d.ts +0 -12
@@ -0,0 +1,26 @@
1
+ function getPackageSource(entry) {
2
+ if (typeof entry === "string") return entry;
3
+ if (typeof entry === "object" && entry !== null) {
4
+ return typeof entry.source === "string" ? entry.source : null;
5
+ }
6
+ return null;
7
+ }
8
+
9
+ export function getStartupPackageActions(config, installedPackages) {
10
+ const unsupportedPackageSources = new Set(
11
+ (config.unsupportedPackages || []).map(getPackageSource).filter((source) => source !== null),
12
+ );
13
+ const packageSources = (config.packages || []).map(getPackageSource).filter((source) => source !== null);
14
+
15
+ const unsupportedPackagesToRemove = [...installedPackages].filter((source) =>
16
+ unsupportedPackageSources.has(source),
17
+ );
18
+ const packagesToInstall = packageSources.filter(
19
+ (source) => !installedPackages.has(source) && !unsupportedPackageSources.has(source),
20
+ );
21
+
22
+ return {
23
+ unsupportedPackagesToRemove,
24
+ packagesToInstall,
25
+ };
26
+ }
package/bin/sling.js CHANGED
@@ -27,6 +27,7 @@ import { homedir } from "node:os";
27
27
  import { spawn } from "node:child_process";
28
28
  import readline from "node:readline/promises";
29
29
  import semver from "semver";
30
+ import { getStartupPackageActions } from "./sling-default-package-policy.js";
30
31
 
31
32
  const __filename = fileURLToPath(import.meta.url);
32
33
  const __dirname = path.dirname(__filename);
@@ -202,15 +203,14 @@ function syncBundledSkills() {
202
203
  }
203
204
  }
204
205
 
205
- async function checkAndInstallPackages(argv = process.argv.slice(2)) {
206
+ export async function checkAndInstallPackages(argv = process.argv.slice(2)) {
206
207
  if (shouldSkipAutoInstall(argv)) return;
207
208
 
208
209
  const configPath = IS_DEV ? path.resolve(__dirname, "./sling-default-packages.json") : path.resolve(__dirname, "../sling-default-packages.json");
209
210
  if (!existsSync(configPath)) return;
210
211
 
211
- let installed = new Set();
212
- let unsupported = new Set();
213
212
  const settingsPath = path.resolve(homedir(), ".sling/agent/settings.json");
213
+ let installed = new Set();
214
214
  if (existsSync(settingsPath)) {
215
215
  try {
216
216
  const settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
@@ -218,20 +218,18 @@ async function checkAndInstallPackages(argv = process.argv.slice(2)) {
218
218
  const source = typeof p === "object" && p !== null ? p.source : p;
219
219
  installed.add(source);
220
220
  }
221
- for (const p of settings.unsupportedPackages || []) {
222
- const source = typeof p === "object" && p !== null ? p.source : p;
223
- unsupported.add(source);
224
- }
225
221
  } catch {}
226
222
  }
227
223
 
228
224
  try {
225
+ const config = JSON.parse(readFileSync(configPath, "utf-8"));
226
+ const { unsupportedPackagesToRemove, packagesToInstall } = getStartupPackageActions(config, installed);
229
227
 
230
- //uninstall unsupported packages
231
- for (const u of unsupported) {
228
+ // uninstall unsupported packages
229
+ for (const u of unsupportedPackagesToRemove) {
232
230
  console.log(`Removing unsupported package ${u}...`);
233
231
  try {
234
- await runCommand(process.execPath, [__filename, "remove", "-g", u]);
232
+ await runCommand(process.execPath, [__filename, "remove", u]);
235
233
  console.log(`✓ Removed ${u}`);
236
234
  } catch (err) {
237
235
  console.error(`✗ Failed to remove ${u}:`, err.message);
@@ -239,10 +237,9 @@ async function checkAndInstallPackages(argv = process.argv.slice(2)) {
239
237
  }
240
238
  }
241
239
 
242
- //remove unsupported packages from installed set
243
- for (const u of unsupported) installed.delete(u);
240
+ // remove unsupported packages from installed set
241
+ for (const u of unsupportedPackagesToRemove) installed.delete(u);
244
242
 
245
- const config = JSON.parse(readFileSync(configPath, "utf-8"));
246
243
  const updateDefaultPackage = shouldUpdateDefaultPackage(argv);
247
244
 
248
245
  if (updateDefaultPackage) {
@@ -256,14 +253,10 @@ async function checkAndInstallPackages(argv = process.argv.slice(2)) {
256
253
  console.error("You can manually update them later with: sling update --extensions");
257
254
  }
258
255
  }
259
- const packages = (config.packages || []).filter((p) => {
260
- const source = typeof p === "object" && p !== null ? p.source : p;
261
- return !installed.has(source);
262
- });
263
- if (packages.length === 0) return;
256
+ if (packagesToInstall.length === 0) return;
264
257
 
265
258
  console.log("\nInstalling default packages...");
266
- for (const pkg of packages) {
259
+ for (const pkg of packagesToInstall) {
267
260
  console.log(`Installing ${pkg}...`);
268
261
  try {
269
262
  // Pass -g so promptInstallScopeIfNeeded skips the scope prompt and
@@ -456,7 +449,9 @@ async function run() {
456
449
  }
457
450
  }
458
451
 
459
- run().catch((err) => {
460
- console.error(err instanceof Error ? err.message : String(err));
461
- process.exit(1);
462
- });
452
+ //if (process.argv[1] === __filename) {
453
+ run().catch((err) => {
454
+ console.error(err instanceof Error ? err.message : String(err));
455
+ process.exit(1);
456
+ });
457
+ //}
@@ -0,0 +1,182 @@
1
+ import { determineTimestampFormat } from "@smithy/core/protocols";
2
+ import { NormalizedSchema } from "@smithy/core/schema";
3
+ import { LazyJsonString, NumericValue, parseEpochTimestamp, parseRfc3339DateTimeWithOffset, parseRfc7231DateTime, } from "@smithy/core/serde";
4
+ import { fromBase64 } from "@smithy/core/serde";
5
+ import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
6
+ import { UnionSerde } from "../../UnionSerde";
7
+ import { jsonReviver } from "../jsonReviver";
8
+ import { parseJsonBody } from "../parseJsonBody";
9
+ let canParseBuffer;
10
+ function detectBufferParsing() {
11
+ if (canParseBuffer === undefined) {
12
+ try {
13
+ const result = JSON.parse(new Uint8Array([0x7b, 0x7d]));
14
+ canParseBuffer = result !== null && typeof result === "object";
15
+ }
16
+ catch {
17
+ canParseBuffer = false;
18
+ }
19
+ }
20
+ return canParseBuffer;
21
+ }
22
+ export class BufferJsonShapeDeserializer extends SerdeContextConfig {
23
+ settings;
24
+ constructor(settings) {
25
+ super();
26
+ this.settings = settings;
27
+ }
28
+ async read(schema, data) {
29
+ let parsed;
30
+ if (typeof data === "string") {
31
+ parsed = JSON.parse(data, jsonReviver);
32
+ }
33
+ else if (data instanceof Uint8Array && detectBufferParsing()) {
34
+ parsed = JSON.parse(data, jsonReviver);
35
+ }
36
+ else {
37
+ parsed = await parseJsonBody(data, this.serdeContext);
38
+ }
39
+ return this._read(schema, parsed);
40
+ }
41
+ readObject(schema, data) {
42
+ return this._read(schema, data);
43
+ }
44
+ _read(schema, value) {
45
+ const isObject = value !== null && typeof value === "object";
46
+ const ns = NormalizedSchema.of(schema);
47
+ if (isObject) {
48
+ if (ns.isStructSchema()) {
49
+ return this._readStruct(ns, value);
50
+ }
51
+ if (Array.isArray(value) && ns.isListSchema()) {
52
+ const listMember = ns.getValueSchema();
53
+ for (let i = 0; i < value.length; ++i) {
54
+ value[i] = this._read(listMember, value[i]);
55
+ }
56
+ return value;
57
+ }
58
+ if (ns.isMapSchema()) {
59
+ const mapMember = ns.getValueSchema();
60
+ const map = value;
61
+ for (const k in map) {
62
+ map[k] = this._read(mapMember, map[k]);
63
+ }
64
+ return map;
65
+ }
66
+ }
67
+ if (ns.isBlobSchema() && typeof value === "string") {
68
+ return fromBase64(value);
69
+ }
70
+ const mediaType = ns.getMergedTraits().mediaType;
71
+ if (ns.isStringSchema() && typeof value === "string" && mediaType) {
72
+ const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
73
+ if (isJson) {
74
+ return LazyJsonString.from(value);
75
+ }
76
+ return value;
77
+ }
78
+ if (ns.isTimestampSchema() && value != null) {
79
+ const format = determineTimestampFormat(ns, this.settings);
80
+ switch (format) {
81
+ case 5:
82
+ return parseRfc3339DateTimeWithOffset(value);
83
+ case 6:
84
+ return parseRfc7231DateTime(value);
85
+ case 7:
86
+ return parseEpochTimestamp(value);
87
+ default:
88
+ console.warn("Missing timestamp format, parsing value with Date constructor:", value);
89
+ return new Date(value);
90
+ }
91
+ }
92
+ if (ns.isBigIntegerSchema() && (typeof value === "number" || typeof value === "string")) {
93
+ return BigInt(value);
94
+ }
95
+ if (ns.isBigDecimalSchema() && value != undefined) {
96
+ if (value instanceof NumericValue) {
97
+ return value;
98
+ }
99
+ const untyped = value;
100
+ if (untyped.type === "bigDecimal" && "string" in untyped) {
101
+ return new NumericValue(untyped.string, untyped.type);
102
+ }
103
+ return new NumericValue(String(value), "bigDecimal");
104
+ }
105
+ if (ns.isNumericSchema() && typeof value === "string") {
106
+ switch (value) {
107
+ case "Infinity":
108
+ return Infinity;
109
+ case "-Infinity":
110
+ return -Infinity;
111
+ case "NaN":
112
+ return NaN;
113
+ }
114
+ return value;
115
+ }
116
+ if (ns.isDocumentSchema()) {
117
+ if (isObject) {
118
+ if (Array.isArray(value)) {
119
+ for (let i = 0; i < value.length; ++i) {
120
+ const v = value[i];
121
+ if (!(v instanceof NumericValue)) {
122
+ value[i] = this._read(ns, v);
123
+ }
124
+ }
125
+ }
126
+ else {
127
+ const doc = value;
128
+ for (const k in doc) {
129
+ const v = doc[k];
130
+ if (!(v instanceof NumericValue)) {
131
+ doc[k] = this._read(ns, v);
132
+ }
133
+ }
134
+ }
135
+ return value;
136
+ }
137
+ else {
138
+ return value;
139
+ }
140
+ }
141
+ return value;
142
+ }
143
+ _readStruct(ns, record) {
144
+ const union = ns.isUnionSchema();
145
+ const out = {};
146
+ let nameMap = void 0;
147
+ const { jsonName } = this.settings;
148
+ if (jsonName) {
149
+ nameMap = {};
150
+ }
151
+ let unionSerde;
152
+ if (union) {
153
+ unionSerde = new UnionSerde(record, out);
154
+ }
155
+ for (const [memberName, memberSchema] of ns.structIterator()) {
156
+ let fromKey = memberName;
157
+ if (jsonName) {
158
+ fromKey = memberSchema.getMergedTraits().jsonName ?? fromKey;
159
+ nameMap[fromKey] = memberName;
160
+ }
161
+ if (union) {
162
+ unionSerde.mark(fromKey);
163
+ }
164
+ if (record[fromKey] != null) {
165
+ out[memberName] = this._read(memberSchema, record[fromKey]);
166
+ }
167
+ }
168
+ if (union) {
169
+ unionSerde.writeUnknown();
170
+ }
171
+ else if (typeof record.__type === "string") {
172
+ for (const k in record) {
173
+ const v = record[k];
174
+ const t = jsonName ? (nameMap[k] ?? k) : k;
175
+ if (!(t in out)) {
176
+ out[t] = v;
177
+ }
178
+ }
179
+ }
180
+ return out;
181
+ }
182
+ }