stitchkit 0.103.12 → 0.104.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/CHANGELOG.md +112 -0
- package/darwin-native.cjs +12 -0
- package/darwin-native.d.cts +2 -0
- package/dist/agent-runtime/store-conformance-lifecycle.d.ts +10 -10
- package/dist/application/directory-inbox-accept.d.ts +13 -0
- package/dist/application/directory-inbox-accept.d.ts.map +1 -0
- package/dist/application/directory-inbox-contract.d.ts +42 -5
- package/dist/application/directory-inbox-contract.d.ts.map +1 -1
- package/dist/application/directory-inbox-delivery.d.ts +14 -0
- package/dist/application/directory-inbox-delivery.d.ts.map +1 -0
- package/dist/application/directory-inbox-files.d.ts +28 -0
- package/dist/application/directory-inbox-files.d.ts.map +1 -0
- package/dist/application/directory-inbox-state.d.ts +14 -0
- package/dist/application/directory-inbox-state.d.ts.map +1 -0
- package/dist/application/directory-inbox.d.ts +2 -1
- package/dist/application/directory-inbox.d.ts.map +1 -1
- package/dist/application/file-state-store.d.ts +2 -8
- package/dist/application/file-state-store.d.ts.map +1 -1
- package/dist/application/state-store.d.ts +6 -1
- package/dist/application/state-store.d.ts.map +1 -1
- package/dist/browser/client-arguments.d.ts +4 -0
- package/dist/browser/client-arguments.d.ts.map +1 -0
- package/dist/browser/client-executors.d.ts.map +1 -1
- package/dist/browser/client.d.ts.map +1 -1
- package/dist/browser/contract-stream.d.ts.map +1 -1
- package/dist/browser/http.d.ts +2 -1
- package/dist/browser/http.d.ts.map +1 -1
- package/dist/browser/native-fetch.d.ts +8 -0
- package/dist/browser/native-fetch.d.ts.map +1 -0
- package/dist/contract/errors.d.ts +16 -12
- package/dist/contract/errors.d.ts.map +1 -1
- package/dist/contract/normalize.d.ts +5 -1
- package/dist/contract/normalize.d.ts.map +1 -1
- package/dist/contract/stream.d.ts +1 -0
- package/dist/contract/stream.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/browser.js +3 -3
- package/dist/entrypoints/agent-runtime/coding-tools.js +8 -6
- package/dist/entrypoints/agent-runtime/harness-tools.js +8 -8
- package/dist/entrypoints/agent-runtime/harness.js +12 -11
- package/dist/entrypoints/agent-runtime/realtime.js +3 -3
- package/dist/entrypoints/agent-runtime/sandbox.js +8 -6
- package/dist/entrypoints/agent-runtime.js +13 -13
- package/dist/entrypoints/application/diagnostic-journal.js +3 -2
- package/dist/entrypoints/application/directory-inbox.js +424 -119
- package/dist/entrypoints/application/grammy.js +1 -1
- package/dist/entrypoints/application.d.ts +2 -2
- package/dist/entrypoints/application.d.ts.map +1 -1
- package/dist/entrypoints/application.js +7 -3
- package/dist/entrypoints/cli.d.ts +2 -0
- package/dist/entrypoints/cli.d.ts.map +1 -1
- package/dist/entrypoints/cli.js +757 -136
- package/dist/entrypoints/contract.js +3 -3
- package/dist/entrypoints/files.js +11 -107
- package/dist/entrypoints/index.js +7 -7
- package/dist/entrypoints/node.js +8 -8
- package/dist/entrypoints/observability.js +2 -2
- package/dist/entrypoints/process.js +2 -1
- package/dist/entrypoints/react.js +1 -1
- package/dist/entrypoints/remote.js +19 -6
- package/dist/entrypoints/server.d.ts +1 -1
- package/dist/entrypoints/server.d.ts.map +1 -1
- package/dist/entrypoints/server.js +20 -14
- package/dist/entrypoints/telegram.d.ts +1 -0
- package/dist/entrypoints/telegram.d.ts.map +1 -1
- package/dist/entrypoints/telegram.js +214 -98
- package/dist/entrypoints/testing.js +7 -7
- package/dist/entrypoints/tools/connections.d.ts +2 -2
- package/dist/entrypoints/tools/connections.d.ts.map +1 -1
- package/dist/entrypoints/tools/connections.js +427 -294
- package/dist/entrypoints/tools/invoker.js +6 -6
- package/dist/entrypoints/tools/mcp.d.ts +12 -0
- package/dist/entrypoints/tools/mcp.d.ts.map +1 -0
- package/dist/entrypoints/tools/mcp.js +45 -0
- package/dist/entrypoints/tools.d.ts +1 -0
- package/dist/entrypoints/tools.d.ts.map +1 -1
- package/dist/entrypoints/tools.js +82 -1147
- package/dist/entrypoints/tracking.js +1 -1
- package/dist/files/boundary.d.ts +2 -8
- package/dist/files/boundary.d.ts.map +1 -1
- package/dist/files/file-io.d.ts +0 -5
- package/dist/files/file-io.d.ts.map +1 -1
- package/dist/files/read.d.ts +2 -2
- package/dist/files/read.d.ts.map +1 -1
- package/dist/index-1a6jtnd9.js +88 -0
- package/dist/{index-fyphpknh.js → index-22rhg58f.js} +1 -1
- package/dist/index-269zqj8m.js +77 -0
- package/dist/{index-r34mvse1.js → index-27a2pj09.js} +1 -1
- package/dist/{index-r956rndn.js → index-2hyavjjj.js} +3 -3
- package/dist/{index-m2xqkv55.js → index-2vnh05w4.js} +83 -14
- package/dist/{index-pw99k9h5.js → index-43p08g7t.js} +1 -1
- package/dist/{index-xwq9j1sf.js → index-4e0ah203.js} +9 -7
- package/dist/{index-nybn2err.js → index-5csmzesf.js} +1 -1
- package/dist/{index-qapzv4p5.js → index-5z6jn897.js} +1 -1
- package/dist/{index-ahvsksw5.js → index-6d9xaxw1.js} +1 -1
- package/dist/{index-ahtnte39.js → index-6drst9sg.js} +46 -35
- package/dist/{index-x87j7csh.js → index-77nxk6ay.js} +2 -2
- package/dist/{index-dnn9z96q.js → index-a0zzh8ak.js} +3 -3
- package/dist/{index-kmpzj1cq.js → index-a3wma1hk.js} +1 -1
- package/dist/{index-j8aw2c0e.js → index-bakgedh8.js} +35 -7
- package/dist/index-bhb950qs.js +1145 -0
- package/dist/{index-tgzhq07n.js → index-cvda079a.js} +1 -1
- package/dist/{index-n2gre124.js → index-fa4wg312.js} +4 -4
- package/dist/{index-zp4jpkp0.js → index-fk18k56k.js} +2 -2
- package/dist/{index-afjvjyck.js → index-g2j7pnak.js} +2 -134
- package/dist/index-g95fk660.js +116 -0
- package/dist/{index-ej331hah.js → index-gxm9rc97.js} +1 -1
- package/dist/{index-r5c4fedv.js → index-h2fhjqy7.js} +2 -1
- package/dist/{index-sybedc8b.js → index-hbd32c6a.js} +23 -94
- package/dist/index-jd470k6q.js +109 -0
- package/dist/{index-b2bz0kdm.js → index-kb8styz3.js} +4 -3
- package/dist/{index-0c419yx7.js → index-kemm0ej5.js} +12 -9
- package/dist/{index-806d5phm.js → index-ptn0g0gj.js} +7 -7
- package/dist/{index-w575evhq.js → index-r4r70zmh.js} +1 -1
- package/dist/{index-12m2v2a9.js → index-s4evrmp5.js} +1 -1
- package/dist/{index-1khy8y7n.js → index-t1sr4aks.js} +3 -3
- package/dist/index-v5ee8ath.js +88 -0
- package/dist/{index-45tdvqa3.js → index-wh0ecvyk.js} +1 -1
- package/dist/{index-n53mswt3.js → index-x928baz2.js} +8 -1
- package/dist/index-yk4g8805.js +133 -0
- package/dist/{index-ygkka6zn.js → index-ywppsaby.js} +28 -5
- package/dist/{index-xvdd2rbb.js → index-za6j7nwy.js} +19 -5
- package/dist/internal/bounded-file-read.d.ts +41 -0
- package/dist/internal/bounded-file-read.d.ts.map +1 -0
- package/dist/internal/darwin-binding-error.d.ts +24 -0
- package/dist/internal/darwin-binding-error.d.ts.map +1 -0
- package/dist/internal/darwin-binding.d.ts.map +1 -1
- package/dist/internal/exclusive-lock.d.ts +2 -0
- package/dist/internal/exclusive-lock.d.ts.map +1 -1
- package/dist/internal/with-exclusive-lock.d.ts +4 -2
- package/dist/internal/with-exclusive-lock.d.ts.map +1 -1
- package/dist/telegram/broadcast-delivery.d.ts +23 -0
- package/dist/telegram/broadcast-delivery.d.ts.map +1 -0
- package/dist/telegram/broadcast-failure.d.ts +22 -0
- package/dist/telegram/broadcast-failure.d.ts.map +1 -0
- package/dist/telegram/broadcast-state.d.ts +6 -3
- package/dist/telegram/broadcast-state.d.ts.map +1 -1
- package/dist/telegram/broadcast.d.ts +10 -5
- package/dist/telegram/broadcast.d.ts.map +1 -1
- package/dist/tools/cli/args-fields.d.ts +2 -0
- package/dist/tools/cli/args-fields.d.ts.map +1 -1
- package/dist/tools/cli/args.d.ts.map +1 -1
- package/dist/tools/cli/format.d.ts.map +1 -1
- package/dist/tools/cli/invoke.d.ts +2 -2
- package/dist/tools/cli/invoke.d.ts.map +1 -1
- package/dist/tools/cli/publication-assets.d.ts +10 -0
- package/dist/tools/cli/publication-assets.d.ts.map +1 -0
- package/dist/tools/cli/publication-contract.d.ts +75 -0
- package/dist/tools/cli/publication-contract.d.ts.map +1 -0
- package/dist/tools/cli/publication-control.d.ts +4 -0
- package/dist/tools/cli/publication-control.d.ts.map +1 -0
- package/dist/tools/cli/publication-storage.d.ts +32 -0
- package/dist/tools/cli/publication-storage.d.ts.map +1 -0
- package/dist/tools/cli/publication.d.ts +35 -0
- package/dist/tools/cli/publication.d.ts.map +1 -0
- package/dist/tools/cli/update.d.ts.map +1 -1
- package/dist/tools/connections/define.d.ts.map +1 -1
- package/dist/tools/connections/error-projection.d.ts +4 -0
- package/dist/tools/connections/error-projection.d.ts.map +1 -0
- package/dist/tools/connections/errors.d.ts +24 -8
- package/dist/tools/connections/errors.d.ts.map +1 -1
- package/dist/tools/connections/limits.d.ts +11 -31
- package/dist/tools/connections/limits.d.ts.map +1 -1
- package/dist/tools/connections/mcp-client.d.ts +6 -4
- package/dist/tools/connections/mcp-client.d.ts.map +1 -1
- package/dist/tools/connections/mcp.d.ts.map +1 -1
- package/dist/tools/connections/openapi.d.ts.map +1 -1
- package/dist/tools/connections/operation-limits.d.ts +25 -0
- package/dist/tools/connections/operation-limits.d.ts.map +1 -0
- package/dist/tools/connections/sse-frames.d.ts +11 -2
- package/dist/tools/connections/sse-frames.d.ts.map +1 -1
- package/dist/tools/connections/sse-session.d.ts +15 -2
- package/dist/tools/connections/sse-session.d.ts.map +1 -1
- package/dist/tools/connections/types.d.ts +19 -1
- package/dist/tools/connections/types.d.ts.map +1 -1
- package/dist/tools/execute-result.d.ts.map +1 -1
- package/dist/tools/execute.d.ts.map +1 -1
- package/dist/tools/internal/observe-hook.d.ts +3 -0
- package/dist/tools/internal/observe-hook.d.ts.map +1 -0
- package/dist/tools/internal/surface-projector.d.ts +2 -1
- package/dist/tools/internal/surface-projector.d.ts.map +1 -1
- package/dist/tools/mcp/mount.d.ts +2 -2
- package/dist/tools/mcp/mount.d.ts.map +1 -1
- package/dist/tools/mcp/prepare.d.ts +4 -5
- package/dist/tools/mcp/prepare.d.ts.map +1 -1
- package/dist/tools/mcp/register.d.ts +4 -1
- package/dist/tools/mcp/register.d.ts.map +1 -1
- package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
- package/dist/tools/remote.d.ts.map +1 -1
- package/dist/tools/runtime-tool-execution.d.ts +65 -0
- package/dist/tools/runtime-tool-execution.d.ts.map +1 -0
- package/dist/tools/runtime-tool-mcp.d.ts +27 -0
- package/dist/tools/runtime-tool-mcp.d.ts.map +1 -0
- package/dist/tools/runtime-tool.d.ts +9 -60
- package/dist/tools/runtime-tool.d.ts.map +1 -1
- package/dist/tools/surface.d.ts +12 -14
- package/dist/tools/surface.d.ts.map +1 -1
- package/llms/application.2.txt +221 -44
- package/llms/application.3.txt +3 -1
- package/llms/application.txt +1 -1
- package/llms/cli.2.txt +144 -1
- package/llms/cli.txt +133 -104
- package/llms/contract.txt +1 -1
- package/llms/process.txt +34 -5
- package/llms/server.4.txt +4 -1
- package/llms/server.5.txt +1 -0
- package/llms/stitchkit.2.txt +14 -0
- package/llms/stitchkit.txt +5 -4
- package/llms/telegram.txt +64 -2
- package/llms/tools-connections.txt +3 -0
- package/llms/tools-mcp.txt +29 -0
- package/llms/tools.2.txt +59 -0
- package/llms/tools.3.txt +1 -0
- package/llms/tools.txt +11 -52
- package/llms/upgrading-0.37.0-0.44.0.txt +444 -0
- package/llms/{upgrading-0.44.0-0.60.0.txt → upgrading-0.44.0-0.61.0.txt} +140 -271
- package/llms/{upgrading-0.61.0-0.74.0.txt → upgrading-0.62.0-0.79.0.txt} +171 -140
- package/llms/{upgrading-0.75.0-0.103.0.txt → upgrading-0.80.0-0.104.0.txt} +120 -171
- package/llms/upgrading.txt +4 -4
- package/llms-full.txt +677 -64
- package/llms.txt +13 -12
- package/package.json +10 -1
- package/dist/index-d4pa2bgs.js +0 -42
- package/dist/index-wykebpn9.js +0 -221
- package/llms/upgrading-0.37.0.txt +0 -176
- package/dist/{index-69nvze1q.js → index-pptyv13k.js} +3 -3
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
validateDeclaredOutput
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-kb8styz3.js";
|
|
4
4
|
import {
|
|
5
5
|
toolResultFromError,
|
|
6
6
|
toolErrorFromResult
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-2vnh05w4.js";
|
|
8
8
|
import {
|
|
9
9
|
coerceJsonArgs2
|
|
10
10
|
} from "./index-9pw0a51a.js";
|
|
@@ -15,17 +15,17 @@ import {
|
|
|
15
15
|
objectShapeKeys,
|
|
16
16
|
assertUniqueToolName,
|
|
17
17
|
buildToolPresentationSchema
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-77nxk6ay.js";
|
|
19
19
|
import {
|
|
20
20
|
createToolRunner,
|
|
21
21
|
formatToolError
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-2hyavjjj.js";
|
|
23
23
|
import {
|
|
24
24
|
isWithinDir2
|
|
25
25
|
} from "./index-5cc6r990.js";
|
|
26
26
|
import {
|
|
27
27
|
collectToolSurface
|
|
28
|
-
} from "./index-
|
|
28
|
+
} from "./index-a0zzh8ak.js";
|
|
29
29
|
import {
|
|
30
30
|
formatZodError2
|
|
31
31
|
} from "./index-1eeqpadm.js";
|
|
@@ -120,6 +120,12 @@ var DEFAULT_EXIT_CODES2 = {
|
|
|
120
120
|
CONFLICT: 5,
|
|
121
121
|
RATE_LIMITED: 6,
|
|
122
122
|
TIMEOUT: 7,
|
|
123
|
+
REQUEST_ABORTED: 130,
|
|
124
|
+
REQUEST_TIMEOUT: 7,
|
|
125
|
+
CONNECTION_TIMEOUT: 7,
|
|
126
|
+
CONNECTION_RESPONSE_TOO_LARGE: 1,
|
|
127
|
+
CONNECTION_REQUEST_FAILED: 1,
|
|
128
|
+
UPSTREAM_TOOL_ERROR: 1,
|
|
123
129
|
WAIT_FAILED: 1,
|
|
124
130
|
INTERNAL_SERVER_ERROR: 1
|
|
125
131
|
};
|
|
@@ -152,6 +158,18 @@ class CliArgumentError2 extends Error {
|
|
|
152
158
|
|
|
153
159
|
// src/tools/cli/args-fields.ts
|
|
154
160
|
import { z } from "zod";
|
|
161
|
+
function appendCliOptionValue(raw, name, value, info) {
|
|
162
|
+
const existing = raw.get(name);
|
|
163
|
+
const repeatable = !name.includes(".") && (info === undefined || info.kind === "array");
|
|
164
|
+
if (existing !== undefined) {
|
|
165
|
+
if (!repeatable) {
|
|
166
|
+
throw new CliArgumentError2(`--${name} was passed ${existing.length + 1} times`);
|
|
167
|
+
}
|
|
168
|
+
existing.push(value);
|
|
169
|
+
} else {
|
|
170
|
+
raw.set(name, [value]);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
155
173
|
function unwrap(field) {
|
|
156
174
|
if (field instanceof z.ZodOptional || field instanceof z.ZodNullable || field instanceof z.ZodDefault) {
|
|
157
175
|
return unwrap(field.unwrap());
|
|
@@ -799,16 +817,13 @@ function readCliTokens(argv, fields, config) {
|
|
|
799
817
|
help: false
|
|
800
818
|
};
|
|
801
819
|
const flags = new Map;
|
|
802
|
-
const
|
|
820
|
+
const literalBooleanFlags = new Set;
|
|
821
|
+
const frameworkFlags = new Map;
|
|
803
822
|
const viewFlags = new Map;
|
|
804
823
|
let ascending = false;
|
|
805
824
|
const positionals = [];
|
|
806
825
|
const pushFlag = (name, value) => {
|
|
807
|
-
|
|
808
|
-
if (existing)
|
|
809
|
-
existing.push(value);
|
|
810
|
-
else
|
|
811
|
-
flags.set(name, [value]);
|
|
826
|
+
appendCliOptionValue(flags, name, value, fields.get(name));
|
|
812
827
|
};
|
|
813
828
|
let optionsEnded = false;
|
|
814
829
|
for (let i = 0;i < argv.length; i++) {
|
|
@@ -824,6 +839,7 @@ function readCliTokens(argv, fields, config) {
|
|
|
824
839
|
continue;
|
|
825
840
|
}
|
|
826
841
|
if (tok === "-h") {
|
|
842
|
+
appendCliOptionValue(frameworkFlags, "help", "true", { kind: "boolean" });
|
|
827
843
|
options.help = true;
|
|
828
844
|
continue;
|
|
829
845
|
}
|
|
@@ -839,7 +855,10 @@ function readCliTokens(argv, fields, config) {
|
|
|
839
855
|
const separate = inline === undefined ? separateBoolValue(argv[i + 1]) : undefined;
|
|
840
856
|
if (separate !== undefined)
|
|
841
857
|
i++;
|
|
842
|
-
|
|
858
|
+
pushFlag(field, inline ?? String(separate ?? true));
|
|
859
|
+
if (inline !== undefined)
|
|
860
|
+
parseReservedBool(field, inline);
|
|
861
|
+
literalBooleanFlags.add(field);
|
|
843
862
|
continue;
|
|
844
863
|
}
|
|
845
864
|
let value = inline;
|
|
@@ -866,6 +885,9 @@ function readCliTokens(argv, fields, config) {
|
|
|
866
885
|
const separate = value === undefined ? separateBoolValue(argv[i + 1]) : undefined;
|
|
867
886
|
if (separate !== undefined)
|
|
868
887
|
i++;
|
|
888
|
+
appendCliOptionValue(frameworkFlags, name, value ?? String(separate ?? true), {
|
|
889
|
+
kind: "boolean"
|
|
890
|
+
});
|
|
869
891
|
const enabled = value === undefined ? separate ?? true : parseReservedBool(name, value);
|
|
870
892
|
if (name === "dry-run")
|
|
871
893
|
options.dryRun = enabled;
|
|
@@ -889,6 +911,7 @@ function readCliTokens(argv, fields, config) {
|
|
|
889
911
|
}
|
|
890
912
|
if (!option.inline)
|
|
891
913
|
i++;
|
|
914
|
+
appendCliOptionValue(frameworkFlags, name, value, { kind: "string" });
|
|
892
915
|
if (name === "wait-timeout") {
|
|
893
916
|
const timeout = Number(value);
|
|
894
917
|
if (!Number.isFinite(timeout) || timeout <= 0) {
|
|
@@ -896,8 +919,6 @@ function readCliTokens(argv, fields, config) {
|
|
|
896
919
|
}
|
|
897
920
|
options.waitTimeout = timeout;
|
|
898
921
|
} else if (VIEW_OPTIONS.has(name)) {
|
|
899
|
-
if (viewFlags.has(name))
|
|
900
|
-
throw new CliArgumentError2(`--${name} was given twice`);
|
|
901
922
|
viewFlags.set(name, value);
|
|
902
923
|
} else {
|
|
903
924
|
options.outputDir = value;
|
|
@@ -905,7 +926,8 @@ function readCliTokens(argv, fields, config) {
|
|
|
905
926
|
continue;
|
|
906
927
|
}
|
|
907
928
|
if (value === undefined && name.startsWith("no-") && fields.get(name.slice(3))?.kind === "boolean") {
|
|
908
|
-
|
|
929
|
+
pushFlag(name.slice(3), "false");
|
|
930
|
+
literalBooleanFlags.add(name.slice(3));
|
|
909
931
|
continue;
|
|
910
932
|
}
|
|
911
933
|
const unsafeSegment = name.split(".").find(isUnsafeKey);
|
|
@@ -922,7 +944,8 @@ function readCliTokens(argv, fields, config) {
|
|
|
922
944
|
const separate = separateBoolValue(argv[i + 1]);
|
|
923
945
|
if (separate !== undefined)
|
|
924
946
|
i++;
|
|
925
|
-
|
|
947
|
+
pushFlag(name, String(separate ?? true));
|
|
948
|
+
literalBooleanFlags.add(name);
|
|
926
949
|
continue;
|
|
927
950
|
}
|
|
928
951
|
const next = argv[i + 1];
|
|
@@ -935,10 +958,10 @@ function readCliTokens(argv, fields, config) {
|
|
|
935
958
|
}
|
|
936
959
|
pushFlag(name, value);
|
|
937
960
|
}
|
|
938
|
-
return { options, flags,
|
|
961
|
+
return { options, flags, literalBooleanFlags, viewFlags, ascending, positionals };
|
|
939
962
|
}
|
|
940
963
|
function buildToolArgs(tokens, fields, declaredPositionals) {
|
|
941
|
-
const { flags,
|
|
964
|
+
const { flags, literalBooleanFlags, positionals } = tokens;
|
|
942
965
|
const toolArgs = {};
|
|
943
966
|
const fillable = declaredPositionals === undefined ? [...fields.entries()].filter(([, info]) => info.kind !== "boolean").map(([name]) => name) : [...declaredPositionals];
|
|
944
967
|
const variadicTail = declaredPositionals !== undefined && fields.get(fillable[fillable.length - 1] ?? "")?.kind === "array" ? fillable[fillable.length - 1] : undefined;
|
|
@@ -964,14 +987,12 @@ function buildToolArgs(tokens, fields, declaredPositionals) {
|
|
|
964
987
|
if (pi < positionals.length) {
|
|
965
988
|
throw new CliArgumentError2(`Unexpected positional argument "${positionals[pi]}"`);
|
|
966
989
|
}
|
|
967
|
-
for (const [key, value] of boolFlags) {
|
|
968
|
-
toolArgs[key] = value;
|
|
969
|
-
}
|
|
970
990
|
const dottedRoots = new Map;
|
|
971
991
|
for (const key of flags.keys()) {
|
|
972
992
|
const dot = key.indexOf(".");
|
|
973
|
-
if (dot > 0)
|
|
993
|
+
if (dot > 0 && !literalBooleanFlags.has(key)) {
|
|
974
994
|
dottedRoots.set(key.slice(0, dot), key);
|
|
995
|
+
}
|
|
975
996
|
}
|
|
976
997
|
for (const [root, dotted] of dottedRoots) {
|
|
977
998
|
if (flags.has(root)) {
|
|
@@ -979,17 +1000,11 @@ function buildToolArgs(tokens, fields, declaredPositionals) {
|
|
|
979
1000
|
}
|
|
980
1001
|
}
|
|
981
1002
|
for (const [key, values] of flags) {
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
throw new CliArgumentError2(`--${key} was passed ${values.length} times`);
|
|
985
|
-
}
|
|
1003
|
+
const info = fields.get(key);
|
|
1004
|
+
if (key.includes(".") && !literalBooleanFlags.has(key)) {
|
|
986
1005
|
setNested(toolArgs, key.split("."), looseCoerce(values[0] ?? ""));
|
|
987
1006
|
continue;
|
|
988
1007
|
}
|
|
989
|
-
const info = fields.get(key);
|
|
990
|
-
if (values.length > 1 && info !== undefined && info.kind !== "array" && info.kind !== "other") {
|
|
991
|
-
throw new CliArgumentError2(`--${key} was passed ${values.length} times`);
|
|
992
|
-
}
|
|
993
1008
|
toolArgs[key] = coerceField(info, values, `--${key}`);
|
|
994
1009
|
}
|
|
995
1010
|
return toolArgs;
|
|
@@ -1041,11 +1056,7 @@ function extractCliGlobalOptions2(argv, schema) {
|
|
|
1041
1056
|
throw new CliArgumentError2(`--${option.name} requires a value`);
|
|
1042
1057
|
}
|
|
1043
1058
|
}
|
|
1044
|
-
|
|
1045
|
-
if (existing)
|
|
1046
|
-
existing.push(value);
|
|
1047
|
-
else
|
|
1048
|
-
raw.set(option.name, [value]);
|
|
1059
|
+
appendCliOptionValue(raw, option.name, value, info);
|
|
1049
1060
|
}
|
|
1050
1061
|
const args = {};
|
|
1051
1062
|
for (const [name, values] of raw) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
projectToolSurface
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-77nxk6ay.js";
|
|
4
4
|
import {
|
|
5
5
|
contractToolMountable
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-2hyavjjj.js";
|
|
7
7
|
import {
|
|
8
8
|
runtimeToolMountable
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-cvda079a.js";
|
|
10
10
|
|
|
11
11
|
// src/tools/surface.ts
|
|
12
12
|
function collectToolSurface({
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
var timestamp = z.string().datetime({ offset: true });
|
|
4
4
|
var key = z.string().min(1).max(255);
|
|
5
|
+
var DirectoryInboxIdentitySchema2 = z.object({ source: z.string().min(1).max(128), key: z.string().min(1).max(1024) }).strict();
|
|
6
|
+
var DirectoryInboxAcceptResultSchema2 = z.object({ status: z.enum(["accepted", "duplicate"]), filename: key }).strict();
|
|
5
7
|
var DirectoryInboxRejectionReasonSchema2 = z.enum([
|
|
6
8
|
"invalid",
|
|
7
9
|
"too-large",
|
|
@@ -11,14 +13,20 @@ var DirectoryInboxStateSchema2 = z.object({
|
|
|
11
13
|
schemaVersion: z.literal(1),
|
|
12
14
|
claims: z.array(z.object({
|
|
13
15
|
key,
|
|
16
|
+
identity: DirectoryInboxIdentitySchema2.optional(),
|
|
14
17
|
attempts: z.number().int().positive(),
|
|
15
18
|
nextAttemptAt: timestamp,
|
|
16
19
|
leaseId: z.string().min(1).max(128).nullable(),
|
|
17
20
|
leaseUntil: timestamp.nullable()
|
|
18
21
|
}).strict()),
|
|
19
|
-
receipts: z.array(z.object({
|
|
22
|
+
receipts: z.array(z.object({
|
|
23
|
+
key,
|
|
24
|
+
identity: DirectoryInboxIdentitySchema2.optional(),
|
|
25
|
+
completedAt: timestamp
|
|
26
|
+
}).strict()),
|
|
20
27
|
rejected: z.array(z.object({
|
|
21
28
|
key,
|
|
29
|
+
identity: DirectoryInboxIdentitySchema2.optional(),
|
|
22
30
|
reason: DirectoryInboxRejectionReasonSchema2,
|
|
23
31
|
detail: z.string().max(1000),
|
|
24
32
|
rejectedAt: timestamp
|
|
@@ -57,6 +65,7 @@ function claimEntry(state, input) {
|
|
|
57
65
|
if (claim.attempts >= input.maxAttempts) {
|
|
58
66
|
const rejection = {
|
|
59
67
|
key: input.key,
|
|
68
|
+
...claim.identity && { identity: claim.identity },
|
|
60
69
|
reason: "attempt-limit",
|
|
61
70
|
detail: `taken ${claim.attempts} times without completing`,
|
|
62
71
|
rejectedAt: iso(now)
|
|
@@ -82,17 +91,25 @@ function claimEntry(state, input) {
|
|
|
82
91
|
step: { kind: "deliver", claim: taken }
|
|
83
92
|
};
|
|
84
93
|
}
|
|
85
|
-
function completeEntry(state,
|
|
94
|
+
function completeEntry(state, claim, now, retain) {
|
|
95
|
+
if (!ownsClaim(state, claim, now))
|
|
96
|
+
return state;
|
|
86
97
|
return {
|
|
87
98
|
...state,
|
|
88
|
-
claims: state.claims.filter((
|
|
99
|
+
claims: state.claims.filter((candidate) => candidate.key !== claim.key),
|
|
89
100
|
receipts: [
|
|
90
|
-
{
|
|
91
|
-
|
|
101
|
+
{
|
|
102
|
+
key: claim.key,
|
|
103
|
+
...claim.identity && { identity: claim.identity },
|
|
104
|
+
completedAt: now.toISOString()
|
|
105
|
+
},
|
|
106
|
+
...state.receipts.filter((receipt) => receipt.key !== claim.key)
|
|
92
107
|
].slice(0, retain)
|
|
93
108
|
};
|
|
94
109
|
}
|
|
95
|
-
function releaseEntry(state, claim, retryAt) {
|
|
110
|
+
function releaseEntry(state, claim, now, retryAt) {
|
|
111
|
+
if (!ownsClaim(state, claim, now))
|
|
112
|
+
return state;
|
|
96
113
|
return {
|
|
97
114
|
...state,
|
|
98
115
|
claims: state.claims.map((candidate) => candidate.key === claim.key && candidate.leaseId === claim.leaseId ? {
|
|
@@ -103,6 +120,17 @@ function releaseEntry(state, claim, retryAt) {
|
|
|
103
120
|
} : candidate)
|
|
104
121
|
};
|
|
105
122
|
}
|
|
123
|
+
function ownsClaim(state, claim, now) {
|
|
124
|
+
return claim.leaseId !== null && state.claims.some((candidate) => candidate.key === claim.key && candidate.leaseId === claim.leaseId && candidate.leaseUntil !== null && Date.parse(candidate.leaseUntil) > now.getTime());
|
|
125
|
+
}
|
|
126
|
+
function renewEntry(state, claim, now, leaseMs) {
|
|
127
|
+
if (!ownsClaim(state, claim, now))
|
|
128
|
+
return state;
|
|
129
|
+
return {
|
|
130
|
+
...state,
|
|
131
|
+
claims: state.claims.map((candidate) => candidate.key === claim.key ? { ...candidate, leaseUntil: iso(now.getTime() + leaseMs) } : candidate)
|
|
132
|
+
};
|
|
133
|
+
}
|
|
106
134
|
function forgetMissing(state, present, now) {
|
|
107
135
|
const live = (claim) => claim.leaseUntil !== null && Date.parse(claim.leaseUntil) > now.getTime();
|
|
108
136
|
return {
|
|
@@ -111,4 +139,4 @@ function forgetMissing(state, present, now) {
|
|
|
111
139
|
};
|
|
112
140
|
}
|
|
113
141
|
|
|
114
|
-
export { DirectoryInboxRejectionReasonSchema2, DirectoryInboxStateSchema2, emptyDirectoryInboxState, withRejection, claimEntry, completeEntry, releaseEntry, forgetMissing };
|
|
142
|
+
export { DirectoryInboxIdentitySchema2, DirectoryInboxAcceptResultSchema2, DirectoryInboxRejectionReasonSchema2, DirectoryInboxStateSchema2, emptyDirectoryInboxState, withRejection, claimEntry, completeEntry, releaseEntry, ownsClaim, renewEntry, forgetMissing };
|