@kitman-sh/cli 0.12.7 → 0.12.8
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/dist/{chunk-q5w3v4k1.js → chunk-0tjg9eya.js} +1 -1
- package/dist/{chunk-cbpb2rww.js → chunk-31gpnkq3.js} +5 -5
- package/dist/{chunk-gxbcvd4q.js → chunk-3x6cbhzd.js} +4 -4
- package/dist/{chunk-mtkstrh3.js → chunk-6d53ezj1.js} +4 -4
- package/dist/{chunk-fyvtc3xv.js → chunk-6w7ajkm8.js} +18 -18
- package/dist/{chunk-vkg40ysx.js → chunk-93ypzdpa.js} +7 -7
- package/dist/{chunk-8b8pw0md.js → chunk-9qp59fht.js} +32 -32
- package/dist/{chunk-p7hxrkmf.js → chunk-bh9k3kty.js} +55 -55
- package/dist/{chunk-jn7w2ntt.js → chunk-c8hwfktd.js} +7 -7
- package/dist/{chunk-0h49y8gf.js → chunk-c8wpw9nh.js} +65 -214
- package/dist/{chunk-4w0c1ykv.js → chunk-cr3qw0xf.js} +297 -381
- package/dist/{chunk-gq7y5v3e.js → chunk-cw61zyh5.js} +1 -1
- package/dist/{chunk-gy9rf14f.js → chunk-fh58za51.js} +3 -3
- package/dist/{chunk-4gy4ty6k.js → chunk-gyek54h3.js} +8 -8
- package/dist/{chunk-5zhh41gb.js → chunk-j1cnq2j0.js} +4 -4
- package/dist/{chunk-gwnyxm1r.js → chunk-jwrs9pfa.js} +107 -107
- package/dist/{chunk-5zth85pj.js → chunk-kzwdhdej.js} +2 -2
- package/dist/{chunk-azfjx5d8.js → chunk-n9351czb.js} +7 -7
- package/dist/{chunk-7dahw7e2.js → chunk-pjpfc3sd.js} +1 -1
- package/dist/{chunk-zw3gf6r5.js → chunk-qjqa338f.js} +333 -94
- package/dist/{chunk-ywzxwgrz.js → chunk-s5pzy86v.js} +6 -6
- package/dist/{chunk-7afnkx5b.js → chunk-tgwa9vqw.js} +6 -6
- package/dist/{chunk-fr79hgq2.js → chunk-wcvfkdwd.js} +24 -24
- package/dist/{chunk-b9rbh1va.js → chunk-xng6j3a8.js} +1 -1
- package/dist/{chunk-y1krmnbv.js → chunk-z5f7g1w1.js} +2 -2
- package/dist/index.js +4 -4
- package/package.json +1 -1
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
isMinLength,
|
|
19
19
|
isMaxLength,
|
|
20
20
|
FiniteFromString
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-qjqa338f.js";
|
|
22
22
|
|
|
23
23
|
// node_modules/.bun/effect@4.1.2/node_modules/effect/dist/JsonSchema.js
|
|
24
24
|
var PRE_2020_TO_2020_COLLISIONS = ["$anchor", "$defs", "$dynamicAnchor", "$dynamicRef", "$vocabulary", "contentSchema", "dependentRequired", "dependentSchemas", "maxContains", "minContains", "prefixItems", "unevaluatedItems", "unevaluatedProperties"];
|
|
@@ -25,16 +25,16 @@ import {
|
|
|
25
25
|
isJsonObject,
|
|
26
26
|
isString2,
|
|
27
27
|
encodeUnknownJsonStringSync
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-qjqa338f.js";
|
|
29
29
|
import {
|
|
30
|
-
|
|
30
|
+
make10,
|
|
31
31
|
runForEach,
|
|
32
32
|
compiled2
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-c8wpw9nh.js";
|
|
34
34
|
import {
|
|
35
35
|
ChildProcessSpawner,
|
|
36
36
|
make3
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-6d53ezj1.js";
|
|
38
38
|
|
|
39
39
|
// packages/agent-runtime/src/opencode-store.ts
|
|
40
40
|
import { lstatSync, readFileSync, realpathSync } from "fs";
|
|
@@ -168,7 +168,7 @@ var isolatedRead = (store, name, input) => gen(function* () {
|
|
|
168
168
|
const spawner = yield* ChildProcessSpawner;
|
|
169
169
|
const [command, ...args] = opencodeReaderCommand();
|
|
170
170
|
const handle = yield* spawner.spawn(make3(command, args, {
|
|
171
|
-
stdin:
|
|
171
|
+
stdin: make10(new TextEncoder().encode(encodeUnknownJsonStringSync({ store, name, input }))),
|
|
172
172
|
stderr: "ignore",
|
|
173
173
|
extendEnv: false,
|
|
174
174
|
env: {},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-6d53ezj1.js";
|
|
3
3
|
import {
|
|
4
4
|
HERDR_CORE_GENERATION2,
|
|
5
5
|
HERDR_CORE_INSTALL_COMMAND2,
|
|
@@ -12,9 +12,9 @@ import {
|
|
|
12
12
|
herdrCoreLayer2,
|
|
13
13
|
herdrCoreTransportLayer2,
|
|
14
14
|
updateHerdrCore2
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import"./chunk-
|
|
17
|
-
import"./chunk-
|
|
15
|
+
} from "./chunk-cr3qw0xf.js";
|
|
16
|
+
import"./chunk-c8wpw9nh.js";
|
|
17
|
+
import"./chunk-qjqa338f.js";
|
|
18
18
|
export {
|
|
19
19
|
HERDR_CORE_GENERATION2 as HERDR_CORE_GENERATION,
|
|
20
20
|
HERDR_CORE_INSTALL_COMMAND2 as HERDR_CORE_INSTALL_COMMAND,
|
|
@@ -19,10 +19,10 @@ import {
|
|
|
19
19
|
never,
|
|
20
20
|
flatMap3,
|
|
21
21
|
andThen2,
|
|
22
|
-
|
|
22
|
+
map7,
|
|
23
23
|
raceFirst,
|
|
24
24
|
scoped
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-qjqa338f.js";
|
|
26
26
|
import {
|
|
27
27
|
unwrap,
|
|
28
28
|
drainFork,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
runCollect,
|
|
32
32
|
runDrain,
|
|
33
33
|
mkString
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-c8wpw9nh.js";
|
|
35
35
|
|
|
36
36
|
// node_modules/.bun/effect@4.1.2/node_modules/effect/dist/internal/redacted.js
|
|
37
37
|
var redactedRegistry = /* @__PURE__ */ new WeakMap;
|
|
@@ -102,7 +102,7 @@ var makeHandle = (params) => Object.setPrototypeOf({
|
|
|
102
102
|
...params
|
|
103
103
|
}, HandleProto);
|
|
104
104
|
var make2 = (spawn) => {
|
|
105
|
-
const streamString = (command, options) => spawn(command).pipe(
|
|
105
|
+
const streamString = (command, options) => spawn(command).pipe(map7((handle) => decodeText(options?.includeStderr === true ? handle.all : drainFork(handle.stdout, handle.stderr))), unwrap);
|
|
106
106
|
const streamLines = (command, options) => splitLines(streamString(command, options));
|
|
107
107
|
return ChildProcessSpawner.of({
|
|
108
108
|
spawn,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
gen,
|
|
11
11
|
fail7,
|
|
12
12
|
flatMap3,
|
|
13
|
-
|
|
13
|
+
map7,
|
|
14
14
|
catchTags,
|
|
15
15
|
mapError2,
|
|
16
16
|
orDie,
|
|
@@ -32,8 +32,8 @@ import {
|
|
|
32
32
|
toCodecJson,
|
|
33
33
|
Json,
|
|
34
34
|
encodePrettyJsonString
|
|
35
|
-
} from "./chunk-
|
|
36
|
-
import"./chunk-
|
|
35
|
+
} from "./chunk-qjqa338f.js";
|
|
36
|
+
import"./chunk-0tjg9eya.js";
|
|
37
37
|
import {
|
|
38
38
|
decodeText,
|
|
39
39
|
mkString,
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
Path,
|
|
42
42
|
withDefault,
|
|
43
43
|
String2
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-c8wpw9nh.js";
|
|
45
45
|
import {
|
|
46
46
|
SecureRandom,
|
|
47
47
|
layerWebCrypto,
|
|
@@ -53,23 +53,23 @@ import {
|
|
|
53
53
|
layer4,
|
|
54
54
|
kitmanMcpServer,
|
|
55
55
|
RunnerRpcProtocolVersion
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-cr3qw0xf.js";
|
|
57
57
|
import {
|
|
58
58
|
Packument,
|
|
59
59
|
tarballMatches
|
|
60
|
-
} from "./chunk-
|
|
61
|
-
import"./chunk-
|
|
60
|
+
} from "./chunk-n9351czb.js";
|
|
61
|
+
import"./chunk-tgwa9vqw.js";
|
|
62
62
|
import {
|
|
63
63
|
AgentDeclaration,
|
|
64
64
|
KitDeclarations,
|
|
65
65
|
describeFlag,
|
|
66
66
|
Described
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-gyek54h3.js";
|
|
68
68
|
import {
|
|
69
69
|
ChildProcessSpawner,
|
|
70
70
|
make3
|
|
71
|
-
} from "./chunk-
|
|
72
|
-
import"./chunk-
|
|
71
|
+
} from "./chunk-6d53ezj1.js";
|
|
72
|
+
import"./chunk-wcvfkdwd.js";
|
|
73
73
|
|
|
74
74
|
// packages/sdk/src/build/index.ts
|
|
75
75
|
class DependencyInstallFailed extends TaggedError2()("DependencyInstallFailed", {
|
|
@@ -118,7 +118,7 @@ var run = (command, args, cwd) => gen(function* () {
|
|
|
118
118
|
}).pipe(scoped);
|
|
119
119
|
var failure = (result) => (result.stderr.trim() || result.stdout.trim()).slice(-2000);
|
|
120
120
|
var provenance = (directory) => gen(function* () {
|
|
121
|
-
const git = (...args) => run("git", args, directory).pipe(
|
|
121
|
+
const git = (...args) => run("git", args, directory).pipe(map7((result) => result.ok ? result.stdout.trim() : undefined), orElseSucceed(() => {
|
|
122
122
|
return;
|
|
123
123
|
}));
|
|
124
124
|
const repository = yield* git("remote", "get-url", "origin");
|
|
@@ -144,7 +144,7 @@ var readText = (directory, text, what) => gen(function* () {
|
|
|
144
144
|
const file = yield* inKit(directory, text.file, what);
|
|
145
145
|
return yield* fs.readFileString(file).pipe(mapError2(() => new DeclarationsInvalid({ reason: `${what} ${text.file} does not read` })));
|
|
146
146
|
});
|
|
147
|
-
var readAgents = (directory, agents) => forEach(Object.entries(agents), ([id, { instructions, ...agent }]) => instructions === undefined ? succeed6([id, agent]) :
|
|
147
|
+
var readAgents = (directory, agents) => forEach(Object.entries(agents), ([id, { instructions, ...agent }]) => instructions === undefined ? succeed6([id, agent]) : map7(readText(directory, instructions, `Agent "${id}" instructions`), (text) => [id, { ...agent, instructions: text.trim() }])).pipe(map7(Object.fromEntries));
|
|
148
148
|
var utf8 = new TextDecoder("utf-8", { fatal: true });
|
|
149
149
|
var setupFile = (bytes) => {
|
|
150
150
|
try {
|
|
@@ -219,7 +219,7 @@ var fetchNpm = (name, wanted, what) => gen(function* () {
|
|
|
219
219
|
const dist = packument.versions[packument["dist-tags"][wanted] ?? wanted]?.dist;
|
|
220
220
|
if (dist === undefined)
|
|
221
221
|
return yield* failed("npm has no such version or dist-tag");
|
|
222
|
-
const tarball = yield* get2(dist.tarball).pipe(flatMap3(filterStatusOk), flatMap3((response) => response.arrayBuffer),
|
|
222
|
+
const tarball = yield* get2(dist.tarball).pipe(flatMap3(filterStatusOk), flatMap3((response) => response.arrayBuffer), map7((buffer) => new Uint8Array(buffer)), mapError2((error) => failed(error.message)));
|
|
223
223
|
if (!tarballMatches(tarball, dist))
|
|
224
224
|
return yield* failed(`the tarball does not match its integrity ${dist.integrity ?? `sha1 ${dist.shasum}`}`);
|
|
225
225
|
const directory = yield* fs.makeTempDirectoryScoped({ prefix: "kitman-npm-" });
|
|
@@ -260,11 +260,11 @@ var setupArchive = (directory, kit, setup, checkouts) => gen(function* () {
|
|
|
260
260
|
const file = yield* inKit(directory, setup.instructions, what);
|
|
261
261
|
files["instructions.md"] = setupFile(yield* fs.readFile(file).pipe(mapError2(() => new DeclarationsInvalid({ reason: `${what} do not read` }))));
|
|
262
262
|
}
|
|
263
|
-
const skills = setup.skills === undefined ? undefined : yield* forEach(setup.skills, (skill) =>
|
|
263
|
+
const skills = setup.skills === undefined ? undefined : yield* forEach(setup.skills, (skill) => map7(sourceTree(directory, skill.source, `Kit ${kit} skill ${skill.name}`, checkouts), (tree) => ({
|
|
264
264
|
...skill,
|
|
265
265
|
source: place(`skills/${skill.name}`, tree)
|
|
266
266
|
})));
|
|
267
|
-
const plugins = setup.plugins === undefined ? undefined : yield* forEach(setup.plugins, (plugin) =>
|
|
267
|
+
const plugins = setup.plugins === undefined ? undefined : yield* forEach(setup.plugins, (plugin) => map7(sourceTree(directory, plugin.sources[0], `Kit ${kit} plugin ${plugin.name}`, checkouts), (tree) => ({
|
|
268
268
|
...plugin,
|
|
269
269
|
sources: [place(`plugins/${plugin.name}`, tree)]
|
|
270
270
|
})));
|
|
@@ -310,7 +310,7 @@ var importedFile = (file, specifier) => gen(function* () {
|
|
|
310
310
|
const path = yield* Path;
|
|
311
311
|
const target = path.resolve(path.dirname(file), specifier);
|
|
312
312
|
for (const candidate of [target, `${target}.ts`, path.join(target, "kitman.config.ts")])
|
|
313
|
-
if (yield* fs.stat(candidate).pipe(
|
|
313
|
+
if (yield* fs.stat(candidate).pipe(map7((info) => info.type === "File"), orElseSucceed(() => false)))
|
|
314
314
|
return candidate;
|
|
315
315
|
return;
|
|
316
316
|
});
|
|
@@ -351,7 +351,7 @@ var kitModules = (root) => gen(function* () {
|
|
|
351
351
|
if (visited.has(file))
|
|
352
352
|
return;
|
|
353
353
|
visited.add(file);
|
|
354
|
-
const transpiled = yield* run("bun", ["build", "--no-bundle", file], root).pipe(
|
|
354
|
+
const transpiled = yield* run("bun", ["build", "--no-bundle", file], root).pipe(map7((result) => result.ok ? result.stdout : ""), orElseSucceed(() => ""));
|
|
355
355
|
for (const [, specifier] of transpiled.matchAll(/\b(?:from|import)\s*"(\.{1,2}\/[^"]+)"/gu)) {
|
|
356
356
|
const module = specifier === undefined ? undefined : yield* importedFile(file, specifier);
|
|
357
357
|
if (module === undefined || visited.has(module))
|
|
@@ -477,7 +477,7 @@ var buildKit = (directory, options = {}) => gen(function* () {
|
|
|
477
477
|
...own.schedules === undefined ? undefined : { schedules: own.schedules },
|
|
478
478
|
carried
|
|
479
479
|
}).pipe(mapError2((error) => new DeclarationsInvalid({ reason: error.message })));
|
|
480
|
-
const bundle = yield* fs.readFileString(bundleFile).pipe(
|
|
480
|
+
const bundle = yield* fs.readFileString(bundleFile).pipe(map7((text) => new TextEncoder().encode(text.replaceAll(entryName, ".kitman-build-entry.ts"))), mapError2((error) => new BundleFailed({ reason: error.message })));
|
|
481
481
|
return {
|
|
482
482
|
...identity,
|
|
483
483
|
bundle,
|
|
@@ -13,27 +13,27 @@ import {
|
|
|
13
13
|
isJsonObject,
|
|
14
14
|
decodeJsonString,
|
|
15
15
|
encodePrettyJsonString
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import"./chunk-
|
|
16
|
+
} from "./chunk-qjqa338f.js";
|
|
17
|
+
import"./chunk-0tjg9eya.js";
|
|
18
18
|
import {
|
|
19
19
|
FileSystem,
|
|
20
20
|
Path
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-c8wpw9nh.js";
|
|
22
22
|
import {
|
|
23
23
|
tomlTableHeader2,
|
|
24
24
|
tomlKeyPath2,
|
|
25
25
|
kitmanSkillEntry,
|
|
26
26
|
isPathWithin2
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-c8hwfktd.js";
|
|
28
28
|
import {
|
|
29
29
|
instructionsStart,
|
|
30
30
|
instructionsEnd,
|
|
31
31
|
renderMcpServer,
|
|
32
32
|
materializeKitSetup,
|
|
33
33
|
tomlInline
|
|
34
|
-
} from "./chunk-
|
|
35
|
-
import"./chunk-
|
|
36
|
-
import"./chunk-
|
|
34
|
+
} from "./chunk-cr3qw0xf.js";
|
|
35
|
+
import"./chunk-n9351czb.js";
|
|
36
|
+
import"./chunk-6d53ezj1.js";
|
|
37
37
|
|
|
38
38
|
// packages/agent-runtime/src/kit-setup-sync.ts
|
|
39
39
|
class KitSyncError extends TaggedError("KitSyncError") {
|
|
@@ -17,12 +17,12 @@ import {
|
|
|
17
17
|
isSuccess,
|
|
18
18
|
TaggedError,
|
|
19
19
|
void_2,
|
|
20
|
-
|
|
20
|
+
makeUnsafe4,
|
|
21
21
|
_await,
|
|
22
22
|
fail5,
|
|
23
23
|
succeed4,
|
|
24
24
|
doneUnsafe,
|
|
25
|
-
|
|
25
|
+
makeUnsafe5,
|
|
26
26
|
provide,
|
|
27
27
|
close,
|
|
28
28
|
buildWithScope,
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
provide2,
|
|
31
31
|
provideMerge,
|
|
32
32
|
squash,
|
|
33
|
+
currentTimeMillis,
|
|
33
34
|
spaced,
|
|
34
35
|
all3,
|
|
35
36
|
forEach,
|
|
@@ -49,7 +50,7 @@ import {
|
|
|
49
50
|
tap2,
|
|
50
51
|
result,
|
|
51
52
|
option2,
|
|
52
|
-
|
|
53
|
+
map7,
|
|
53
54
|
as,
|
|
54
55
|
asVoid,
|
|
55
56
|
catch_,
|
|
@@ -79,6 +80,8 @@ import {
|
|
|
79
80
|
runSync,
|
|
80
81
|
fnUntraced,
|
|
81
82
|
fn,
|
|
83
|
+
makeUnsafe6,
|
|
84
|
+
formatIso,
|
|
82
85
|
decodeUnknownEffect2,
|
|
83
86
|
optionalKey,
|
|
84
87
|
optional,
|
|
@@ -118,12 +121,9 @@ import {
|
|
|
118
121
|
decodeJsonStringOption,
|
|
119
122
|
encodeJsonStringSync,
|
|
120
123
|
encodePrettyJsonString
|
|
121
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-qjqa338f.js";
|
|
122
125
|
import {
|
|
123
|
-
currentTimeMillis,
|
|
124
126
|
SecureRandom,
|
|
125
|
-
makeUnsafe,
|
|
126
|
-
formatIso,
|
|
127
127
|
error,
|
|
128
128
|
parseDate,
|
|
129
129
|
currentDate,
|
|
@@ -170,13 +170,13 @@ import {
|
|
|
170
170
|
runMcpEffect,
|
|
171
171
|
createAgentAuthSignedFetch,
|
|
172
172
|
setupMcpAgentCredential
|
|
173
|
-
} from "./chunk-
|
|
173
|
+
} from "./chunk-cr3qw0xf.js";
|
|
174
174
|
import {
|
|
175
175
|
guard,
|
|
176
176
|
Id,
|
|
177
177
|
Timestamp,
|
|
178
178
|
ActorType
|
|
179
|
-
} from "./chunk-
|
|
179
|
+
} from "./chunk-0tjg9eya.js";
|
|
180
180
|
import {
|
|
181
181
|
join,
|
|
182
182
|
interrupt,
|
|
@@ -190,21 +190,21 @@ import {
|
|
|
190
190
|
withDefault,
|
|
191
191
|
option,
|
|
192
192
|
String2
|
|
193
|
-
} from "./chunk-
|
|
193
|
+
} from "./chunk-c8wpw9nh.js";
|
|
194
194
|
import {
|
|
195
195
|
searchDocs2,
|
|
196
196
|
readDoc2
|
|
197
|
-
} from "./chunk-
|
|
197
|
+
} from "./chunk-xng6j3a8.js";
|
|
198
198
|
import {
|
|
199
199
|
nextInt
|
|
200
|
-
} from "./chunk-
|
|
200
|
+
} from "./chunk-cw61zyh5.js";
|
|
201
201
|
import {
|
|
202
202
|
layerJson,
|
|
203
203
|
make4,
|
|
204
204
|
withHeaders,
|
|
205
205
|
layerProtocolSocket,
|
|
206
206
|
ConnectionHooks
|
|
207
|
-
} from "./chunk-
|
|
207
|
+
} from "./chunk-wcvfkdwd.js";
|
|
208
208
|
|
|
209
209
|
// apps/cli/src/mcp.ts
|
|
210
210
|
import { tmpdir as tmpdir2 } from "os";
|
|
@@ -2043,7 +2043,7 @@ function connectKitmanLiveRoot(protocol) {
|
|
|
2043
2043
|
const authenticate = async (input) => {
|
|
2044
2044
|
close2();
|
|
2045
2045
|
const brokenListeners = new Set;
|
|
2046
|
-
const scope =
|
|
2046
|
+
const scope = makeUnsafe5();
|
|
2047
2047
|
let connected = false;
|
|
2048
2048
|
const hooks = succeed5(ConnectionHooks)({
|
|
2049
2049
|
onConnect: sync2(() => {
|
|
@@ -2085,7 +2085,7 @@ function call(connection, effect) {
|
|
|
2085
2085
|
}
|
|
2086
2086
|
function openStream(connection, stream, isOpened, deliver) {
|
|
2087
2087
|
return new Promise((resolve, reject) => {
|
|
2088
|
-
const opened =
|
|
2088
|
+
const opened = makeUnsafe4();
|
|
2089
2089
|
const fiber = runFork(withHeaders2(connection, runForEach(stream, (message) => isOpened(message) ? succeed4(opened, message) : promise(() => deliver(message)))).pipe(mapError2(toError), tapError2((error) => fail5(opened, error)), ensuring2(fail5(opened, toError({ message: "Live subscription ended before it opened" }))), provide(connection.scope)));
|
|
2090
2090
|
runPromise(_await(opened)).then((message) => resolve({
|
|
2091
2091
|
opened: message,
|
|
@@ -5328,7 +5328,7 @@ process.stdin.on('data', chunk => {
|
|
|
5328
5328
|
var bootGuest = gen(function* () {
|
|
5329
5329
|
const assets = yield* codeModeAssets;
|
|
5330
5330
|
const nonce = yield* (yield* SecureRandom).uuidV4();
|
|
5331
|
-
const result =
|
|
5331
|
+
const result = makeUnsafe4();
|
|
5332
5332
|
let call = () => Promise.reject(new Error("Code Mode guest has no execution"));
|
|
5333
5333
|
yield* sweepStaleSidecarTemp;
|
|
5334
5334
|
const fs = yield* FileSystem;
|
|
@@ -5419,12 +5419,12 @@ var takeGuest = suspend3(() => {
|
|
|
5419
5419
|
expireWhenIdle(booting);
|
|
5420
5420
|
return join(taken);
|
|
5421
5421
|
});
|
|
5422
|
-
var outcomeOf = (warm) => raceFirst(
|
|
5422
|
+
var outcomeOf = (warm) => raceFirst(map7(_await(warm.result), (text) => ({ text })), tryPromise({
|
|
5423
5423
|
try: () => warm.guest.wait(),
|
|
5424
5424
|
catch: (error) => new CodeModeExecutionError({
|
|
5425
5425
|
message: `Code Mode secure-exec failed: ${error instanceof Error ? error.message : "unknown error"}`
|
|
5426
5426
|
})
|
|
5427
|
-
}).pipe(flatMap3((exitCode) => exitCode === 0 ? _await(warm.result).pipe(timeoutOrElse({ duration: millis(100), orElse: () => succeed6("{}") }),
|
|
5427
|
+
}).pipe(flatMap3((exitCode) => exitCode === 0 ? _await(warm.result).pipe(timeoutOrElse({ duration: millis(100), orElse: () => succeed6("{}") }), map7((text) => ({ text }))) : succeed6({ exitCode }))));
|
|
5428
5428
|
var executeCodeMode = fnUntraced(function* (input, options) {
|
|
5429
5429
|
const startedAt = yield* currentTimeMillis;
|
|
5430
5430
|
const codeHash = digestSha256(input.code, "hex");
|
|
@@ -5442,7 +5442,7 @@ var executeCodeMode = fnUntraced(function* (input, options) {
|
|
|
5442
5442
|
return yield* new CodeModeExecutionError({
|
|
5443
5443
|
message: `Code Mode secure-exec failed with exit code ${outcome.exitCode}`
|
|
5444
5444
|
});
|
|
5445
|
-
const returned = yield* decodeJsonString(outcome.text).pipe(
|
|
5445
|
+
const returned = yield* decodeJsonString(outcome.text).pipe(map7((json) => isJsonObject(json) ? json : {}), mapError2(() => new CodeModeExecutionError({ message: "Code Mode secure-exec returned an unreadable result" })));
|
|
5446
5446
|
if (isString2(returned.thrown))
|
|
5447
5447
|
return yield* new CodeModeExecutionError({ message: `Code Mode code threw ${returned.thrown}` });
|
|
5448
5448
|
const finishedAt = yield* currentTimeMillis;
|
|
@@ -5972,7 +5972,7 @@ function createCodeModeHost(options) {
|
|
|
5972
5972
|
const dispatchPrepared = fnUntraced(function* (operationName, preparedArgs, descriptor) {
|
|
5973
5973
|
const startedAt = yield* currentTimeMillis;
|
|
5974
5974
|
const backend = options.dispatchOperation ?? options.executeCapability ?? (() => fail7(new McpToolInputError({ message: "Kitman Code Mode dispatch is not configured." })));
|
|
5975
|
-
return yield* backend(operationName, preparedArgs).pipe(tap2((output) => validateOperationOutput(descriptor, output)), tap2((output) => currentTimeMillis.pipe(
|
|
5975
|
+
return yield* backend(operationName, preparedArgs).pipe(tap2((output) => validateOperationOutput(descriptor, output)), tap2((output) => currentTimeMillis.pipe(map7((now) => calls.push({ operationName, status: "ok", durationMs: now - startedAt, resourceIds: resourceIds(output) })))), tapError2(() => currentTimeMillis.pipe(map7((now) => calls.push({ operationName, status: "error", durationMs: now - startedAt })))));
|
|
5976
5976
|
});
|
|
5977
5977
|
const dispatch = fnUntraced(function* (operationName, args) {
|
|
5978
5978
|
const { descriptor, preparedArgs } = yield* prepareArgs(operationName, args);
|
|
@@ -6429,7 +6429,7 @@ function createCodeModeExecutionStore(options = {}) {
|
|
|
6429
6429
|
...input.content === undefined ? undefined : { content: input.content }
|
|
6430
6430
|
});
|
|
6431
6431
|
});
|
|
6432
|
-
const listForActor = (actorDigest) => sweep.pipe(
|
|
6432
|
+
const listForActor = (actorDigest) => sweep.pipe(map7(() => [...entries.values()].flatMap((entry) => entry.approvalActorDigest === actorDigest && entry.status === "paused" ? [inspection(entry)] : [])));
|
|
6433
6433
|
const markUnknown = (input) => {
|
|
6434
6434
|
const entry = entries.get(input.executionId);
|
|
6435
6435
|
if (entry === undefined || entry.ownerDigest !== ownerDigest(input.owner))
|
|
@@ -6439,7 +6439,7 @@ function createCodeModeExecutionStore(options = {}) {
|
|
|
6439
6439
|
markUnknownEntry(entry, input.reason);
|
|
6440
6440
|
return true;
|
|
6441
6441
|
};
|
|
6442
|
-
const inspect = (executionId) => sweep.pipe(
|
|
6442
|
+
const inspect = (executionId) => sweep.pipe(map7(() => {
|
|
6443
6443
|
const entry = entries.get(executionId);
|
|
6444
6444
|
return entry === undefined ? undefined : inspection(entry);
|
|
6445
6445
|
}));
|
|
@@ -6462,7 +6462,7 @@ function createCodeModeExecutionStore(options = {}) {
|
|
|
6462
6462
|
entry.onDecision = undefined;
|
|
6463
6463
|
}
|
|
6464
6464
|
function settle(entry, result) {
|
|
6465
|
-
return currentTimeMillis.pipe(
|
|
6465
|
+
return currentTimeMillis.pipe(map7((now) => {
|
|
6466
6466
|
entry.status = "settled";
|
|
6467
6467
|
entry.settledResult = result;
|
|
6468
6468
|
entry.settledUntilMs = now + settledReplayTtlMs;
|
|
@@ -6472,7 +6472,7 @@ function createCodeModeExecutionStore(options = {}) {
|
|
|
6472
6472
|
}));
|
|
6473
6473
|
}
|
|
6474
6474
|
function settledResume(entry, input) {
|
|
6475
|
-
return currentTimeMillis.pipe(
|
|
6475
|
+
return currentTimeMillis.pipe(map7((now) => {
|
|
6476
6476
|
if (entry.settledResult === undefined || entry.settledUntilMs === undefined || now >= entry.settledUntilMs) {
|
|
6477
6477
|
entry.status = "expired";
|
|
6478
6478
|
entry.settledResult = undefined;
|
|
@@ -6487,7 +6487,7 @@ function createCodeModeExecutionStore(options = {}) {
|
|
|
6487
6487
|
}
|
|
6488
6488
|
}
|
|
6489
6489
|
function isoString(epochMillis) {
|
|
6490
|
-
return formatIso(
|
|
6490
|
+
return formatIso(makeUnsafe6(epochMillis));
|
|
6491
6491
|
}
|
|
6492
6492
|
function pauseValue(entry, ttlMs) {
|
|
6493
6493
|
return {
|
|
@@ -6849,7 +6849,7 @@ function registerCodeModeTools(server, options = {}) {
|
|
|
6849
6849
|
const resolveDecision = (id) => options.resolveExecutionDecision?.({ executionId: id, owner }) ?? undefined_;
|
|
6850
6850
|
if (executionId === undefined) {
|
|
6851
6851
|
const paused = yield* executionStore.listForActor(owner.approvalActorDigest ?? owner.actorDigest);
|
|
6852
|
-
const decided = yield* forEach(paused, (execution) => resolveDecision(execution.executionId).pipe(
|
|
6852
|
+
const decided = yield* forEach(paused, (execution) => resolveDecision(execution.executionId).pipe(map7((decision) => ({ execution, action: decision }))), { concurrency: "unbounded" });
|
|
6853
6853
|
const resumable = decided.filter((candidate) => candidate.action !== undefined);
|
|
6854
6854
|
if (resumable.length === 1) {
|
|
6855
6855
|
executionId = resumable[0]?.execution.executionId;
|
|
@@ -8295,7 +8295,7 @@ function registerStepTools(server, adapt, input) {
|
|
|
8295
8295
|
description: "Read the brief for the Step you are working on: its instructions, Context Pack and Output schema. A long brief comes in pages; each names the offset of the next.",
|
|
8296
8296
|
inputSchema: adapt(StepBriefArguments),
|
|
8297
8297
|
annotations: { readOnlyHint: true, idempotentHint: true }
|
|
8298
|
-
}, (args) => run(
|
|
8298
|
+
}, (args) => run(map7(request("/brief"), (brief) => text(briefPage(brief.prompt, isNumber2(args.offset) ? args.offset : 0)))));
|
|
8299
8299
|
const closed = (question) => gen(function* () {
|
|
8300
8300
|
let current = question;
|
|
8301
8301
|
const interval = fromInputUnsafe(input.answerPollInterval ?? "2 seconds");
|
|
@@ -8330,7 +8330,7 @@ function registerStepTools(server, adapt, input) {
|
|
|
8330
8330
|
structuredContent: result
|
|
8331
8331
|
});
|
|
8332
8332
|
case "parked":
|
|
8333
|
-
return
|
|
8333
|
+
return map7(closed(result.question), (question) => ({
|
|
8334
8334
|
...failure(question.answer === undefined ? `Output refused again: ${result.message}. The Question it put to a person was closed without an answer (${question.status}). Stop working.` : `Output refused again: ${result.message}. Your Step waited for a person, who answered: \u201C${question.answer.value}\u201D Correct the Output as they say and submit it again; you have one more submission and one repair.`),
|
|
8335
8335
|
structuredContent: { ...result, question }
|
|
8336
8336
|
}));
|
|
@@ -8343,11 +8343,11 @@ function registerStepTools(server, adapt, input) {
|
|
|
8343
8343
|
inputSchema: adapt(SessionUpdateArguments),
|
|
8344
8344
|
outputSchema: adapt(AnyResult),
|
|
8345
8345
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false }
|
|
8346
|
-
}, (args) => run(
|
|
8346
|
+
}, (args) => run(map7(request("/session-updates", {
|
|
8347
8347
|
kind: isString2(args.kind) ? args.kind : "progress",
|
|
8348
8348
|
content: isString2(args.content) ? args.content : ""
|
|
8349
8349
|
}), (result) => ({ content: [{ type: "text", text: "SessionUpdate recorded." }], structuredContent: result }))));
|
|
8350
|
-
const answerOf = (question) =>
|
|
8350
|
+
const answerOf = (question) => map7(closed(question), (current) => current.answer === undefined ? failure(`The Question was closed without an answer (${current.status}). Stop and submit what you have.`) : {
|
|
8351
8351
|
content: [
|
|
8352
8352
|
{ type: "text", text: encodeJsonStringSync({ answer: current.answer.value, questionId: current.id }) }
|
|
8353
8353
|
],
|
|
@@ -8372,13 +8372,13 @@ function registerStepTools(server, adapt, input) {
|
|
|
8372
8372
|
const fitting = input.fittingSkills ?? [];
|
|
8373
8373
|
const rank = (name) => fitting.includes(name) ? fitting.indexOf(name) : fitting.length;
|
|
8374
8374
|
const names = (yield* fs.readDirectory(skillsDir).pipe(orElseSucceed(() => []))).toSorted((a, b) => rank(a) - rank(b) || a.localeCompare(b));
|
|
8375
|
-
return yield* forEach(names, (name) => fs.readFileString(`${skillsDir}/${name}/SKILL.md`).pipe(
|
|
8375
|
+
return yield* forEach(names, (name) => fs.readFileString(`${skillsDir}/${name}/SKILL.md`).pipe(map7((skill) => [{ name, skill }]), orElseSucceed(() => []))).pipe(map7((found) => found.flat()));
|
|
8376
8376
|
});
|
|
8377
8377
|
server.registerTool("skills", {
|
|
8378
8378
|
description: "List the Run's skills you can load with no name, or load one by name; a second load answers that it is already in your context unless you pass reload: true after compaction.",
|
|
8379
8379
|
inputSchema: adapt(SkillsArguments),
|
|
8380
8380
|
annotations: { readOnlyHint: true, idempotentHint: false }
|
|
8381
|
-
}, (args) => runMcpEffect(
|
|
8381
|
+
}, (args) => runMcpEffect(map7(loadable, (skills) => {
|
|
8382
8382
|
const name = isString2(args.name) ? args.name : undefined;
|
|
8383
8383
|
if (name === undefined)
|
|
8384
8384
|
return skills.length === 0 ? text("This Step has no skills to load.") : text(skills.map((found) => `- ${found.name}: ${skillDescription(found.skill)}`).join(`
|