@ycodium-ai/agent-dsh 0.2.2882 → 0.2.2892

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.
Files changed (2) hide show
  1. package/dist/index.js +75 -16
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -31514,6 +31514,60 @@ function approvalOutcomeForDecision(decision, optionId) {
31514
31514
  return decision !== "cancel" && optionId !== void 0 ? { outcome: "selected", optionId } : { outcome: "cancelled" };
31515
31515
  }
31516
31516
 
31517
+ // ../../packages/ycodium-acp-executor/src/artifacts.ts
31518
+ import * as NodePath from "node:path";
31519
+ import * as NodeURL from "node:url";
31520
+ function resourceLinkArtifacts(content) {
31521
+ if (content["type"] !== "resource_link" || typeof content["uri"] !== "string") return [];
31522
+ const uri = content["uri"].trim();
31523
+ let path;
31524
+ try {
31525
+ path = uri.toLowerCase().startsWith("file:") ? NodeURL.fileURLToPath(uri) : uri;
31526
+ } catch {
31527
+ return [];
31528
+ }
31529
+ if (!NodePath.isAbsolute(path)) return [];
31530
+ const name = typeof content["name"] === "string" ? content["name"].trim() : "";
31531
+ const mimeType = typeof content["mimeType"] === "string" ? content["mimeType"].trim() : "";
31532
+ return [
31533
+ {
31534
+ path,
31535
+ ...name.length > 0 ? { name } : {},
31536
+ ...mimeType.length > 0 ? { mimeType } : {}
31537
+ }
31538
+ ];
31539
+ }
31540
+ function acpArtifactEvent(input2) {
31541
+ if (input2.artifacts.length === 0) return void 0;
31542
+ const { toolCallId } = input2;
31543
+ return {
31544
+ ...input2.base,
31545
+ type: "assistant.artifact.produced",
31546
+ payload: {
31547
+ artifacts: input2.artifacts.map((artifact) => ({
31548
+ ...artifact,
31549
+ ...toolCallId !== void 0 ? { toolCallId } : {}
31550
+ }))
31551
+ }
31552
+ };
31553
+ }
31554
+ function makeArtifactEmitter(input2) {
31555
+ return (artifacts, toolCallId) => {
31556
+ const turnId = input2.turnId();
31557
+ const event = acpArtifactEvent({
31558
+ artifacts,
31559
+ toolCallId,
31560
+ base: {
31561
+ ...input2.stamp(),
31562
+ provider: input2.options.provider,
31563
+ threadId: input2.options.threadId,
31564
+ ...turnId === void 0 ? {} : { turnId }
31565
+ }
31566
+ });
31567
+ if (event !== void 0) input2.emit(event);
31568
+ };
31569
+ }
31570
+
31517
31571
  // ../../packages/ycodium-acp-executor/src/event-stream.ts
31518
31572
  var UnboundedEventStream = class {
31519
31573
  subscribers = /* @__PURE__ */ new Set();
@@ -32929,9 +32983,8 @@ function createAcpExecutor(options) {
32929
32983
  options.originBindingGeneration === void 0 ? event : { ...event, originBindingGeneration: options.originBindingGeneration }
32930
32984
  );
32931
32985
  };
32932
- const emit = (event) => {
32933
- publish(event);
32934
- };
32986
+ const emit = publish;
32987
+ const emitArtifacts = makeArtifactEmitter({ emit, stamp, options, turnId: () => activeTurnId });
32935
32988
  const failIfDisposed = () => {
32936
32989
  if (disposed) {
32937
32990
  throw new AcpExecutorDisposedError();
@@ -33034,6 +33087,8 @@ function createAcpExecutor(options) {
33034
33087
  payload: taskEvent.payload
33035
33088
  });
33036
33089
  }
33090
+ if (nextToolCall.status === "completed" && hookResult && "artifacts" in hookResult)
33091
+ emitArtifacts(hookResult.artifacts ?? [], nextToolCall.toolCallId);
33037
33092
  if (handledByHook || !decision.emit) {
33038
33093
  continue;
33039
33094
  }
@@ -33053,6 +33108,10 @@ function createAcpExecutor(options) {
33053
33108
  );
33054
33109
  continue;
33055
33110
  }
33111
+ if (event._tag === "AssistantContentBlock") {
33112
+ emitArtifacts(resourceLinkArtifacts(event.content));
33113
+ continue;
33114
+ }
33056
33115
  if (event._tag === "CompactionUpdated") {
33057
33116
  applyCompactionUpdate(event);
33058
33117
  continue;
@@ -34169,7 +34228,7 @@ async function probeCliVersion(input2) {
34169
34228
  import * as NodeCrypto2 from "node:crypto";
34170
34229
  import * as NodeFS from "node:fs";
34171
34230
  import * as NodeOS from "node:os";
34172
- import * as NodePath from "node:path";
34231
+ import * as NodePath2 from "node:path";
34173
34232
  import {
34174
34233
  parseRetryAfterMs
34175
34234
  } from "@ycodium-ai/plugin-api/usage";
@@ -34258,15 +34317,15 @@ var createDshUsage = (input2) => {
34258
34317
  const now = input2.now ?? Date.now;
34259
34318
  const processEnv = input2.processEnv ?? process.env;
34260
34319
  const envValue = (name) => nonEmpty(input2.environment[name]) ?? nonEmpty(processEnv[name]);
34261
- const dshHome = () => nonEmpty(input2.environment[input2.homeEnvVar]) ?? nonEmpty(input2.homePath) ?? nonEmpty(processEnv[input2.homeEnvVar]) ?? NodePath.join(NodeOS.homedir(), ".dsh");
34320
+ const dshHome = () => nonEmpty(input2.environment[input2.homeEnvVar]) ?? nonEmpty(input2.homePath) ?? nonEmpty(processEnv[input2.homeEnvVar]) ?? NodePath2.join(NodeOS.homedir(), ".dsh");
34262
34321
  const resolveKey = () => {
34263
34322
  const fromEnvironment = envValue(API_KEY_NAME);
34264
34323
  if (fromEnvironment !== null) return fromEnvironment;
34265
34324
  const home = dshHome();
34266
- const yaml = readFile(NodePath.join(home, ".credentials.yaml"));
34325
+ const yaml = readFile(NodePath2.join(home, ".credentials.yaml"));
34267
34326
  const fromYaml = yaml === null ? null : readCredentialsYamlRef(yaml, API_KEY_NAME);
34268
34327
  if (fromYaml !== null) return fromYaml;
34269
- const dotenv = readFile(NodePath.join(home, ".env"));
34328
+ const dotenv = readFile(NodePath2.join(home, ".env"));
34270
34329
  return dotenv === null ? null : readDotenvValue(dotenv, API_KEY_NAME);
34271
34330
  };
34272
34331
  const readQuota = async (request) => {
@@ -34327,7 +34386,7 @@ var createDshUsage = (input2) => {
34327
34386
  import * as NodeCrypto3 from "node:crypto";
34328
34387
  import * as NodeFSP from "node:fs/promises";
34329
34388
  import * as NodeOS2 from "node:os";
34330
- import * as NodePath2 from "node:path";
34389
+ import * as NodePath3 from "node:path";
34331
34390
  var import_yaml = __toESM(require_dist(), 1);
34332
34391
  var OVERLAY_DIR = "ycodium-dsh-patches";
34333
34392
  var DUMP_CONFIG_TIMEOUT_MS = 15e3;
@@ -34346,8 +34405,8 @@ function dshSkillOverlay(skillsDir) {
34346
34405
  async function ensureDshSkillOverlay(skillsDir, tempRoot = NodeOS2.tmpdir()) {
34347
34406
  const contents = dshSkillOverlay(skillsDir);
34348
34407
  const hash2 = NodeCrypto3.createHash("sha256").update(contents).digest("hex").slice(0, 16);
34349
- const directory = NodePath2.join(tempRoot, OVERLAY_DIR);
34350
- const file2 = NodePath2.join(directory, `${hash2}.yml`);
34408
+ const directory = NodePath3.join(tempRoot, OVERLAY_DIR);
34409
+ const file2 = NodePath3.join(directory, `${hash2}.yml`);
34351
34410
  const present = await NodeFSP.readFile(file2, "utf8").then(
34352
34411
  (existing) => existing === contents,
34353
34412
  () => false
@@ -34522,7 +34581,7 @@ function tokenizeLaunchArgs(value) {
34522
34581
  // src/probeModels.ts
34523
34582
  import * as NodeFS2 from "node:fs";
34524
34583
  import * as NodeOS4 from "node:os";
34525
- import * as NodePath4 from "node:path";
34584
+ import * as NodePath5 from "node:path";
34526
34585
  import {
34527
34586
  describeExecutorSpawnFailure,
34528
34587
  ExecutorSpawnRefusedError,
@@ -34532,7 +34591,7 @@ import { nodeStreamsFromHandle } from "@ycodium-ai/plugin-api/process-stdin";
34532
34591
 
34533
34592
  // src/spawnEnv.ts
34534
34593
  import * as NodeOS3 from "node:os";
34535
- import * as NodePath3 from "node:path";
34594
+ import * as NodePath4 from "node:path";
34536
34595
  import { mergeLaunchEnv } from "@ycodium-ai/plugin-api/executor";
34537
34596
 
34538
34597
  // src/permission.ts
@@ -34577,18 +34636,18 @@ function dshPermissionEnv(nativeModeId) {
34577
34636
  function expandHomePath(value) {
34578
34637
  if (value === "~") return NodeOS3.homedir();
34579
34638
  if (value.startsWith("~/") || value.startsWith("~\\")) {
34580
- return NodePath3.join(NodeOS3.homedir(), value.slice(2));
34639
+ return NodePath4.join(NodeOS3.homedir(), value.slice(2));
34581
34640
  }
34582
34641
  return value;
34583
34642
  }
34584
34643
  function resolveHomePath(value) {
34585
34644
  const trimmed = value.trim();
34586
34645
  if (trimmed.length === 0) return "";
34587
- return NodePath3.resolve(expandHomePath(trimmed));
34646
+ return NodePath4.resolve(expandHomePath(trimmed));
34588
34647
  }
34589
34648
  function dshContinuationKey(homePath) {
34590
34649
  const resolved = resolveHomePath(homePath);
34591
- return `dsh:home:${resolved.length > 0 ? resolved : NodePath3.join(NodeOS3.homedir(), ".dsh")}`;
34650
+ return `dsh:home:${resolved.length > 0 ? resolved : NodePath4.join(NodeOS3.homedir(), ".dsh")}`;
34592
34651
  }
34593
34652
  function buildSpawnEnv(recipe, resolvedHomePath, nativeModeId) {
34594
34653
  const homeEnvVar = recipe.homeEnvVar.trim() || DSH_CARD.homeEnvVar;
@@ -34606,7 +34665,7 @@ function buildSpawnEnv(recipe, resolvedHomePath, nativeModeId) {
34606
34665
  var PROBE_REQUEST_TIMEOUT_MS = 15e3;
34607
34666
  function dshProbeSessionCwd(instanceId) {
34608
34667
  const safe = instanceId.trim().replace(/[^A-Za-z0-9._-]/g, "-") || "instance";
34609
- return NodePath4.join(NodeOS4.tmpdir(), `ycodium-dsh-probe-${safe}`);
34668
+ return NodePath5.join(NodeOS4.tmpdir(), `ycodium-dsh-probe-${safe}`);
34610
34669
  }
34611
34670
  function isRecord7(value) {
34612
34671
  return typeof value === "object" && value !== null && !Array.isArray(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-dsh",
3
- "version": "0.2.2882",
3
+ "version": "0.2.2892",
4
4
  "description": "DeepSeek Harness executor: dsh CLI over Agent Client Protocol stdio.",
5
5
  "keywords": [
6
6
  "ycodium",
@@ -22,8 +22,8 @@
22
22
  "esbuild": "0.28.1",
23
23
  "vite-plus": "0.2.2",
24
24
  "yaml": "^2.9.0",
25
- "@ycodium-ai/plugin-api": "0.2.2882",
26
- "ycodium-acp-executor": "0.2.2882",
25
+ "@ycodium-ai/plugin-api": "0.2.2892",
26
+ "ycodium-acp-executor": "0.2.2892",
27
27
  "ycodium-executor-testing": "0.0.0"
28
28
  },
29
29
  "ycodium": {