@nyte-ai/core 0.0.21 → 0.0.23
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/chunks/{compose-8mkfr84d.js → compose-1tdb9ezw.js} +1 -1
- package/dist/chunks/{compose-q2zxbg41.js → compose-1xn3eecn.js} +13 -13
- package/dist/chunks/{compose-e9f6nrwp.js → compose-2gsbcjgv.js} +4 -4
- package/dist/chunks/{compose-9hy3p236.js → compose-42egt9y7.js} +3 -3
- package/dist/chunks/{compose-cdj05t7x.js → compose-5njywhy8.js} +2 -2
- package/dist/chunks/{compose-d1m94kzq.js → compose-917xy085.js} +1 -1
- package/dist/chunks/{compose-zjj072km.js → compose-97y00axn.js} +5 -5
- package/dist/chunks/{compose-b2bf1jvy.js → compose-9jvn2wvh.js} +57 -29
- package/dist/chunks/{compose-753gc057.js → compose-a40dnhy5.js} +2 -2
- package/dist/chunks/{compose-12jnd50a.js → compose-ay7t13m9.js} +1 -1
- package/dist/chunks/{compose-jmmyw9hd.js → compose-c4z4kp98.js} +75 -20
- package/dist/chunks/{compose-e2fyz3xc.js → compose-ee0h1pk1.js} +1 -1
- package/dist/chunks/{compose-jd4bsnqh.js → compose-enq3x3rq.js} +1 -1
- package/dist/chunks/{compose-1knxqqm1.js → compose-ht1tbyr3.js} +1 -1
- package/dist/chunks/{compose-a8ddt55n.js → compose-nw5hdpxk.js} +2 -2
- package/dist/chunks/{compose-wvzzf8n2.js → compose-qjxtbzgq.js} +1 -1
- package/dist/chunks/{compose-pkprmn5b.js → compose-v46qmh60.js} +2 -2
- package/dist/chunks/{compose-1r0wr5dc.js → compose-xvbyp65f.js} +1 -1
- package/dist/chunks/{compose-0m65m83c.js → compose-yr19b453.js} +4 -4
- package/dist/src/agent/compaction.js +3 -3
- package/dist/src/agent/transcript.js +2 -2
- package/dist/src/agent/turn.js +4 -4
- package/dist/src/api/connection.js +12 -12
- package/dist/src/api/head.js +4 -4
- package/dist/src/api/server.js +6 -6
- package/dist/src/api/session.js +7 -7
- package/dist/src/builtins/environment.js +1 -1
- package/dist/src/compose.js +18 -18
- package/dist/src/drive/execution.js +5 -5
- package/dist/src/engine/start.js +4 -4
- package/dist/src/env/workspaces.js +2 -2
- package/dist/src/env/worktrees.js +3 -3
- package/dist/src/extend/activation.js +3 -3
- package/dist/src/extend/plugin-runtime.js +5 -5
- package/dist/src/extend/resources.js +1 -1
- package/dist/src/extend/settings.js +3 -3
- package/dist/src/extend/workspace-commands.js +6 -6
- package/dist/src/harness.js +19 -19
- package/dist/src/server.js +18 -18
- package/dist/src/testing.js +19 -19
- package/package.json +6 -5
|
@@ -62,11 +62,11 @@ import {
|
|
|
62
62
|
import {
|
|
63
63
|
dropScans2,
|
|
64
64
|
resourcesPlugin2
|
|
65
|
-
} from "./compose-
|
|
65
|
+
} from "./compose-c4z4kp98.js";
|
|
66
66
|
import {
|
|
67
67
|
createCompactor2,
|
|
68
68
|
createSummarizer2
|
|
69
|
-
} from "./compose-
|
|
69
|
+
} from "./compose-ay7t13m9.js";
|
|
70
70
|
import {
|
|
71
71
|
stoppableTool2
|
|
72
72
|
} from "./compose-mcz93154.js";
|
|
@@ -75,31 +75,31 @@ import {
|
|
|
75
75
|
} from "./compose-gj2ypr7q.js";
|
|
76
76
|
import {
|
|
77
77
|
createTurnDriver2
|
|
78
|
-
} from "./compose-
|
|
78
|
+
} from "./compose-v46qmh60.js";
|
|
79
79
|
import {
|
|
80
80
|
openPresence2
|
|
81
81
|
} from "./compose-gvm49f4b.js";
|
|
82
82
|
import {
|
|
83
83
|
createWorkspaceState2,
|
|
84
84
|
createWorkspaces2
|
|
85
|
-
} from "./compose-
|
|
85
|
+
} from "./compose-917xy085.js";
|
|
86
86
|
import {
|
|
87
87
|
sweepWorktrees2
|
|
88
|
-
} from "./compose-
|
|
88
|
+
} from "./compose-ee0h1pk1.js";
|
|
89
89
|
import {
|
|
90
90
|
stopStart2
|
|
91
|
-
} from "./compose-
|
|
91
|
+
} from "./compose-nw5hdpxk.js";
|
|
92
92
|
import {
|
|
93
93
|
createExecutionState2,
|
|
94
94
|
driveInProcess2,
|
|
95
95
|
dispatchHead2
|
|
96
|
-
} from "./compose-
|
|
96
|
+
} from "./compose-1tdb9ezw.js";
|
|
97
97
|
import {
|
|
98
98
|
createConnectionRegistry2
|
|
99
99
|
} from "./compose-jwy1gba9.js";
|
|
100
100
|
import {
|
|
101
101
|
createSettingsApi2
|
|
102
|
-
} from "./compose-
|
|
102
|
+
} from "./compose-a40dnhy5.js";
|
|
103
103
|
import {
|
|
104
104
|
createPartDefinitions2
|
|
105
105
|
} from "./compose-zaanjpb7.js";
|
|
@@ -109,7 +109,7 @@ import {
|
|
|
109
109
|
checkPlugins2,
|
|
110
110
|
replacePlugins2,
|
|
111
111
|
hostPluginRows2
|
|
112
|
-
} from "./compose-
|
|
112
|
+
} from "./compose-42egt9y7.js";
|
|
113
113
|
import {
|
|
114
114
|
createHostState2
|
|
115
115
|
} from "./compose-xm52jghq.js";
|
|
@@ -119,20 +119,20 @@ import {
|
|
|
119
119
|
import {
|
|
120
120
|
sessionHandle2,
|
|
121
121
|
activationSession2
|
|
122
|
-
} from "./compose-
|
|
122
|
+
} from "./compose-2gsbcjgv.js";
|
|
123
123
|
import {
|
|
124
124
|
createConnection2,
|
|
125
125
|
createHost2
|
|
126
|
-
} from "./compose-
|
|
126
|
+
} from "./compose-97y00axn.js";
|
|
127
127
|
import {
|
|
128
128
|
createServerHost2
|
|
129
|
-
} from "./compose-
|
|
129
|
+
} from "./compose-qjxtbzgq.js";
|
|
130
130
|
import {
|
|
131
131
|
delegationPlugin2
|
|
132
132
|
} from "./compose-m91ffwss.js";
|
|
133
133
|
import {
|
|
134
134
|
environmentPlugin2
|
|
135
|
-
} from "./compose-
|
|
135
|
+
} from "./compose-9jvn2wvh.js";
|
|
136
136
|
import {
|
|
137
137
|
mcpPlugin2
|
|
138
138
|
} from "./compose-597de3tc.js";
|
|
@@ -66,25 +66,25 @@ import {
|
|
|
66
66
|
import {
|
|
67
67
|
isolateWorkspace2,
|
|
68
68
|
releaseWorktree2
|
|
69
|
-
} from "./compose-
|
|
69
|
+
} from "./compose-ee0h1pk1.js";
|
|
70
70
|
import {
|
|
71
71
|
releaseStart2,
|
|
72
72
|
stopStart2,
|
|
73
73
|
discardSession2
|
|
74
|
-
} from "./compose-
|
|
74
|
+
} from "./compose-nw5hdpxk.js";
|
|
75
75
|
import {
|
|
76
76
|
runCommand2,
|
|
77
77
|
completeSessionCommand2
|
|
78
78
|
} from "./compose-ae5t6v5b.js";
|
|
79
79
|
import {
|
|
80
80
|
configure2
|
|
81
|
-
} from "./compose-
|
|
81
|
+
} from "./compose-a40dnhy5.js";
|
|
82
82
|
import {
|
|
83
83
|
headHandle2,
|
|
84
84
|
createHead2,
|
|
85
85
|
mergeHead2,
|
|
86
86
|
removeHead2
|
|
87
|
-
} from "./compose-
|
|
87
|
+
} from "./compose-xvbyp65f.js";
|
|
88
88
|
import {
|
|
89
89
|
createPart2,
|
|
90
90
|
partHandle2
|
|
@@ -20,10 +20,10 @@ import {
|
|
|
20
20
|
} from "./compose-ry29956g.js";
|
|
21
21
|
import {
|
|
22
22
|
scanResources2
|
|
23
|
-
} from "./compose-
|
|
23
|
+
} from "./compose-c4z4kp98.js";
|
|
24
24
|
import {
|
|
25
25
|
activateSession2
|
|
26
|
-
} from "./compose-
|
|
26
|
+
} from "./compose-ht1tbyr3.js";
|
|
27
27
|
import {
|
|
28
28
|
corePluginApi2,
|
|
29
29
|
build2
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
import {
|
|
41
41
|
settingHandle2,
|
|
42
42
|
publishSettings2
|
|
43
|
-
} from "./compose-
|
|
43
|
+
} from "./compose-a40dnhy5.js";
|
|
44
44
|
|
|
45
45
|
// src/extend/plugin-runtime.ts
|
|
46
46
|
import { SdkError } from "@nyte-ai/schema";
|
|
@@ -19,10 +19,10 @@ import {
|
|
|
19
19
|
} from "./compose-xm52jghq.js";
|
|
20
20
|
import {
|
|
21
21
|
createHost2
|
|
22
|
-
} from "./compose-
|
|
22
|
+
} from "./compose-97y00axn.js";
|
|
23
23
|
import {
|
|
24
24
|
createKernel2
|
|
25
|
-
} from "./compose-
|
|
25
|
+
} from "./compose-1xn3eecn.js";
|
|
26
26
|
import {
|
|
27
27
|
memoryStore2
|
|
28
28
|
} from "./compose-ts08bth2.js";
|
|
@@ -9,12 +9,12 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
createWorkspaces2,
|
|
11
11
|
workspaceHandle2
|
|
12
|
-
} from "./compose-
|
|
12
|
+
} from "./compose-917xy085.js";
|
|
13
13
|
import {
|
|
14
14
|
cover2,
|
|
15
15
|
advance2,
|
|
16
16
|
repair2
|
|
17
|
-
} from "./compose-
|
|
17
|
+
} from "./compose-1tdb9ezw.js";
|
|
18
18
|
import {
|
|
19
19
|
gate2,
|
|
20
20
|
gated2,
|
|
@@ -22,12 +22,12 @@ import {
|
|
|
22
22
|
} from "./compose-jwy1gba9.js";
|
|
23
23
|
import {
|
|
24
24
|
createSettingsApi2
|
|
25
|
-
} from "./compose-
|
|
25
|
+
} from "./compose-a40dnhy5.js";
|
|
26
26
|
import {
|
|
27
27
|
readWorkspaceCatalog2,
|
|
28
28
|
runWorkspaceCommand2,
|
|
29
29
|
completeWorkspaceCommand2
|
|
30
|
-
} from "./compose-
|
|
30
|
+
} from "./compose-yr19b453.js";
|
|
31
31
|
import {
|
|
32
32
|
inspect2
|
|
33
33
|
} from "./compose-smsafpqe.js";
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
import {
|
|
38
38
|
sessionHandle2,
|
|
39
39
|
createSessions2
|
|
40
|
-
} from "./compose-
|
|
40
|
+
} from "./compose-2gsbcjgv.js";
|
|
41
41
|
|
|
42
42
|
// src/api/connection.ts
|
|
43
43
|
import { SdkError } from "@nyte-ai/schema";
|
|
@@ -13,6 +13,7 @@ var READ_CHARS = 50 * 1024;
|
|
|
13
13
|
var LIST_LIMIT = 500;
|
|
14
14
|
var SHELL_BYTES = 32 * 1024;
|
|
15
15
|
var PROGRESS_BYTES = 4 * 1024;
|
|
16
|
+
var PROGRESS_MS = 80;
|
|
16
17
|
var FIRST_OUTPUT_MS = 1000;
|
|
17
18
|
var MIME_TYPES = new Map([
|
|
18
19
|
["png", "image/png"],
|
|
@@ -253,36 +254,61 @@ function createShellOutput(progress) {
|
|
|
253
254
|
let dropped = 0;
|
|
254
255
|
let code = null;
|
|
255
256
|
let pending = null;
|
|
257
|
+
let published = Number.NEGATIVE_INFINITY;
|
|
258
|
+
let timer;
|
|
259
|
+
const publish = () => {
|
|
260
|
+
clearTimeout(timer);
|
|
261
|
+
timer = undefined;
|
|
262
|
+
published = Date.now();
|
|
263
|
+
progress(decodeOutputTail(chunks, PROGRESS_BYTES));
|
|
264
|
+
};
|
|
265
|
+
const follow = async (frames, until) => {
|
|
266
|
+
const detached = new Promise((resolve) => {
|
|
267
|
+
if (until.aborted)
|
|
268
|
+
resolve(null);
|
|
269
|
+
until.addEventListener("abort", () => resolve(null), { once: true });
|
|
270
|
+
});
|
|
271
|
+
for (;; ) {
|
|
272
|
+
pending ??= frames.next();
|
|
273
|
+
const next = await Promise.race([pending, detached]);
|
|
274
|
+
if (next === null)
|
|
275
|
+
return false;
|
|
276
|
+
pending = null;
|
|
277
|
+
if (next.done === true)
|
|
278
|
+
return true;
|
|
279
|
+
const frame = next.value;
|
|
280
|
+
if (frame.kind === "exit") {
|
|
281
|
+
code = frame.code;
|
|
282
|
+
return true;
|
|
283
|
+
}
|
|
284
|
+
if (frame.kind === "gap")
|
|
285
|
+
continue;
|
|
286
|
+
chunks.push(frame.data);
|
|
287
|
+
kept += frame.data.byteLength;
|
|
288
|
+
while (kept - (chunks[0]?.byteLength ?? 0) >= SHELL_BYTES && chunks.length > 1) {
|
|
289
|
+
const first = chunks.shift();
|
|
290
|
+
kept -= first?.byteLength ?? 0;
|
|
291
|
+
dropped += first?.byteLength ?? 0;
|
|
292
|
+
}
|
|
293
|
+
if (timer !== undefined)
|
|
294
|
+
continue;
|
|
295
|
+
const wait = published + PROGRESS_MS - Date.now();
|
|
296
|
+
if (wait > 0)
|
|
297
|
+
timer = setTimeout(publish, wait);
|
|
298
|
+
else
|
|
299
|
+
publish();
|
|
300
|
+
}
|
|
301
|
+
};
|
|
256
302
|
return {
|
|
257
303
|
async read(frames, until) {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
if (next === null)
|
|
267
|
-
return false;
|
|
268
|
-
pending = null;
|
|
269
|
-
if (next.done === true)
|
|
270
|
-
return true;
|
|
271
|
-
const frame = next.value;
|
|
272
|
-
if (frame.kind === "exit") {
|
|
273
|
-
code = frame.code;
|
|
274
|
-
return true;
|
|
275
|
-
}
|
|
276
|
-
if (frame.kind === "gap")
|
|
277
|
-
continue;
|
|
278
|
-
chunks.push(frame.data);
|
|
279
|
-
kept += frame.data.byteLength;
|
|
280
|
-
while (kept - (chunks[0]?.byteLength ?? 0) >= SHELL_BYTES && chunks.length > 1) {
|
|
281
|
-
const first = chunks.shift();
|
|
282
|
-
kept -= first?.byteLength ?? 0;
|
|
283
|
-
dropped += first?.byteLength ?? 0;
|
|
284
|
-
}
|
|
285
|
-
progress(decodeOutputTail(chunks, PROGRESS_BYTES));
|
|
304
|
+
try {
|
|
305
|
+
const ended = await follow(frames, until);
|
|
306
|
+
if (timer !== undefined)
|
|
307
|
+
publish();
|
|
308
|
+
return ended;
|
|
309
|
+
} finally {
|
|
310
|
+
clearTimeout(timer);
|
|
311
|
+
timer = undefined;
|
|
286
312
|
}
|
|
287
313
|
},
|
|
288
314
|
code: () => code,
|
|
@@ -314,7 +340,9 @@ function decodeOutputTail(chunks, limit) {
|
|
|
314
340
|
tail.unshift(chunk);
|
|
315
341
|
size += chunk.byteLength;
|
|
316
342
|
}
|
|
317
|
-
const text = new TextDecoder().decode(joinBytes(tail).subarray(Math.max(0, size - limit))
|
|
343
|
+
const text = new TextDecoder().decode(joinBytes(tail).subarray(Math.max(0, size - limit)), {
|
|
344
|
+
stream: true
|
|
345
|
+
});
|
|
318
346
|
const [, ...whole] = text.split(`
|
|
319
347
|
`);
|
|
320
348
|
return (size > limit && whole.length > 0 ? whole.join(`
|
|
@@ -26,10 +26,10 @@ import {
|
|
|
26
26
|
import {
|
|
27
27
|
SKILL_PATHS2,
|
|
28
28
|
dropScans2
|
|
29
|
-
} from "./compose-
|
|
29
|
+
} from "./compose-c4z4kp98.js";
|
|
30
30
|
import {
|
|
31
31
|
trustChanged2
|
|
32
|
-
} from "./compose-
|
|
32
|
+
} from "./compose-917xy085.js";
|
|
33
33
|
import {
|
|
34
34
|
settingInfos2,
|
|
35
35
|
readSettingLayers2,
|
|
@@ -20,9 +20,12 @@ import {
|
|
|
20
20
|
// src/extend/resources.ts
|
|
21
21
|
import { SdkError, standard } from "@nyte-ai/schema";
|
|
22
22
|
import { Type } from "typebox";
|
|
23
|
+
import { isMap, isScalar, parseDocument } from "yaml";
|
|
23
24
|
var CONTEXT_NAMES = ["AGENTS.override.md", "AGENTS.md", "CLAUDE.md"];
|
|
24
25
|
var SKILL_DIRECTORIES = [".nyte/skills", ".agents/skills"];
|
|
25
26
|
var FRONTMATTER = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/;
|
|
27
|
+
var ABSOLUTE = /^(?:\/|[A-Za-z]:[\\/])/;
|
|
28
|
+
var LINK_HOPS = 8;
|
|
26
29
|
var SKILL_PATHS2 = "skills.paths";
|
|
27
30
|
var scanIssues = new WeakMap;
|
|
28
31
|
async function scanResources2(kernel, session) {
|
|
@@ -169,13 +172,13 @@ async function scan(kernel, workspace, attach) {
|
|
|
169
172
|
const root = env !== null && env.cwd.startsWith("/") ? env.cwd : null;
|
|
170
173
|
const home = kernel.home;
|
|
171
174
|
const [projectSkills, userSkills, pathSkills] = await Promise.all([
|
|
172
|
-
project === null ? [] : skillsIn(project, SKILL_DIRECTORIES, "project"),
|
|
173
|
-
user === null ? [] : skillsIn(user, SKILL_DIRECTORIES, "user"),
|
|
174
|
-
user === null ? [] : skillsAt(user, await skillPaths(kernel.store))
|
|
175
|
+
project === null ? [] : skillsIn(project, SKILL_DIRECTORIES, "project", root),
|
|
176
|
+
user === null ? [] : skillsIn(user, SKILL_DIRECTORIES, "user", home),
|
|
177
|
+
user === null ? [] : skillsAt(user, await skillPaths(kernel.store), home)
|
|
175
178
|
]);
|
|
176
179
|
const { kept: skills, dropped } = byName([
|
|
177
180
|
...projectSkills,
|
|
178
|
-
...[...userSkills, ...pathSkills].map((skill) => home === null ||
|
|
181
|
+
...[...userSkills, ...pathSkills].map((skill) => home === null || ABSOLUTE.test(skill.location) ? skill : { ...skill, location: join(home, skill.location) })
|
|
179
182
|
]);
|
|
180
183
|
const issues = dropped.map(({ item, over }) => ({
|
|
181
184
|
severity: "warning",
|
|
@@ -269,21 +272,57 @@ async function skillPaths(store) {
|
|
|
269
272
|
const value = await readKv2(store, kvRef2("host", "settings", SKILL_PATHS2));
|
|
270
273
|
return Array.isArray(value) ? value.flatMap((entry) => typeof entry === "string" ? [entry] : []) : [];
|
|
271
274
|
}
|
|
272
|
-
async function skillsIn(files, directories, scope) {
|
|
273
|
-
const listed = await Promise.all(directories.map(async (directory) => (await listDirectChildren(files, directory, "directory")).map((
|
|
274
|
-
|
|
275
|
-
|
|
275
|
+
async function skillsIn(files, directories, scope, root) {
|
|
276
|
+
const listed = await Promise.all(directories.map(async (directory) => (await listDirectChildren(files, directory, ["directory", "symlink"])).map((entry) => ({
|
|
277
|
+
...entry,
|
|
278
|
+
path: `${directory}/${entry.name}`
|
|
276
279
|
}))));
|
|
277
|
-
const
|
|
280
|
+
const candidates = listed.flat().toSorted((left, right) => Number(left.kind === "symlink") - Number(right.kind === "symlink"));
|
|
281
|
+
const targets = await Promise.all(candidates.map(async ({ kind, path }) => kind === "directory" ? resolvePath(root, path) : linkedDirectory(files, path, root)));
|
|
282
|
+
const loaded = new Set;
|
|
283
|
+
const read = await Promise.all(candidates.map(async ({ name, path }, index) => {
|
|
284
|
+
const target = targets[index];
|
|
285
|
+
if (target === undefined || target === null || loaded.has(target))
|
|
286
|
+
return [];
|
|
287
|
+
loaded.add(target);
|
|
288
|
+
const location = `${path}/SKILL.md`;
|
|
278
289
|
const content = await readText(files, location);
|
|
279
290
|
return content === null ? [] : [parseSkillMetadata(content, name, location, scope)];
|
|
280
291
|
}));
|
|
281
292
|
return read.flat();
|
|
282
293
|
}
|
|
283
|
-
async function
|
|
294
|
+
async function linkedDirectory(files, path, root) {
|
|
295
|
+
let at = resolvePath(root, path);
|
|
296
|
+
for (let hop = 0;hop < LINK_HOPS; hop += 1) {
|
|
297
|
+
const found = await files.stat(at).catch(() => null);
|
|
298
|
+
if (found?.kind === "directory")
|
|
299
|
+
return at;
|
|
300
|
+
if (found?.kind !== "symlink" || found.target === undefined)
|
|
301
|
+
return null;
|
|
302
|
+
const parent = at.slice(0, Math.max(at.lastIndexOf("/"), 0));
|
|
303
|
+
at = resolvePath(root, ABSOLUTE.test(found.target) ? found.target : join(parent, found.target));
|
|
304
|
+
}
|
|
305
|
+
return null;
|
|
306
|
+
}
|
|
307
|
+
function resolvePath(root, path) {
|
|
308
|
+
const full = root === null || ABSOLUTE.test(path) ? path : join(root, path);
|
|
309
|
+
const absolute = full.startsWith("/");
|
|
310
|
+
const parts = [];
|
|
311
|
+
for (const part of full.split("/")) {
|
|
312
|
+
if (part === "" || part === "." || part === ".." && absolute && parts.length === 0)
|
|
313
|
+
continue;
|
|
314
|
+
if (part === ".." && parts.length > 0 && parts.at(-1) !== "..")
|
|
315
|
+
parts.pop();
|
|
316
|
+
else
|
|
317
|
+
parts.push(part);
|
|
318
|
+
}
|
|
319
|
+
const normal = `${absolute ? "/" : ""}${parts.join("/")}`;
|
|
320
|
+
return root !== null && normal.startsWith(join(root, "")) ? normal.slice(join(root, "").length) : normal;
|
|
321
|
+
}
|
|
322
|
+
async function skillsAt(files, paths, root) {
|
|
284
323
|
const found = await Promise.all(userSkillPaths(paths).map(async (path) => {
|
|
285
324
|
if (!path.endsWith(".md"))
|
|
286
|
-
return skillsIn(files, [path], "path");
|
|
325
|
+
return skillsIn(files, [path], "path", root);
|
|
287
326
|
const content = await readText(files, path);
|
|
288
327
|
const name = path.split("/").at(-1)?.slice(0, -".md".length) ?? path;
|
|
289
328
|
return content === null ? [] : [parseSkillMetadata(content, name, path, "path")];
|
|
@@ -291,8 +330,8 @@ async function skillsAt(files, paths) {
|
|
|
291
330
|
return found.flat();
|
|
292
331
|
}
|
|
293
332
|
async function promptsIn(files, scope) {
|
|
294
|
-
const
|
|
295
|
-
return
|
|
333
|
+
const entries = await listDirectChildren(files, ".nyte/prompts", ["file"]);
|
|
334
|
+
return entries.flatMap(({ name }) => name.endsWith(".md") ? [{ name: name.slice(0, -".md".length), location: `.nyte/prompts/${name}`, scope }] : []);
|
|
296
335
|
}
|
|
297
336
|
function parseSkillMetadata(content, fallback, location, scope) {
|
|
298
337
|
const fields = frontmatter(content);
|
|
@@ -322,18 +361,18 @@ async function firstContext(files, at) {
|
|
|
322
361
|
}));
|
|
323
362
|
return read.find((context) => context !== null) ?? null;
|
|
324
363
|
}
|
|
325
|
-
async function listDirectChildren(files, directory,
|
|
326
|
-
const
|
|
364
|
+
async function listDirectChildren(files, directory, kinds) {
|
|
365
|
+
const children = new Map;
|
|
327
366
|
for await (const frame of files.scan({ directory })) {
|
|
328
367
|
if (frame.kind !== "entries")
|
|
329
368
|
continue;
|
|
330
369
|
for (const entry of frame.entries) {
|
|
331
370
|
const relative = entry.path.startsWith(`${directory}/`) ? entry.path.slice(directory.length + 1) : entry.path;
|
|
332
|
-
if (entry.kind
|
|
333
|
-
|
|
371
|
+
if (kinds.includes(entry.kind) && relative !== "" && !relative.includes("/"))
|
|
372
|
+
children.set(relative, entry.kind);
|
|
334
373
|
}
|
|
335
374
|
}
|
|
336
|
-
return [...
|
|
375
|
+
return [...children].map(([name, kind]) => ({ name, kind })).sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0);
|
|
337
376
|
}
|
|
338
377
|
async function readText(files, path) {
|
|
339
378
|
const document = await files.read(path).catch((error) => {
|
|
@@ -344,9 +383,25 @@ async function readText(files, path) {
|
|
|
344
383
|
return document?.kind === "text" ? document.contents : null;
|
|
345
384
|
}
|
|
346
385
|
function frontmatter(content) {
|
|
347
|
-
const fields = new Map;
|
|
348
386
|
const block = FRONTMATTER.exec(content)?.[1];
|
|
349
|
-
|
|
387
|
+
if (block === undefined)
|
|
388
|
+
return new Map;
|
|
389
|
+
const document = parseDocument(block);
|
|
390
|
+
if (document.errors.length > 0 || !isMap(document.contents))
|
|
391
|
+
return frontmatterLines(block);
|
|
392
|
+
const fields = new Map;
|
|
393
|
+
for (const { key, value } of document.contents.items) {
|
|
394
|
+
if (!isScalar(key) || !isScalar(value))
|
|
395
|
+
continue;
|
|
396
|
+
const text = value.value === null ? "" : value.toString().trim();
|
|
397
|
+
if (text !== "")
|
|
398
|
+
fields.set(String(key.value), text);
|
|
399
|
+
}
|
|
400
|
+
return fields;
|
|
401
|
+
}
|
|
402
|
+
function frontmatterLines(block) {
|
|
403
|
+
const fields = new Map;
|
|
404
|
+
for (const line of block.split(/\r?\n/)) {
|
|
350
405
|
const pair = /^([A-Za-z][\w-]*):\s*(.*)$/.exec(line);
|
|
351
406
|
const key = pair?.[1];
|
|
352
407
|
const value = pair?.[2]?.trim();
|
|
@@ -35,10 +35,10 @@ import {
|
|
|
35
35
|
} from "./compose-t9fcqtby.js";
|
|
36
36
|
import {
|
|
37
37
|
dropScans2
|
|
38
|
-
} from "./compose-
|
|
38
|
+
} from "./compose-c4z4kp98.js";
|
|
39
39
|
import {
|
|
40
40
|
releaseWorktree2
|
|
41
|
-
} from "./compose-
|
|
41
|
+
} from "./compose-ee0h1pk1.js";
|
|
42
42
|
|
|
43
43
|
// src/engine/start.ts
|
|
44
44
|
import { SdkError } from "@nyte-ai/schema";
|
|
@@ -69,12 +69,12 @@ import {
|
|
|
69
69
|
import {
|
|
70
70
|
requestBody2,
|
|
71
71
|
estimateTranscriptTokens2
|
|
72
|
-
} from "./compose-
|
|
72
|
+
} from "./compose-enq3x3rq.js";
|
|
73
73
|
import {
|
|
74
74
|
compact2,
|
|
75
75
|
failLeftoverCompactions2,
|
|
76
76
|
readProviderCheckpoint2
|
|
77
|
-
} from "./compose-
|
|
77
|
+
} from "./compose-ay7t13m9.js";
|
|
78
78
|
import {
|
|
79
79
|
executeCall2
|
|
80
80
|
} from "./compose-mcz93154.js";
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./compose-4ppmas7g.js";
|
|
4
4
|
import {
|
|
5
5
|
scanWorkspaceResources2
|
|
6
|
-
} from "./compose-
|
|
6
|
+
} from "./compose-c4z4kp98.js";
|
|
7
7
|
import {
|
|
8
8
|
newChatPlugins2
|
|
9
|
-
} from "./compose-
|
|
9
|
+
} from "./compose-ht1tbyr3.js";
|
|
10
10
|
import {
|
|
11
11
|
createHookDispatch2
|
|
12
12
|
} from "./compose-jeemzja1.js";
|
|
@@ -19,10 +19,10 @@ import {
|
|
|
19
19
|
} from "./compose-ae5t6v5b.js";
|
|
20
20
|
import {
|
|
21
21
|
settingHandle2
|
|
22
|
-
} from "./compose-
|
|
22
|
+
} from "./compose-a40dnhy5.js";
|
|
23
23
|
import {
|
|
24
24
|
activateApart2
|
|
25
|
-
} from "./compose-
|
|
25
|
+
} from "./compose-42egt9y7.js";
|
|
26
26
|
|
|
27
27
|
// src/extend/workspace-commands.ts
|
|
28
28
|
import { asId, SdkError } from "@nyte-ai/schema";
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
createSummarizer2,
|
|
5
5
|
failLeftoverCompactions2,
|
|
6
6
|
readProviderCheckpoint2
|
|
7
|
-
} from "../../chunks/compose-
|
|
8
|
-
import"../../chunks/compose-
|
|
7
|
+
} from "../../chunks/compose-ay7t13m9.js";
|
|
8
|
+
import"../../chunks/compose-enq3x3rq.js";
|
|
9
9
|
import"../../chunks/compose-c4238qkb.js";
|
|
10
10
|
import"../../chunks/compose-sprfv38c.js";
|
|
11
11
|
import"../../chunks/compose-bd8c5n7k.js";
|
|
@@ -13,7 +13,7 @@ import"../../chunks/compose-mdwr0er9.js";
|
|
|
13
13
|
import"../../chunks/compose-ae5t6v5b.js";
|
|
14
14
|
import"../../chunks/compose-c9wxgbjp.js";
|
|
15
15
|
import"../../chunks/compose-qwbe95qs.js";
|
|
16
|
-
import"../../chunks/compose-
|
|
16
|
+
import"../../chunks/compose-c4z4kp98.js";
|
|
17
17
|
import"../../chunks/compose-8pp3vtv0.js";
|
|
18
18
|
import"../../chunks/compose-4ppmas7g.js";
|
|
19
19
|
import"../../chunks/compose-2rha31fc.js";
|
|
@@ -2,13 +2,13 @@ import {
|
|
|
2
2
|
projectedCommit2,
|
|
3
3
|
requestBody2,
|
|
4
4
|
estimateTranscriptTokens2
|
|
5
|
-
} from "../../chunks/compose-
|
|
5
|
+
} from "../../chunks/compose-enq3x3rq.js";
|
|
6
6
|
import"../../chunks/compose-c4238qkb.js";
|
|
7
7
|
import"../../chunks/compose-bd8c5n7k.js";
|
|
8
8
|
import"../../chunks/compose-ae5t6v5b.js";
|
|
9
9
|
import"../../chunks/compose-c9wxgbjp.js";
|
|
10
10
|
import"../../chunks/compose-qwbe95qs.js";
|
|
11
|
-
import"../../chunks/compose-
|
|
11
|
+
import"../../chunks/compose-c4z4kp98.js";
|
|
12
12
|
import"../../chunks/compose-8pp3vtv0.js";
|
|
13
13
|
import"../../chunks/compose-4ppmas7g.js";
|
|
14
14
|
import"../../chunks/compose-2rha31fc.js";
|