@downcity/plugins 1.0.34 → 1.0.38

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 (77) hide show
  1. package/bin/auth/Plugin.js +2 -2
  2. package/bin/auth/Plugin.js.map +1 -1
  3. package/bin/chat/Action.js +4 -4
  4. package/bin/chat/Action.js.map +1 -1
  5. package/bin/chat/accounts/ChannelAccountManager.d.ts +3 -3
  6. package/bin/chat/accounts/ChannelAccountManager.js +6 -6
  7. package/bin/chat/accounts/ChannelAccountManager.js.map +1 -1
  8. package/bin/chat/accounts/Crypto.d.ts +1 -1
  9. package/bin/chat/accounts/Crypto.js +1 -1
  10. package/bin/chat/accounts/Store.d.ts +8 -8
  11. package/bin/chat/accounts/Store.js +13 -13
  12. package/bin/chat/accounts/Store.js.map +1 -1
  13. package/bin/chat/channels/feishu/Configuration.d.ts +1 -1
  14. package/bin/chat/channels/feishu/Configuration.js +5 -5
  15. package/bin/chat/channels/feishu/Configuration.js.map +1 -1
  16. package/bin/chat/channels/qq/Configuration.d.ts +1 -1
  17. package/bin/chat/channels/qq/Configuration.js +5 -5
  18. package/bin/chat/channels/qq/Configuration.js.map +1 -1
  19. package/bin/chat/channels/telegram/BotInfo.d.ts +1 -1
  20. package/bin/chat/channels/telegram/BotInfo.js +1 -1
  21. package/bin/chat/channels/telegram/Configuration.d.ts +1 -1
  22. package/bin/chat/channels/telegram/Configuration.js +5 -5
  23. package/bin/chat/channels/telegram/Configuration.js.map +1 -1
  24. package/bin/chat/runtime/ChatChannelCore.d.ts +1 -1
  25. package/bin/chat/runtime/ChatChannelCore.js +1 -1
  26. package/bin/chat/runtime/ChatChannelLifecycle.js +1 -1
  27. package/bin/chat/runtime/ChatChannelLifecycle.js.map +1 -1
  28. package/bin/chat/runtime/ChatPluginSystem.d.ts +2 -2
  29. package/bin/chat/runtime/ChatPluginSystem.js +1 -1
  30. package/bin/chat/runtime/ChatPromptAssets.d.ts +1 -1
  31. package/bin/chat/runtime/ChatPromptAssets.js +1 -1
  32. package/bin/chat/runtime/ChatQueueWorker.d.ts.map +1 -1
  33. package/bin/chat/runtime/ChatQueueWorker.js +12 -33
  34. package/bin/chat/runtime/ChatQueueWorker.js.map +1 -1
  35. package/bin/chat/runtime/ChatSession.d.ts.map +1 -1
  36. package/bin/chat/runtime/ChatSession.js +11 -2
  37. package/bin/chat/runtime/ChatSession.js.map +1 -1
  38. package/bin/chat/runtime/SystemPrompt.js +2 -2
  39. package/bin/chat/runtime/SystemPrompt.js.map +1 -1
  40. package/bin/chat/types/BotInfo.d.ts +2 -2
  41. package/bin/chat/types/BotInfo.js +1 -1
  42. package/bin/chat/types/ChannelAccount.d.ts +12 -12
  43. package/bin/chat/types/ChannelAccount.js +2 -2
  44. package/bin/chat/types/ChannelConfiguration.d.ts +2 -2
  45. package/bin/chat/types/FeishuPost.d.ts +1 -1
  46. package/bin/chat/types/FeishuPost.js +1 -1
  47. package/bin/shell/runtime/ShellRuntimeEnvironment.js +4 -4
  48. package/bin/shell/runtime/ShellRuntimeEnvironment.js.map +1 -1
  49. package/bin/skill/runtime/SystemProvider.js +3 -3
  50. package/bin/skill/runtime/SystemProvider.js.map +1 -1
  51. package/bin/task/runtime/TaskRunnerRound.d.ts.map +1 -1
  52. package/bin/task/runtime/TaskRunnerRound.js +13 -2
  53. package/bin/task/runtime/TaskRunnerRound.js.map +1 -1
  54. package/package.json +2 -2
  55. package/src/auth/Plugin.ts +2 -2
  56. package/src/chat/Action.ts +4 -4
  57. package/src/chat/accounts/ChannelAccountManager.ts +6 -6
  58. package/src/chat/accounts/Crypto.ts +1 -1
  59. package/src/chat/accounts/Store.ts +13 -13
  60. package/src/chat/channels/feishu/Configuration.ts +5 -5
  61. package/src/chat/channels/qq/Configuration.ts +5 -5
  62. package/src/chat/channels/telegram/BotInfo.ts +1 -1
  63. package/src/chat/channels/telegram/Configuration.ts +5 -5
  64. package/src/chat/runtime/ChatChannelCore.ts +1 -1
  65. package/src/chat/runtime/ChatChannelLifecycle.ts +1 -1
  66. package/src/chat/runtime/ChatPluginSystem.ts +2 -2
  67. package/src/chat/runtime/ChatPromptAssets.ts +1 -1
  68. package/src/chat/runtime/ChatQueueWorker.ts +12 -39
  69. package/src/chat/runtime/ChatSession.ts +12 -2
  70. package/src/chat/runtime/SystemPrompt.ts +2 -2
  71. package/src/chat/types/BotInfo.ts +2 -2
  72. package/src/chat/types/ChannelAccount.ts +12 -12
  73. package/src/chat/types/ChannelConfiguration.ts +2 -3
  74. package/src/chat/types/FeishuPost.ts +1 -1
  75. package/src/shell/runtime/ShellRuntimeEnvironment.ts +4 -4
  76. package/src/skill/runtime/SystemProvider.ts +3 -3
  77. package/src/task/runtime/TaskRunnerRound.ts +15 -2
@@ -11,6 +11,7 @@ import fs from "fs-extra";
11
11
  import type { AgentContext } from "@downcity/agent/internal/types/runtime/agent/AgentContext.js";
12
12
  import { runSandboxCommand } from "@downcity/agent/internal/sandbox/SandboxRunner.js";
13
13
  import type { SessionRunResult } from "@downcity/agent/internal/executor/types/SessionRun.js";
14
+ import type { SessionRunContext } from "@downcity/agent/internal/types/executor/SessionRunContext.js";
14
15
  import type { JsonObject } from "@downcity/agent/internal/types/common/Json.js";
15
16
  import type {
16
17
  ChatSendOutputPick,
@@ -245,7 +246,7 @@ export async function runAgentRound(params: {
245
246
 
246
247
  const result = await withSessionRunScope(
247
248
  {
248
- sessionId: params.sessionId,
249
+ runContext: create_task_run_context(params.sessionId),
249
250
  },
250
251
  () =>
251
252
  params.taskSessionRuntime.getExecutor(params.sessionId).run({
@@ -286,7 +287,7 @@ export async function runScriptTask(params: {
286
287
  await fs.writeFile(scriptAbs, body.endsWith("\n") ? body : `${body}\n`, "utf-8");
287
288
 
288
289
  const execResult = await withSessionRunScope(
289
- { sessionId: params.sessionId },
290
+ { runContext: create_task_run_context(params.sessionId) },
290
291
  () => {
291
292
  const childEnv: NodeJS.ProcessEnv = {
292
293
  ...process.env,
@@ -314,6 +315,18 @@ export async function runScriptTask(params: {
314
315
  };
315
316
  }
316
317
 
318
+ /**
319
+ * 创建 task runner 的显式 session run context。
320
+ */
321
+ function create_task_run_context(session_id: string): SessionRunContext {
322
+ return {
323
+ sessionId: session_id,
324
+ injectedUserMessages: [],
325
+ deferredPersistedUserMessages: [],
326
+ pendingAssistantFileParts: [],
327
+ };
328
+ }
329
+
317
330
  /**
318
331
  * 校验任务结果是否满足“必须有结果”的规则。
319
332
  */