aai-lark-bridge 0.2.3 → 0.2.5
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 +30 -5
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
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.
|
|
7
|
+
version: "0.2.5",
|
|
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",
|
|
@@ -4963,6 +4963,7 @@ async function runQuiet(cmd, args, env) {
|
|
|
4963
4963
|
|
|
4964
4964
|
// src/bridge/lark-cli/profile-projection.ts
|
|
4965
4965
|
import { chmod as chmod4, mkdir as mkdir12 } from "fs/promises";
|
|
4966
|
+
import { basename as basename4 } from "path";
|
|
4966
4967
|
async function writeLarkCliSourceProjection(cfg, appPaths2) {
|
|
4967
4968
|
await mkdir12(appPaths2.larkCliSourceDir, { recursive: true, mode: 448 });
|
|
4968
4969
|
await chmod4(appPaths2.larkCliSourceDir, 448).catch(() => {
|
|
@@ -4989,9 +4990,9 @@ async function buildProjectionSecrets(cfg, appPaths2) {
|
|
|
4989
4990
|
...cfg.secrets?.providers ?? {}
|
|
4990
4991
|
};
|
|
4991
4992
|
const providerName = bridgeProviderName(cfg.accounts.app.secret);
|
|
4992
|
-
|
|
4993
|
+
const existing = providerName ? providers[providerName] : void 0;
|
|
4994
|
+
if (providerName && !isForeignExecProvider(existing)) {
|
|
4993
4995
|
const wrapperPath = await ensureSecretsGetterWrapper(appPaths2);
|
|
4994
|
-
const existing = providers[providerName];
|
|
4995
4996
|
providers[providerName] = {
|
|
4996
4997
|
...existing ?? {},
|
|
4997
4998
|
source: "exec",
|
|
@@ -5010,6 +5011,14 @@ async function buildProjectionSecrets(cfg, appPaths2) {
|
|
|
5010
5011
|
...Object.keys(providers).length > 0 ? { providers } : {}
|
|
5011
5012
|
};
|
|
5012
5013
|
}
|
|
5014
|
+
function isForeignExecProvider(pc) {
|
|
5015
|
+
if (!pc?.command || pc.source !== "exec") return false;
|
|
5016
|
+
const name = basename4(pc.command);
|
|
5017
|
+
if (name === "secrets-getter" || name === "secrets-getter.cmd") return false;
|
|
5018
|
+
const args = pc.args ?? [];
|
|
5019
|
+
if (args.length >= 2 && args[args.length - 2] === "secrets" && args[args.length - 1] === "get") return false;
|
|
5020
|
+
return true;
|
|
5021
|
+
}
|
|
5013
5022
|
function bridgeProviderName(secret) {
|
|
5014
5023
|
if (!isSecretRef(secret)) return void 0;
|
|
5015
5024
|
if (secret.source !== "exec") return void 0;
|
|
@@ -7132,6 +7141,7 @@ function safeJsonStringify(value) {
|
|
|
7132
7141
|
import { createHash as createHash2, randomBytes as randomBytes4 } from "crypto";
|
|
7133
7142
|
import {
|
|
7134
7143
|
appendFileSync,
|
|
7144
|
+
copyFileSync,
|
|
7135
7145
|
existsSync as existsSync6,
|
|
7136
7146
|
linkSync,
|
|
7137
7147
|
mkdirSync as mkdirSync3,
|
|
@@ -7141,7 +7151,7 @@ import {
|
|
|
7141
7151
|
unlinkSync as unlinkSync2,
|
|
7142
7152
|
writeFileSync as writeFileSync3
|
|
7143
7153
|
} from "fs";
|
|
7144
|
-
import { dirname as dirname14, isAbsolute as isAbsolute2, join as join19, sep as sep2 } from "path";
|
|
7154
|
+
import { basename as basename5, dirname as dirname14, isAbsolute as isAbsolute2, join as join19, sep as sep2 } from "path";
|
|
7145
7155
|
var BINDING_VERSION = 1;
|
|
7146
7156
|
var MIN_START_USD = 0.5;
|
|
7147
7157
|
var BINDING_INVALID_REPLY = "\u4EFB\u52A1\u7ED1\u5B9A\u8BFB\u4E0D\u4E86\uFF0C\u5148\u6309\u666E\u901A\u5BF9\u8BDD\u5904\u7406";
|
|
@@ -7297,6 +7307,20 @@ function recordBudgetHit(binding, spentUsd, now = /* @__PURE__ */ new Date()) {
|
|
|
7297
7307
|
at: now.toISOString()
|
|
7298
7308
|
});
|
|
7299
7309
|
}
|
|
7310
|
+
function copyAttachmentsIntoTask(binding, attachments) {
|
|
7311
|
+
const dir = join19(binding.cwdRealpath, "notes", "attachments");
|
|
7312
|
+
return attachments.map((a) => {
|
|
7313
|
+
if (a.decision !== "accepted") return a;
|
|
7314
|
+
try {
|
|
7315
|
+
mkdirSync3(dir, { recursive: true });
|
|
7316
|
+
const dest = join19(dir, basename5(a.absPath));
|
|
7317
|
+
if (!existsSync6(dest)) copyFileSync(a.absPath, dest);
|
|
7318
|
+
return { ...a, absPath: dest, path: dest };
|
|
7319
|
+
} catch {
|
|
7320
|
+
return a;
|
|
7321
|
+
}
|
|
7322
|
+
});
|
|
7323
|
+
}
|
|
7300
7324
|
|
|
7301
7325
|
// src/bridge/binding/run-hooks.ts
|
|
7302
7326
|
function taskRunHooks(input) {
|
|
@@ -15201,7 +15225,8 @@ async function runAgentBatch(deps) {
|
|
|
15201
15225
|
const resourceItems = batch.flatMap(
|
|
15202
15226
|
(m) => m.resources.map((r) => ({ messageId: m.messageId, resource: r }))
|
|
15203
15227
|
);
|
|
15204
|
-
const
|
|
15228
|
+
const resolved = await media.resolve(resourceItems, controls.profileConfig.attachments);
|
|
15229
|
+
const attachments = binding ? copyAttachmentsIntoTask(binding, resolved) : resolved;
|
|
15205
15230
|
if (attachments.length > 0) {
|
|
15206
15231
|
log.info("media", "resolved", { count: attachments.length });
|
|
15207
15232
|
for (const attachment of attachments) {
|