aai-lark-bridge 0.2.3 → 0.2.4

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/cli.js CHANGED
@@ -4,7 +4,7 @@ import { Command } from "commander";
4
4
  // package.json
5
5
  var package_default = {
6
6
  name: "aai-lark-bridge",
7
- version: "0.2.3",
7
+ version: "0.2.4",
8
8
  description: "Lark AI Native Bridge - Lark\u57FA\u7840\u8BBE\u65BD\u5C42\u548CCLI\u96C6\u6210",
9
9
  type: "module",
10
10
  main: "./dist/index.js",
@@ -7132,6 +7132,7 @@ function safeJsonStringify(value) {
7132
7132
  import { createHash as createHash2, randomBytes as randomBytes4 } from "crypto";
7133
7133
  import {
7134
7134
  appendFileSync,
7135
+ copyFileSync,
7135
7136
  existsSync as existsSync6,
7136
7137
  linkSync,
7137
7138
  mkdirSync as mkdirSync3,
@@ -7141,7 +7142,7 @@ import {
7141
7142
  unlinkSync as unlinkSync2,
7142
7143
  writeFileSync as writeFileSync3
7143
7144
  } from "fs";
7144
- import { dirname as dirname14, isAbsolute as isAbsolute2, join as join19, sep as sep2 } from "path";
7145
+ import { basename as basename4, dirname as dirname14, isAbsolute as isAbsolute2, join as join19, sep as sep2 } from "path";
7145
7146
  var BINDING_VERSION = 1;
7146
7147
  var MIN_START_USD = 0.5;
7147
7148
  var BINDING_INVALID_REPLY = "\u4EFB\u52A1\u7ED1\u5B9A\u8BFB\u4E0D\u4E86\uFF0C\u5148\u6309\u666E\u901A\u5BF9\u8BDD\u5904\u7406";
@@ -7297,6 +7298,20 @@ function recordBudgetHit(binding, spentUsd, now = /* @__PURE__ */ new Date()) {
7297
7298
  at: now.toISOString()
7298
7299
  });
7299
7300
  }
7301
+ function copyAttachmentsIntoTask(binding, attachments) {
7302
+ const dir = join19(binding.cwdRealpath, "notes", "attachments");
7303
+ return attachments.map((a) => {
7304
+ if (a.decision !== "accepted") return a;
7305
+ try {
7306
+ mkdirSync3(dir, { recursive: true });
7307
+ const dest = join19(dir, basename4(a.absPath));
7308
+ if (!existsSync6(dest)) copyFileSync(a.absPath, dest);
7309
+ return { ...a, absPath: dest, path: dest };
7310
+ } catch {
7311
+ return a;
7312
+ }
7313
+ });
7314
+ }
7300
7315
 
7301
7316
  // src/bridge/binding/run-hooks.ts
7302
7317
  function taskRunHooks(input) {
@@ -15201,7 +15216,8 @@ async function runAgentBatch(deps) {
15201
15216
  const resourceItems = batch.flatMap(
15202
15217
  (m) => m.resources.map((r) => ({ messageId: m.messageId, resource: r }))
15203
15218
  );
15204
- const attachments = await media.resolve(resourceItems, controls.profileConfig.attachments);
15219
+ const resolved = await media.resolve(resourceItems, controls.profileConfig.attachments);
15220
+ const attachments = binding ? copyAttachmentsIntoTask(binding, resolved) : resolved;
15205
15221
  if (attachments.length > 0) {
15206
15222
  log.info("media", "resolved", { count: attachments.length });
15207
15223
  for (const attachment of attachments) {