acryl 0.1.18 → 0.1.19
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/lib/bin.js +81 -107
- package/lib/bin.js.map +1 -1
- package/lib/index.js +65 -0
- package/lib/index.js.map +1 -1
- package/package.json +1 -2
package/lib/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { fileURLToPath } from "node:url";
|
|
|
6
6
|
import { BlockAssembler, createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
7
7
|
import { SessionId } from "@deepseek-ai/dsh-session";
|
|
8
8
|
import { DEFAULT_PROFILE_BUNDLES, boot, composeEntries, healProfilesModuleFallback, initProfile, loadProfile, resolveProfileDir } from "@deepseek-ai/dsh-app-boot";
|
|
9
|
+
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
9
10
|
import { execFile, spawn } from "node:child_process";
|
|
10
11
|
import { diffLines } from "diff";
|
|
11
12
|
import { Container, Editor, HStack, Key, KeybindingsManager, ProcessTerminal, ScrollView, TUI_KEYBINDINGS, Text, TuiAltScreen, VStack, matchesKey, setKeybindings, visibleWidth, wrapTextWithAnsi } from "@earendil-works/pi-tui";
|
|
@@ -338,6 +339,69 @@ function createAcrylSessionBridge(ctx, options) {
|
|
|
338
339
|
}
|
|
339
340
|
});
|
|
340
341
|
}
|
|
342
|
+
/** Canonical tool name exposed to the model. */
|
|
343
|
+
const TOOL_NAME = "acryl_workspace_status";
|
|
344
|
+
/** Read the ACRYL workspace/profile context the agent is running under. */
|
|
345
|
+
function readWorkspaceContext() {
|
|
346
|
+
return {
|
|
347
|
+
cwd: process.cwd(),
|
|
348
|
+
dshHome: process.env.DSH_HOME ?? "",
|
|
349
|
+
profile: process.env.ACRYL_PROFILE ?? "",
|
|
350
|
+
surface: process.env.ACRYL_SURFACE ?? ""
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
/** Render one line of the model-facing text from the canonical context value. */
|
|
354
|
+
function fmt(label, value, prefix) {
|
|
355
|
+
return `${prefix} ${label}: ${value}`;
|
|
356
|
+
}
|
|
357
|
+
/** Register the `acryl_workspace_status` tool on `ctx.tools`. Returns a disposer. */
|
|
358
|
+
function installAcrylWorkspaceStatusTool(ctx) {
|
|
359
|
+
const tool = defineTool({
|
|
360
|
+
name: TOOL_NAME,
|
|
361
|
+
description: "Report the ACRYL workspace context the agent is operating in: current working directory, DSH home, active ACRYL profile, and presentation surface. Use it to confirm which project/profile a session is bound to before acting.",
|
|
362
|
+
parameters: {},
|
|
363
|
+
output: {
|
|
364
|
+
schema: {
|
|
365
|
+
type: "object",
|
|
366
|
+
additionalProperties: false,
|
|
367
|
+
properties: {
|
|
368
|
+
cwd: {
|
|
369
|
+
type: "string",
|
|
370
|
+
required: true
|
|
371
|
+
},
|
|
372
|
+
dshHome: {
|
|
373
|
+
type: "string",
|
|
374
|
+
required: true
|
|
375
|
+
},
|
|
376
|
+
profile: {
|
|
377
|
+
type: "string",
|
|
378
|
+
required: true
|
|
379
|
+
},
|
|
380
|
+
surface: {
|
|
381
|
+
type: "string",
|
|
382
|
+
required: true
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
render(_args, value) {
|
|
387
|
+
const v = value;
|
|
388
|
+
return [{
|
|
389
|
+
type: "text",
|
|
390
|
+
text: ["ACRYL workspace context:", ...[
|
|
391
|
+
fmt("cwd", v.cwd, "-"),
|
|
392
|
+
fmt("dshHome", v.dshHome || "<unset>", "-"),
|
|
393
|
+
fmt("profile", v.profile || "<default>", "-"),
|
|
394
|
+
fmt("surface", v.surface || "<tui>", "-")
|
|
395
|
+
]].join("\n")
|
|
396
|
+
}];
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
async execute(_args, _exec) {
|
|
400
|
+
return readWorkspaceContext();
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
return ctx.tools.register(tool);
|
|
404
|
+
}
|
|
341
405
|
const dshInstallAnchor = createRequire(import.meta.url).resolve("@deepseek-ai/dsh/package.json");
|
|
342
406
|
const profileRoot = "[]\n";
|
|
343
407
|
/** Boot one normal pinned-Harness ACRYL profile in a single Cordis root. */
|
|
@@ -355,6 +419,7 @@ async function bootAcrylHarnessProfile(options) {
|
|
|
355
419
|
]);
|
|
356
420
|
if (composeEntries([patches]).find((entry) => entry.id === "hmr")?.disabled !== true && !process.execArgv.includes("--expose-internals")) throw new Error("ACRYL profile enables Cordis HMR and must be launched with Node --expose-internals");
|
|
357
421
|
const ctx = await boot("acryl", rootConfig, patches, options.prepare);
|
|
422
|
+
if (ctx.tools) installAcrylWorkspaceStatusTool(ctx);
|
|
358
423
|
let disposed = false;
|
|
359
424
|
return Object.freeze({
|
|
360
425
|
ctx,
|