acryl 0.1.17 → 0.1.18

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/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { createRequire } from "node:module";
2
2
  import { randomUUID } from "node:crypto";
3
- import { BlockAssembler, createUserMessage } from "@deepseek-ai/dsh-llm";
4
- import { SessionId } from "@deepseek-ai/dsh-session";
5
3
  import { existsSync, writeFileSync } from "node:fs";
6
4
  import { dirname, join, relative, resolve } from "node:path";
7
5
  import { fileURLToPath } from "node:url";
6
+ import { BlockAssembler, createUserMessage } from "@deepseek-ai/dsh-llm";
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
9
  import { execFile, spawn } from "node:child_process";
10
10
  import { diffLines } from "diff";
@@ -90,6 +90,55 @@ function parseAcrylArgs(args) {
90
90
  process.stdout, process.stderr;
91
91
  //#endregion
92
92
  //#region ../acryl-harness-runtime/lib/index.mjs
93
+ const shippedPresetsDir = join(resolve(dirname(fileURLToPath(import.meta.url)), "../.."), "deepseek-harness", "packages", "preset", "agent-presets", "presets");
94
+ const authorizationCapabilityPatches = [{
95
+ id: "system-prompt",
96
+ name: "@deepseek-ai/dsh-system-prompt",
97
+ config: { persona: "You are a coding agent powered by the {{model}} model. Your working directory is {{cwd}}." }
98
+ }, { insert: [
99
+ {
100
+ id: "agent-presets",
101
+ name: "@deepseek-ai/dsh-agent-presets",
102
+ config: {
103
+ default: "standard",
104
+ roots: existsSync(shippedPresetsDir) ? [{
105
+ path: shippedPresetsDir,
106
+ trust: "system"
107
+ }] : [],
108
+ includeShippedRoot: false,
109
+ includeUserRoot: true
110
+ }
111
+ },
112
+ {
113
+ id: "session-stats",
114
+ name: "@deepseek-ai/dsh-session-stats"
115
+ },
116
+ {
117
+ id: "authorization",
118
+ name: "@deepseek-ai/dsh-authorization"
119
+ }
120
+ ] }];
121
+ const NON_TUI_SHARED_ROW_IDS = /* @__PURE__ */ new Set(["authorization"]);
122
+ function selectNonTuiCapabilityPatches(patches) {
123
+ return patches.flatMap((patch) => {
124
+ if (!("insert" in patch) || !Array.isArray(patch.insert)) return [];
125
+ const insert = patch.insert.filter((row) => NON_TUI_SHARED_ROW_IDS.has(row.id));
126
+ return insert.length === 0 ? [] : [{ insert }];
127
+ });
128
+ }
129
+ const ACRYL_CODING_CAPABILITIES = [{
130
+ id: "authorization",
131
+ surfaces: [
132
+ "tui",
133
+ "web",
134
+ "desktop"
135
+ ],
136
+ loaderPatches: authorizationCapabilityPatches
137
+ }];
138
+ function createAcrylCodingCapabilityPatches(surfaces) {
139
+ const includeSharedCodingRows = surfaces.has("tui");
140
+ return structuredClone(ACRYL_CODING_CAPABILITIES.filter((capability) => capability.surfaces.some((surface) => surfaces.has(surface))).flatMap((capability) => includeSharedCodingRows ? capability.loaderPatches : selectNonTuiCapabilityPatches(capability.loaderPatches)));
141
+ }
93
142
  function contentText(content) {
94
143
  return content.filter((block) => {
95
144
  return block.type === "text" && typeof block.text === "string";
@@ -291,34 +340,6 @@ function createAcrylSessionBridge(ctx, options) {
291
340
  }
292
341
  const dshInstallAnchor = createRequire(import.meta.url).resolve("@deepseek-ai/dsh/package.json");
293
342
  const profileRoot = "[]\n";
294
- const shippedPresetsDir = join(resolve(dirname(fileURLToPath(import.meta.url)), "../.."), "deepseek-harness", "packages", "preset", "agent-presets", "presets");
295
- const ACRYL_RUNTIME_ROWS = [{
296
- id: "system-prompt",
297
- name: "@deepseek-ai/dsh-system-prompt",
298
- config: { persona: "You are a coding agent powered by the {{model}} model. Your working directory is {{cwd}}." }
299
- }, { insert: [
300
- {
301
- id: "agent-presets",
302
- name: "@deepseek-ai/dsh-agent-presets",
303
- config: {
304
- default: "standard",
305
- roots: existsSync(shippedPresetsDir) ? [{
306
- path: shippedPresetsDir,
307
- trust: "system"
308
- }] : [],
309
- includeShippedRoot: false,
310
- includeUserRoot: true
311
- }
312
- },
313
- {
314
- id: "session-stats",
315
- name: "@deepseek-ai/dsh-session-stats"
316
- },
317
- {
318
- id: "authorization",
319
- name: "@deepseek-ai/dsh-authorization"
320
- }
321
- ] }];
322
343
  /** Boot one normal pinned-Harness ACRYL profile in a single Cordis root. */
323
344
  async function bootAcrylHarnessProfile(options) {
324
345
  if (options.profile.trim() === "") throw new Error("ACRYL Harness profile must not be empty");
@@ -329,7 +350,7 @@ async function bootAcrylHarnessProfile(options) {
329
350
  writeFileSync(rootConfig, profileRoot);
330
351
  const patches = structuredClone([
331
352
  ...profile.layers.flatMap((layer) => layer.patches),
332
- ...ACRYL_RUNTIME_ROWS,
353
+ ...createAcrylCodingCapabilityPatches(/* @__PURE__ */ new Set(["tui"])),
333
354
  ...profile.patches
334
355
  ]);
335
356
  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");