orbitmap 0.3.0 → 0.4.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 (174) hide show
  1. package/README.md +546 -212
  2. package/dist/adapters/cloud.d.ts +367 -0
  3. package/dist/adapters/cloud.js +582 -0
  4. package/dist/adapters/cloud.js.map +1 -0
  5. package/dist/adapters/factory.d.ts +15 -0
  6. package/dist/adapters/factory.js +31 -0
  7. package/dist/adapters/factory.js.map +1 -0
  8. package/dist/adapters/local/adapter.d.ts +351 -0
  9. package/dist/adapters/local/adapter.js +346 -0
  10. package/dist/adapters/local/adapter.js.map +1 -0
  11. package/dist/adapters/local/context.d.ts +112 -0
  12. package/dist/adapters/local/context.js +137 -0
  13. package/dist/adapters/local/context.js.map +1 -0
  14. package/dist/adapters/local/entities/documents.d.ts +85 -0
  15. package/dist/adapters/local/entities/documents.js +251 -0
  16. package/dist/adapters/local/entities/documents.js.map +1 -0
  17. package/dist/adapters/local/entities/planning.d.ts +108 -0
  18. package/dist/adapters/local/entities/planning.js +540 -0
  19. package/dist/adapters/local/entities/planning.js.map +1 -0
  20. package/dist/adapters/local/entities/tasks.d.ts +95 -0
  21. package/dist/adapters/local/entities/tasks.js +442 -0
  22. package/dist/adapters/local/entities/tasks.js.map +1 -0
  23. package/dist/adapters/local/entities/work-items.d.ts +110 -0
  24. package/dist/adapters/local/entities/work-items.js +623 -0
  25. package/dist/adapters/local/entities/work-items.js.map +1 -0
  26. package/dist/adapters/local/rules.d.ts +172 -0
  27. package/dist/adapters/local/rules.js +319 -0
  28. package/dist/adapters/local/rules.js.map +1 -0
  29. package/dist/adapters/local/shapes.d.ts +209 -0
  30. package/dist/adapters/local/shapes.js +558 -0
  31. package/dist/adapters/local/shapes.js.map +1 -0
  32. package/dist/adapters/local/store.d.ts +200 -0
  33. package/dist/adapters/local/store.js +665 -0
  34. package/dist/adapters/local/store.js.map +1 -0
  35. package/dist/adapters/local/types.d.ts +226 -0
  36. package/dist/adapters/local/types.js +41 -0
  37. package/dist/adapters/local/types.js.map +1 -0
  38. package/dist/adapters/types.d.ts +332 -0
  39. package/dist/adapters/types.js +2 -0
  40. package/dist/adapters/types.js.map +1 -0
  41. package/dist/agent-instructions.d.ts +25 -9
  42. package/dist/agent-instructions.js +285 -237
  43. package/dist/agent-instructions.js.map +1 -1
  44. package/dist/api-client.d.ts +8 -239
  45. package/dist/api-client.js +8 -403
  46. package/dist/api-client.js.map +1 -1
  47. package/dist/commands/agents.d.ts +1 -1
  48. package/dist/commands/agents.js +10 -10
  49. package/dist/commands/agents.js.map +1 -1
  50. package/dist/commands/areas.d.ts +3 -0
  51. package/dist/commands/areas.js +29 -0
  52. package/dist/commands/areas.js.map +1 -0
  53. package/dist/commands/assign.d.ts +3 -2
  54. package/dist/commands/assign.js +52 -15
  55. package/dist/commands/assign.js.map +1 -1
  56. package/dist/commands/context.d.ts +1 -1
  57. package/dist/commands/context.js +18 -12
  58. package/dist/commands/context.js.map +1 -1
  59. package/dist/commands/create-area.d.ts +7 -0
  60. package/dist/commands/create-area.js +29 -0
  61. package/dist/commands/create-area.js.map +1 -0
  62. package/dist/commands/create.d.ts +3 -1
  63. package/dist/commands/create.js +5 -8
  64. package/dist/commands/create.js.map +1 -1
  65. package/dist/commands/dep.d.ts +2 -2
  66. package/dist/commands/dep.js +3 -3
  67. package/dist/commands/dep.js.map +1 -1
  68. package/dist/commands/doc-import.d.ts +1 -1
  69. package/dist/commands/doc-import.js +2 -2
  70. package/dist/commands/doc-import.js.map +1 -1
  71. package/dist/commands/doc-patch.d.ts +1 -1
  72. package/dist/commands/doc-patch.js +2 -2
  73. package/dist/commands/doc-patch.js.map +1 -1
  74. package/dist/commands/doc-share.d.ts +6 -6
  75. package/dist/commands/doc-share.js +13 -13
  76. package/dist/commands/doc-share.js.map +1 -1
  77. package/dist/commands/doc-update.d.ts +1 -1
  78. package/dist/commands/doc-update.js +2 -2
  79. package/dist/commands/doc-update.js.map +1 -1
  80. package/dist/commands/doc.d.ts +1 -1
  81. package/dist/commands/doc.js +5 -4
  82. package/dist/commands/doc.js.map +1 -1
  83. package/dist/commands/docs-cache.d.ts +2 -2
  84. package/dist/commands/docs-cache.js +3 -3
  85. package/dist/commands/docs-cache.js.map +1 -1
  86. package/dist/commands/docs.d.ts +1 -1
  87. package/dist/commands/docs.js +2 -2
  88. package/dist/commands/docs.js.map +1 -1
  89. package/dist/commands/get.d.ts +1 -1
  90. package/dist/commands/get.js +43 -3
  91. package/dist/commands/get.js.map +1 -1
  92. package/dist/commands/ideas.d.ts +4 -4
  93. package/dist/commands/ideas.js +6 -11
  94. package/dist/commands/ideas.js.map +1 -1
  95. package/dist/commands/init.d.ts +45 -3
  96. package/dist/commands/init.js +452 -104
  97. package/dist/commands/init.js.map +1 -1
  98. package/dist/commands/intent.d.ts +41 -0
  99. package/dist/commands/intent.js +237 -0
  100. package/dist/commands/intent.js.map +1 -0
  101. package/dist/commands/issues.d.ts +6 -5
  102. package/dist/commands/issues.js +8 -12
  103. package/dist/commands/issues.js.map +1 -1
  104. package/dist/commands/log.d.ts +1 -1
  105. package/dist/commands/log.js +2 -2
  106. package/dist/commands/log.js.map +1 -1
  107. package/dist/commands/mission.d.ts +42 -0
  108. package/dist/commands/mission.js +219 -0
  109. package/dist/commands/mission.js.map +1 -0
  110. package/dist/commands/orbit.d.ts +40 -3
  111. package/dist/commands/orbit.js +231 -58
  112. package/dist/commands/orbit.js.map +1 -1
  113. package/dist/commands/overview.d.ts +2 -2
  114. package/dist/commands/overview.js +25 -28
  115. package/dist/commands/overview.js.map +1 -1
  116. package/dist/commands/setup-agent.d.ts +27 -0
  117. package/dist/commands/setup-agent.js +85 -30
  118. package/dist/commands/setup-agent.js.map +1 -1
  119. package/dist/commands/setup-mcp.d.ts +1 -1
  120. package/dist/commands/setup-mcp.js +20 -49
  121. package/dist/commands/setup-mcp.js.map +1 -1
  122. package/dist/commands/start.d.ts +1 -1
  123. package/dist/commands/start.js +2 -2
  124. package/dist/commands/start.js.map +1 -1
  125. package/dist/commands/status.d.ts +2 -1
  126. package/dist/commands/status.js +3 -3
  127. package/dist/commands/status.js.map +1 -1
  128. package/dist/commands/subtask.d.ts +1 -1
  129. package/dist/commands/subtask.js +2 -2
  130. package/dist/commands/subtask.js.map +1 -1
  131. package/dist/commands/task-edit-content.d.ts +1 -1
  132. package/dist/commands/task-edit-content.js +2 -2
  133. package/dist/commands/task-edit-content.js.map +1 -1
  134. package/dist/commands/task.d.ts +10 -3
  135. package/dist/commands/task.js +19 -21
  136. package/dist/commands/task.js.map +1 -1
  137. package/dist/commands/tasks.d.ts +1 -1
  138. package/dist/commands/tasks.js +2 -2
  139. package/dist/commands/tasks.js.map +1 -1
  140. package/dist/commands/vibes.d.ts +4 -4
  141. package/dist/commands/vibes.js +5 -5
  142. package/dist/commands/vibes.js.map +1 -1
  143. package/dist/config.d.ts +69 -9
  144. package/dist/config.js +206 -23
  145. package/dist/config.js.map +1 -1
  146. package/dist/doc-cache.d.ts +23 -3
  147. package/dist/doc-cache.js +72 -12
  148. package/dist/doc-cache.js.map +1 -1
  149. package/dist/errors.d.ts +19 -2
  150. package/dist/errors.js +35 -0
  151. package/dist/errors.js.map +1 -1
  152. package/dist/id-resolve.d.ts +61 -0
  153. package/dist/id-resolve.js +87 -0
  154. package/dist/id-resolve.js.map +1 -0
  155. package/dist/index.js +477 -104
  156. package/dist/index.js.map +1 -1
  157. package/dist/mcp-config.d.ts +36 -0
  158. package/dist/mcp-config.js +51 -0
  159. package/dist/mcp-config.js.map +1 -0
  160. package/dist/oauth.d.ts +8 -0
  161. package/dist/oauth.js +54 -15
  162. package/dist/oauth.js.map +1 -1
  163. package/dist/output.js +7 -2
  164. package/dist/output.js.map +1 -1
  165. package/dist/paths.d.ts +97 -0
  166. package/dist/paths.js +178 -0
  167. package/dist/paths.js.map +1 -0
  168. package/dist/project-config.d.ts +75 -0
  169. package/dist/project-config.js +55 -0
  170. package/dist/project-config.js.map +1 -0
  171. package/dist/workspace-resolve.d.ts +158 -0
  172. package/dist/workspace-resolve.js +284 -0
  173. package/dist/workspace-resolve.js.map +1 -0
  174. package/package.json +53 -50
@@ -0,0 +1,209 @@
1
+ /**
2
+ * Envelope builders for local mode (spec §2.2).
3
+ *
4
+ * Everything the LocalAdapter returns is produced here, byte-shape-compatible with the
5
+ * Agent API envelopes the golden fixtures in `tests/contract/fixtures/` describe:
6
+ * same field names, same nesting, same enums. Fields the local store cannot know
7
+ * (server-only concepts) are filled with the stable placeholders of §2.2 — never omitted.
8
+ *
9
+ * Pure functions only: no file I/O, no validation (that is `rules.ts`).
10
+ */
11
+ import type { AreaFile, DocumentRecord, IntentRecord, MissionRecord, TaskRecord, WorkspaceFile } from './types.js';
12
+ /**
13
+ * The API splits an entity number into `task_number` (the bare code) and
14
+ * `display_number` (`TS-<code>`); locally we store the prefixed form.
15
+ */
16
+ export declare function stripEntityPrefix(entityNumber: string): string;
17
+ /** The implicit local agent, in the `/context` agent shape. */
18
+ export declare function agentShape(): {
19
+ id: string;
20
+ name: string;
21
+ slug: string;
22
+ introduction: string;
23
+ };
24
+ /** Workspace as embedded in `areas` list items. */
25
+ export declare function workspaceShape(workspace: WorkspaceFile): {
26
+ id: string;
27
+ name: string;
28
+ slug: string;
29
+ };
30
+ /** Workspace as embedded in the task-detail `area` block (adds `docs_tenant_id`). */
31
+ export declare function workspaceShapeWithTenant(workspace: WorkspaceFile): {
32
+ id: string;
33
+ name: string;
34
+ slug: string;
35
+ docs_tenant_id: null;
36
+ };
37
+ /** Area block of `/context`. */
38
+ export declare function contextAreaShape(area: AreaFile): {
39
+ id: string;
40
+ name: string;
41
+ slug: string;
42
+ description: string | null;
43
+ git_url: string | null;
44
+ default_branch: string;
45
+ };
46
+ /** One row of the `areas` list. */
47
+ export declare function areaListItem(area: AreaFile, workspace: WorkspaceFile, current: boolean): Record<string, unknown>;
48
+ /** `GET /areas` envelope. */
49
+ export declare function areasListEnvelope(areas: readonly AreaFile[], workspace: WorkspaceFile, currentSlug?: string): {
50
+ data: Array<Record<string, unknown>>;
51
+ meta: {
52
+ count: number;
53
+ };
54
+ };
55
+ /** `POST /areas` envelope (create-area). */
56
+ export declare function areaCreateEnvelope(area: AreaFile, workspace: WorkspaceFile): {
57
+ data: Record<string, unknown>;
58
+ };
59
+ /** `GET /areas/{id}/members` envelope — exactly `me` + `local-agent` (spec §1). */
60
+ export declare function areaMembersEnvelope(): {
61
+ data: {
62
+ agents: Array<Record<string, unknown>>;
63
+ users: Array<Record<string, unknown>>;
64
+ };
65
+ meta: {
66
+ agents_count: number;
67
+ users_count: number;
68
+ };
69
+ };
70
+ /** Task counts by status, plus `total` — the `task_stats` block of the overview. */
71
+ export declare function taskStats(tasks: readonly TaskRecord[]): Record<string, number>;
72
+ /** `GET /areas/{id}/overview` envelope. */
73
+ export declare function areaOverviewEnvelope(area: AreaFile, tasks: readonly TaskRecord[]): {
74
+ data: Record<string, unknown>;
75
+ };
76
+ /** Number of `##` headings in a document body (the API's `sections_count`). */
77
+ export declare function countSections(body: string): number;
78
+ /** Document entry as embedded in `/context` and task detail. */
79
+ export declare function documentEntry(document: DocumentRecord, body: string): Record<string, unknown>;
80
+ export interface ContextInput {
81
+ workspace: WorkspaceFile;
82
+ area?: AreaFile;
83
+ activeMission?: MissionRecord | null;
84
+ tasks: readonly TaskRecord[];
85
+ documents: readonly Record<string, unknown>[];
86
+ }
87
+ /** `GET /context` envelope. */
88
+ export declare function contextEnvelope(input: ContextInput): {
89
+ data: Record<string, unknown>;
90
+ };
91
+ /** One row of `GET /tasks`. */
92
+ export declare function taskListItem(task: TaskRecord, description: string | null): Record<string, unknown>;
93
+ /** `GET /tasks` envelope. */
94
+ export declare function tasksListEnvelope(items: Array<Record<string, unknown>>): {
95
+ data: Array<Record<string, unknown>>;
96
+ meta: {
97
+ count: number;
98
+ };
99
+ };
100
+ /** The `task` block of the task-detail envelope. */
101
+ export declare function taskShape(task: TaskRecord, area: AreaFile, description: string | null): Record<string, unknown>;
102
+ /** Compact task shape used for subtasks and dependency references. */
103
+ export declare function taskSummary(task: TaskRecord): Record<string, unknown>;
104
+ export interface TaskDetailInput {
105
+ task: TaskRecord;
106
+ area: AreaFile;
107
+ workspace: WorkspaceFile;
108
+ description: string | null;
109
+ logs: readonly WorkLogEntry[];
110
+ subtasks: readonly TaskRecord[];
111
+ dependsOn: readonly TaskRecord[];
112
+ blocks: readonly TaskRecord[];
113
+ related: readonly TaskRecord[];
114
+ documents?: readonly Record<string, unknown>[];
115
+ }
116
+ /** `data` of `GET /tasks/{id}` — also the payload `start` returns. */
117
+ export declare function taskDetailData(input: TaskDetailInput): Record<string, unknown>;
118
+ /** `GET /tasks/{id}` envelope. */
119
+ export declare function taskDetailEnvelope(input: TaskDetailInput): {
120
+ data: Record<string, unknown>;
121
+ };
122
+ /** `POST /tasks` envelope. */
123
+ export declare function taskCreateEnvelope(task: TaskRecord, area: AreaFile, options?: {
124
+ sourceIssueNumber?: string | null;
125
+ }): {
126
+ data: Record<string, unknown>;
127
+ };
128
+ /** `PATCH /tasks/{id}/status` envelope. */
129
+ export declare function taskStatusEnvelope(task: TaskRecord): {
130
+ data: Record<string, unknown>;
131
+ };
132
+ /** `POST /tasks/{id}/subtasks` envelope. */
133
+ export declare function subtasksEnvelope(parent: TaskRecord, subtasks: readonly TaskRecord[]): {
134
+ data: Record<string, unknown>;
135
+ };
136
+ /** `PATCH /tasks/{id}/content` envelope. */
137
+ export declare function taskContentEnvelope(task: TaskRecord, updatedFields: readonly string[], description: string | null): {
138
+ data: Record<string, unknown>;
139
+ };
140
+ /** `POST /tasks/{id}/assign` envelope. */
141
+ export declare function assignTaskEnvelope(task: TaskRecord): {
142
+ data: Record<string, unknown>;
143
+ };
144
+ /** `POST /assign` (generic item assignment) envelope. */
145
+ export declare function assignItemEnvelope(id: string, assignedAgent: string | null, assignedUser: string | null): {
146
+ data: Record<string, unknown>;
147
+ };
148
+ /** `POST /tasks/{id}/dependencies` envelope. */
149
+ export declare function dependencyAddEnvelope(task: TaskRecord, target: TaskRecord, type: string, note: string | null): {
150
+ data: Record<string, unknown>;
151
+ };
152
+ /** `DELETE /tasks/{id}/dependencies/{target}` envelope. */
153
+ export declare function dependencyRemoveEnvelope(task: TaskRecord, target: TaskRecord, type: string): {
154
+ data: Record<string, unknown>;
155
+ };
156
+ /** `POST /tasks/{id}/logs` envelope. */
157
+ export declare function logWorkEnvelope(logId: string, task: TaskRecord, type: string): {
158
+ data: Record<string, unknown>;
159
+ };
160
+ /** One parsed `### <iso> · <type> · <author>` work-log entry. */
161
+ export interface WorkLogEntry {
162
+ created_at: string;
163
+ type: string;
164
+ author: string;
165
+ content: string;
166
+ }
167
+ /**
168
+ * Split a task body into its description text and the *raw* work-log section
169
+ * (starting at the `## Work Log` heading). The work-log slice is returned verbatim so
170
+ * rewrites never reflow existing entries (spec §4.5).
171
+ */
172
+ export declare function splitTaskBody(body: string): {
173
+ description: string;
174
+ workLog: string;
175
+ };
176
+ /** The task description, or `null` when the body carries none. */
177
+ export declare function parseDescription(body: string): string | null;
178
+ /** Parse the `## Work Log` section into entries, oldest first. */
179
+ export declare function parseWorkLog(body: string): WorkLogEntry[];
180
+ /** Build the initial body of a new task file. */
181
+ export declare function buildTaskBody(description?: string | null): string;
182
+ /** Replace the description while preserving the work-log section byte-for-byte. */
183
+ export declare function replaceDescription(body: string, description: string): string;
184
+ /**
185
+ * Append one work-log entry. The existing body — including every earlier entry — is
186
+ * copied verbatim; only new bytes are added at the end (spec §4.5, append-only).
187
+ */
188
+ export declare function appendWorkLogEntry(body: string, entry: WorkLogEntry): string;
189
+ /** Work-log entry in the API's `logs[]` shape. */
190
+ export declare function workLogEntryShape(entry: WorkLogEntry, task: TaskRecord, index: number): Record<string, unknown>;
191
+ /** `GET /prompts/work-on-next-task` envelope, built from local records. */
192
+ export declare function workPromptEnvelope(area: AreaFile, task: TaskRecord | null, description: string | null): {
193
+ data: {
194
+ content: string;
195
+ has_task: boolean;
196
+ };
197
+ };
198
+ /** `GET /prompts/import-docs` envelope. */
199
+ export declare function importDocsPromptEnvelope(area: AreaFile): {
200
+ data: {
201
+ content: string;
202
+ };
203
+ };
204
+ /** The active mission of the workspace, or `null`. */
205
+ export declare function findActiveMission(missions: readonly MissionRecord[]): MissionRecord | null;
206
+ /** Intent numbers, for reference validation (rules.ts rule 3). */
207
+ export declare function intentNumbers(intents: readonly IntentRecord[]): string[];
208
+ /** Mission numbers, for reference validation (rules.ts rule 3). */
209
+ export declare function missionNumbers(missions: readonly MissionRecord[]): string[];