galaxy-opc-plugin 0.2.0 → 0.2.2

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 (46) hide show
  1. package/index.ts +244 -8
  2. package/package.json +17 -3
  3. package/skills/acquisition-management/SKILL.md +83 -0
  4. package/skills/ai-staff/SKILL.md +89 -0
  5. package/skills/asset-package/SKILL.md +142 -0
  6. package/skills/opb-canvas/SKILL.md +88 -0
  7. package/src/__tests__/e2e/company-lifecycle.test.ts +399 -0
  8. package/src/__tests__/integration/business-workflows.test.ts +366 -0
  9. package/src/__tests__/test-utils.ts +316 -0
  10. package/src/commands/opc-command.ts +422 -0
  11. package/src/db/index.ts +3 -0
  12. package/src/db/migrations.test.ts +324 -0
  13. package/src/db/migrations.ts +131 -0
  14. package/src/db/schema.ts +211 -0
  15. package/src/db/sqlite-adapter.ts +5 -0
  16. package/src/opc/autonomy-rules.ts +132 -0
  17. package/src/opc/briefing-builder.ts +1331 -0
  18. package/src/opc/business-workflows.test.ts +535 -0
  19. package/src/opc/business-workflows.ts +325 -0
  20. package/src/opc/context-injector.ts +366 -28
  21. package/src/opc/event-triggers.ts +472 -0
  22. package/src/opc/intelligence-engine.ts +702 -0
  23. package/src/opc/milestone-detector.ts +251 -0
  24. package/src/opc/proactive-service.ts +179 -0
  25. package/src/opc/reminder-service.ts +4 -43
  26. package/src/opc/session-task-tracker.ts +60 -0
  27. package/src/opc/stage-detector.ts +168 -0
  28. package/src/opc/task-executor.ts +332 -0
  29. package/src/opc/task-templates.ts +179 -0
  30. package/src/tools/acquisition-tool.ts +8 -5
  31. package/src/tools/document-tool.ts +1176 -0
  32. package/src/tools/finance-tool.test.ts +238 -0
  33. package/src/tools/finance-tool.ts +922 -14
  34. package/src/tools/hr-tool.ts +10 -1
  35. package/src/tools/legal-tool.test.ts +251 -0
  36. package/src/tools/legal-tool.ts +26 -4
  37. package/src/tools/lifecycle-tool.test.ts +231 -0
  38. package/src/tools/media-tool.ts +156 -1
  39. package/src/tools/monitoring-tool.ts +135 -2
  40. package/src/tools/opc-tool.test.ts +250 -0
  41. package/src/tools/opc-tool.ts +251 -28
  42. package/src/tools/project-tool.test.ts +218 -0
  43. package/src/tools/schemas.ts +80 -0
  44. package/src/tools/search-tool.ts +227 -0
  45. package/src/tools/staff-tool.ts +395 -2
  46. package/src/web/config-ui.ts +299 -45
@@ -8,6 +8,7 @@
8
8
  import { Type, type Static } from "@sinclair/typebox";
9
9
  import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
10
10
  import type { OpcDatabase } from "../db/index.js";
11
+ import { CompanyManager } from "../opc/company-manager.js";
11
12
  import { json, toolError } from "../utils/tool-helper.js";
12
13
 
13
14
  const AcquisitionSchema = Type.Union([
@@ -43,6 +44,8 @@ const AcquisitionSchema = Type.Union([
43
44
  type AcquisitionParams = Static<typeof AcquisitionSchema>;
44
45
 
45
46
  export function registerAcquisitionTool(api: OpenClawPluginApi, db: OpcDatabase): void {
47
+ const manager = new CompanyManager(db);
48
+
46
49
  api.registerTool(
47
50
  {
48
51
  name: "opc_acquisition",
@@ -75,11 +78,11 @@ export function registerAcquisitionTool(api: OpenClawPluginApi, db: OpcDatabase)
75
78
  p.notes ?? "", now, now,
76
79
  );
77
80
 
78
- // 同步将公司状态标记为 acquired
79
- db.execute(
80
- `UPDATE opc_companies SET status = 'acquired', updated_at = ? WHERE id = ?`,
81
- now, p.company_id,
82
- );
81
+ // 通过状态机将公司标记为 acquired
82
+ const transitioned = manager.transitionStatus(p.company_id, "acquired");
83
+ if (!transitioned) {
84
+ return toolError(`公司 ${p.company_id} 不存在或当前状态不允许收购`, "INVALID_STATUS");
85
+ }
83
86
 
84
87
  const row = db.queryOne(
85
88
  `SELECT a.*, c.name as company_name FROM opc_acquisition_cases a