@downcity/agent 1.1.199 → 1.1.200

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 (94) hide show
  1. package/bin/executor/Executor.d.ts +2 -2
  2. package/bin/executor/Executor.d.ts.map +1 -1
  3. package/bin/executor/Executor.js +23 -24
  4. package/bin/executor/Executor.js.map +1 -1
  5. package/bin/executor/composer/compaction/SessionCompactionComposer.d.ts +5 -5
  6. package/bin/executor/composer/compaction/SessionCompactionComposer.d.ts.map +1 -1
  7. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.js +1 -1
  8. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.js.map +1 -1
  9. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.d.ts +2 -2
  10. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.d.ts.map +1 -1
  11. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.js +23 -30
  12. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.js.map +1 -1
  13. package/bin/executor/composer/history/jsonl/JsonlSessionHistoryComposer.d.ts.map +1 -1
  14. package/bin/executor/composer/history/jsonl/JsonlSessionHistoryComposer.js +4 -3
  15. package/bin/executor/composer/history/jsonl/JsonlSessionHistoryComposer.js.map +1 -1
  16. package/bin/executor/messages/SessionAttachmentMapper.js.map +1 -1
  17. package/bin/executor/messages/SessionMessageCodec.d.ts +1 -1
  18. package/bin/executor/messages/SessionMessageCodec.js +3 -3
  19. package/bin/executor/messages/SessionMessageCodec.js.map +1 -1
  20. package/bin/executor/messages/SessionStepEventMapper.d.ts +2 -2
  21. package/bin/executor/messages/SessionStepEventMapper.d.ts.map +1 -1
  22. package/bin/executor/messages/SessionStepEventMapper.js.map +1 -1
  23. package/bin/executor/services/ExecutorInflightService.d.ts +2 -2
  24. package/bin/executor/services/ExecutorInflightService.d.ts.map +1 -1
  25. package/bin/executor/services/ExecutorInflightService.js +9 -5
  26. package/bin/executor/services/ExecutorInflightService.js.map +1 -1
  27. package/bin/executor/store/history/SessionHistoryStore.d.ts +11 -11
  28. package/bin/executor/store/history/SessionHistoryStore.d.ts.map +1 -1
  29. package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.d.ts +9 -7
  30. package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.d.ts.map +1 -1
  31. package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.js +97 -52
  32. package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.js.map +1 -1
  33. package/bin/executor/types/SessionMessages.d.ts +41 -22
  34. package/bin/executor/types/SessionMessages.d.ts.map +1 -1
  35. package/bin/executor/types/SessionMessages.js +25 -7
  36. package/bin/executor/types/SessionMessages.js.map +1 -1
  37. package/bin/index.d.ts +1 -1
  38. package/bin/index.d.ts.map +1 -1
  39. package/bin/index.js.map +1 -1
  40. package/bin/session/SessionTitle.d.ts.map +1 -1
  41. package/bin/session/SessionTitle.js +5 -0
  42. package/bin/session/SessionTitle.js.map +1 -1
  43. package/bin/session/browse/Browse.d.ts.map +1 -1
  44. package/bin/session/browse/Browse.js +35 -32
  45. package/bin/session/browse/Browse.js.map +1 -1
  46. package/bin/session/services/SessionStateService.d.ts +8 -8
  47. package/bin/session/services/SessionStateService.d.ts.map +1 -1
  48. package/bin/session/services/SessionStateService.js +44 -54
  49. package/bin/session/services/SessionStateService.js.map +1 -1
  50. package/bin/session/services/SessionTurnService.js +3 -3
  51. package/bin/session/services/SessionTurnService.js.map +1 -1
  52. package/bin/session/services/SessionViewService.d.ts.map +1 -1
  53. package/bin/session/services/SessionViewService.js +17 -27
  54. package/bin/session/services/SessionViewService.js.map +1 -1
  55. package/bin/types/agent/SessionTypes.d.ts +10 -10
  56. package/bin/types/agent/SessionTypes.d.ts.map +1 -1
  57. package/bin/types/executor/SessionRunContext.d.ts +6 -6
  58. package/bin/types/executor/SessionRunContext.d.ts.map +1 -1
  59. package/bin/types/sdk/AgentSessionAction.d.ts +67 -0
  60. package/bin/types/sdk/AgentSessionAction.d.ts.map +1 -0
  61. package/bin/types/sdk/AgentSessionAction.js +10 -0
  62. package/bin/types/sdk/AgentSessionAction.js.map +1 -0
  63. package/bin/types/sdk/AgentSessionEvent.d.ts +2 -2
  64. package/bin/types/sdk/AgentSessionEvent.d.ts.map +1 -1
  65. package/package.json +3 -3
  66. package/scripts/{session-operation-message.test.mjs → session-action-message.test.mjs} +57 -55
  67. package/src/executor/Executor.ts +28 -29
  68. package/src/executor/composer/compaction/SessionCompactionComposer.ts +5 -5
  69. package/src/executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.ts +1 -1
  70. package/src/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.ts +32 -37
  71. package/src/executor/composer/history/jsonl/JsonlSessionHistoryComposer.ts +7 -4
  72. package/src/executor/messages/SessionAttachmentMapper.ts +2 -2
  73. package/src/executor/messages/SessionMessageCodec.ts +3 -3
  74. package/src/executor/messages/SessionStepEventMapper.ts +5 -5
  75. package/src/executor/services/ExecutorInflightService.ts +11 -7
  76. package/src/executor/store/history/SessionHistoryStore.ts +11 -10
  77. package/src/executor/store/history/jsonl/JsonlSessionHistoryStore.ts +118 -63
  78. package/src/executor/types/SessionMessages.ts +69 -31
  79. package/src/index.ts +5 -6
  80. package/src/session/SessionTitle.ts +3 -0
  81. package/src/session/browse/Browse.ts +42 -34
  82. package/src/session/services/SessionStateService.ts +54 -64
  83. package/src/session/services/SessionTurnService.ts +3 -3
  84. package/src/session/services/SessionViewService.ts +17 -27
  85. package/src/types/agent/SessionTypes.ts +10 -10
  86. package/src/types/executor/SessionRunContext.ts +11 -11
  87. package/src/types/sdk/AgentSessionAction.ts +79 -0
  88. package/src/types/sdk/AgentSessionEvent.ts +2 -2
  89. package/tsconfig.tsbuildinfo +1 -1
  90. package/bin/types/sdk/AgentSessionOperation.d.ts +0 -99
  91. package/bin/types/sdk/AgentSessionOperation.d.ts.map +0 -1
  92. package/bin/types/sdk/AgentSessionOperation.js +0 -10
  93. package/bin/types/sdk/AgentSessionOperation.js.map +0 -1
  94. package/src/types/sdk/AgentSessionOperation.ts +0 -125
@@ -1,99 +0,0 @@
1
- /**
2
- * Agent Session operation 类型定义。
3
- *
4
- * 关键点(中文)
5
- * - operation 描述 session 内部正在发生的辅助操作,不代表 assistant 正文。
6
- * - operation 可以同时作为订阅事件发布,也可以作为 UIMessage 持久化到 JSONL。
7
- * - operation message 只用于前端时间线与调试,不应进入 LLM 输入。
8
- */
9
- import type { JsonValue } from "../../types/common/Json.js";
10
- /**
11
- * Session operation 当前状态。
12
- */
13
- export type AgentSessionOperationStatus = "started" | "progress" | "finished" | "skipped" | "failed";
14
- /**
15
- * Session operation 名称。
16
- *
17
- * 说明(中文)
18
- * - 内置名称用于 SDK 与前端约定常见辅助操作。
19
- * - 字符串扩展允许 plugin 或宿主运行时声明自己的 operation。
20
- */
21
- export type AgentSessionOperationName = "compacting" | "model-switching" | "history-forking" | (string & {});
22
- /**
23
- * Session operation 记录。
24
- */
25
- export interface AgentSessionOperationRecord {
26
- /**
27
- * 同一个 operation 生命周期内稳定复用的 ID。
28
- */
29
- operationId: string;
30
- /**
31
- * 当前 operation 名称。
32
- */
33
- name: AgentSessionOperationName;
34
- /**
35
- * 当前 operation 状态。
36
- */
37
- status: AgentSessionOperationStatus;
38
- /**
39
- * 当前 operation 关联的 turn 标识。
40
- *
41
- * 说明(中文)
42
- * - turn 内触发的 operation 应写入该字段。
43
- * - session 级 operation 可以省略。
44
- */
45
- turnId?: string;
46
- /**
47
- * 面向用户展示的短文本。
48
- */
49
- label?: string;
50
- /**
51
- * 机器可读原因。
52
- *
53
- * 示例(中文)
54
- * - `under_budget`:未达到压缩阈值。
55
- * - `summary_fallback`:摘要生成失败后使用降级摘要。
56
- */
57
- reason?: string;
58
- /**
59
- * 当前 operation 进度,范围 0 到 1。
60
- *
61
- * 说明(中文)
62
- * - 无法估算进度时省略。
63
- */
64
- progress?: number;
65
- /**
66
- * operation 完成后产生的轻量结果。
67
- */
68
- result?: JsonValue;
69
- /**
70
- * operation 失败时的错误文本。
71
- */
72
- error?: string;
73
- /**
74
- * 是否建议前端展示。
75
- *
76
- * 说明(中文)
77
- * - 默认视为 `true`。
78
- * - 调试或审计类辅助事件可显式写入 `false`。
79
- */
80
- visible?: boolean;
81
- }
82
- /**
83
- * Session operation 订阅事件。
84
- */
85
- export interface AgentSessionOperationEvent extends AgentSessionOperationRecord {
86
- /**
87
- * 当前事件类型。
88
- */
89
- type: "operation";
90
- /**
91
- * 当前 session 唯一标识。
92
- */
93
- sessionId: string;
94
- }
95
- /**
96
- * Session operation 发布回调。
97
- */
98
- export type AgentSessionOperationCallback = (operation: AgentSessionOperationEvent) => Promise<void>;
99
- //# sourceMappingURL=AgentSessionOperation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AgentSessionOperation.d.ts","sourceRoot":"","sources":["../../../src/types/sdk/AgentSessionOperation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,2BAA2B,GACnC,SAAS,GACT,UAAU,GACV,UAAU,GACV,SAAS,GACT,QAAQ,CAAC;AAEb;;;;;;GAMG;AACH,MAAM,MAAM,yBAAyB,GACjC,YAAY,GACZ,iBAAiB,GACjB,iBAAiB,GACjB,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,IAAI,EAAE,yBAAyB,CAAC;IAEhC;;OAEG;IACH,MAAM,EAAE,2BAA2B,CAAC;IAEpC;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,2BAA2B;IAC7E;;OAEG;IACH,IAAI,EAAE,WAAW,CAAC;IAElB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG,CAC1C,SAAS,EAAE,0BAA0B,KAClC,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Agent Session operation 类型定义。
3
- *
4
- * 关键点(中文)
5
- * - operation 描述 session 内部正在发生的辅助操作,不代表 assistant 正文。
6
- * - operation 可以同时作为订阅事件发布,也可以作为 UIMessage 持久化到 JSONL。
7
- * - operation message 只用于前端时间线与调试,不应进入 LLM 输入。
8
- */
9
- export {};
10
- //# sourceMappingURL=AgentSessionOperation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AgentSessionOperation.js","sourceRoot":"","sources":["../../../src/types/sdk/AgentSessionOperation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
@@ -1,125 +0,0 @@
1
- /**
2
- * Agent Session operation 类型定义。
3
- *
4
- * 关键点(中文)
5
- * - operation 描述 session 内部正在发生的辅助操作,不代表 assistant 正文。
6
- * - operation 可以同时作为订阅事件发布,也可以作为 UIMessage 持久化到 JSONL。
7
- * - operation message 只用于前端时间线与调试,不应进入 LLM 输入。
8
- */
9
-
10
- import type { JsonValue } from "@/types/common/Json.js";
11
-
12
- /**
13
- * Session operation 当前状态。
14
- */
15
- export type AgentSessionOperationStatus =
16
- | "started"
17
- | "progress"
18
- | "finished"
19
- | "skipped"
20
- | "failed";
21
-
22
- /**
23
- * Session operation 名称。
24
- *
25
- * 说明(中文)
26
- * - 内置名称用于 SDK 与前端约定常见辅助操作。
27
- * - 字符串扩展允许 plugin 或宿主运行时声明自己的 operation。
28
- */
29
- export type AgentSessionOperationName =
30
- | "compacting"
31
- | "model-switching"
32
- | "history-forking"
33
- | (string & {});
34
-
35
- /**
36
- * Session operation 记录。
37
- */
38
- export interface AgentSessionOperationRecord {
39
- /**
40
- * 同一个 operation 生命周期内稳定复用的 ID。
41
- */
42
- operationId: string;
43
-
44
- /**
45
- * 当前 operation 名称。
46
- */
47
- name: AgentSessionOperationName;
48
-
49
- /**
50
- * 当前 operation 状态。
51
- */
52
- status: AgentSessionOperationStatus;
53
-
54
- /**
55
- * 当前 operation 关联的 turn 标识。
56
- *
57
- * 说明(中文)
58
- * - turn 内触发的 operation 应写入该字段。
59
- * - session 级 operation 可以省略。
60
- */
61
- turnId?: string;
62
-
63
- /**
64
- * 面向用户展示的短文本。
65
- */
66
- label?: string;
67
-
68
- /**
69
- * 机器可读原因。
70
- *
71
- * 示例(中文)
72
- * - `under_budget`:未达到压缩阈值。
73
- * - `summary_fallback`:摘要生成失败后使用降级摘要。
74
- */
75
- reason?: string;
76
-
77
- /**
78
- * 当前 operation 进度,范围 0 到 1。
79
- *
80
- * 说明(中文)
81
- * - 无法估算进度时省略。
82
- */
83
- progress?: number;
84
-
85
- /**
86
- * operation 完成后产生的轻量结果。
87
- */
88
- result?: JsonValue;
89
-
90
- /**
91
- * operation 失败时的错误文本。
92
- */
93
- error?: string;
94
-
95
- /**
96
- * 是否建议前端展示。
97
- *
98
- * 说明(中文)
99
- * - 默认视为 `true`。
100
- * - 调试或审计类辅助事件可显式写入 `false`。
101
- */
102
- visible?: boolean;
103
- }
104
-
105
- /**
106
- * Session operation 订阅事件。
107
- */
108
- export interface AgentSessionOperationEvent extends AgentSessionOperationRecord {
109
- /**
110
- * 当前事件类型。
111
- */
112
- type: "operation";
113
-
114
- /**
115
- * 当前 session 唯一标识。
116
- */
117
- sessionId: string;
118
- }
119
-
120
- /**
121
- * Session operation 发布回调。
122
- */
123
- export type AgentSessionOperationCallback = (
124
- operation: AgentSessionOperationEvent,
125
- ) => Promise<void>;