stitchkit 0.87.1 → 0.89.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 +190 -0
- package/dist/agent-runtime/child-blocking.d.ts +17 -0
- package/dist/agent-runtime/child-blocking.d.ts.map +1 -0
- package/dist/agent-runtime/child-budget-policy.d.ts +23 -0
- package/dist/agent-runtime/child-budget-policy.d.ts.map +1 -0
- package/dist/agent-runtime/children-contract.d.ts +155 -0
- package/dist/agent-runtime/children-contract.d.ts.map +1 -0
- package/dist/agent-runtime/children.d.ts +4 -99
- package/dist/agent-runtime/children.d.ts.map +1 -1
- package/dist/agent-runtime/coding-shell-process.d.ts +33 -0
- package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -0
- package/dist/agent-runtime/coding-tool-contract.d.ts +18 -0
- package/dist/agent-runtime/coding-tool-contract.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-files.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-listing.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-paths.d.ts +1 -1
- package/dist/agent-runtime/coding-tool-paths.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-search-patch.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-shell.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-utf8.d.ts +28 -0
- package/dist/agent-runtime/coding-tool-utf8.d.ts.map +1 -0
- package/dist/agent-runtime/contained-files.d.ts +20 -0
- package/dist/agent-runtime/contained-files.d.ts.map +1 -1
- package/dist/agent-runtime/durability-contract.d.ts +176 -0
- package/dist/agent-runtime/durability-contract.d.ts.map +1 -0
- package/dist/agent-runtime/durability-json.d.ts +3 -0
- package/dist/agent-runtime/durability-json.d.ts.map +1 -0
- package/dist/agent-runtime/durability-ledger.d.ts +16 -0
- package/dist/agent-runtime/durability-ledger.d.ts.map +1 -0
- package/dist/agent-runtime/durability-scheduler.d.ts +29 -0
- package/dist/agent-runtime/durability-scheduler.d.ts.map +1 -0
- package/dist/agent-runtime/durability.d.ts +14 -0
- package/dist/agent-runtime/durability.d.ts.map +1 -0
- package/dist/agent-runtime/event-search.d.ts.map +1 -1
- package/dist/agent-runtime/harness-contract.d.ts +37 -0
- package/dist/agent-runtime/harness-contract.d.ts.map +1 -1
- package/dist/agent-runtime/harness.d.ts +8 -0
- package/dist/agent-runtime/harness.d.ts.map +1 -1
- package/dist/agent-runtime/models.d.ts +14 -0
- package/dist/agent-runtime/models.d.ts.map +1 -1
- package/dist/agent-runtime/observability.d.ts +8 -0
- package/dist/agent-runtime/observability.d.ts.map +1 -1
- package/dist/agent-runtime/owned-provider-stream.d.ts +16 -0
- package/dist/agent-runtime/owned-provider-stream.d.ts.map +1 -0
- package/dist/agent-runtime/prompt.d.ts +23 -0
- package/dist/agent-runtime/prompt.d.ts.map +1 -1
- package/dist/agent-runtime/run-execution.d.ts.map +1 -1
- package/dist/agent-runtime/runtime-internals.d.ts +16 -0
- package/dist/agent-runtime/runtime-internals.d.ts.map +1 -1
- package/dist/agent-runtime/runtime.d.ts +25 -0
- package/dist/agent-runtime/runtime.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox-broker.d.ts +7 -0
- package/dist/agent-runtime/sandbox-broker.d.ts.map +1 -0
- package/dist/agent-runtime/sandbox-bubblewrap-args.d.ts +9 -0
- package/dist/agent-runtime/sandbox-bubblewrap-args.d.ts.map +1 -0
- package/dist/agent-runtime/sandbox-bubblewrap-storage.d.ts +22 -0
- package/dist/agent-runtime/sandbox-bubblewrap-storage.d.ts.map +1 -0
- package/dist/agent-runtime/sandbox-bubblewrap.d.ts +14 -0
- package/dist/agent-runtime/sandbox-bubblewrap.d.ts.map +1 -0
- package/dist/agent-runtime/sandbox-coding-adapter.d.ts +15 -0
- package/dist/agent-runtime/sandbox-coding-adapter.d.ts.map +1 -0
- package/dist/agent-runtime/sandbox-coding.d.ts +15 -0
- package/dist/agent-runtime/sandbox-coding.d.ts.map +1 -0
- package/dist/agent-runtime/sandbox-contract.d.ts +93 -0
- package/dist/agent-runtime/sandbox-contract.d.ts.map +1 -0
- package/dist/agent-runtime/sandbox-process-owner.d.ts +11 -0
- package/dist/agent-runtime/sandbox-process-owner.d.ts.map +1 -0
- package/dist/agent-runtime/sandbox-process.d.ts +8 -0
- package/dist/agent-runtime/sandbox-process.d.ts.map +1 -0
- package/dist/agent-runtime/sandbox-session.d.ts +5 -0
- package/dist/agent-runtime/sandbox-session.d.ts.map +1 -0
- package/dist/agent-runtime/sandbox.d.ts +19 -0
- package/dist/agent-runtime/sandbox.d.ts.map +1 -1
- package/dist/agent-runtime/schemas.d.ts +6 -0
- package/dist/agent-runtime/schemas.d.ts.map +1 -1
- package/dist/agent-runtime/sqlite-purge.d.ts.map +1 -1
- package/dist/agent-runtime/sqlite.d.ts.map +1 -1
- package/dist/agent-runtime/store-driver.d.ts +127 -0
- package/dist/agent-runtime/store-driver.d.ts.map +1 -1
- package/dist/agent-runtime/store-events.d.ts +106 -0
- package/dist/agent-runtime/store-events.d.ts.map +1 -1
- package/dist/agent-runtime/store-migrations/v2-to-v3.d.ts +14 -0
- package/dist/agent-runtime/store-migrations/v2-to-v3.d.ts.map +1 -0
- package/dist/agent-runtime/store.d.ts +115 -0
- package/dist/agent-runtime/store.d.ts.map +1 -1
- package/dist/agent-runtime-browser.js +5 -3
- package/dist/agent-runtime-coding-tools.js +11 -1236
- package/dist/agent-runtime-harness.d.ts +1 -1
- package/dist/agent-runtime-harness.d.ts.map +1 -1
- package/dist/agent-runtime-harness.js +69 -19
- package/dist/agent-runtime-openrouter.d.ts +3 -12
- package/dist/agent-runtime-openrouter.d.ts.map +1 -1
- package/dist/agent-runtime-openrouter.js +22 -9
- package/dist/agent-runtime-sandbox.d.ts +5 -0
- package/dist/agent-runtime-sandbox.d.ts.map +1 -0
- package/dist/agent-runtime-sandbox.js +797 -0
- package/dist/agent-runtime-sqlite-bun.js +5 -5
- package/dist/agent-runtime-sqlite-node.js +5 -5
- package/dist/agent-runtime.d.ts +6 -5
- package/dist/agent-runtime.d.ts.map +1 -1
- package/dist/agent-runtime.js +266 -69
- package/dist/application.js +26 -26
- package/dist/cli.js +8 -8
- package/dist/{index-rcgsnrr6.js → index-31jw8fjq.js} +3 -3
- package/dist/{index-9hw9eq48.js → index-7601qfg1.js} +14 -14
- package/dist/{index-3xnq72rz.js → index-7rkhw9ec.js} +14 -1
- package/dist/{index-0vfdh685.js → index-8c3a7m4g.js} +1 -1
- package/dist/{index-t7gh5w3v.js → index-bn2cjajt.js} +27 -6
- package/dist/{index-z2452tsw.js → index-bt14acb5.js} +2 -2
- package/dist/index-cp20z0n6.js +1351 -0
- package/dist/{index-9553432s.js → index-crykmqkr.js} +1 -1
- package/dist/{index-6g273pqx.js → index-fadnxwna.js} +89 -7
- package/dist/{index-p1b1y93x.js → index-gtj3zc53.js} +5 -1
- package/dist/{index-5wezxcxx.js → index-hrbajay7.js} +107 -5
- package/dist/{index-35aefxby.js → index-hw2chdvy.js} +768 -49
- package/dist/{index-0ydchz76.js → index-mnm4qp0p.js} +5 -5
- package/dist/{index-tg3m2ec5.js → index-mqv3b5rh.js} +4 -1
- package/dist/{index-1szetq6f.js → index-q3ve2d1k.js} +30 -8
- package/dist/{index-hkm6wysp.js → index-y64k3s0h.js} +1 -1
- package/dist/{index-z1m86vc8.js → index-zwkgfq1s.js} +97 -86
- package/dist/{index-wn9cb82y.js → index-zyvby92n.js} +12 -9
- package/dist/index.js +13 -13
- package/dist/server/index.js +9 -9
- package/dist/testing/agent-store-conformance.d.ts.map +1 -1
- package/dist/testing.js +69 -24
- package/dist/tool-invoker.js +6 -6
- package/dist/tools/agent.d.ts +6 -0
- package/dist/tools/agent.d.ts.map +1 -1
- package/dist/tools/connections/define.d.ts +6 -0
- package/dist/tools/connections/define.d.ts.map +1 -0
- package/dist/tools/connections/errors.d.ts +50 -0
- package/dist/tools/connections/errors.d.ts.map +1 -0
- package/dist/tools/connections/http.d.ts +3 -0
- package/dist/tools/connections/http.d.ts.map +1 -0
- package/dist/tools/connections/index.d.ts +19 -0
- package/dist/tools/connections/index.d.ts.map +1 -0
- package/dist/tools/connections/index.js +1047 -0
- package/dist/tools/connections/instance.d.ts +3 -0
- package/dist/tools/connections/instance.d.ts.map +1 -0
- package/dist/tools/connections/json-rpc.d.ts +8 -0
- package/dist/tools/connections/json-rpc.d.ts.map +1 -0
- package/dist/tools/connections/limits.d.ts +36 -0
- package/dist/tools/connections/limits.d.ts.map +1 -0
- package/dist/tools/connections/mcp-client.d.ts +44 -0
- package/dist/tools/connections/mcp-client.d.ts.map +1 -0
- package/dist/tools/connections/mcp.d.ts +5 -0
- package/dist/tools/connections/mcp.d.ts.map +1 -0
- package/dist/tools/connections/mount.d.ts +12 -0
- package/dist/tools/connections/mount.d.ts.map +1 -0
- package/dist/tools/connections/openapi-document.d.ts +4 -0
- package/dist/tools/connections/openapi-document.d.ts.map +1 -0
- package/dist/tools/connections/openapi.d.ts +5 -0
- package/dist/tools/connections/openapi.d.ts.map +1 -0
- package/dist/tools/connections/runtime.d.ts +29 -0
- package/dist/tools/connections/runtime.d.ts.map +1 -0
- package/dist/tools/connections/schema-budget.d.ts +8 -0
- package/dist/tools/connections/schema-budget.d.ts.map +1 -0
- package/dist/tools/connections/sse-frames.d.ts +7 -0
- package/dist/tools/connections/sse-frames.d.ts.map +1 -0
- package/dist/tools/connections/sse-session.d.ts +26 -0
- package/dist/tools/connections/sse-session.d.ts.map +1 -0
- package/dist/tools/connections/ssrf.d.ts +15 -0
- package/dist/tools/connections/ssrf.d.ts.map +1 -0
- package/dist/tools/connections/types.d.ts +60 -0
- package/dist/tools/connections/types.d.ts.map +1 -0
- package/dist/tools/durability-context.d.ts +7 -0
- package/dist/tools/durability-context.d.ts.map +1 -0
- package/dist/tools/execute.d.ts +2 -0
- package/dist/tools/execute.d.ts.map +1 -1
- package/dist/tools/registry.d.ts +38 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/runtime-tool.d.ts +4 -0
- package/dist/tools/runtime-tool.d.ts.map +1 -1
- package/dist/tools.d.ts +1 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +83 -26
- package/llms-full.txt +329 -14
- package/llms.txt +1 -0
- package/package.json +9 -1
- package/dist/{index-evcnmsc3.js → index-t7fkyxcr.js} +3 -3
package/dist/application.js
CHANGED
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
import"./index-pq95qkbf.js";
|
|
2
|
-
import {
|
|
3
|
-
ApplicationAdmissionError,
|
|
4
|
-
ApplicationRestartInputSchema,
|
|
5
|
-
ApplicationRestartOutcomeSchema,
|
|
6
|
-
ApplicationRestartResultSchema,
|
|
7
|
-
ApplicationShutdownBudgetSchema,
|
|
8
|
-
ApplicationShutdownOptionsSchema,
|
|
9
|
-
createApplication
|
|
10
|
-
} from "./index-evcnmsc3.js";
|
|
11
|
-
import {
|
|
12
|
-
defineManagedResource,
|
|
13
|
-
managedResourceDependencyId
|
|
14
|
-
} from "./index-2k4yrqkc.js";
|
|
15
1
|
import {
|
|
16
2
|
ActivityIdSchema,
|
|
17
3
|
ActivityLiveStateSchema,
|
|
@@ -28,6 +14,29 @@ import {
|
|
|
28
14
|
createApplicationSnapshotSink,
|
|
29
15
|
createManagedSchedule
|
|
30
16
|
} from "./index-9f8ztey6.js";
|
|
17
|
+
import {
|
|
18
|
+
DiagnosticJournalCloseResultSchema,
|
|
19
|
+
DiagnosticJournalFailurePhaseSchema,
|
|
20
|
+
DiagnosticJournalFrameSchema,
|
|
21
|
+
DiagnosticJournalLimitsSchema,
|
|
22
|
+
DiagnosticJournalLockPolicySchema,
|
|
23
|
+
DiagnosticJournalRefusalReasonSchema,
|
|
24
|
+
DiagnosticJournalStateSchema,
|
|
25
|
+
DiagnosticJournalStatusSchema,
|
|
26
|
+
DiagnosticJournalSubmitResultSchema,
|
|
27
|
+
DiagnosticJournalWaitResultSchema,
|
|
28
|
+
readDiagnosticJournalLockDiagnosis
|
|
29
|
+
} from "./index-wc4x00bn.js";
|
|
30
|
+
import"./index-pq95qkbf.js";
|
|
31
|
+
import {
|
|
32
|
+
ApplicationAdmissionError,
|
|
33
|
+
ApplicationRestartInputSchema,
|
|
34
|
+
ApplicationRestartOutcomeSchema,
|
|
35
|
+
ApplicationRestartResultSchema,
|
|
36
|
+
ApplicationShutdownBudgetSchema,
|
|
37
|
+
ApplicationShutdownOptionsSchema,
|
|
38
|
+
createApplication
|
|
39
|
+
} from "./index-t7fkyxcr.js";
|
|
31
40
|
import {
|
|
32
41
|
ApplicationAdmissionSnapshotSchema,
|
|
33
42
|
ApplicationHealthSchema,
|
|
@@ -42,18 +51,9 @@ import {
|
|
|
42
51
|
projectApplicationStatus
|
|
43
52
|
} from "./index-3gye9wzb.js";
|
|
44
53
|
import {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
DiagnosticJournalLimitsSchema,
|
|
49
|
-
DiagnosticJournalLockPolicySchema,
|
|
50
|
-
DiagnosticJournalRefusalReasonSchema,
|
|
51
|
-
DiagnosticJournalStateSchema,
|
|
52
|
-
DiagnosticJournalStatusSchema,
|
|
53
|
-
DiagnosticJournalSubmitResultSchema,
|
|
54
|
-
DiagnosticJournalWaitResultSchema,
|
|
55
|
-
readDiagnosticJournalLockDiagnosis
|
|
56
|
-
} from "./index-wc4x00bn.js";
|
|
54
|
+
defineManagedResource,
|
|
55
|
+
managedResourceDependencyId
|
|
56
|
+
} from "./index-2k4yrqkc.js";
|
|
57
57
|
import {
|
|
58
58
|
withDeadline
|
|
59
59
|
} from "./index-b9aefrqd.js";
|
package/dist/cli.js
CHANGED
|
@@ -5,23 +5,23 @@ import {
|
|
|
5
5
|
emitResult,
|
|
6
6
|
parseCliArgs,
|
|
7
7
|
pollUntilDone
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-7601qfg1.js";
|
|
9
9
|
import"./index-sbdmyz75.js";
|
|
10
|
-
import"./index-
|
|
11
|
-
import"./index-
|
|
12
|
-
import"./index-
|
|
13
|
-
import"./index-wn9cb82y.js";
|
|
10
|
+
import"./index-31jw8fjq.js";
|
|
11
|
+
import"./index-8c3a7m4g.js";
|
|
12
|
+
import"./index-zyvby92n.js";
|
|
14
13
|
import"./index-vsbzgd7b.js";
|
|
15
14
|
import"./index-f9mb610r.js";
|
|
16
|
-
import"./index-r159gjwy.js";
|
|
17
|
-
import"./index-cby4ar3v.js";
|
|
18
|
-
import"./index-7zbps32p.js";
|
|
19
15
|
import"./index-7evdsyez.js";
|
|
20
16
|
import"./index-2bxcmqkb.js";
|
|
21
17
|
import"./index-6k1937bx.js";
|
|
22
18
|
import"./index-0w9abg87.js";
|
|
23
19
|
import"./index-zcgf3gqf.js";
|
|
20
|
+
import"./index-7zbps32p.js";
|
|
24
21
|
import"./index-kzfs85xp.js";
|
|
22
|
+
import"./index-kc6h6hg0.js";
|
|
23
|
+
import"./index-r159gjwy.js";
|
|
24
|
+
import"./index-cby4ar3v.js";
|
|
25
25
|
import"./index-77fekveh.js";
|
|
26
26
|
export {
|
|
27
27
|
pollUntilDone,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
contractToolMountable
|
|
3
|
+
} from "./index-8c3a7m4g.js";
|
|
1
4
|
import {
|
|
2
5
|
runtimeToolMountable
|
|
3
6
|
} from "./index-kc6h6hg0.js";
|
|
4
|
-
import {
|
|
5
|
-
contractToolMountable
|
|
6
|
-
} from "./index-0vfdh685.js";
|
|
7
7
|
import {
|
|
8
8
|
projectToolSurface
|
|
9
9
|
} from "./index-r159gjwy.js";
|
|
@@ -3,33 +3,33 @@ import {
|
|
|
3
3
|
} from "./index-sbdmyz75.js";
|
|
4
4
|
import {
|
|
5
5
|
collectToolSurface
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-31jw8fjq.js";
|
|
7
7
|
import {
|
|
8
8
|
createToolRunner,
|
|
9
9
|
formatToolError
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-8c3a7m4g.js";
|
|
11
11
|
import {
|
|
12
12
|
toolResultFromError
|
|
13
|
-
} from "./index-
|
|
14
|
-
import {
|
|
15
|
-
assertUniqueToolName,
|
|
16
|
-
buildToolPresentationSchema,
|
|
17
|
-
objectShapeKeys
|
|
18
|
-
} from "./index-r159gjwy.js";
|
|
19
|
-
import {
|
|
20
|
-
jsonSchemaFields
|
|
21
|
-
} from "./index-cby4ar3v.js";
|
|
22
|
-
import {
|
|
23
|
-
coerceJsonArgs
|
|
24
|
-
} from "./index-7zbps32p.js";
|
|
13
|
+
} from "./index-zyvby92n.js";
|
|
25
14
|
import {
|
|
26
15
|
formatZodError,
|
|
27
16
|
validateDeclaredOutput
|
|
28
17
|
} from "./index-7evdsyez.js";
|
|
18
|
+
import {
|
|
19
|
+
coerceJsonArgs
|
|
20
|
+
} from "./index-7zbps32p.js";
|
|
29
21
|
import {
|
|
30
22
|
isUnsafeKey,
|
|
31
23
|
safeJsonParse
|
|
32
24
|
} from "./index-kzfs85xp.js";
|
|
25
|
+
import {
|
|
26
|
+
assertUniqueToolName,
|
|
27
|
+
buildToolPresentationSchema,
|
|
28
|
+
objectShapeKeys
|
|
29
|
+
} from "./index-r159gjwy.js";
|
|
30
|
+
import {
|
|
31
|
+
jsonSchemaFields
|
|
32
|
+
} from "./index-cby4ar3v.js";
|
|
33
33
|
import {
|
|
34
34
|
isRecord
|
|
35
35
|
} from "./index-77fekveh.js";
|
|
@@ -18,4 +18,17 @@ function isAgentToolError(value) {
|
|
|
18
18
|
return typeof value === "object" && value !== null && AGENT_TOOL_ERROR_BRAND in value;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
// src/tools/durability-context.ts
|
|
22
|
+
var contexts = new WeakMap;
|
|
23
|
+
function createToolDurabilityContext(factory) {
|
|
24
|
+
const context = {};
|
|
25
|
+
contexts.set(context, factory);
|
|
26
|
+
return context;
|
|
27
|
+
}
|
|
28
|
+
function resolveToolDurability(context, callId, signal) {
|
|
29
|
+
if (typeof context !== "object" || context === null)
|
|
30
|
+
return;
|
|
31
|
+
return contexts.get(context)?.(callId, signal);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { AgentToolError, isAgentToolError, createToolDurabilityContext, resolveToolDurability };
|
|
@@ -21,6 +21,9 @@ import {
|
|
|
21
21
|
import { createRequire } from "node:module";
|
|
22
22
|
import path from "node:path";
|
|
23
23
|
import { fileURLToPath } from "node:url";
|
|
24
|
+
function containedEntryKind(entry) {
|
|
25
|
+
return entry.isDirectory() ? "directory" : entry.isSymbolicLink() ? "symlink" : entry.isFile() ? "file" : "other";
|
|
26
|
+
}
|
|
24
27
|
var FILE_TYPE_MASK = 61440;
|
|
25
28
|
var FILE_TYPE_DIRECTORY = 16384;
|
|
26
29
|
var FILE_TYPE_REGULAR = 32768;
|
|
@@ -174,14 +177,18 @@ async function listContainedDirectory(root, relative, maxEntries, authorizePath)
|
|
|
174
177
|
const raw = [...await listAt(current)];
|
|
175
178
|
raw.sort((left, right) => left.name.localeCompare(right.name));
|
|
176
179
|
const admitted = [];
|
|
180
|
+
const denied = [];
|
|
177
181
|
for (const entry of raw) {
|
|
178
182
|
const entryPath = relative === "." ? entry.name : path.join(relative, entry.name);
|
|
179
|
-
if (
|
|
180
|
-
|
|
183
|
+
if (authorizePath && !await authorizePath(entryPath)) {
|
|
184
|
+
denied.push({ name: entry.name, kind: containedEntryKind(entry) });
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
admitted.push(entry);
|
|
181
188
|
}
|
|
182
189
|
const entries = [];
|
|
183
190
|
for (const entry of admitted.slice(0, maxEntries)) {
|
|
184
|
-
const kind =
|
|
191
|
+
const kind = containedEntryKind(entry);
|
|
185
192
|
if (kind !== "file") {
|
|
186
193
|
entries.push({ name: entry.name, kind });
|
|
187
194
|
continue;
|
|
@@ -198,7 +205,12 @@ async function listContainedDirectory(root, relative, maxEntries, authorizePath)
|
|
|
198
205
|
return left.name.localeCompare(right.name);
|
|
199
206
|
return left.kind === "directory" ? -1 : right.kind === "directory" ? 1 : 0;
|
|
200
207
|
});
|
|
201
|
-
return {
|
|
208
|
+
return {
|
|
209
|
+
entries,
|
|
210
|
+
truncated: admitted.length > maxEntries,
|
|
211
|
+
denied: denied.slice(0, maxEntries),
|
|
212
|
+
deniedTruncated: denied.length > maxEntries
|
|
213
|
+
};
|
|
202
214
|
} finally {
|
|
203
215
|
await current.close();
|
|
204
216
|
}
|
|
@@ -424,6 +436,8 @@ async function scanContainedFiles(input) {
|
|
|
424
436
|
let truncated = false;
|
|
425
437
|
let skippedDirectories = 0;
|
|
426
438
|
let skippedSymlinks = 0;
|
|
439
|
+
const denied = [];
|
|
440
|
+
let deniedTruncated = false;
|
|
427
441
|
const root = await openPinnedDirectory(input.root);
|
|
428
442
|
const visit = async (directory, relativeDirectory, depth) => {
|
|
429
443
|
if (truncated)
|
|
@@ -437,8 +451,15 @@ async function scanContainedFiles(input) {
|
|
|
437
451
|
for (const entry of entries) {
|
|
438
452
|
const relative = relativeDirectory ? path.join(relativeDirectory, entry.name) : entry.name;
|
|
439
453
|
const kind = entry.isDirectory() ? "directory" : entry.isSymbolicLink() ? "symlink" : entry.isFile() ? "file" : "other";
|
|
440
|
-
if (input.
|
|
454
|
+
if (kind === "file" && input.includeFile && !input.includeFile(relative))
|
|
455
|
+
continue;
|
|
456
|
+
if (input.authorizePath && !await input.authorizePath(relative, kind)) {
|
|
457
|
+
if (denied.length < input.maxFiles)
|
|
458
|
+
denied.push({ relative, kind });
|
|
459
|
+
else
|
|
460
|
+
deniedTruncated = true;
|
|
441
461
|
continue;
|
|
462
|
+
}
|
|
442
463
|
if (entry.isSymbolicLink()) {
|
|
443
464
|
if (input.symlinks === "refuse") {
|
|
444
465
|
throw new Error(`Contained file traversal refuses symlink: ${relative}`);
|
|
@@ -497,7 +518,7 @@ async function scanContainedFiles(input) {
|
|
|
497
518
|
} finally {
|
|
498
519
|
await root.close();
|
|
499
520
|
}
|
|
500
|
-
return { files, truncated, skippedDirectories, skippedSymlinks };
|
|
521
|
+
return { files, truncated, skippedDirectories, skippedSymlinks, denied, deniedTruncated };
|
|
501
522
|
}
|
|
502
523
|
|
|
503
524
|
export { listContainedDirectory, missingContainedDirectories, openContainedParent, openContainedFile, assertContainedFileCurrent, assertContainedParentCurrent, writeContainedFile, containedEntryMetadata, openContainedParentFile, readContainedUtf8Handle, walkContainedFiles, scanContainedFiles };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentRuntimeEventSchema
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-y64k3s0h.js";
|
|
4
4
|
import {
|
|
5
5
|
AgentMessagePartSchema,
|
|
6
6
|
AgentSnapshotSchema
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-gtj3zc53.js";
|
|
8
8
|
|
|
9
9
|
// src/agent-runtime/control-schema.ts
|
|
10
10
|
import { z } from "zod";
|