stitchkit 0.90.4 → 0.90.6
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/CHANGELOG.md +102 -0
- package/README.md +2 -0
- package/dist/agent-runtime-coding-tools.js +5 -4
- package/dist/agent-runtime-harness.js +6 -5
- package/dist/agent-runtime-sandbox.js +5 -4
- package/dist/agent-runtime.js +9 -8
- package/dist/application/grammy.d.ts.map +1 -1
- package/dist/application-grammy.js +4 -1
- package/dist/cli.js +62 -18
- package/dist/contract/index.js +2 -1
- package/dist/google.d.ts +56 -0
- package/dist/google.d.ts.map +1 -0
- package/dist/google.js +175 -0
- package/dist/{index-32vjke6q.js → index-1bnkzq95.js} +1 -1
- package/dist/{index-db51n3xr.js → index-640tz39q.js} +5 -5
- package/dist/{index-19ryv24q.js → index-83fafqw8.js} +3 -3
- package/dist/{index-z78bjcxj.js → index-aj9geeez.js} +1 -1
- package/dist/{index-bg8ypxzn.js → index-bva395we.js} +6 -7
- package/dist/{index-y47z614h.js → index-fqg5mfk7.js} +145 -32
- package/dist/index-hr4tzbwq.js +11 -0
- package/dist/{index-kazec06k.js → index-nrqg8tks.js} +5 -19
- package/dist/index-rxfy4cq7.js +17 -0
- package/dist/{index-6atvfjc1.js → index-s208wab5.js} +1 -1
- package/dist/{index-7t0wq6j5.js → index-tgh3ksfh.js} +5 -5
- package/dist/{index-6q3zjwaz.js → index-vy2nxwg8.js} +1 -1
- package/dist/{index-kzxpsf8y.js → index-zsdgd1tz.js} +1 -1
- package/dist/index.js +10 -9
- package/dist/internal/pkce.d.ts +3 -0
- package/dist/internal/pkce.d.ts.map +1 -0
- package/dist/node.js +5 -4
- package/dist/oauth.d.ts +57 -0
- package/dist/oauth.d.ts.map +1 -0
- package/dist/oauth.js +170 -0
- package/dist/observability/index.js +3 -2
- package/dist/primitives.js +2 -1
- package/dist/remote.js +4 -3
- package/dist/server/bun.d.ts.map +1 -1
- package/dist/server/index.js +14 -11
- package/dist/server/middleware/pkce.d.ts +1 -2
- package/dist/server/middleware/pkce.d.ts.map +1 -1
- package/dist/testing.js +5 -4
- package/dist/tool-invoker.js +7 -6
- package/dist/tools/cli-args.d.ts +10 -8
- package/dist/tools/cli-args.d.ts.map +1 -1
- package/dist/tools/cli-installer.d.ts +7 -2
- package/dist/tools/cli-installer.d.ts.map +1 -1
- package/dist/tools/cli-view.d.ts.map +1 -1
- package/dist/tools/cli.d.ts.map +1 -1
- package/dist/tools/connections/index.js +37 -4
- package/dist/tools/connections/mcp-envelope.d.ts +44 -0
- package/dist/tools/connections/mcp-envelope.d.ts.map +1 -0
- package/dist/tools/connections/mcp.d.ts.map +1 -1
- package/dist/tools.js +16 -14
- package/dist/tracking.js +3 -2
- package/llms-full.txt +224 -8
- package/llms.txt +1 -0
- package/package.json +36 -22
- package/dist/{index-8crm1srv.js → index-3yqgj323.js} +3 -3
- package/dist/{index-vcnfwrtr.js → index-8pjqv3zh.js} +6 -6
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
isOriginAllowed,
|
|
23
23
|
mediaTypeEssence,
|
|
24
24
|
reportSignalError
|
|
25
|
-
} from "./index-
|
|
25
|
+
} from "./index-aj9geeez.js";
|
|
26
26
|
import {
|
|
27
27
|
getRequestContext,
|
|
28
28
|
runWithRequestContext,
|
|
@@ -46,15 +46,15 @@ import {
|
|
|
46
46
|
DEFAULT_CONTRACT_STREAM_FRAME_BYTES,
|
|
47
47
|
joinRoutePath,
|
|
48
48
|
parseTrailingWildcard
|
|
49
|
-
} from "./index-
|
|
49
|
+
} from "./index-nrqg8tks.js";
|
|
50
|
+
import {
|
|
51
|
+
resolveTraceContext
|
|
52
|
+
} from "./index-zcgf3gqf.js";
|
|
50
53
|
import {
|
|
51
54
|
AppError,
|
|
52
55
|
badRequest,
|
|
53
56
|
forbidden
|
|
54
57
|
} from "./index-scs3f1eg.js";
|
|
55
|
-
import {
|
|
56
|
-
resolveTraceContext
|
|
57
|
-
} from "./index-zcgf3gqf.js";
|
|
58
58
|
import {
|
|
59
59
|
isUnsafeKey,
|
|
60
60
|
safeJsonParse
|
|
@@ -4,16 +4,16 @@ import {
|
|
|
4
4
|
} from "./index-7rkhw9ec.js";
|
|
5
5
|
import {
|
|
6
6
|
collectToolSurface
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-zsdgd1tz.js";
|
|
8
8
|
import {
|
|
9
9
|
createToolRunner,
|
|
10
10
|
formatToolError
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-1bnkzq95.js";
|
|
12
12
|
import {
|
|
13
13
|
isToolExecutionControlError,
|
|
14
14
|
toolCauseFromResult,
|
|
15
15
|
toolResultFromError
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-8pjqv3zh.js";
|
|
17
17
|
import {
|
|
18
18
|
isRecord
|
|
19
19
|
} from "./index-77fekveh.js";
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
deriveCodeChallenge
|
|
3
|
+
} from "./index-hr4tzbwq.js";
|
|
1
4
|
import {
|
|
2
5
|
contextContributionDelta,
|
|
3
6
|
mergeContextContribution,
|
|
4
7
|
prepareContextContribution
|
|
5
|
-
} from "./index-
|
|
8
|
+
} from "./index-aj9geeez.js";
|
|
6
9
|
import {
|
|
7
10
|
base64UrlToBytes,
|
|
8
11
|
bytesToBase64Url
|
|
9
|
-
} from "./index-
|
|
12
|
+
} from "./index-rxfy4cq7.js";
|
|
10
13
|
import {
|
|
11
14
|
forbidden,
|
|
12
15
|
unauthorized
|
|
@@ -312,10 +315,6 @@ function createBearerResolver(config) {
|
|
|
312
315
|
}
|
|
313
316
|
|
|
314
317
|
// src/server/middleware/pkce.ts
|
|
315
|
-
async function deriveCodeChallenge(verifier) {
|
|
316
|
-
const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(verifier));
|
|
317
|
-
return bytesToBase64Url(new Uint8Array(digest));
|
|
318
|
-
}
|
|
319
318
|
async function verifyPkce(verifier, challenge) {
|
|
320
319
|
if (!verifier || !challenge)
|
|
321
320
|
return false;
|
|
@@ -323,4 +322,4 @@ async function verifyPkce(verifier, challenge) {
|
|
|
323
322
|
return derived === challenge;
|
|
324
323
|
}
|
|
325
324
|
|
|
326
|
-
export { parseCookieHeader, parseCookies, serializeCookie, defineCookie, verifyJwt, signJwt, extractToken, createAuthHook, composeAuthHooks, createBearerResolver,
|
|
325
|
+
export { parseCookieHeader, parseCookies, serializeCookie, defineCookie, verifyJwt, signJwt, extractToken, createAuthHook, composeAuthHooks, createBearerResolver, verifyPkce };
|
|
@@ -3,15 +3,15 @@ import {
|
|
|
3
3
|
} from "./index-sbdmyz75.js";
|
|
4
4
|
import {
|
|
5
5
|
collectToolSurface
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-zsdgd1tz.js";
|
|
7
7
|
import {
|
|
8
8
|
createToolRunner,
|
|
9
9
|
formatToolError
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-1bnkzq95.js";
|
|
11
11
|
import {
|
|
12
12
|
toolErrorFromResult,
|
|
13
13
|
toolResultFromError
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-8pjqv3zh.js";
|
|
15
15
|
import {
|
|
16
16
|
formatZodError,
|
|
17
17
|
validateDeclaredOutput
|
|
@@ -19,10 +19,6 @@ import {
|
|
|
19
19
|
import {
|
|
20
20
|
coerceJsonArgs
|
|
21
21
|
} from "./index-7zbps32p.js";
|
|
22
|
-
import {
|
|
23
|
-
isUnsafeKey,
|
|
24
|
-
safeJsonParse
|
|
25
|
-
} from "./index-kzfs85xp.js";
|
|
26
22
|
import {
|
|
27
23
|
assertUniqueToolName,
|
|
28
24
|
buildToolPresentationSchema,
|
|
@@ -31,6 +27,10 @@ import {
|
|
|
31
27
|
import {
|
|
32
28
|
jsonSchemaFields
|
|
33
29
|
} from "./index-cby4ar3v.js";
|
|
30
|
+
import {
|
|
31
|
+
isUnsafeKey,
|
|
32
|
+
safeJsonParse
|
|
33
|
+
} from "./index-kzfs85xp.js";
|
|
34
34
|
import {
|
|
35
35
|
isRecord
|
|
36
36
|
} from "./index-77fekveh.js";
|
|
@@ -38,8 +38,8 @@ import {
|
|
|
38
38
|
// src/tools/cli-args.ts
|
|
39
39
|
import { z } from "zod";
|
|
40
40
|
var NUMERIC_VALUE = /^-(\d+\.?\d*|\.\d+)$/;
|
|
41
|
-
var BOOL_OPTIONS = new Set(["json", "wait", "quiet", "dry-run", "help"]);
|
|
42
|
-
var VIEW_OPTIONS = new Set(["count-by", "sum", "by", "top", "table"]);
|
|
41
|
+
var BOOL_OPTIONS = new Set(["json", "wait", "quiet", "dry-run", "help", "ascending"]);
|
|
42
|
+
var VIEW_OPTIONS = new Set(["count-by", "sum", "by", "top", "table", "sort"]);
|
|
43
43
|
var VALUE_OPTIONS = new Set(["wait-timeout", "output-dir", ...VIEW_OPTIONS]);
|
|
44
44
|
var RESERVED_CLI_OPTIONS = new Set([...BOOL_OPTIONS, ...VALUE_OPTIONS]);
|
|
45
45
|
function classifyLongOptionToken(token) {
|
|
@@ -54,10 +54,30 @@ function classifyLongOptionToken(token) {
|
|
|
54
54
|
globalKind: BOOL_OPTIONS.has(name) ? "boolean" : VALUE_OPTIONS.has(name) ? "value" : undefined
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
+
var HELP_TOKENS = new Set(["--help", "-h", "help"]);
|
|
58
|
+
function helpFilterFrom(token, rest) {
|
|
59
|
+
if (token?.startsWith("--help=")) {
|
|
60
|
+
const value = token.slice("--help=".length).trim();
|
|
61
|
+
if (value.length === 0 || isReservedBoolWord(value))
|
|
62
|
+
return;
|
|
63
|
+
return value;
|
|
64
|
+
}
|
|
65
|
+
if (token === undefined || !HELP_TOKENS.has(token))
|
|
66
|
+
return;
|
|
67
|
+
const next = rest[0];
|
|
68
|
+
return next !== undefined && !next.startsWith("-") ? next : undefined;
|
|
69
|
+
}
|
|
57
70
|
function routeCliArgv(argv, defaultCommand) {
|
|
58
71
|
if (defaultCommand === undefined) {
|
|
59
72
|
const [command, ...commandArgv] = argv;
|
|
60
|
-
|
|
73
|
+
const helpFilter = helpFilterFrom(command, commandArgv);
|
|
74
|
+
return {
|
|
75
|
+
command,
|
|
76
|
+
commandArgv,
|
|
77
|
+
topLevelHelp: false,
|
|
78
|
+
version: false,
|
|
79
|
+
...helpFilter !== undefined && { helpFilter }
|
|
80
|
+
};
|
|
61
81
|
}
|
|
62
82
|
const globals = [];
|
|
63
83
|
let index = 0;
|
|
@@ -73,8 +93,15 @@ function routeCliArgv(argv, defaultCommand) {
|
|
|
73
93
|
error: 'A command is required before "--"'
|
|
74
94
|
};
|
|
75
95
|
}
|
|
76
|
-
|
|
77
|
-
|
|
96
|
+
const inlineHelpFilter = token.startsWith("--help=") && !isReservedBoolWord(token.slice("--help=".length));
|
|
97
|
+
if (token === "--help" || token === "-h" || inlineHelpFilter) {
|
|
98
|
+
const helpFilter = helpFilterFrom(token, argv.slice(index + 1));
|
|
99
|
+
return {
|
|
100
|
+
commandArgv: [],
|
|
101
|
+
topLevelHelp: true,
|
|
102
|
+
version: false,
|
|
103
|
+
...helpFilter !== undefined && { helpFilter }
|
|
104
|
+
};
|
|
78
105
|
}
|
|
79
106
|
if (token === "--version" || token === "version") {
|
|
80
107
|
return { commandArgv: [], topLevelHelp: false, version: true };
|
|
@@ -114,7 +141,13 @@ function routeCliArgv(argv, defaultCommand) {
|
|
|
114
141
|
if (!option.inline) {
|
|
115
142
|
const value = argv[index + 1];
|
|
116
143
|
if (value === "--help" || value === "-h") {
|
|
117
|
-
|
|
144
|
+
const helpFilter = helpFilterFrom(value, argv.slice(index + 2));
|
|
145
|
+
return {
|
|
146
|
+
commandArgv: [],
|
|
147
|
+
topLevelHelp: true,
|
|
148
|
+
version: false,
|
|
149
|
+
...helpFilter !== undefined && { helpFilter }
|
|
150
|
+
};
|
|
118
151
|
}
|
|
119
152
|
if (value === "--version" || value === "version") {
|
|
120
153
|
return { commandArgv: [], topLevelHelp: false, version: true };
|
|
@@ -217,6 +250,10 @@ function describeSchemaFields(schema) {
|
|
|
217
250
|
}
|
|
218
251
|
var TRUE_WORDS = new Set(["true", "1", "yes", "on"]);
|
|
219
252
|
var FALSE_WORDS = new Set(["false", "0", "no", "off"]);
|
|
253
|
+
function isReservedBoolWord(value) {
|
|
254
|
+
const word = value.toLowerCase();
|
|
255
|
+
return TRUE_WORDS.has(word) || FALSE_WORDS.has(word);
|
|
256
|
+
}
|
|
220
257
|
function parseReservedBool(name, value) {
|
|
221
258
|
const v = value.toLowerCase();
|
|
222
259
|
if (TRUE_WORDS.has(v))
|
|
@@ -317,6 +354,7 @@ function parseCliArgs(argv, schema, config = {}) {
|
|
|
317
354
|
const flags = new Map;
|
|
318
355
|
const boolFlags = new Map;
|
|
319
356
|
const viewFlags = new Map;
|
|
357
|
+
let ascending = false;
|
|
320
358
|
const positionals = [];
|
|
321
359
|
const pushFlag = (name, value) => {
|
|
322
360
|
const existing = flags.get(name);
|
|
@@ -384,6 +422,8 @@ function parseCliArgs(argv, schema, config = {}) {
|
|
|
384
422
|
options.wait = enabled;
|
|
385
423
|
else if (name === "quiet")
|
|
386
424
|
options.quiet = enabled;
|
|
425
|
+
else if (name === "ascending")
|
|
426
|
+
ascending = enabled;
|
|
387
427
|
else
|
|
388
428
|
options.help = enabled;
|
|
389
429
|
continue;
|
|
@@ -439,7 +479,7 @@ function parseCliArgs(argv, schema, config = {}) {
|
|
|
439
479
|
}
|
|
440
480
|
pushFlag(name, value);
|
|
441
481
|
}
|
|
442
|
-
const view = resolveCliView(viewFlags);
|
|
482
|
+
const view = resolveCliView(viewFlags, ascending);
|
|
443
483
|
if (view)
|
|
444
484
|
options.view = view;
|
|
445
485
|
const toolArgs = {};
|
|
@@ -545,9 +585,13 @@ function extractCliGlobalOptions(argv, schema) {
|
|
|
545
585
|
}
|
|
546
586
|
return { argv: rest, globals: parsed.data };
|
|
547
587
|
}
|
|
548
|
-
function resolveCliView(flags) {
|
|
549
|
-
if (flags.size === 0)
|
|
588
|
+
function resolveCliView(flags, ascending) {
|
|
589
|
+
if (flags.size === 0) {
|
|
590
|
+
if (ascending) {
|
|
591
|
+
throw new CliArgumentError("--ascending orders a record view; pass --sort with it");
|
|
592
|
+
}
|
|
550
593
|
return;
|
|
594
|
+
}
|
|
551
595
|
const countBy = flags.get("count-by");
|
|
552
596
|
const sum = flags.get("sum");
|
|
553
597
|
const table = flags.get("table");
|
|
@@ -555,8 +599,7 @@ function resolveCliView(flags) {
|
|
|
555
599
|
const rawTop = flags.get("top");
|
|
556
600
|
const named = [
|
|
557
601
|
["--count-by", countBy],
|
|
558
|
-
["--sum", sum]
|
|
559
|
-
["--table", table]
|
|
602
|
+
["--sum", sum]
|
|
560
603
|
].filter(([, value]) => value !== undefined);
|
|
561
604
|
if (named.length > 1) {
|
|
562
605
|
throw new CliArgumentError(`${named.map(([flag]) => flag).join(" and ")} ask for different shapes — pass one`);
|
|
@@ -568,14 +611,33 @@ function resolveCliView(flags) {
|
|
|
568
611
|
throw new CliArgumentError("--top must be a positive whole number");
|
|
569
612
|
}
|
|
570
613
|
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
614
|
+
const sort = flags.get("sort");
|
|
615
|
+
if (table !== undefined || sort !== undefined) {
|
|
616
|
+
if (countBy !== undefined || sum !== undefined) {
|
|
617
|
+
throw new CliArgumentError(`${table !== undefined ? "--table" : "--sort"} lists records; --count-by and --sum aggregate them — pass one`);
|
|
574
618
|
}
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
619
|
+
if (by !== undefined) {
|
|
620
|
+
throw new CliArgumentError("--by groups a view; a record view orders with --sort");
|
|
621
|
+
}
|
|
622
|
+
if (top !== undefined && sort === undefined) {
|
|
623
|
+
throw new CliArgumentError("--top needs --sort here: unordered records have no n largest");
|
|
624
|
+
}
|
|
625
|
+
let fields;
|
|
626
|
+
if (table !== undefined) {
|
|
627
|
+
fields = table.split(",").map((field) => field.trim()).filter(Boolean);
|
|
628
|
+
if (fields.length === 0)
|
|
629
|
+
throw new CliArgumentError("--table needs at least one field");
|
|
630
|
+
}
|
|
631
|
+
return {
|
|
632
|
+
kind: "records",
|
|
633
|
+
...sort !== undefined && { sort },
|
|
634
|
+
...ascending && { ascending },
|
|
635
|
+
...top !== undefined && { top },
|
|
636
|
+
...fields && { table: fields }
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
if (ascending) {
|
|
640
|
+
throw new CliArgumentError("--ascending orders a record view; pass --sort with it");
|
|
579
641
|
}
|
|
580
642
|
if (sum !== undefined) {
|
|
581
643
|
if (top !== undefined && by === undefined) {
|
|
@@ -600,7 +662,7 @@ function resolveCliView(flags) {
|
|
|
600
662
|
}
|
|
601
663
|
return { kind: "count", field: by, top };
|
|
602
664
|
}
|
|
603
|
-
throw new CliArgumentError("--top needs --by, --count-by or --sum to rank");
|
|
665
|
+
throw new CliArgumentError("--top needs --sort, --by, --count-by or --sum to rank");
|
|
604
666
|
}
|
|
605
667
|
|
|
606
668
|
// src/tools/cli-command.ts
|
|
@@ -790,10 +852,37 @@ function renderTable(records, fields) {
|
|
|
790
852
|
`)}
|
|
791
853
|
`;
|
|
792
854
|
}
|
|
855
|
+
function compareFieldValues(left, right) {
|
|
856
|
+
if (left === undefined || left === null)
|
|
857
|
+
return right === undefined || right === null ? 0 : 1;
|
|
858
|
+
if (right === undefined || right === null)
|
|
859
|
+
return -1;
|
|
860
|
+
if (typeof left === "number" && typeof right === "number")
|
|
861
|
+
return left - right;
|
|
862
|
+
if (typeof left === "bigint" || typeof right === "bigint") {
|
|
863
|
+
return Number(left) - Number(right);
|
|
864
|
+
}
|
|
865
|
+
return groupKey(left).localeCompare(groupKey(right));
|
|
866
|
+
}
|
|
867
|
+
function renderRecords(records, view) {
|
|
868
|
+
let selected = [...records];
|
|
869
|
+
if (view.sort !== undefined) {
|
|
870
|
+
const path = assertFieldPresent(records, view.sort);
|
|
871
|
+
const direction = view.ascending ? 1 : -1;
|
|
872
|
+
selected.sort((left, right) => {
|
|
873
|
+
const order = compareFieldValues(readField(left, path), readField(right, path));
|
|
874
|
+
const absent = readField(left, path) === undefined || readField(right, path) === undefined;
|
|
875
|
+
return absent ? order : order * direction;
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
if (view.top !== undefined)
|
|
879
|
+
selected = selected.slice(0, view.top);
|
|
880
|
+
return view.table ? { kind: "text", text: renderTable(selected, view.table) } : { kind: "json", data: selected };
|
|
881
|
+
}
|
|
793
882
|
function renderCliView(data, view) {
|
|
794
883
|
const records = selectRecords(data);
|
|
795
|
-
if (view.kind === "
|
|
796
|
-
return
|
|
884
|
+
if (view.kind === "records")
|
|
885
|
+
return renderRecords(records, view);
|
|
797
886
|
if (view.kind === "count") {
|
|
798
887
|
const path2 = assertFieldPresent(records, view.field);
|
|
799
888
|
const totals2 = new Map;
|
|
@@ -1368,9 +1457,12 @@ var GLOBAL_OPTIONS = [
|
|
|
1368
1457
|
["--quiet", "Suppress non-essential stderr output"],
|
|
1369
1458
|
["--dry-run", "Print the resolved call without executing it"],
|
|
1370
1459
|
["--help, -h", "Show help for a command"],
|
|
1460
|
+
["--help <text>", "List only the commands matching a substring"],
|
|
1371
1461
|
["--count-by <field>", "Count records per distinct value of a field"],
|
|
1372
1462
|
["--sum <field>", "Total a numeric field, optionally grouped by --by"],
|
|
1373
|
-
["--
|
|
1463
|
+
["--sort <field>", "Order the records by a field, largest first"],
|
|
1464
|
+
["--ascending", "Flip --sort to smallest first"],
|
|
1465
|
+
["--top <n>", "Keep the n leading entries of the view asked for"],
|
|
1374
1466
|
["--table <a,b>", "Render the named fields as an aligned table"]
|
|
1375
1467
|
];
|
|
1376
1468
|
async function readPipedStdin() {
|
|
@@ -1451,14 +1543,19 @@ function applicationOptionLines(fields) {
|
|
|
1451
1543
|
...fields.map((field) => ` ${padRight(labels.get(field.name) ?? `--${field.name}`, width)} ${field.description ?? ""}`.trimEnd())
|
|
1452
1544
|
];
|
|
1453
1545
|
}
|
|
1546
|
+
function filterCommands(commands, filter) {
|
|
1547
|
+
const needle = filter.toLowerCase();
|
|
1548
|
+
return new Map([...commands].filter(([command, descriptor]) => command.toLowerCase().includes(needle) || descriptor.description.toLowerCase().includes(needle)));
|
|
1549
|
+
}
|
|
1454
1550
|
function renderTopHelp(input) {
|
|
1455
|
-
const { name, version,
|
|
1551
|
+
const { name, version, defaultCommand } = input;
|
|
1552
|
+
const commands = input.filter === undefined ? input.commands : filterCommands(input.commands, input.filter);
|
|
1456
1553
|
const lines = [
|
|
1457
1554
|
`${name} ${version}`,
|
|
1458
1555
|
"",
|
|
1459
1556
|
`Usage: ${name} ${defaultCommand ? "[command]" : "<command>"} [args] [--flags]`,
|
|
1460
1557
|
"",
|
|
1461
|
-
"Commands:"
|
|
1558
|
+
input.filter === undefined ? "Commands:" : `Commands matching "${input.filter}" (${commands.size} of ${input.commands.size}):`
|
|
1462
1559
|
];
|
|
1463
1560
|
const width = Math.max(0, ...[...commands.keys()].map((key) => key.length));
|
|
1464
1561
|
for (const [command, descriptor] of commands) {
|
|
@@ -1467,6 +1564,12 @@ function renderTopHelp(input) {
|
|
|
1467
1564
|
if (input.unavailable !== undefined) {
|
|
1468
1565
|
lines.push("", `Managed commands are unavailable: ${input.unavailable}`);
|
|
1469
1566
|
}
|
|
1567
|
+
if (input.filter !== undefined) {
|
|
1568
|
+
lines.push("", `Run "${name} <command> --help" for command-specific flags.`);
|
|
1569
|
+
return `${lines.join(`
|
|
1570
|
+
`)}
|
|
1571
|
+
`;
|
|
1572
|
+
}
|
|
1470
1573
|
lines.push("", "Global options:");
|
|
1471
1574
|
const optWidth = Math.max(...GLOBAL_OPTIONS.map(([flag]) => flag.length));
|
|
1472
1575
|
for (const [flag, desc] of GLOBAL_OPTIONS)
|
|
@@ -1793,15 +1896,25 @@ async function createCli(config) {
|
|
|
1793
1896
|
assertCliPoliciesResolved(help, config);
|
|
1794
1897
|
return { resolved: true, auth, help, tools };
|
|
1795
1898
|
};
|
|
1796
|
-
const topLevelHelp = route.topLevelHelp || command === undefined || command === "help" || command === "--help" || command === "-h";
|
|
1899
|
+
const topLevelHelp = route.topLevelHelp || command === undefined || command === "help" || command === "--help" || command === "-h" || command.startsWith("--help=") && !isReservedBoolWord(command.slice("--help=".length));
|
|
1797
1900
|
const managed = await buildManagedSurface(!topLevelHelp && !helpRequested);
|
|
1798
1901
|
if (topLevelHelp) {
|
|
1902
|
+
const helpFilter = route.helpFilter ?? (command !== undefined ? commandArgv[0] : undefined);
|
|
1903
|
+
const filter = helpFilter !== undefined && !helpFilter.startsWith("-") ? helpFilter : undefined;
|
|
1904
|
+
if (filter !== undefined && filterCommands(managed.help, filter).size === 0) {
|
|
1905
|
+
stderr(`no command matches "${filter}" (${managed.help.size} available)
|
|
1906
|
+
` + (managed.resolved ? "" : `Managed commands are unavailable: ${managed.reason}
|
|
1907
|
+
`));
|
|
1908
|
+
const codes = { ...DEFAULT_EXIT_CODES, ...config.exitCodes };
|
|
1909
|
+
return exit(codes.NOT_FOUND ?? 4);
|
|
1910
|
+
}
|
|
1799
1911
|
stdout(renderTopHelp({
|
|
1800
1912
|
name: config.name,
|
|
1801
1913
|
version: config.version,
|
|
1802
1914
|
commands: managed.help,
|
|
1803
1915
|
defaultCommand: config.defaultCommand,
|
|
1804
1916
|
applicationOptions,
|
|
1917
|
+
...filter !== undefined && { filter },
|
|
1805
1918
|
...managed.resolved ? {} : { unavailable: managed.reason }
|
|
1806
1919
|
}));
|
|
1807
1920
|
return exit(0);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
bytesToBase64Url
|
|
3
|
+
} from "./index-rxfy4cq7.js";
|
|
4
|
+
|
|
5
|
+
// src/internal/pkce.ts
|
|
6
|
+
async function deriveCodeChallenge(verifier, subtle = globalThis.crypto.subtle) {
|
|
7
|
+
const digest = await subtle.digest("SHA-256", new TextEncoder().encode(verifier));
|
|
8
|
+
return bytesToBase64Url(new Uint8Array(digest));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { deriveCodeChallenge };
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
base64UrlToBytes,
|
|
3
|
+
bytesToBase64Url
|
|
4
|
+
} from "./index-rxfy4cq7.js";
|
|
1
5
|
import {
|
|
2
6
|
AppError,
|
|
3
7
|
STITCH_ERROR_STATUS,
|
|
@@ -422,24 +426,6 @@ function createContractFactory(config) {
|
|
|
422
426
|
}
|
|
423
427
|
// src/contract/pagination.ts
|
|
424
428
|
import { z as z3 } from "zod";
|
|
425
|
-
|
|
426
|
-
// src/internal/base64url.ts
|
|
427
|
-
function bytesToBase64Url(bytes) {
|
|
428
|
-
let binary = "";
|
|
429
|
-
for (const byte of bytes)
|
|
430
|
-
binary += String.fromCharCode(byte);
|
|
431
|
-
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
432
|
-
}
|
|
433
|
-
function base64UrlToBytes(segment) {
|
|
434
|
-
if (!/^[A-Za-z0-9_-]*$/.test(segment) || segment.length % 4 === 1) {
|
|
435
|
-
throw new Error("invalid base64url segment");
|
|
436
|
-
}
|
|
437
|
-
const b64 = segment.replace(/-/g, "+").replace(/_/g, "/");
|
|
438
|
-
const padded = b64.padEnd(Math.ceil(b64.length / 4) * 4, "=");
|
|
439
|
-
return Uint8Array.from(atob(padded), (c) => c.charCodeAt(0));
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
// src/contract/pagination.ts
|
|
443
429
|
function paginatedSchema(itemSchema) {
|
|
444
430
|
return z3.object({
|
|
445
431
|
items: z3.array(itemSchema),
|
|
@@ -481,4 +467,4 @@ var ContractStreamFrameSchema = z4.discriminatedUnion("type", [
|
|
|
481
467
|
}).strict(),
|
|
482
468
|
z4.object({ type: z4.literal("end") }).strict()
|
|
483
469
|
]);
|
|
484
|
-
export { joinRoutePath, resolveRouteParamsSchema, parseTrailingWildcard, ALL_TRANSPORTS, defineContract, mergeMeta, defineErrors, createContractFactory,
|
|
470
|
+
export { joinRoutePath, resolveRouteParamsSchema, parseTrailingWildcard, ALL_TRANSPORTS, defineContract, mergeMeta, defineErrors, createContractFactory, paginatedSchema, encodeCursor, decodeCursor, DEFAULT_CONTRACT_STREAM_FRAME_BYTES, ContractStreamFrameSchema };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/internal/base64url.ts
|
|
2
|
+
function bytesToBase64Url(bytes) {
|
|
3
|
+
let binary = "";
|
|
4
|
+
for (const byte of bytes)
|
|
5
|
+
binary += String.fromCharCode(byte);
|
|
6
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
7
|
+
}
|
|
8
|
+
function base64UrlToBytes(segment) {
|
|
9
|
+
if (!/^[A-Za-z0-9_-]*$/.test(segment) || segment.length % 4 === 1) {
|
|
10
|
+
throw new Error("invalid base64url segment");
|
|
11
|
+
}
|
|
12
|
+
const b64 = segment.replace(/-/g, "+").replace(/_/g, "/");
|
|
13
|
+
const padded = b64.padEnd(Math.ceil(b64.length / 4) * 4, "=");
|
|
14
|
+
return Uint8Array.from(atob(padded), (c) => c.charCodeAt(0));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { bytesToBase64Url, base64UrlToBytes };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
collectTools,
|
|
3
3
|
createToolRunner
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-1bnkzq95.js";
|
|
5
5
|
import {
|
|
6
6
|
toolErrorFromResult
|
|
7
|
-
} from "./index-
|
|
8
|
-
import {
|
|
9
|
-
AppError
|
|
10
|
-
} from "./index-scs3f1eg.js";
|
|
7
|
+
} from "./index-8pjqv3zh.js";
|
|
11
8
|
import {
|
|
12
9
|
assertUniqueToolName
|
|
13
10
|
} from "./index-fenaekmk.js";
|
|
11
|
+
import {
|
|
12
|
+
AppError
|
|
13
|
+
} from "./index-scs3f1eg.js";
|
|
14
14
|
|
|
15
15
|
// src/tools/invoker.ts
|
|
16
16
|
function createToolInvoker(services, config) {
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
createUrlBuilder,
|
|
16
16
|
createUrlBuilders,
|
|
17
17
|
parseNDJSON
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-vy2nxwg8.js";
|
|
19
19
|
import {
|
|
20
20
|
REALTIME_REJECTION_KEY,
|
|
21
21
|
asRealtimeRejection,
|
|
@@ -60,11 +60,19 @@ import {
|
|
|
60
60
|
defineErrors,
|
|
61
61
|
encodeCursor,
|
|
62
62
|
paginatedSchema
|
|
63
|
-
} from "./index-
|
|
63
|
+
} from "./index-nrqg8tks.js";
|
|
64
|
+
import"./index-rxfy4cq7.js";
|
|
64
65
|
import {
|
|
65
66
|
ManagedFilePathSchema,
|
|
66
67
|
ManagedFileRefSchema
|
|
67
68
|
} from "./index-6k1937bx.js";
|
|
69
|
+
import {
|
|
70
|
+
childSpan,
|
|
71
|
+
createTraceContext,
|
|
72
|
+
formatTraceparent,
|
|
73
|
+
parseTraceparent,
|
|
74
|
+
randomHex
|
|
75
|
+
} from "./index-zcgf3gqf.js";
|
|
68
76
|
import {
|
|
69
77
|
AppError,
|
|
70
78
|
STITCH_ERROR_STATUS,
|
|
@@ -77,13 +85,6 @@ import {
|
|
|
77
85
|
rateLimited,
|
|
78
86
|
unauthorized
|
|
79
87
|
} from "./index-scs3f1eg.js";
|
|
80
|
-
import {
|
|
81
|
-
childSpan,
|
|
82
|
-
createTraceContext,
|
|
83
|
-
formatTraceparent,
|
|
84
|
-
parseTraceparent,
|
|
85
|
-
randomHex
|
|
86
|
-
} from "./index-zcgf3gqf.js";
|
|
87
88
|
import"./index-kzfs85xp.js";
|
|
88
89
|
import"./index-77fekveh.js";
|
|
89
90
|
// src/retained.ts
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pkce.d.ts","sourceRoot":"","sources":["../../src/internal/pkce.ts"],"names":[],"mappings":"AAEA,sFAAsF;AACtF,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,EAChB,MAAM,GAAE,IAAI,CAAC,YAAY,EAAE,QAAQ,CAA4B,GAC9D,OAAO,CAAC,MAAM,CAAC,CAGjB"}
|
package/dist/node.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
createHandler,
|
|
6
6
|
createSocketIOServer,
|
|
7
7
|
createUnixClientTransport
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-640tz39q.js";
|
|
9
9
|
import"./index-y91ry9h2.js";
|
|
10
10
|
import {
|
|
11
11
|
ShutdownOptionsSchema,
|
|
@@ -24,12 +24,14 @@ import {
|
|
|
24
24
|
createScopedImplementRegistry,
|
|
25
25
|
implement,
|
|
26
26
|
implementRegistry
|
|
27
|
-
} from "./index-
|
|
27
|
+
} from "./index-aj9geeez.js";
|
|
28
28
|
import"./index-vsbzgd7b.js";
|
|
29
29
|
import"./index-f9mb610r.js";
|
|
30
30
|
import"./index-2hryh65w.js";
|
|
31
|
-
import"./index-
|
|
31
|
+
import"./index-nrqg8tks.js";
|
|
32
|
+
import"./index-rxfy4cq7.js";
|
|
32
33
|
import"./index-6k1937bx.js";
|
|
34
|
+
import"./index-zcgf3gqf.js";
|
|
33
35
|
import {
|
|
34
36
|
AppError,
|
|
35
37
|
appError,
|
|
@@ -40,7 +42,6 @@ import {
|
|
|
40
42
|
rateLimited,
|
|
41
43
|
unauthorized
|
|
42
44
|
} from "./index-scs3f1eg.js";
|
|
43
|
-
import"./index-zcgf3gqf.js";
|
|
44
45
|
import"./index-kzfs85xp.js";
|
|
45
46
|
import"./index-77fekveh.js";
|
|
46
47
|
// src/server/node.ts
|