@vibe-lark/larkpal 0.1.53 → 0.1.54

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/main.mjs +50 -8
  2. package/package.json +2 -2
package/dist/main.mjs CHANGED
@@ -2326,6 +2326,8 @@ function buildAgentRuntimeConfig(input) {
2326
2326
  userName: input.identity?.userName,
2327
2327
  cwd,
2328
2328
  authHeaders,
2329
+ attachments: input.attachments,
2330
+ sourceArtifacts: input.sourceArtifacts,
2329
2331
  llmConfig: input.llmConfig,
2330
2332
  policy,
2331
2333
  metadata
@@ -2341,6 +2343,8 @@ function buildAgentRuntimeConfig(input) {
2341
2343
  userContext,
2342
2344
  tenantContext: { tenantKey },
2343
2345
  authHeaders,
2346
+ attachments: input.attachments,
2347
+ sourceArtifacts: input.sourceArtifacts,
2344
2348
  llmConfig: input.llmConfig,
2345
2349
  policy,
2346
2350
  requestContext,
@@ -2359,6 +2363,9 @@ function buildAgentRuntimeConfig(input) {
2359
2363
  metadata
2360
2364
  };
2361
2365
  }
2366
+ function getRunInputValue(...values) {
2367
+ return values.find((value) => value !== void 0);
2368
+ }
2362
2369
  function summarizeForAudit(value) {
2363
2370
  if (value == null) return value;
2364
2371
  if (typeof value === "string") return summarizeString(value);
@@ -2419,6 +2426,12 @@ function buildVerifierAuditMetadata(result) {
2419
2426
  if (result.missingArtifacts) metadata.missingArtifacts = summarizeForAudit(result.missingArtifacts);
2420
2427
  return metadata;
2421
2428
  }
2429
+ function buildRunInputAuditMetadata(config) {
2430
+ const metadata = {};
2431
+ if (config.attachments !== void 0) metadata.attachments = summarizeForAudit(config.attachments);
2432
+ if (config.sourceArtifacts !== void 0) metadata.sourceArtifacts = summarizeForAudit(config.sourceArtifacts);
2433
+ return metadata;
2434
+ }
2422
2435
  function buildRuntimeEventAuditMetadata(event) {
2423
2436
  const metadata = {
2424
2437
  runtimeEventType: event.type,
@@ -2598,6 +2611,8 @@ async function handleExecute(req, res, processManager) {
2598
2611
  const traceId = body.traceId || body.trace_id || getGatewayTraceId(req.headers, requestId);
2599
2612
  const conversationId = body.conversationId || body.conversation_id || body.session_id;
2600
2613
  const scenarioId = getScenarioId(body.scenarioId || body.scenario_id, body.metadata);
2614
+ const attachments = getRunInputValue(body.attachments, body.metadata?.attachments);
2615
+ const sourceArtifacts = getRunInputValue(body.sourceArtifacts, body.source_artifacts, body.metadata?.sourceArtifacts, body.metadata?.source_artifacts);
2601
2616
  const identity = resolveExecuteIdentity(req, body);
2602
2617
  const missingIdentityFields = getMissingIdentityFields(identity);
2603
2618
  if (missingIdentityFields.length > 0) {
@@ -2642,6 +2657,8 @@ async function handleExecute(req, res, processManager) {
2642
2657
  model: body.llm_config.model
2643
2658
  } : void 0,
2644
2659
  authHeaders: body.auth_headers,
2660
+ attachments,
2661
+ sourceArtifacts,
2645
2662
  policy: body.policy,
2646
2663
  metadata: body.metadata,
2647
2664
  identity
@@ -2768,6 +2785,8 @@ async function handleBatchExecute(req, res, processManager) {
2768
2785
  const batchRequestId = getGatewayRequestId(req.headers);
2769
2786
  const traceId = getGatewayTraceId(req.headers, batchRequestId);
2770
2787
  const scenarioId = getScenarioId(body.scenarioId || body.scenario_id, body.metadata);
2788
+ const batchAttachments = getRunInputValue(body.attachments, body.metadata?.attachments);
2789
+ const batchSourceArtifacts = getRunInputValue(body.sourceArtifacts, body.source_artifacts, body.metadata?.sourceArtifacts, body.metadata?.source_artifacts);
2771
2790
  const concurrency = body.concurrency ?? 3;
2772
2791
  const taskIds = [];
2773
2792
  const taskConfigs = [];
@@ -2775,6 +2794,14 @@ async function handleBatchExecute(req, res, processManager) {
2775
2794
  const taskId = v4();
2776
2795
  taskIds.push(taskId);
2777
2796
  try {
2797
+ const taskMetadata = {
2798
+ ...body.metadata,
2799
+ ...task.metadata,
2800
+ batchId,
2801
+ batchTaskIndex: index
2802
+ };
2803
+ const taskAttachments = getRunInputValue(task.attachments, task.metadata?.attachments, batchAttachments);
2804
+ const taskSourceArtifacts = getRunInputValue(task.sourceArtifacts, task.source_artifacts, task.metadata?.sourceArtifacts, task.metadata?.source_artifacts, batchSourceArtifacts);
2778
2805
  const config = buildAgentRuntimeConfig({
2779
2806
  requestId: `${batchRequestId}:${index}`,
2780
2807
  traceId,
@@ -2785,12 +2812,10 @@ async function handleBatchExecute(req, res, processManager) {
2785
2812
  cwd: task.cwd,
2786
2813
  prompt: task.prompt,
2787
2814
  authHeaders: body.auth_headers,
2815
+ attachments: taskAttachments,
2816
+ sourceArtifacts: taskSourceArtifacts,
2788
2817
  policy: body.policy,
2789
- metadata: {
2790
- ...body.metadata,
2791
- batchId,
2792
- batchTaskIndex: index
2793
- },
2818
+ metadata: taskMetadata,
2794
2819
  identity
2795
2820
  });
2796
2821
  const taskInfo = {
@@ -2948,7 +2973,8 @@ function logRunStarted(config) {
2948
2973
  traceId: config.runContext?.traceId,
2949
2974
  requestId: config.runContext?.requestId,
2950
2975
  entrypoint: config.runContext?.entrypoint,
2951
- scenarioId: config.runContext?.scenarioId
2976
+ scenarioId: config.runContext?.scenarioId,
2977
+ ...buildRunInputAuditMetadata(config)
2952
2978
  } }));
2953
2979
  }
2954
2980
  function logAuditEvent(event) {
@@ -4934,12 +4960,16 @@ function createChatRouter(config) {
4934
4960
  const requestId = getGatewayRequestId(req.headers);
4935
4961
  const traceId = getGatewayTraceId(req.headers, requestId);
4936
4962
  const scenarioId = getScenarioId(body.options?.scenarioId, body.options?.metadata);
4963
+ const attachments = getRunInputValue(body.attachments, body.options?.attachments, body.options?.metadata?.attachments);
4964
+ const sourceArtifacts = getRunInputValue(body.sourceArtifacts, body.source_artifacts, body.options?.sourceArtifacts, body.options?.source_artifacts, body.options?.metadata?.sourceArtifacts, body.options?.metadata?.source_artifacts);
4937
4965
  log$25.info("[stream] 收到流式对话请求", {
4938
4966
  userId,
4939
4967
  sessionId: body.session_id,
4940
4968
  requestId,
4941
4969
  traceId,
4942
4970
  scenarioId,
4971
+ hasAttachments: attachments !== void 0,
4972
+ hasSourceArtifacts: sourceArtifacts !== void 0,
4943
4973
  promptLength: body.prompt.length
4944
4974
  });
4945
4975
  let sessionId = body.session_id;
@@ -4977,7 +5007,16 @@ function createChatRouter(config) {
4977
5007
  sessionId,
4978
5008
  role: "user",
4979
5009
  content: body.prompt,
4980
- channel: "web"
5010
+ channel: "web",
5011
+ metadata: {
5012
+ requestId,
5013
+ traceId,
5014
+ scenarioId,
5015
+ ...buildRunInputAuditMetadata({
5016
+ attachments,
5017
+ sourceArtifacts
5018
+ })
5019
+ }
4981
5020
  });
4982
5021
  } catch (err) {
4983
5022
  activeStreamSessions.delete(sessionId);
@@ -5006,6 +5045,8 @@ function createChatRouter(config) {
5006
5045
  maxTurns: body.options?.maxTurns,
5007
5046
  maxBudgetUsd: body.options?.maxBudgetUsd,
5008
5047
  model: process.env.CLAUDE_MODEL || void 0,
5048
+ attachments,
5049
+ sourceArtifacts,
5009
5050
  policy: body.options?.policy,
5010
5051
  metadata: body.options?.metadata,
5011
5052
  identity: {
@@ -5213,7 +5254,8 @@ function createChatRouter(config) {
5213
5254
  traceId: runtimeConfig.runContext?.traceId,
5214
5255
  requestId: runtimeConfig.runContext?.requestId,
5215
5256
  entrypoint: runtimeConfig.runContext?.entrypoint,
5216
- scenarioId: runtimeConfig.runContext?.scenarioId
5257
+ scenarioId: runtimeConfig.runContext?.scenarioId,
5258
+ ...buildRunInputAuditMetadata(runtimeConfig)
5217
5259
  } }));
5218
5260
  log$25.info("[stream] 开始执行 prompt", {
5219
5261
  sessionId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibe-lark/larkpal",
3
- "version": "0.1.53",
3
+ "version": "0.1.54",
4
4
  "description": "LarkPal - Lark/Feishu bot service",
5
5
  "type": "module",
6
6
  "main": "./dist/main.mjs",
@@ -50,7 +50,7 @@
50
50
  "zod": "^4.3.6"
51
51
  },
52
52
  "optionalDependencies": {
53
- "@vibe-lark/larkpal-agent": "^0.1.9"
53
+ "@vibe-lark/larkpal-agent": "^0.1.16"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@eslint/js": "^10.0.1",