team-anya-cli 0.1.8 → 1.0.1

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 (168) hide show
  1. package/README.md +1 -37
  2. package/package.json +6 -37
  3. package/anya/prompts/execution-guides/git-delivery.md +0 -38
  4. package/anya/prompts/execution-guides/testing-and-self-heal.md +0 -28
  5. package/anya/prompts/protocols/brief-assembly.md +0 -55
  6. package/anya/prompts/protocols/report.md +0 -175
  7. package/anya/prompts/protocols/review.md +0 -90
  8. package/anya/prompts/task-claude-md.template.md +0 -32
  9. package/apps/server/dist/broker/cc-broker.js +0 -261
  10. package/apps/server/dist/cli.js +0 -296
  11. package/apps/server/dist/config.js +0 -76
  12. package/apps/server/dist/daemon.js +0 -51
  13. package/apps/server/dist/franky/context-builder.js +0 -160
  14. package/apps/server/dist/franky/franky-mcp-server.js +0 -107
  15. package/apps/server/dist/franky/franky-orchestrator.js +0 -450
  16. package/apps/server/dist/franky/index.js +0 -5
  17. package/apps/server/dist/franky/topic-router.js +0 -16
  18. package/apps/server/dist/gateway/chat-sync.js +0 -135
  19. package/apps/server/dist/gateway/command-router.js +0 -114
  20. package/apps/server/dist/gateway/commands/cancel.js +0 -32
  21. package/apps/server/dist/gateway/commands/help.js +0 -16
  22. package/apps/server/dist/gateway/commands/index.js +0 -26
  23. package/apps/server/dist/gateway/commands/restart.js +0 -34
  24. package/apps/server/dist/gateway/commands/status.js +0 -34
  25. package/apps/server/dist/gateway/commands/tasks.js +0 -33
  26. package/apps/server/dist/gateway/feishu-sender.js +0 -410
  27. package/apps/server/dist/gateway/feishu-ws.js +0 -256
  28. package/apps/server/dist/gateway/http.js +0 -1019
  29. package/apps/server/dist/gateway/media-downloader.js +0 -149
  30. package/apps/server/dist/gateway/message-events.js +0 -10
  31. package/apps/server/dist/gateway/message-intake.js +0 -67
  32. package/apps/server/dist/gateway/message-queue.js +0 -118
  33. package/apps/server/dist/gateway/session-reader.js +0 -142
  34. package/apps/server/dist/gateway/ws-push.js +0 -115
  35. package/apps/server/dist/loid/brain.js +0 -105
  36. package/apps/server/dist/loid/clarifier.js +0 -162
  37. package/apps/server/dist/loid/context-builder.js +0 -413
  38. package/apps/server/dist/loid/mcp-server.js +0 -106
  39. package/apps/server/dist/loid/memory-settler.js +0 -189
  40. package/apps/server/dist/loid/opportunity-manager.js +0 -148
  41. package/apps/server/dist/loid/profile-updater.js +0 -179
  42. package/apps/server/dist/loid/reporter.js +0 -148
  43. package/apps/server/dist/loid/schemas.js +0 -117
  44. package/apps/server/dist/loid/self-calibrator.js +0 -314
  45. package/apps/server/dist/loid/session-manager.js +0 -301
  46. package/apps/server/dist/loid/session.js +0 -271
  47. package/apps/server/dist/loid/worktree-manager.js +0 -191
  48. package/apps/server/dist/main.js +0 -393
  49. package/apps/server/dist/tracing/index.js +0 -2
  50. package/apps/server/dist/tracing/trace-context.js +0 -92
  51. package/apps/server/dist/types/message.js +0 -2
  52. package/apps/server/dist/yor/yor-mcp-server.js +0 -104
  53. package/apps/server/dist/yor/yor-orchestrator.js +0 -233
  54. package/apps/web/dist/assets/index-BiiEB0qZ.css +0 -1
  55. package/apps/web/dist/assets/index-D1AK5ZEE.js +0 -798
  56. package/apps/web/dist/index.html +0 -13
  57. package/packages/cc-client/dist/claude-code-backend.js +0 -664
  58. package/packages/cc-client/dist/index.js +0 -2
  59. package/packages/cc-client/package.json +0 -11
  60. package/packages/core/dist/constants.js +0 -59
  61. package/packages/core/dist/errors.js +0 -35
  62. package/packages/core/dist/index.js +0 -7
  63. package/packages/core/dist/office-init.js +0 -101
  64. package/packages/core/dist/scope/checker.js +0 -114
  65. package/packages/core/dist/scope/defaults.js +0 -55
  66. package/packages/core/dist/scope/index.js +0 -3
  67. package/packages/core/dist/state-machine.js +0 -85
  68. package/packages/core/dist/types/audit.js +0 -12
  69. package/packages/core/dist/types/backend.js +0 -2
  70. package/packages/core/dist/types/commitment.js +0 -17
  71. package/packages/core/dist/types/communication.js +0 -18
  72. package/packages/core/dist/types/index.js +0 -8
  73. package/packages/core/dist/types/opportunity.js +0 -27
  74. package/packages/core/dist/types/org.js +0 -26
  75. package/packages/core/dist/types/task.js +0 -46
  76. package/packages/core/package.json +0 -10
  77. package/packages/db/dist/client.js +0 -69
  78. package/packages/db/dist/index.js +0 -691
  79. package/packages/db/dist/schema/audit-events.js +0 -13
  80. package/packages/db/dist/schema/cc-sessions.js +0 -14
  81. package/packages/db/dist/schema/chats.js +0 -33
  82. package/packages/db/dist/schema/commitments.js +0 -18
  83. package/packages/db/dist/schema/communication-events.js +0 -14
  84. package/packages/db/dist/schema/index.js +0 -13
  85. package/packages/db/dist/schema/message-log.js +0 -20
  86. package/packages/db/dist/schema/opportunities.js +0 -23
  87. package/packages/db/dist/schema/org.js +0 -36
  88. package/packages/db/dist/schema/projects.js +0 -23
  89. package/packages/db/dist/schema/tasks.js +0 -48
  90. package/packages/db/dist/schema/topics.js +0 -20
  91. package/packages/db/dist/schema/trace-spans.js +0 -19
  92. package/packages/db/package.json +0 -12
  93. package/packages/db/src/migrations/0000_baseline.sql +0 -251
  94. package/packages/db/src/migrations/meta/_journal.json +0 -13
  95. package/packages/mcp-tools/dist/index.js +0 -41
  96. package/packages/mcp-tools/dist/layer1/audit-append.js +0 -38
  97. package/packages/mcp-tools/dist/layer1/audit-query.js +0 -51
  98. package/packages/mcp-tools/dist/layer1/memory-brief.js +0 -168
  99. package/packages/mcp-tools/dist/layer1/memory-context.js +0 -124
  100. package/packages/mcp-tools/dist/layer1/memory-digest.js +0 -126
  101. package/packages/mcp-tools/dist/layer1/memory-forget.js +0 -108
  102. package/packages/mcp-tools/dist/layer1/memory-learn.js +0 -63
  103. package/packages/mcp-tools/dist/layer1/memory-recall.js +0 -287
  104. package/packages/mcp-tools/dist/layer1/memory-reflect.js +0 -80
  105. package/packages/mcp-tools/dist/layer1/memory-remember.js +0 -119
  106. package/packages/mcp-tools/dist/layer1/memory-search.js +0 -263
  107. package/packages/mcp-tools/dist/layer1/memory-write.js +0 -21
  108. package/packages/mcp-tools/dist/layer1/org-lookup.js +0 -47
  109. package/packages/mcp-tools/dist/layer1/project-get.js +0 -28
  110. package/packages/mcp-tools/dist/layer1/project-list.js +0 -20
  111. package/packages/mcp-tools/dist/layer1/report-daily.js +0 -68
  112. package/packages/mcp-tools/dist/layer1/task-get.js +0 -29
  113. package/packages/mcp-tools/dist/layer1/task-update.js +0 -34
  114. package/packages/mcp-tools/dist/layer2/franky/topic-checkpoint.js +0 -43
  115. package/packages/mcp-tools/dist/layer2/franky/topic-escalate.js +0 -19
  116. package/packages/mcp-tools/dist/layer2/loid/decision-log.js +0 -15
  117. package/packages/mcp-tools/dist/layer2/loid/decision-no-action.js +0 -15
  118. package/packages/mcp-tools/dist/layer2/loid/delivery-create-pr.js +0 -30
  119. package/packages/mcp-tools/dist/layer2/loid/delivery-share.js +0 -12
  120. package/packages/mcp-tools/dist/layer2/loid/delivery-submit.js +0 -77
  121. package/packages/mcp-tools/dist/layer2/loid/delivery-upload.js +0 -18
  122. package/packages/mcp-tools/dist/layer2/loid/project-remove.js +0 -16
  123. package/packages/mcp-tools/dist/layer2/loid/project-upsert.js +0 -33
  124. package/packages/mcp-tools/dist/layer2/loid/task-dispatch.js +0 -196
  125. package/packages/mcp-tools/dist/layer2/loid/task-lookup.js +0 -38
  126. package/packages/mcp-tools/dist/layer2/loid/topic-close.js +0 -22
  127. package/packages/mcp-tools/dist/layer2/loid/topic-create.js +0 -56
  128. package/packages/mcp-tools/dist/layer2/loid/yor-approve.js +0 -8
  129. package/packages/mcp-tools/dist/layer2/loid/yor-kill.js +0 -7
  130. package/packages/mcp-tools/dist/layer2/loid/yor-rework.js +0 -7
  131. package/packages/mcp-tools/dist/layer2/loid/yor-spawn.js +0 -15
  132. package/packages/mcp-tools/dist/layer2/loid/yor-status.js +0 -8
  133. package/packages/mcp-tools/dist/layer2/yor/task-block.js +0 -11
  134. package/packages/mcp-tools/dist/layer2/yor/task-deliver.js +0 -35
  135. package/packages/mcp-tools/dist/layer2/yor/task-progress.js +0 -21
  136. package/packages/mcp-tools/dist/layer3/adapters/feishu-adapter.js +0 -192
  137. package/packages/mcp-tools/dist/layer3/adapters/types.js +0 -28
  138. package/packages/mcp-tools/dist/layer3/channel-receive.js +0 -11
  139. package/packages/mcp-tools/dist/layer3/channel-send.js +0 -91
  140. package/packages/mcp-tools/dist/layer3/file-upload.js +0 -44
  141. package/packages/mcp-tools/dist/registry.js +0 -871
  142. package/packages/mcp-tools/package.json +0 -13
  143. package/workspace/.claude/settings.local.json +0 -9
  144. package/workspace/.mcp.json +0 -12
  145. package/workspace/CHARTER.md +0 -76
  146. package/workspace/CLAUDE.md +0 -58
  147. package/workspace/PROTOCOL.md +0 -160
  148. package/workspace/TOOLS.md +0 -470
  149. package/workspace/audit/.gitkeep +0 -0
  150. package/workspace/franky/CLAUDE.md +0 -37
  151. package/workspace/franky/PLAYBOOK.md +0 -215
  152. package/workspace/franky/PROFILE.md +0 -80
  153. package/workspace/loid/CLAUDE.md +0 -12
  154. package/workspace/loid/PLAYBOOK.md +0 -198
  155. package/workspace/loid/PROFILE.md +0 -78
  156. package/workspace/memory/commitments/.gitkeep +0 -0
  157. package/workspace/memory/execution/.gitkeep +0 -0
  158. package/workspace/memory/people/.gitkeep +0 -0
  159. package/workspace/memory/projects/.gitkeep +0 -0
  160. package/workspace/memory/self/.gitkeep +0 -0
  161. package/workspace/reference/identity/.gitkeep +0 -0
  162. package/workspace/reference/org/escalation.yaml +0 -24
  163. package/workspace/reference/org/ownership.yaml +0 -28
  164. package/workspace/reports/.gitkeep +0 -0
  165. package/workspace/yor/CLAUDE.md +0 -22
  166. package/workspace/yor/PLAYBOOK.md +0 -73
  167. package/workspace/yor/PROFILE.md +0 -52
  168. package/workspace/yor/SELF-HEAL.md +0 -39
@@ -1,14 +0,0 @@
1
- import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';
2
- import { sql } from 'drizzle-orm';
3
- export const ccSessions = sqliteTable('cc_sessions', {
4
- id: integer('id').primaryKey({ autoIncrement: true }),
5
- session_id: text('session_id').notNull().unique(),
6
- role: text('role').notNull(), // 'loid' | 'yor'
7
- instance_id: text('instance_id'),
8
- task_id: text('task_id'),
9
- chat_id: text('chat_id'),
10
- project_path: text('project_path'),
11
- started_at: text('started_at').notNull().default(sql `(strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))`),
12
- ended_at: text('ended_at'),
13
- });
14
- //# sourceMappingURL=cc-sessions.js.map
@@ -1,33 +0,0 @@
1
- import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';
2
- import { sql } from 'drizzle-orm';
3
- import { orgMembers } from './org.js';
4
- // chats 表 — 群聊实体
5
- export const chats = sqliteTable('chats', {
6
- chat_id: text('chat_id').primaryKey(), // 飞书 oc_xxx
7
- platform: text('platform').notNull().default('feishu'),
8
- name: text('name'),
9
- description: text('description'),
10
- avatar: text('avatar'), // 群头像 URL
11
- owner_id: text('owner_id'), // 群主 open_id
12
- chat_mode: text('chat_mode'), // group / topic
13
- chat_type: text('chat_type'), // private / public
14
- chat_tag: text('chat_tag'), // inner / tenant / department / meeting
15
- chat_status: text('chat_status').default('normal'), // normal / dissolved
16
- external: integer('external').default(0), // 是否外部群 0/1
17
- tenant_key: text('tenant_key'),
18
- user_count: integer('user_count'),
19
- bot_count: integer('bot_count'),
20
- metadata: text('metadata'), // JSON 扩展
21
- first_seen_at: text('first_seen_at').notNull().default(sql `(strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))`),
22
- last_synced_at: text('last_synced_at'),
23
- updated_at: text('updated_at').notNull().default(sql `(strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))`),
24
- });
25
- // chat_members 关联表 — 群 ↔ 人 多对多
26
- export const chatMembers = sqliteTable('chat_members', {
27
- id: integer('id').primaryKey({ autoIncrement: true }),
28
- chat_id: text('chat_id').notNull().references(() => chats.chat_id),
29
- member_id: text('member_id').notNull().references(() => orgMembers.member_id),
30
- role: text('role').default('member'), // owner / admin / member
31
- synced_at: text('synced_at').notNull().default(sql `(strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))`),
32
- });
33
- //# sourceMappingURL=chats.js.map
@@ -1,18 +0,0 @@
1
- /**
2
- * @deprecated 此模块已废弃,改为 Agent 自主判断/使用 memory 系统。
3
- * 保留此文件仅为兼容历史数据,新代码请勿使用。
4
- */
5
- import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';
6
- import { sql } from 'drizzle-orm';
7
- import { tasks } from './tasks.js';
8
- export const commitments = sqliteTable('commitments', {
9
- id: integer('id').primaryKey({ autoIncrement: true }),
10
- task_id: text('task_id').notNull().references(() => tasks.task_id),
11
- promised_to: text('promised_to').notNull(),
12
- promise: text('promise').notNull(),
13
- deadline: text('deadline'),
14
- status: text('status').notNull().default('active'),
15
- break_reason: text('break_reason'),
16
- promised_at: text('promised_at').notNull().default(sql `(strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))`),
17
- });
18
- //# sourceMappingURL=commitments.js.map
@@ -1,14 +0,0 @@
1
- import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';
2
- import { sql } from 'drizzle-orm';
3
- export const communicationEvents = sqliteTable('communication_events', {
4
- id: integer('id').primaryKey({ autoIncrement: true }),
5
- source_type: text('source_type').notNull(),
6
- source_ref: text('source_ref'),
7
- intent_level: integer('intent_level').notNull(),
8
- sender: text('sender'),
9
- summary: text('summary').notNull(),
10
- raw_content_path: text('raw_content_path'),
11
- opportunity_id: text('opportunity_id'),
12
- created_at: text('created_at').notNull().default(sql `(strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))`),
13
- });
14
- //# sourceMappingURL=communication-events.js.map
@@ -1,13 +0,0 @@
1
- export * from './tasks.js';
2
- export * from './commitments.js';
3
- export * from './opportunities.js';
4
- export * from './audit-events.js';
5
- export * from './communication-events.js';
6
- export * from './message-log.js';
7
- export * from './org.js';
8
- export * from './chats.js';
9
- export * from './trace-spans.js';
10
- export * from './projects.js';
11
- export * from './cc-sessions.js';
12
- export * from './topics.js';
13
- //# sourceMappingURL=index.js.map
@@ -1,20 +0,0 @@
1
- import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';
2
- import { sql } from 'drizzle-orm';
3
- export const messageLog = sqliteTable('message_log', {
4
- id: integer('id').primaryKey({ autoIncrement: true }),
5
- direction: text('direction').notNull(), // 'inbound' | 'outbound'
6
- source_type: text('source_type').notNull(), // 'feishu'
7
- source_ref: text('source_ref'), // 飞书 message_id
8
- sender: text('sender'),
9
- receiver: text('receiver'),
10
- chat_id: text('chat_id'), // 群聊 ID 或私聊对方 ID
11
- chat_type: text('chat_type'), // 'group' | 'p2p'
12
- content: text('content').notNull(),
13
- message_type: text('message_type'), // 'text' | 'card' | 'clarification' | 'alert' | 'report' | 'task_done'
14
- intent_level: integer('intent_level'),
15
- related_task_id: text('related_task_id'),
16
- metadata: text('metadata'), // JSON
17
- trace_id: text('trace_id'),
18
- created_at: text('created_at').notNull().default(sql `(strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))`),
19
- });
20
- //# sourceMappingURL=message-log.js.map
@@ -1,23 +0,0 @@
1
- /**
2
- * @deprecated 此模块已废弃,改为 Agent 自主判断/使用 memory 系统。
3
- * 保留此文件仅为兼容历史数据,新代码请勿使用。
4
- */
5
- import { sqliteTable, text, real } from 'drizzle-orm/sqlite-core';
6
- import { sql } from 'drizzle-orm';
7
- import { tasks } from './tasks.js';
8
- export const opportunities = sqliteTable('opportunities', {
9
- id: text('id').primaryKey(),
10
- status: text('status').notNull().default('detected'),
11
- source_ref: text('source_ref'),
12
- summary: text('summary').notNull(),
13
- // 评分
14
- score_impact: real('score_impact'),
15
- score_urgency: real('score_urgency'),
16
- score_feasibility: real('score_feasibility'),
17
- score_permission: real('score_permission'),
18
- total_score: real('total_score'),
19
- converted_task_id: text('converted_task_id').references(() => tasks.task_id),
20
- detected_at: text('detected_at').notNull().default(sql `(strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))`),
21
- claimed_at: text('claimed_at'),
22
- });
23
- //# sourceMappingURL=opportunities.js.map
@@ -1,36 +0,0 @@
1
- import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';
2
- import { sql } from 'drizzle-orm';
3
- export const orgMembers = sqliteTable('org_members', {
4
- member_id: text('member_id').primaryKey(),
5
- name: text('name').notNull(),
6
- role: text('role'),
7
- team: text('team'),
8
- timezone: text('timezone'),
9
- profile_path: text('profile_path'),
10
- response_pattern: text('response_pattern'),
11
- platform: text('platform').default('feishu'),
12
- union_id: text('union_id'),
13
- user_id: text('user_id'), // 飞书租户内 ID
14
- en_name: text('en_name'),
15
- email: text('email'),
16
- employee_no: text('employee_no'),
17
- avatar_url: text('avatar_url'),
18
- metadata: text('metadata'), // JSON 扩展
19
- last_synced_at: text('last_synced_at'),
20
- updated_at: text('updated_at').notNull().default(sql `(strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))`),
21
- });
22
- export const orgOwnership = sqliteTable('org_ownership', {
23
- id: integer('id').primaryKey({ autoIncrement: true }),
24
- scope: text('scope').notNull(),
25
- target: text('target').notNull(),
26
- member_id: text('member_id').notNull().references(() => orgMembers.member_id),
27
- role: text('role').notNull().default('owner'),
28
- });
29
- export const orgEscalationRules = sqliteTable('org_escalation_rules', {
30
- id: integer('id').primaryKey({ autoIncrement: true }),
31
- scope: text('scope').notNull().default('global'),
32
- after_minutes: integer('after_minutes').notNull(),
33
- action: text('action').notNull(),
34
- targets: text('targets').notNull(), // JSON 数组字符串
35
- });
36
- //# sourceMappingURL=org.js.map
@@ -1,23 +0,0 @@
1
- import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';
2
- import { sql } from 'drizzle-orm';
3
- export const projects = sqliteTable('projects', {
4
- project_id: text('project_id').primaryKey(),
5
- name: text('name').notNull(),
6
- description: text('description'),
7
- platform: text('platform').default('github'), // github | gitlab | local
8
- claude_md: text('claude_md'),
9
- created_at: text('created_at').notNull().default(sql `(strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))`),
10
- updated_at: text('updated_at').notNull().default(sql `(strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))`),
11
- deleted_at: text('deleted_at'), // null = 活跃,有值 = 已软删除
12
- });
13
- // project_repos 关联表 — 项目 ↔ 仓库 一对多
14
- export const projectRepos = sqliteTable('project_repos', {
15
- id: integer('id').primaryKey({ autoIncrement: true }),
16
- project_id: text('project_id').notNull().references(() => projects.project_id),
17
- name: text('name').notNull(), // 仓库名,也是子目录名
18
- git_url: text('git_url'), // 远程仓库地址,用于自动 clone
19
- repo_path: text('repo_path'), // 主仓库绝对路径
20
- default_branch: text('default_branch').default('main'),
21
- created_at: text('created_at').notNull().default(sql `(strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))`),
22
- });
23
- //# sourceMappingURL=projects.js.map
@@ -1,48 +0,0 @@
1
- import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';
2
- import { sql } from 'drizzle-orm';
3
- export const tasks = sqliteTable('tasks', {
4
- task_id: text('task_id').primaryKey(),
5
- title: text('title').notNull(),
6
- status: text('status').notNull().default('NEW'),
7
- // 来源
8
- source_type: text('source_type').notNull(),
9
- source_ref: text('source_ref'),
10
- created_by: text('created_by'), // 任务创建者(人名或 'loid')
11
- source_chat_id: text('source_chat_id'), // 触发任务的聊天 ID
12
- // 需求定义
13
- objective: text('objective'),
14
- acceptance_criteria: text('acceptance_criteria'), // JSON 数组字符串
15
- context: text('context'),
16
- // 执行信息
17
- project_id: text('project_id'),
18
- assignee: text('assignee'),
19
- branch: text('branch'),
20
- pr_url: text('pr_url'),
21
- // 重试与阻塞
22
- retry_count: integer('retry_count').notNull().default(0),
23
- max_retries: integer('max_retries').notNull().default(3),
24
- blocked_reason: text('blocked_reason'),
25
- blocked_since: text('blocked_since'),
26
- // 执行指引
27
- execution_guidance: text('execution_guidance'),
28
- // CC 会话
29
- cc_session_id: text('cc_session_id'),
30
- // 文件路径
31
- workspace_path: text('workspace_path'),
32
- // 专项关联(可选,用于回溯关联)
33
- topic_id: text('topic_id'),
34
- // 时间戳
35
- created_at: text('created_at').notNull().default(sql `(strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))`),
36
- updated_at: text('updated_at').notNull().default(sql `(strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))`),
37
- });
38
- export const taskClarifications = sqliteTable('task_clarifications', {
39
- id: integer('id').primaryKey({ autoIncrement: true }),
40
- task_id: text('task_id').notNull().references(() => tasks.task_id),
41
- question: text('question').notNull(),
42
- answer: text('answer'),
43
- asked_by: text('asked_by').notNull().default('loid'),
44
- answered_by: text('answered_by'),
45
- asked_at: text('asked_at').notNull().default(sql `(strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))`),
46
- answered_at: text('answered_at'),
47
- });
48
- //# sourceMappingURL=tasks.js.map
@@ -1,20 +0,0 @@
1
- import { sqliteTable, text } from 'drizzle-orm/sqlite-core';
2
- import { sql } from 'drizzle-orm';
3
- import { projects } from './projects.js';
4
- export const topics = sqliteTable('topics', {
5
- id: text('id').primaryKey(),
6
- project_id: text('project_id').references(() => projects.project_id),
7
- title: text('title').notNull(),
8
- description: text('description'),
9
- status: text('status').notNull().default('active'),
10
- thread_id: text('thread_id'),
11
- root_message_id: text('root_message_id'),
12
- chat_id: text('chat_id'),
13
- workspace_path: text('workspace_path'),
14
- branch_name: text('branch_name'),
15
- created_by: text('created_by'),
16
- created_at: text('created_at').notNull().default(sql `(strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))`),
17
- updated_at: text('updated_at').notNull().default(sql `(strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))`),
18
- closed_at: text('closed_at'),
19
- });
20
- //# sourceMappingURL=topics.js.map
@@ -1,19 +0,0 @@
1
- import { sqliteTable, text, integer, real } from 'drizzle-orm/sqlite-core';
2
- import { sql } from 'drizzle-orm';
3
- export const traceSpans = sqliteTable('trace_spans', {
4
- id: integer('id').primaryKey({ autoIncrement: true }),
5
- trace_id: text('trace_id').notNull(),
6
- span_id: text('span_id').notNull(),
7
- parent_span_id: text('parent_span_id'),
8
- operation: text('operation').notNull(),
9
- status: text('status').notNull().default('in_progress'), // 'in_progress' | 'success' | 'error'
10
- started_at: text('started_at').notNull(),
11
- ended_at: text('ended_at'),
12
- duration_ms: real('duration_ms'),
13
- input: text('input'), // JSON
14
- output: text('output'), // JSON
15
- error: text('error'),
16
- metadata: text('metadata'), // JSON
17
- created_at: text('created_at').notNull().default(sql `(strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))`),
18
- });
19
- //# sourceMappingURL=trace-spans.js.map
@@ -1,12 +0,0 @@
1
- {
2
- "name": "@team-anya/db",
3
- "version": "0.1.0",
4
- "type": "module",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "dependencies": {
8
- "@team-anya/core": "file:../core",
9
- "better-sqlite3": "^11.8.0",
10
- "drizzle-orm": "^0.38.0"
11
- }
12
- }
@@ -1,251 +0,0 @@
1
- -- Baseline: squash of migrations 0000-0007
2
- -- Generated: 2026-02-26
3
- CREATE TABLE `tasks` (
4
- `task_id` text PRIMARY KEY NOT NULL,
5
- `title` text NOT NULL,
6
- `status` text DEFAULT 'NEW' NOT NULL,
7
- `source_type` text NOT NULL,
8
- `source_ref` text,
9
- `created_by` text,
10
- `source_chat_id` text,
11
- `objective` text,
12
- `acceptance_criteria` text,
13
- `context` text,
14
- `project_id` text,
15
- `assignee` text,
16
- `branch` text,
17
- `pr_url` text,
18
- `retry_count` integer DEFAULT 0 NOT NULL,
19
- `max_retries` integer DEFAULT 3 NOT NULL,
20
- `blocked_reason` text,
21
- `blocked_since` text,
22
- `execution_guidance` text,
23
- `cc_session_id` text,
24
- `workspace_path` text,
25
- `topic_id` text REFERENCES `topics`(`id`),
26
- `created_at` text DEFAULT (datetime('now')) NOT NULL,
27
- `updated_at` text DEFAULT (datetime('now')) NOT NULL
28
- );
29
- --> statement-breakpoint
30
- CREATE TABLE `task_clarifications` (
31
- `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
32
- `task_id` text NOT NULL,
33
- `question` text NOT NULL,
34
- `answer` text,
35
- `asked_by` text DEFAULT 'loid' NOT NULL,
36
- `answered_by` text,
37
- `asked_at` text DEFAULT (datetime('now')) NOT NULL,
38
- `answered_at` text,
39
- FOREIGN KEY (`task_id`) REFERENCES `tasks`(`task_id`) ON UPDATE no action ON DELETE no action
40
- );
41
- --> statement-breakpoint
42
- CREATE TABLE `commitments` (
43
- `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
44
- `task_id` text NOT NULL,
45
- `promised_to` text NOT NULL,
46
- `promise` text NOT NULL,
47
- `deadline` text,
48
- `status` text DEFAULT 'active' NOT NULL,
49
- `break_reason` text,
50
- `promised_at` text DEFAULT (datetime('now')) NOT NULL,
51
- FOREIGN KEY (`task_id`) REFERENCES `tasks`(`task_id`) ON UPDATE no action ON DELETE no action
52
- );
53
- --> statement-breakpoint
54
- CREATE TABLE `opportunities` (
55
- `id` text PRIMARY KEY NOT NULL,
56
- `status` text DEFAULT 'detected' NOT NULL,
57
- `source_ref` text,
58
- `summary` text NOT NULL,
59
- `score_impact` real,
60
- `score_urgency` real,
61
- `score_feasibility` real,
62
- `score_permission` real,
63
- `total_score` real,
64
- `converted_task_id` text,
65
- `detected_at` text DEFAULT (datetime('now')) NOT NULL,
66
- `claimed_at` text,
67
- FOREIGN KEY (`converted_task_id`) REFERENCES `tasks`(`task_id`) ON UPDATE no action ON DELETE no action
68
- );
69
- --> statement-breakpoint
70
- CREATE TABLE `audit_events` (
71
- `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
72
- `event_type` text NOT NULL,
73
- `actor` text NOT NULL,
74
- `task_id` text,
75
- `summary` text NOT NULL,
76
- `detail` text,
77
- `file_ref` text,
78
- `created_at` text DEFAULT (datetime('now')) NOT NULL
79
- );
80
- --> statement-breakpoint
81
- CREATE TABLE `communication_events` (
82
- `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
83
- `source_type` text NOT NULL,
84
- `source_ref` text,
85
- `intent_level` integer NOT NULL,
86
- `sender` text,
87
- `summary` text NOT NULL,
88
- `raw_content_path` text,
89
- `opportunity_id` text,
90
- `created_at` text DEFAULT (datetime('now')) NOT NULL
91
- );
92
- --> statement-breakpoint
93
- CREATE TABLE `message_log` (
94
- `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
95
- `direction` text NOT NULL,
96
- `source_type` text NOT NULL,
97
- `source_ref` text,
98
- `sender` text,
99
- `receiver` text,
100
- `chat_id` text,
101
- `chat_type` text,
102
- `content` text NOT NULL,
103
- `message_type` text,
104
- `intent_level` integer,
105
- `related_task_id` text,
106
- `metadata` text,
107
- `trace_id` text,
108
- `created_at` text DEFAULT (datetime('now')) NOT NULL
109
- );
110
- --> statement-breakpoint
111
- CREATE TABLE `org_members` (
112
- `member_id` text PRIMARY KEY NOT NULL,
113
- `name` text NOT NULL,
114
- `role` text,
115
- `team` text,
116
- `timezone` text,
117
- `profile_path` text,
118
- `response_pattern` text,
119
- `platform` text DEFAULT 'feishu',
120
- `union_id` text,
121
- `user_id` text,
122
- `en_name` text,
123
- `email` text,
124
- `employee_no` text,
125
- `avatar_url` text,
126
- `metadata` text,
127
- `last_synced_at` text,
128
- `updated_at` text DEFAULT (datetime('now')) NOT NULL
129
- );
130
- --> statement-breakpoint
131
- CREATE TABLE `org_ownership` (
132
- `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
133
- `scope` text NOT NULL,
134
- `target` text NOT NULL,
135
- `member_id` text NOT NULL,
136
- `role` text DEFAULT 'owner' NOT NULL,
137
- FOREIGN KEY (`member_id`) REFERENCES `org_members`(`member_id`) ON UPDATE no action ON DELETE no action
138
- );
139
- --> statement-breakpoint
140
- CREATE TABLE `org_escalation_rules` (
141
- `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
142
- `scope` text DEFAULT 'global' NOT NULL,
143
- `after_minutes` integer NOT NULL,
144
- `action` text NOT NULL,
145
- `targets` text NOT NULL
146
- );
147
- --> statement-breakpoint
148
- CREATE TABLE `trace_spans` (
149
- `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
150
- `trace_id` text NOT NULL,
151
- `span_id` text NOT NULL,
152
- `parent_span_id` text,
153
- `operation` text NOT NULL,
154
- `status` text DEFAULT 'in_progress' NOT NULL,
155
- `started_at` text NOT NULL,
156
- `ended_at` text,
157
- `duration_ms` real,
158
- `input` text,
159
- `output` text,
160
- `error` text,
161
- `metadata` text,
162
- `created_at` text DEFAULT (datetime('now')) NOT NULL
163
- );
164
- --> statement-breakpoint
165
- CREATE TABLE `chats` (
166
- `chat_id` text PRIMARY KEY NOT NULL,
167
- `platform` text DEFAULT 'feishu' NOT NULL,
168
- `name` text,
169
- `description` text,
170
- `avatar` text,
171
- `owner_id` text,
172
- `chat_mode` text,
173
- `chat_type` text,
174
- `chat_tag` text,
175
- `chat_status` text DEFAULT 'normal',
176
- `external` integer DEFAULT 0,
177
- `tenant_key` text,
178
- `user_count` integer,
179
- `bot_count` integer,
180
- `metadata` text,
181
- `first_seen_at` text DEFAULT (datetime('now')) NOT NULL,
182
- `last_synced_at` text,
183
- `updated_at` text DEFAULT (datetime('now')) NOT NULL
184
- );
185
- --> statement-breakpoint
186
- CREATE TABLE `chat_members` (
187
- `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
188
- `chat_id` text NOT NULL,
189
- `member_id` text NOT NULL,
190
- `role` text DEFAULT 'member',
191
- `synced_at` text DEFAULT (datetime('now')) NOT NULL,
192
- FOREIGN KEY (`chat_id`) REFERENCES `chats`(`chat_id`) ON UPDATE no action ON DELETE no action,
193
- FOREIGN KEY (`member_id`) REFERENCES `org_members`(`member_id`) ON UPDATE no action ON DELETE no action
194
- );
195
- --> statement-breakpoint
196
- CREATE TABLE `projects` (
197
- `project_id` text PRIMARY KEY NOT NULL,
198
- `name` text NOT NULL,
199
- `description` text,
200
- `platform` text DEFAULT 'github',
201
- `claude_md` text,
202
- `deleted_at` text,
203
- `created_at` text DEFAULT (datetime('now')) NOT NULL,
204
- `updated_at` text DEFAULT (datetime('now')) NOT NULL
205
- );
206
- --> statement-breakpoint
207
- CREATE TABLE `project_repos` (
208
- `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
209
- `project_id` text NOT NULL,
210
- `name` text NOT NULL,
211
- `git_url` text,
212
- `repo_path` text,
213
- `default_branch` text DEFAULT 'main',
214
- `created_at` text DEFAULT (datetime('now')) NOT NULL,
215
- FOREIGN KEY (`project_id`) REFERENCES `projects`(`project_id`) ON UPDATE no action ON DELETE no action
216
- );
217
- --> statement-breakpoint
218
- CREATE TABLE `cc_sessions` (
219
- `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
220
- `session_id` text NOT NULL,
221
- `role` text NOT NULL,
222
- `instance_id` text,
223
- `task_id` text,
224
- `chat_id` text,
225
- `project_path` text,
226
- `started_at` text DEFAULT (datetime('now')) NOT NULL,
227
- `ended_at` text
228
- );
229
- --> statement-breakpoint
230
- CREATE UNIQUE INDEX `cc_sessions_session_id_unique` ON `cc_sessions` (`session_id`);
231
- --> statement-breakpoint
232
- CREATE TABLE `topics` (
233
- `id` text PRIMARY KEY NOT NULL,
234
- `project_id` text REFERENCES `projects`(`project_id`),
235
- `title` text NOT NULL,
236
- `description` text,
237
- `status` text NOT NULL DEFAULT 'active',
238
- `thread_id` text,
239
- `root_message_id` text,
240
- `chat_id` text,
241
- `workspace_path` text,
242
- `branch_name` text,
243
- `created_by` text,
244
- `created_at` text NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
245
- `updated_at` text NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
246
- `closed_at` text
247
- );
248
- --> statement-breakpoint
249
- CREATE INDEX `idx_topics_thread_id` ON `topics` (`thread_id`);
250
- --> statement-breakpoint
251
- CREATE INDEX `idx_topics_status` ON `topics` (`status`);
@@ -1,13 +0,0 @@
1
- {
2
- "version": "7",
3
- "dialect": "sqlite",
4
- "entries": [
5
- {
6
- "idx": 0,
7
- "version": "7",
8
- "when": 1772100000000,
9
- "tag": "0000_baseline",
10
- "breakpoints": true
11
- }
12
- ]
13
- }
@@ -1,41 +0,0 @@
1
- // ── Layer 1: 共享基础 — 记忆工具(v2) ──
2
- export { memoryRecall } from './layer1/memory-recall.js';
3
- export { memoryRemember } from './layer1/memory-remember.js';
4
- export { memoryDigest } from './layer1/memory-digest.js';
5
- export { memoryBrief } from './layer1/memory-brief.js';
6
- export { memoryForget } from './layer1/memory-forget.js';
7
- // ── Layer 1: 旧版记忆工具(deprecated,保留编译兼容) ──
8
- /** @deprecated 使用 memoryBrief 替代 */
9
- export { memoryContext } from './layer1/memory-context.js';
10
- /** @deprecated 使用 memoryRecall 替代 */
11
- export { memorySearch, buildSearchIndex } from './layer1/memory-search.js';
12
- /** @deprecated 使用 memoryRemember 替代 */
13
- export { memoryLearn } from './layer1/memory-learn.js';
14
- /** @deprecated 使用 memoryDigest 替代 */
15
- export { memoryReflect } from './layer1/memory-reflect.js';
16
- export { orgLookup } from './layer1/org-lookup.js';
17
- export { taskGet } from './layer1/task-get.js';
18
- export { auditAppend, appendToAuditFile } from './layer1/audit-append.js';
19
- export { auditQuery } from './layer1/audit-query.js';
20
- export { reportDaily } from './layer1/report-daily.js';
21
- // ── Layer 2: Loid 专属 ──
22
- export { taskDispatch } from './layer2/loid/task-dispatch.js';
23
- export { taskLookup } from './layer2/loid/task-lookup.js';
24
- export { decisionLog } from './layer2/loid/decision-log.js';
25
- // ── Layer 2: Yor 专属 ──
26
- export { taskDeliver } from './layer2/yor/task-deliver.js';
27
- export { taskBlock } from './layer2/yor/task-block.js';
28
- export { taskProgress } from './layer2/yor/task-progress.js';
29
- // ── Layer 3: 外部桥梁 ──
30
- export { channelSend } from './layer3/channel-send.js';
31
- export { channelReceive } from './layer3/channel-receive.js';
32
- export { fileUpload } from './layer3/file-upload.js';
33
- export { ChannelRegistry } from './layer3/adapters/types.js';
34
- export { FeishuAdapter, detectMediaKind, resolveFileType, isMarkdown } from './layer3/adapters/feishu-adapter.js';
35
- // ── Registry ──
36
- export { createToolRouter, getToolsForRole, TOOL_REGISTRY } from './registry.js';
37
- // ── 向后兼容(旧导出名保留) ──
38
- export { taskGet as taskContext } from './layer1/task-get.js';
39
- /** @deprecated 使用 memoryLearn 替代 */
40
- export { memoryWrite } from './layer1/memory-write.js';
41
- //# sourceMappingURL=index.js.map
@@ -1,38 +0,0 @@
1
- import { appendFile, mkdir } from 'node:fs/promises';
2
- import { join } from 'node:path';
3
- import { insertAuditEvent } from '@team-anya/db';
4
- /**
5
- * 审计事件双写:SQLite + 文件
6
- */
7
- export async function auditAppend(db, workspacePath, input) {
8
- // 1. 写入 SQLite
9
- const result = insertAuditEvent(db, {
10
- event_type: input.event_type,
11
- actor: input.actor,
12
- task_id: input.task_id ?? null,
13
- summary: input.summary,
14
- detail: input.detail ? JSON.stringify(input.detail) : null,
15
- });
16
- // 2. 写入审计文件
17
- await appendToAuditFile(workspacePath, input);
18
- return { event_id: result.id };
19
- }
20
- /**
21
- * 仅写审计文件(taskTransition 内部调用)
22
- */
23
- export async function appendToAuditFile(workspacePath, input) {
24
- const date = new Date().toISOString().slice(0, 10);
25
- const auditDir = join(workspacePath, 'audit');
26
- await mkdir(auditDir, { recursive: true });
27
- const filePath = join(auditDir, `events-${date}.jsonl`);
28
- const entry = {
29
- ts: new Date().toISOString(),
30
- type: input.event_type,
31
- actor: input.actor,
32
- task_id: input.task_id,
33
- summary: input.summary,
34
- ...(input.detail ? { detail: input.detail } : {}),
35
- };
36
- await appendFile(filePath, JSON.stringify(entry) + '\n');
37
- }
38
- //# sourceMappingURL=audit-append.js.map