@suwujs/king-ai 0.2.0

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 (104) hide show
  1. package/README.md +96 -0
  2. package/dist/src/agent-config-validation.d.ts +9 -0
  3. package/dist/src/agent-config-validation.js +30 -0
  4. package/dist/src/api.d.ts +4 -0
  5. package/dist/src/api.js +48 -0
  6. package/dist/src/attachments.d.ts +45 -0
  7. package/dist/src/attachments.js +322 -0
  8. package/dist/src/cli.d.ts +20 -0
  9. package/dist/src/cli.js +1697 -0
  10. package/dist/src/config.d.ts +3 -0
  11. package/dist/src/config.js +20 -0
  12. package/dist/src/cron.d.ts +11 -0
  13. package/dist/src/cron.js +65 -0
  14. package/dist/src/daemon.d.ts +36 -0
  15. package/dist/src/daemon.js +373 -0
  16. package/dist/src/engine.d.ts +32 -0
  17. package/dist/src/engine.js +1014 -0
  18. package/dist/src/heartbeat.d.ts +18 -0
  19. package/dist/src/heartbeat.js +28 -0
  20. package/dist/src/host-api.d.ts +40 -0
  21. package/dist/src/host-api.js +59 -0
  22. package/dist/src/host-control.d.ts +48 -0
  23. package/dist/src/host-control.js +1279 -0
  24. package/dist/src/host-export.d.ts +50 -0
  25. package/dist/src/host-export.js +187 -0
  26. package/dist/src/host-feedback.d.ts +78 -0
  27. package/dist/src/host-feedback.js +178 -0
  28. package/dist/src/host-home.d.ts +13 -0
  29. package/dist/src/host-home.js +54 -0
  30. package/dist/src/host-ledger.d.ts +261 -0
  31. package/dist/src/host-ledger.js +554 -0
  32. package/dist/src/host-loop-events.d.ts +69 -0
  33. package/dist/src/host-loop-events.js +288 -0
  34. package/dist/src/host-permission.d.ts +36 -0
  35. package/dist/src/host-permission.js +180 -0
  36. package/dist/src/host-policy.d.ts +15 -0
  37. package/dist/src/host-policy.js +36 -0
  38. package/dist/src/host-run-executor.d.ts +13 -0
  39. package/dist/src/host-run-executor.js +221 -0
  40. package/dist/src/host-run-heartbeat.d.ts +40 -0
  41. package/dist/src/host-run-heartbeat.js +103 -0
  42. package/dist/src/host-run-layout.d.ts +17 -0
  43. package/dist/src/host-run-layout.js +387 -0
  44. package/dist/src/host-run-meta.d.ts +41 -0
  45. package/dist/src/host-run-meta.js +115 -0
  46. package/dist/src/host-run-spec.d.ts +149 -0
  47. package/dist/src/host-run-spec.js +465 -0
  48. package/dist/src/host-runs.d.ts +77 -0
  49. package/dist/src/host-runs.js +195 -0
  50. package/dist/src/host-sdk.d.ts +412 -0
  51. package/dist/src/host-sdk.js +628 -0
  52. package/dist/src/host-server.d.ts +26 -0
  53. package/dist/src/host-server.js +921 -0
  54. package/dist/src/host-timeline.d.ts +24 -0
  55. package/dist/src/host-timeline.js +161 -0
  56. package/dist/src/jsonl.d.ts +13 -0
  57. package/dist/src/jsonl.js +47 -0
  58. package/dist/src/lifecycle.d.ts +5 -0
  59. package/dist/src/lifecycle.js +18 -0
  60. package/dist/src/message-routing.d.ts +32 -0
  61. package/dist/src/message-routing.js +119 -0
  62. package/dist/src/paths.d.ts +19 -0
  63. package/dist/src/paths.js +26 -0
  64. package/dist/src/project-profile.d.ts +49 -0
  65. package/dist/src/project-profile.js +356 -0
  66. package/dist/src/remediation.d.ts +14 -0
  67. package/dist/src/remediation.js +114 -0
  68. package/dist/src/remote-devices.d.ts +41 -0
  69. package/dist/src/remote-devices.js +156 -0
  70. package/dist/src/remote-diagnostics.d.ts +39 -0
  71. package/dist/src/remote-diagnostics.js +199 -0
  72. package/dist/src/remote-ssh.d.ts +39 -0
  73. package/dist/src/remote-ssh.js +129 -0
  74. package/dist/src/run-stream.d.ts +57 -0
  75. package/dist/src/run-stream.js +119 -0
  76. package/dist/src/runner.d.ts +131 -0
  77. package/dist/src/runner.js +1161 -0
  78. package/dist/src/runtime-data.d.ts +68 -0
  79. package/dist/src/runtime-data.js +172 -0
  80. package/dist/src/service.d.ts +114 -0
  81. package/dist/src/service.js +631 -0
  82. package/dist/src/shared-skills.d.ts +26 -0
  83. package/dist/src/shared-skills.js +85 -0
  84. package/dist/src/shim.d.ts +1 -0
  85. package/dist/src/shim.js +64 -0
  86. package/dist/src/skill-check.d.ts +17 -0
  87. package/dist/src/skill-check.js +158 -0
  88. package/dist/src/sse.d.ts +9 -0
  89. package/dist/src/sse.js +36 -0
  90. package/dist/src/team-routing.d.ts +55 -0
  91. package/dist/src/team-routing.js +131 -0
  92. package/dist/src/team-workflow.d.ts +78 -0
  93. package/dist/src/team-workflow.js +253 -0
  94. package/dist/src/text.d.ts +7 -0
  95. package/dist/src/text.js +27 -0
  96. package/dist/src/types.d.ts +98 -0
  97. package/dist/src/types.js +1 -0
  98. package/dist/src/usage.d.ts +116 -0
  99. package/dist/src/usage.js +350 -0
  100. package/dist/src/workspace.d.ts +9 -0
  101. package/dist/src/workspace.js +56 -0
  102. package/dist/src/worktree.d.ts +47 -0
  103. package/dist/src/worktree.js +201 -0
  104. package/package.json +63 -0
@@ -0,0 +1,261 @@
1
+ import { type CompactJsonlResult } from "./jsonl.js";
2
+ import type { KingHandoffPolicy, KingWorkflowObjectType } from "./team-workflow.js";
3
+ export type HostTaskStatus = "pending" | "in_progress" | "blocked" | "done" | "cancelled";
4
+ export type HostCapsuleStatus = "open" | "in_review" | "accepted" | "abandoned";
5
+ export type HostWorkflowStatus = "open" | "assigned" | "in_progress" | "blocked" | "review" | "waiting_human" | "done" | "cancelled";
6
+ export interface HostLedgerPathInput {
7
+ outputDir?: string;
8
+ tasksFile?: string;
9
+ capsulesFile?: string;
10
+ workflowFile?: string;
11
+ }
12
+ export interface HostTaskCreateInput extends HostLedgerPathInput {
13
+ id?: string;
14
+ title: string;
15
+ status?: HostTaskStatus;
16
+ assignee?: string;
17
+ ownerRole?: string;
18
+ reviewerRole?: string;
19
+ priority?: string;
20
+ dependsOn?: string[];
21
+ capsuleId?: string;
22
+ acceptance?: string[];
23
+ detail?: string;
24
+ }
25
+ export interface HostTaskUpdateInput extends HostLedgerPathInput {
26
+ id: string;
27
+ status?: HostTaskStatus;
28
+ assignee?: string;
29
+ ownerRole?: string;
30
+ reviewerRole?: string;
31
+ priority?: string;
32
+ dependsOn?: string[];
33
+ capsuleId?: string;
34
+ acceptance?: string[];
35
+ detail?: string;
36
+ result?: string;
37
+ }
38
+ export interface HostTaskListInput extends HostLedgerPathInput {
39
+ status?: HostTaskStatus;
40
+ assignee?: string;
41
+ limit?: number;
42
+ }
43
+ export interface HostAgendaInput extends HostLedgerPathInput {
44
+ assignee?: string;
45
+ limit?: number;
46
+ }
47
+ export interface HostCapsuleCreateInput extends HostLedgerPathInput {
48
+ id?: string;
49
+ taskId?: string;
50
+ goal: string;
51
+ owner: string;
52
+ branchOrWorktree: string;
53
+ allowedPaths: string[];
54
+ acceptance: string[];
55
+ reviewer: string;
56
+ verificationCommands: string[];
57
+ status?: HostCapsuleStatus;
58
+ }
59
+ export interface HostCapsuleUpdateInput extends HostLedgerPathInput {
60
+ id: string;
61
+ taskId?: string;
62
+ goal?: string;
63
+ owner?: string;
64
+ branchOrWorktree?: string;
65
+ allowedPaths?: string[];
66
+ acceptance?: string[];
67
+ reviewer?: string;
68
+ verificationCommands?: string[];
69
+ status?: HostCapsuleStatus;
70
+ }
71
+ export interface HostCapsuleListInput extends HostLedgerPathInput {
72
+ status?: HostCapsuleStatus;
73
+ owner?: string;
74
+ limit?: number;
75
+ }
76
+ export interface HostTask {
77
+ id: string;
78
+ title: string;
79
+ status: HostTaskStatus;
80
+ createdAt: string;
81
+ updatedAt?: string;
82
+ assignee?: string;
83
+ ownerRole?: string;
84
+ reviewerRole?: string;
85
+ priority?: string;
86
+ dependsOn: string[];
87
+ capsuleId?: string;
88
+ acceptance: string[];
89
+ detail?: string;
90
+ result?: string;
91
+ }
92
+ export interface HostTaskUpdate {
93
+ id: string;
94
+ updatedAt: string;
95
+ status?: HostTaskStatus;
96
+ assignee?: string;
97
+ ownerRole?: string;
98
+ reviewerRole?: string;
99
+ priority?: string;
100
+ dependsOn?: string[];
101
+ capsuleId?: string;
102
+ acceptance?: string[];
103
+ detail?: string;
104
+ result?: string;
105
+ }
106
+ export interface HostCapsule {
107
+ id: string;
108
+ status: HostCapsuleStatus;
109
+ createdAt: string;
110
+ updatedAt?: string;
111
+ taskId?: string;
112
+ goal: string;
113
+ owner: string;
114
+ branchOrWorktree: string;
115
+ allowedPaths: string[];
116
+ acceptance: string[];
117
+ reviewer: string;
118
+ verificationCommands: string[];
119
+ }
120
+ export interface HostWorkflowCardCreateInput extends HostLedgerPathInput {
121
+ kind: KingWorkflowObjectType;
122
+ id?: string;
123
+ title: string;
124
+ status?: HostWorkflowStatus;
125
+ ownerRole?: string;
126
+ reviewerRole?: string;
127
+ assignee?: string;
128
+ priority?: string;
129
+ dependsOn?: string[];
130
+ acceptance?: string[];
131
+ handoffPolicy?: KingHandoffPolicy;
132
+ sourceId?: string;
133
+ targetRole?: string;
134
+ decisionBy?: string;
135
+ artifactPath?: string;
136
+ detail?: string;
137
+ result?: string;
138
+ metadata?: Record<string, unknown>;
139
+ }
140
+ export interface HostWorkflowCardUpdateInput extends HostLedgerPathInput {
141
+ id: string;
142
+ status?: HostWorkflowStatus;
143
+ ownerRole?: string;
144
+ reviewerRole?: string;
145
+ assignee?: string;
146
+ priority?: string;
147
+ dependsOn?: string[];
148
+ acceptance?: string[];
149
+ handoffPolicy?: KingHandoffPolicy;
150
+ sourceId?: string;
151
+ targetRole?: string;
152
+ decisionBy?: string;
153
+ artifactPath?: string;
154
+ detail?: string;
155
+ result?: string;
156
+ metadata?: Record<string, unknown>;
157
+ }
158
+ export interface HostWorkflowCardListInput extends HostLedgerPathInput {
159
+ kind?: KingWorkflowObjectType;
160
+ status?: HostWorkflowStatus;
161
+ ownerRole?: string;
162
+ reviewerRole?: string;
163
+ assignee?: string;
164
+ limit?: number;
165
+ }
166
+ export interface HostWorkflowCard {
167
+ kind: KingWorkflowObjectType;
168
+ id: string;
169
+ title: string;
170
+ status: HostWorkflowStatus;
171
+ createdAt: string;
172
+ updatedAt?: string;
173
+ ownerRole?: string;
174
+ reviewerRole?: string;
175
+ assignee?: string;
176
+ priority?: string;
177
+ dependsOn: string[];
178
+ acceptance: string[];
179
+ handoffPolicy?: KingHandoffPolicy;
180
+ sourceId?: string;
181
+ targetRole?: string;
182
+ decisionBy?: string;
183
+ artifactPath?: string;
184
+ detail?: string;
185
+ result?: string;
186
+ metadata?: Record<string, unknown>;
187
+ }
188
+ export interface HostWorkflowCardUpdate {
189
+ id: string;
190
+ updatedAt: string;
191
+ status?: HostWorkflowStatus;
192
+ ownerRole?: string;
193
+ reviewerRole?: string;
194
+ assignee?: string;
195
+ priority?: string;
196
+ dependsOn?: string[];
197
+ acceptance?: string[];
198
+ handoffPolicy?: KingHandoffPolicy;
199
+ sourceId?: string;
200
+ targetRole?: string;
201
+ decisionBy?: string;
202
+ artifactPath?: string;
203
+ detail?: string;
204
+ result?: string;
205
+ metadata?: Record<string, unknown>;
206
+ }
207
+ export interface HostCapsuleUpdate {
208
+ id: string;
209
+ updatedAt: string;
210
+ status?: HostCapsuleStatus;
211
+ taskId?: string;
212
+ goal?: string;
213
+ owner?: string;
214
+ branchOrWorktree?: string;
215
+ allowedPaths?: string[];
216
+ acceptance?: string[];
217
+ reviewer?: string;
218
+ verificationCommands?: string[];
219
+ }
220
+ export interface HostAgendaTask extends HostTask {
221
+ blockedBy: string[];
222
+ ready: boolean;
223
+ }
224
+ export interface HostAgenda {
225
+ tasks: HostAgendaTask[];
226
+ readyCount: number;
227
+ blockedCount: number;
228
+ summary: string;
229
+ }
230
+ export declare function hostTasksPathForOutputDir(outputDir?: string): string;
231
+ export declare function hostCapsulesPathForOutputDir(outputDir?: string): string;
232
+ export declare function hostWorkflowPathForOutputDir(outputDir?: string): string;
233
+ export declare function createHostTask(input: HostTaskCreateInput, now?: () => Date): Promise<HostTask>;
234
+ export declare function updateHostTask(input: HostTaskUpdateInput, now?: () => Date): Promise<HostTask>;
235
+ export declare function listHostTasks(input?: HostTaskListInput): Promise<HostTask[]>;
236
+ export declare function buildHostAgenda(input?: HostAgendaInput): Promise<HostAgenda>;
237
+ export declare function createHostCapsule(input: HostCapsuleCreateInput, now?: () => Date): Promise<HostCapsule>;
238
+ export declare function updateHostCapsule(input: HostCapsuleUpdateInput, now?: () => Date): Promise<HostCapsule>;
239
+ export declare function listHostCapsules(input?: HostCapsuleListInput): Promise<HostCapsule[]>;
240
+ export declare function getHostCapsule(input: HostLedgerPathInput & {
241
+ id: string;
242
+ }): Promise<HostCapsule | null>;
243
+ export declare function createHostWorkflowCard(input: HostWorkflowCardCreateInput, now?: () => Date): Promise<HostWorkflowCard>;
244
+ export declare function updateHostWorkflowCard(input: HostWorkflowCardUpdateInput, now?: () => Date): Promise<HostWorkflowCard>;
245
+ export declare function listHostWorkflowCards(input?: HostWorkflowCardListInput): Promise<HostWorkflowCard[]>;
246
+ export declare function formatHostWorkflowCards(cards: HostWorkflowCard[]): string;
247
+ export declare function formatHostTasks(tasks: HostTask[]): string;
248
+ export declare function formatHostCapsules(capsules: HostCapsule[]): string;
249
+ export declare function formatHostAgenda(agenda: Pick<HostAgenda, "tasks" | "readyCount" | "blockedCount">): string;
250
+ export interface HostLedgerCompactResult {
251
+ tasks: CompactJsonlResult;
252
+ capsules: CompactJsonlResult;
253
+ workflow: CompactJsonlResult;
254
+ }
255
+ /**
256
+ * Rewrite the append-only task, capsule, and workflow logs into their merged latest-state
257
+ * snapshots. The result is observationally identical to the pre-compaction ledger but drops
258
+ * superseded update records, bounding unbounded log growth from long multi-role runs.
259
+ */
260
+ export declare function compactHostLedger(input?: HostLedgerPathInput): Promise<HostLedgerCompactResult>;
261
+ export declare function formatHostLedgerCompact(result: HostLedgerCompactResult): string;