indusagi-coding-agent 0.1.28 → 0.1.30

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 (147) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/LICENSE.md +22 -0
  3. package/README.md +2 -0
  4. package/dist/core/messages.d.ts +1 -76
  5. package/dist/core/messages.d.ts.map +1 -1
  6. package/dist/core/messages.js +1 -122
  7. package/dist/core/messages.js.map +1 -1
  8. package/dist/core/session-manager.d.ts +1 -447
  9. package/dist/core/session-manager.d.ts.map +1 -1
  10. package/dist/core/session-manager.js +1 -1203
  11. package/dist/core/session-manager.js.map +1 -1
  12. package/package.json +2 -2
  13. package/docs/COMPLETE-GUIDE.md +0 -300
  14. package/docs/COMPREHENSIVE-CLI-SUMMARY.md +0 -900
  15. package/docs/MODES-ARCHITECTURE.md +0 -565
  16. package/docs/PRINT-MODE-GUIDE.md +0 -456
  17. package/docs/README.md +0 -78
  18. package/docs/RPC-GUIDE.md +0 -705
  19. package/docs/UTILS-IMPLEMENTATION-SUMMARY.md +0 -647
  20. package/docs/UTILS-MODULE-OVERVIEW.md +0 -1480
  21. package/docs/UTILS-QA-CHECKLIST.md +0 -1061
  22. package/docs/UTILS-USAGE-GUIDE.md +0 -1419
  23. package/docs/compaction.md +0 -390
  24. package/docs/custom-provider.md +0 -538
  25. package/docs/development.md +0 -69
  26. package/docs/extensions.md +0 -1733
  27. package/docs/hooks.md +0 -378
  28. package/docs/images/doom-extension.png +0 -0
  29. package/docs/images/interactive-mode.png +0 -0
  30. package/docs/images/tree-view.png +0 -0
  31. package/docs/json.md +0 -79
  32. package/docs/keybindings.md +0 -162
  33. package/docs/models.md +0 -193
  34. package/docs/packages.md +0 -163
  35. package/docs/prompt-templates.md +0 -67
  36. package/docs/providers.md +0 -147
  37. package/docs/rpc.md +0 -1048
  38. package/docs/sdk.md +0 -969
  39. package/docs/session.md +0 -412
  40. package/docs/settings.md +0 -219
  41. package/docs/shell-aliases.md +0 -13
  42. package/docs/skills.md +0 -226
  43. package/docs/subagents.md +0 -225
  44. package/docs/terminal-setup.md +0 -65
  45. package/docs/themes.md +0 -295
  46. package/docs/tree.md +0 -219
  47. package/docs/tui.md +0 -887
  48. package/docs/web-tools.md +0 -304
  49. package/docs/windows.md +0 -17
  50. package/examples/README.md +0 -25
  51. package/examples/extensions/README.md +0 -192
  52. package/examples/extensions/antigravity-image-gen.ts +0 -414
  53. package/examples/extensions/auto-commit-on-exit.ts +0 -49
  54. package/examples/extensions/bookmark.ts +0 -50
  55. package/examples/extensions/claude-rules.ts +0 -86
  56. package/examples/extensions/confirm-destructive.ts +0 -59
  57. package/examples/extensions/custom-compaction.ts +0 -115
  58. package/examples/extensions/custom-footer.ts +0 -65
  59. package/examples/extensions/custom-header.ts +0 -73
  60. package/examples/extensions/custom-provider-anthropic/index.ts +0 -605
  61. package/examples/extensions/custom-provider-anthropic/package-lock.json +0 -24
  62. package/examples/extensions/custom-provider-anthropic/package.json +0 -19
  63. package/examples/extensions/custom-provider-gitlab-duo/index.ts +0 -350
  64. package/examples/extensions/custom-provider-gitlab-duo/package.json +0 -16
  65. package/examples/extensions/custom-provider-gitlab-duo/test.ts +0 -83
  66. package/examples/extensions/dirty-repo-guard.ts +0 -56
  67. package/examples/extensions/doom-overlay/README.md +0 -46
  68. package/examples/extensions/doom-overlay/doom/build/doom.js +0 -21
  69. package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
  70. package/examples/extensions/doom-overlay/doom/build.sh +0 -152
  71. package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +0 -72
  72. package/examples/extensions/doom-overlay/doom-component.ts +0 -133
  73. package/examples/extensions/doom-overlay/doom-engine.ts +0 -173
  74. package/examples/extensions/doom-overlay/doom-keys.ts +0 -105
  75. package/examples/extensions/doom-overlay/index.ts +0 -74
  76. package/examples/extensions/doom-overlay/wad-finder.ts +0 -51
  77. package/examples/extensions/event-bus.ts +0 -43
  78. package/examples/extensions/file-trigger.ts +0 -41
  79. package/examples/extensions/git-checkpoint.ts +0 -53
  80. package/examples/extensions/handoff.ts +0 -151
  81. package/examples/extensions/hello.ts +0 -25
  82. package/examples/extensions/inline-bash.ts +0 -94
  83. package/examples/extensions/input-transform.ts +0 -43
  84. package/examples/extensions/interactive-shell.ts +0 -196
  85. package/examples/extensions/mac-system-theme.ts +0 -47
  86. package/examples/extensions/message-renderer.ts +0 -60
  87. package/examples/extensions/modal-editor.ts +0 -86
  88. package/examples/extensions/model-status.ts +0 -31
  89. package/examples/extensions/notify.ts +0 -25
  90. package/examples/extensions/overlay-qa-tests.ts +0 -882
  91. package/examples/extensions/overlay-test.ts +0 -151
  92. package/examples/extensions/permission-gate.ts +0 -34
  93. package/examples/extensions/pirate.ts +0 -47
  94. package/examples/extensions/plan-mode/README.md +0 -65
  95. package/examples/extensions/plan-mode/index.ts +0 -341
  96. package/examples/extensions/plan-mode/utils.ts +0 -168
  97. package/examples/extensions/preset.ts +0 -399
  98. package/examples/extensions/protected-paths.ts +0 -30
  99. package/examples/extensions/qna.ts +0 -120
  100. package/examples/extensions/question.ts +0 -265
  101. package/examples/extensions/questionnaire.ts +0 -428
  102. package/examples/extensions/rainbow-editor.ts +0 -88
  103. package/examples/extensions/sandbox/index.ts +0 -318
  104. package/examples/extensions/sandbox/package-lock.json +0 -92
  105. package/examples/extensions/sandbox/package.json +0 -19
  106. package/examples/extensions/send-user-message.ts +0 -97
  107. package/examples/extensions/session-name.ts +0 -27
  108. package/examples/extensions/shutdown-command.ts +0 -63
  109. package/examples/extensions/snake.ts +0 -344
  110. package/examples/extensions/space-invaders.ts +0 -561
  111. package/examples/extensions/ssh.ts +0 -220
  112. package/examples/extensions/status-line.ts +0 -40
  113. package/examples/extensions/subagent/README.md +0 -172
  114. package/examples/extensions/subagent/agents/planner.md +0 -37
  115. package/examples/extensions/subagent/agents/reviewer.md +0 -35
  116. package/examples/extensions/subagent/agents/scout.md +0 -50
  117. package/examples/extensions/subagent/agents/worker.md +0 -24
  118. package/examples/extensions/subagent/agents.ts +0 -127
  119. package/examples/extensions/subagent/index.ts +0 -964
  120. package/examples/extensions/subagent/prompts/implement-and-review.md +0 -10
  121. package/examples/extensions/subagent/prompts/implement.md +0 -10
  122. package/examples/extensions/subagent/prompts/scout-and-plan.md +0 -9
  123. package/examples/extensions/summarize.ts +0 -196
  124. package/examples/extensions/timed-confirm.ts +0 -70
  125. package/examples/extensions/todo.ts +0 -300
  126. package/examples/extensions/tool-override.ts +0 -144
  127. package/examples/extensions/tools.ts +0 -147
  128. package/examples/extensions/trigger-compact.ts +0 -40
  129. package/examples/extensions/truncated-tool.ts +0 -193
  130. package/examples/extensions/widget-placement.ts +0 -17
  131. package/examples/extensions/with-deps/index.ts +0 -36
  132. package/examples/extensions/with-deps/package-lock.json +0 -31
  133. package/examples/extensions/with-deps/package.json +0 -22
  134. package/examples/sdk/01-minimal.ts +0 -22
  135. package/examples/sdk/02-custom-model.ts +0 -50
  136. package/examples/sdk/03-custom-prompt.ts +0 -55
  137. package/examples/sdk/04-skills.ts +0 -46
  138. package/examples/sdk/05-tools.ts +0 -56
  139. package/examples/sdk/06-extensions.ts +0 -88
  140. package/examples/sdk/07-context-files.ts +0 -40
  141. package/examples/sdk/08-prompt-templates.ts +0 -47
  142. package/examples/sdk/09-api-keys-and-oauth.ts +0 -48
  143. package/examples/sdk/10-settings.ts +0 -38
  144. package/examples/sdk/11-sessions.ts +0 -48
  145. package/examples/sdk/12-full-control.ts +0 -82
  146. package/examples/sdk/13-codex-oauth.ts +0 -37
  147. package/examples/sdk/README.md +0 -144
package/docs/session.md DELETED
@@ -1,412 +0,0 @@
1
- # Session File Format
2
-
3
- Sessions are stored as JSONL (JSON Lines) files. Each line is a JSON object with a `type` field. Session entries form a tree structure via `id`/`parentId` fields, enabling in-place branching without creating new files.
4
-
5
- ## File Location
6
-
7
- ```
8
- ~/.indusagi/agent/sessions/--<path>--/<timestamp>_<uuid>.jsonl
9
- ```
10
-
11
- Where `<path>` is the working directory with `/` replaced by `-`.
12
-
13
- ## Deleting Sessions
14
-
15
- Sessions can be removed by deleting their `.jsonl` files under `~/.indusagi/agent/sessions/`.
16
-
17
- Indusagi also supports deleting sessions interactively from `/resume` (select a session and press `Ctrl+D`, then confirm). When available, indusagi uses the `trash` CLI to avoid permanent deletion.
18
-
19
- ## Session Version
20
-
21
- Sessions have a version field in the header:
22
-
23
- - **Version 1**: Linear entry sequence (legacy, auto-migrated on load)
24
- - **Version 2**: Tree structure with `id`/`parentId` linking
25
- - **Version 3**: Renamed `hookMessage` role to `custom` (extensions unification)
26
-
27
- Existing sessions are automatically migrated to the current version (v3) when loaded.
28
-
29
- ## Source Files
30
-
31
- Source on GitHub ([indusagi-mono](https://github.com/badlogic/indusagi-mono)):
32
- - [`packages/coding-agent/src/core/session-manager.ts`](https://github.com/badlogic/indusagi-mono/blob/main/packages/coding-agent/src/core/session-manager.ts) - Session entry types and SessionManager
33
- - [`packages/coding-agent/src/core/messages.ts`](https://github.com/badlogic/indusagi-mono/blob/main/packages/coding-agent/src/core/messages.ts) - Extended message types (BashExecutionMessage, CustomMessage, etc.)
34
- - [`packages/ai/src/types.ts`](https://github.com/badlogic/indusagi-mono/blob/main/packages/ai/src/types.ts) - Base message types (UserMessage, AssistantMessage, ToolResultMessage)
35
- - [`packages/agent/src/types.ts`](https://github.com/badlogic/indusagi-mono/blob/main/packages/agent/src/types.ts) - AgentMessage union type
36
-
37
- For TypeScript definitions in your project, inspect `node_modules/indusagi-coding-agent/dist/` and `node_modules/indusagi-ai/dist/`.
38
-
39
- ## Message Types
40
-
41
- Session entries contain `AgentMessage` objects. Understanding these types is essential for parsing sessions and writing extensions.
42
-
43
- ### Content Blocks
44
-
45
- Messages contain arrays of typed content blocks:
46
-
47
- ```typescript
48
- interface TextContent {
49
- type: "text";
50
- text: string;
51
- }
52
-
53
- interface ImageContent {
54
- type: "image";
55
- data: string; // base64 encoded
56
- mimeType: string; // e.g., "image/jpeg", "image/png"
57
- }
58
-
59
- interface ThinkingContent {
60
- type: "thinking";
61
- thinking: string;
62
- }
63
-
64
- interface ToolCall {
65
- type: "toolCall";
66
- id: string;
67
- name: string;
68
- arguments: Record<string, any>;
69
- }
70
- ```
71
-
72
- ### Base Message Types (from indusagi-ai)
73
-
74
- ```typescript
75
- interface UserMessage {
76
- role: "user";
77
- content: string | (TextContent | ImageContent)[];
78
- timestamp: number; // Unix ms
79
- }
80
-
81
- interface AssistantMessage {
82
- role: "assistant";
83
- content: (TextContent | ThinkingContent | ToolCall)[];
84
- api: string;
85
- provider: string;
86
- model: string;
87
- usage: Usage;
88
- stopReason: "stop" | "length" | "toolUse" | "error" | "aborted";
89
- errorMessage?: string;
90
- timestamp: number;
91
- }
92
-
93
- interface ToolResultMessage {
94
- role: "toolResult";
95
- toolCallId: string;
96
- toolName: string;
97
- content: (TextContent | ImageContent)[];
98
- details?: any; // Tool-specific metadata
99
- isError: boolean;
100
- timestamp: number;
101
- }
102
-
103
- interface Usage {
104
- input: number;
105
- output: number;
106
- cacheRead: number;
107
- cacheWrite: number;
108
- totalTokens: number;
109
- cost: {
110
- input: number;
111
- output: number;
112
- cacheRead: number;
113
- cacheWrite: number;
114
- total: number;
115
- };
116
- }
117
- ```
118
-
119
- ### Extended Message Types (from indusagi-coding-agent)
120
-
121
- ```typescript
122
- interface BashExecutionMessage {
123
- role: "bashExecution";
124
- command: string;
125
- output: string;
126
- exitCode: number | undefined;
127
- cancelled: boolean;
128
- truncated: boolean;
129
- fullOutputPath?: string;
130
- excludeFromContext?: boolean; // true for !! prefix commands
131
- timestamp: number;
132
- }
133
-
134
- interface CustomMessage {
135
- role: "custom";
136
- customType: string; // Extension identifier
137
- content: string | (TextContent | ImageContent)[];
138
- display: boolean; // Show in TUI
139
- details?: any; // Extension-specific metadata
140
- timestamp: number;
141
- }
142
-
143
- interface BranchSummaryMessage {
144
- role: "branchSummary";
145
- summary: string;
146
- fromId: string; // Entry we branched from
147
- timestamp: number;
148
- }
149
-
150
- interface CompactionSummaryMessage {
151
- role: "compactionSummary";
152
- summary: string;
153
- tokensBefore: number;
154
- timestamp: number;
155
- }
156
- ```
157
-
158
- ### AgentMessage Union
159
-
160
- ```typescript
161
- type AgentMessage =
162
- | UserMessage
163
- | AssistantMessage
164
- | ToolResultMessage
165
- | BashExecutionMessage
166
- | CustomMessage
167
- | BranchSummaryMessage
168
- | CompactionSummaryMessage;
169
- ```
170
-
171
- ## Entry Base
172
-
173
- All entries (except `SessionHeader`) extend `SessionEntryBase`:
174
-
175
- ```typescript
176
- interface SessionEntryBase {
177
- type: string;
178
- id: string; // 8-char hex ID
179
- parentId: string | null; // Parent entry ID (null for first entry)
180
- timestamp: string; // ISO timestamp
181
- }
182
- ```
183
-
184
- ## Entry Types
185
-
186
- ### SessionHeader
187
-
188
- First line of the file. Metadata only, not part of the tree (no `id`/`parentId`).
189
-
190
- ```json
191
- {"type":"session","version":3,"id":"uuid","timestamp":"2024-12-03T14:00:00.000Z","cwd":"/path/to/project"}
192
- ```
193
-
194
- For sessions with a parent (created via `/fork` or `newSession({ parentSession })`):
195
-
196
- ```json
197
- {"type":"session","version":3,"id":"uuid","timestamp":"2024-12-03T14:00:00.000Z","cwd":"/path/to/project","parentSession":"/path/to/original/session.jsonl"}
198
- ```
199
-
200
- ### SessionMessageEntry
201
-
202
- A message in the conversation. The `message` field contains an `AgentMessage`.
203
-
204
- ```json
205
- {"type":"message","id":"a1b2c3d4","parentId":"prev1234","timestamp":"2024-12-03T14:00:01.000Z","message":{"role":"user","content":"Hello"}}
206
- {"type":"message","id":"b2c3d4e5","parentId":"a1b2c3d4","timestamp":"2024-12-03T14:00:02.000Z","message":{"role":"assistant","content":[{"type":"text","text":"Hi!"}],"provider":"anthropic","model":"claude-sonnet-4-5","usage":{...},"stopReason":"stop"}}
207
- {"type":"message","id":"c3d4e5f6","parentId":"b2c3d4e5","timestamp":"2024-12-03T14:00:03.000Z","message":{"role":"toolResult","toolCallId":"call_123","toolName":"bash","content":[{"type":"text","text":"output"}],"isError":false}}
208
- ```
209
-
210
- ### ModelChangeEntry
211
-
212
- Emitted when the user switches models mid-session.
213
-
214
- ```json
215
- {"type":"model_change","id":"d4e5f6g7","parentId":"c3d4e5f6","timestamp":"2024-12-03T14:05:00.000Z","provider":"openai","modelId":"gpt-4o"}
216
- ```
217
-
218
- ### ThinkingLevelChangeEntry
219
-
220
- Emitted when the user changes the thinking/reasoning level.
221
-
222
- ```json
223
- {"type":"thinking_level_change","id":"e5f6g7h8","parentId":"d4e5f6g7","timestamp":"2024-12-03T14:06:00.000Z","thinkingLevel":"high"}
224
- ```
225
-
226
- ### CompactionEntry
227
-
228
- Created when context is compacted. Stores a summary of earlier messages.
229
-
230
- ```json
231
- {"type":"compaction","id":"f6g7h8i9","parentId":"e5f6g7h8","timestamp":"2024-12-03T14:10:00.000Z","summary":"User discussed X, Y, Z...","firstKeptEntryId":"c3d4e5f6","tokensBefore":50000}
232
- ```
233
-
234
- Optional fields:
235
- - `details`: Implementation-specific data (e.g., `{ readFiles: string[], modifiedFiles: string[] }` for default, or custom data for extensions)
236
- - `fromHook`: `true` if generated by an extension, `false`/`undefined` if indusagi-generated (legacy field name)
237
-
238
- ### BranchSummaryEntry
239
-
240
- Created when switching branches via `/tree` with an LLM generated summary of the left branch up to the common ancestor. Captures context from the abandoned path.
241
-
242
- ```json
243
- {"type":"branch_summary","id":"g7h8i9j0","parentId":"a1b2c3d4","timestamp":"2024-12-03T14:15:00.000Z","fromId":"f6g7h8i9","summary":"Branch explored approach A..."}
244
- ```
245
-
246
- Optional fields:
247
- - `details`: File tracking data (`{ readFiles: string[], modifiedFiles: string[] }`) for default, or custom data for extensions
248
- - `fromHook`: `true` if generated by an extension, `false`/`undefined` if indusagi-generated (legacy field name)
249
-
250
- ### CustomEntry
251
-
252
- Extension state persistence. Does NOT participate in LLM context.
253
-
254
- ```json
255
- {"type":"custom","id":"h8i9j0k1","parentId":"g7h8i9j0","timestamp":"2024-12-03T14:20:00.000Z","customType":"my-extension","data":{"count":42}}
256
- ```
257
-
258
- Use `customType` to identify your extension's entries on reload.
259
-
260
- ### CustomMessageEntry
261
-
262
- Extension-injected messages that DO participate in LLM context.
263
-
264
- ```json
265
- {"type":"custom_message","id":"i9j0k1l2","parentId":"h8i9j0k1","timestamp":"2024-12-03T14:25:00.000Z","customType":"my-extension","content":"Injected context...","display":true}
266
- ```
267
-
268
- Fields:
269
- - `content`: String or `(TextContent | ImageContent)[]` (same as UserMessage)
270
- - `display`: `true` = show in TUI with distinct styling, `false` = hidden
271
- - `details`: Optional extension-specific metadata (not sent to LLM)
272
-
273
- ### LabelEntry
274
-
275
- User-defined bookmark/marker on an entry.
276
-
277
- ```json
278
- {"type":"label","id":"j0k1l2m3","parentId":"i9j0k1l2","timestamp":"2024-12-03T14:30:00.000Z","targetId":"a1b2c3d4","label":"checkpoint-1"}
279
- ```
280
-
281
- Set `label` to `undefined` to clear a label.
282
-
283
- ### SessionInfoEntry
284
-
285
- Session metadata (e.g., user-defined display name). Set via `/name` command or `indusagi.setSessionName()` in extensions.
286
-
287
- ```json
288
- {"type":"session_info","id":"k1l2m3n4","parentId":"j0k1l2m3","timestamp":"2024-12-03T14:35:00.000Z","name":"Refactor auth module"}
289
- ```
290
-
291
- The session name is displayed in the session selector (`/resume`) instead of the first message when set.
292
-
293
- ## Tree Structure
294
-
295
- Entries form a tree:
296
- - First entry has `parentId: null`
297
- - Each subsequent entry points to its parent via `parentId`
298
- - Branching creates new children from an earlier entry
299
- - The "leaf" is the current position in the tree
300
-
301
- ```
302
- [user msg] ─── [assistant] ─── [user msg] ─── [assistant] ─┬─ [user msg] ← current leaf
303
-
304
- └─ [branch_summary] ─── [user msg] ← alternate branch
305
- ```
306
-
307
- ## Context Building
308
-
309
- `buildSessionContext()` walks from the current leaf to the root, producing the message list for the LLM:
310
-
311
- 1. Collects all entries on the path
312
- 2. Extracts current model and thinking level settings
313
- 3. If a `CompactionEntry` is on the path:
314
- - Emits the summary first
315
- - Then messages from `firstKeptEntryId` to compaction
316
- - Then messages after compaction
317
- 4. Converts `BranchSummaryEntry` and `CustomMessageEntry` to appropriate message formats
318
-
319
- ## Parsing Example
320
-
321
- ```typescript
322
- import { readFileSync } from "fs";
323
-
324
- const lines = readFileSync("session.jsonl", "utf8").trim().split("\n");
325
-
326
- for (const line of lines) {
327
- const entry = JSON.parse(line);
328
-
329
- switch (entry.type) {
330
- case "session":
331
- console.log(`Session v${entry.version ?? 1}: ${entry.id}`);
332
- break;
333
- case "message":
334
- console.log(`[${entry.id}] ${entry.message.role}: ${JSON.stringify(entry.message.content)}`);
335
- break;
336
- case "compaction":
337
- console.log(`[${entry.id}] Compaction: ${entry.tokensBefore} tokens summarized`);
338
- break;
339
- case "branch_summary":
340
- console.log(`[${entry.id}] Branch from ${entry.fromId}`);
341
- break;
342
- case "custom":
343
- console.log(`[${entry.id}] Custom (${entry.customType}): ${JSON.stringify(entry.data)}`);
344
- break;
345
- case "custom_message":
346
- console.log(`[${entry.id}] Extension message (${entry.customType}): ${entry.content}`);
347
- break;
348
- case "label":
349
- console.log(`[${entry.id}] Label "${entry.label}" on ${entry.targetId}`);
350
- break;
351
- case "model_change":
352
- console.log(`[${entry.id}] Model: ${entry.provider}/${entry.modelId}`);
353
- break;
354
- case "thinking_level_change":
355
- console.log(`[${entry.id}] Thinking: ${entry.thinkingLevel}`);
356
- break;
357
- }
358
- }
359
- ```
360
-
361
- ## SessionManager API
362
-
363
- Key methods for working with sessions programmatically.
364
-
365
- ### Static Creation Methods
366
- - `SessionManager.create(cwd, sessionDir?)` - New session
367
- - `SessionManager.open(path, sessionDir?)` - Open existing session file
368
- - `SessionManager.continueRecent(cwd, sessionDir?)` - Continue most recent or create new
369
- - `SessionManager.inMemory(cwd?)` - No file persistence
370
- - `SessionManager.forkFrom(sourcePath, targetCwd, sessionDir?)` - Fork session from another project
371
-
372
- ### Static Listing Methods
373
- - `SessionManager.list(cwd, sessionDir?, onProgress?)` - List sessions for a directory
374
- - `SessionManager.listAll(onProgress?)` - List all sessions across all projects
375
-
376
- ### Instance Methods - Session Management
377
- - `newSession(options?)` - Start a new session (options: `{ parentSession?: string }`)
378
- - `setSessionFile(path)` - Switch to a different session file
379
- - `createBranchedSession(leafId)` - Extract branch to new session file
380
-
381
- ### Instance Methods - Appending (all return entry ID)
382
- - `appendMessage(message)` - Add message
383
- - `appendThinkingLevelChange(level)` - Record thinking change
384
- - `appendModelChange(provider, modelId)` - Record model change
385
- - `appendCompaction(summary, firstKeptEntryId, tokensBefore, details?, fromHook?)` - Add compaction
386
- - `appendCustomEntry(customType, data?)` - Extension state (not in context)
387
- - `appendSessionInfo(name)` - Set session display name
388
- - `appendCustomMessageEntry(customType, content, display, details?)` - Extension message (in context)
389
- - `appendLabelChange(targetId, label)` - Set/clear label
390
-
391
- ### Instance Methods - Tree Navigation
392
- - `getLeafId()` - Current position
393
- - `getLeafEntry()` - Get current leaf entry
394
- - `getEntry(id)` - Get entry by ID
395
- - `getBranch(fromId?)` - Walk from entry to root
396
- - `getTree()` - Get full tree structure
397
- - `getChildren(parentId)` - Get direct children
398
- - `getLabel(id)` - Get label for entry
399
- - `branch(entryId)` - Move leaf to earlier entry
400
- - `resetLeaf()` - Reset leaf to null (before any entries)
401
- - `branchWithSummary(entryId, summary, details?, fromHook?)` - Branch with context summary
402
-
403
- ### Instance Methods - Context & Info
404
- - `buildSessionContext()` - Get messages, thinkingLevel, and model for LLM
405
- - `getEntries()` - All entries (excluding header)
406
- - `getHeader()` - Session header metadata
407
- - `getSessionName()` - Get display name from latest session_info entry
408
- - `getCwd()` - Working directory
409
- - `getSessionDir()` - Session storage directory
410
- - `getSessionId()` - Session UUID
411
- - `getSessionFile()` - Session file path (undefined for in-memory)
412
- - `isPersisted()` - Whether session is saved to disk
package/docs/settings.md DELETED
@@ -1,219 +0,0 @@
1
- # Settings
2
-
3
- Indusagi uses JSON settings files with project settings overriding global settings.
4
-
5
- | Location | Scope |
6
- |----------|-------|
7
- | `~/.indusagi/agent/settings.json` | Global (all projects) |
8
- | `.indusagi/settings.json` | Project (current directory) |
9
-
10
- Edit directly or use `/settings` for common options.
11
-
12
- ## All Settings
13
-
14
- ### Model & Thinking
15
-
16
- | Setting | Type | Default | Description |
17
- |---------|------|---------|-------------|
18
- | `defaultProvider` | string | - | Default provider (e.g., `"anthropic"`, `"openai"`) |
19
- | `defaultModel` | string | - | Default model ID |
20
- | `defaultThinkingLevel` | string | - | `"off"`, `"minimal"`, `"low"`, `"medium"`, `"high"`, `"xhigh"` |
21
- | `hideThinkingBlock` | boolean | `false` | Hide thinking blocks in output |
22
- | `thinkingBudgets` | object | - | Custom token budgets per thinking level |
23
-
24
- #### thinkingBudgets
25
-
26
- ```json
27
- {
28
- "thinkingBudgets": {
29
- "minimal": 1024,
30
- "low": 4096,
31
- "medium": 10240,
32
- "high": 32768
33
- }
34
- }
35
- ```
36
-
37
- ### UI & Display
38
-
39
- | Setting | Type | Default | Description |
40
- |---------|------|---------|-------------|
41
- | `theme` | string | `"dark"` | Theme name (`"dark"`, `"light"`, or custom) |
42
- | `quietStartup` | boolean | `false` | Hide startup header |
43
- | `collapseChangelog` | boolean | `false` | Show condensed changelog after updates |
44
- | `doubleEscapeAction` | string | `"tree"` | Action for double-escape: `"tree"` or `"fork"` |
45
- | `editorPaddingX` | number | `0` | Horizontal padding for input editor (0-3) |
46
- | `showHardwareCursor` | boolean | `false` | Show terminal cursor |
47
-
48
- ### Compaction
49
-
50
- | Setting | Type | Default | Description |
51
- |---------|------|---------|-------------|
52
- | `compaction.enabled` | boolean | `true` | Enable auto-compaction |
53
- | `compaction.reserveTokens` | number | `16384` | Tokens reserved for LLM response |
54
- | `compaction.keepRecentTokens` | number | `20000` | Recent tokens to keep (not summarized) |
55
-
56
- ```json
57
- {
58
- "compaction": {
59
- "enabled": true,
60
- "reserveTokens": 16384,
61
- "keepRecentTokens": 20000
62
- }
63
- }
64
- ```
65
-
66
- ### Branch Summary
67
-
68
- | Setting | Type | Default | Description |
69
- |---------|------|---------|-------------|
70
- | `branchSummary.reserveTokens` | number | `16384` | Tokens reserved for branch summarization |
71
-
72
- ### Retry
73
-
74
- | Setting | Type | Default | Description |
75
- |---------|------|---------|-------------|
76
- | `retry.enabled` | boolean | `true` | Enable automatic retry on transient errors |
77
- | `retry.maxRetries` | number | `3` | Maximum retry attempts |
78
- | `retry.baseDelayMs` | number | `2000` | Base delay for exponential backoff (2s, 4s, 8s) |
79
-
80
- ```json
81
- {
82
- "retry": {
83
- "enabled": true,
84
- "maxRetries": 3,
85
- "baseDelayMs": 2000
86
- }
87
- }
88
- ```
89
-
90
- ### Message Delivery
91
-
92
- | Setting | Type | Default | Description |
93
- |---------|------|---------|-------------|
94
- | `steeringMode` | string | `"one-at-a-time"` | How steering messages are sent: `"all"` or `"one-at-a-time"` |
95
- | `followUpMode` | string | `"one-at-a-time"` | How follow-up messages are sent: `"all"` or `"one-at-a-time"` |
96
-
97
- ### Terminal & Images
98
-
99
- | Setting | Type | Default | Description |
100
- |---------|------|---------|-------------|
101
- | `terminal.showImages` | boolean | `true` | Show images in terminal (if supported) |
102
- | `terminal.startupImage` | string | - | Path to an image displayed at startup (interactive mode only) |
103
- | `images.autoResize` | boolean | `true` | Resize images to 2000x2000 max |
104
- | `images.blockImages` | boolean | `false` | Block all images from being sent to LLM |
105
-
106
- Paths in `terminal.startupImage` follow the same resolution rules as other settings: global settings resolve relative to `~/.indusagi/agent`, project settings resolve relative to `.indusagi` (absolute paths and `~` are supported).
107
-
108
- ### Shell
109
-
110
- | Setting | Type | Default | Description |
111
- |---------|------|---------|-------------|
112
- | `shellPath` | string | - | Custom shell path (e.g., for Cygwin on Windows) |
113
- | `shellCommandPrefix` | string | - | Prefix for every bash command (e.g., `"shopt -s expand_aliases"`) |
114
-
115
- ### Model Cycling
116
-
117
- | Setting | Type | Default | Description |
118
- |---------|------|---------|-------------|
119
- | `enabledModels` | string[] | - | Model patterns for Ctrl+P cycling (same format as `--models` CLI flag) |
120
-
121
- ```json
122
- {
123
- "enabledModels": ["claude-*", "gpt-4o", "gemini-2*"]
124
- }
125
- ```
126
-
127
- ### Markdown
128
-
129
- | Setting | Type | Default | Description |
130
- |---------|------|---------|-------------|
131
- | `markdown.codeBlockIndent` | string | `" "` | Indentation for code blocks |
132
-
133
- ### Resources
134
-
135
- These settings define where to load extensions, skills, prompts, and themes from.
136
-
137
- Paths in `~/.indusagi/agent/settings.json` resolve relative to `~/.indusagi/agent`. Paths in `.indusagi/settings.json` resolve relative to `.indusagi`. Absolute paths and `~` are supported.
138
-
139
- | Setting | Type | Default | Description |
140
- |---------|------|---------|-------------|
141
- | `packages` | array | `[]` | npm/git packages to load resources from |
142
- | `extensions` | string[] | `[]` | Local extension file paths or directories |
143
- | `skills` | string[] | `[]` | Local skill file paths or directories |
144
- | `prompts` | string[] | `[]` | Local prompt template paths or directories |
145
- | `themes` | string[] | `[]` | Local theme file paths or directories |
146
- | `enableSkillCommands` | boolean | `true` | Register skills as `/skill:name` commands |
147
-
148
- Arrays support glob patterns and exclusions. Use `!pattern` to exclude. Use `+path` to force-include an exact path and `-path` to force-exclude an exact path.
149
-
150
- #### packages
151
-
152
- String form loads all resources from a package:
153
-
154
- ```json
155
- {
156
- "packages": ["indusagi-skills", "@org/my-extension"]
157
- }
158
- ```
159
-
160
- Object form filters which resources to load:
161
-
162
- ```json
163
- {
164
- "packages": [
165
- {
166
- "source": "indusagi-skills",
167
- "skills": ["brave-search", "transcribe"],
168
- "extensions": []
169
- }
170
- ]
171
- }
172
- ```
173
-
174
- See [packages.md](packages.md) for package management details.
175
-
176
- ## Example
177
-
178
- ```json
179
- {
180
- "defaultProvider": "anthropic",
181
- "defaultModel": "claude-sonnet-4-20250514",
182
- "defaultThinkingLevel": "medium",
183
- "theme": "dark",
184
- "compaction": {
185
- "enabled": true,
186
- "reserveTokens": 16384,
187
- "keepRecentTokens": 20000
188
- },
189
- "retry": {
190
- "enabled": true,
191
- "maxRetries": 3
192
- },
193
- "enabledModels": ["claude-*", "gpt-4o"],
194
- "packages": ["indusagi-skills"]
195
- }
196
- ```
197
-
198
- ## Project Overrides
199
-
200
- Project settings (`.indusagi/settings.json`) override global settings. Nested objects are merged:
201
-
202
- ```json
203
- // ~/.indusagi/agent/settings.json (global)
204
- {
205
- "theme": "dark",
206
- "compaction": { "enabled": true, "reserveTokens": 16384 }
207
- }
208
-
209
- // .indusagi/settings.json (project)
210
- {
211
- "compaction": { "reserveTokens": 8192 }
212
- }
213
-
214
- // Result
215
- {
216
- "theme": "dark",
217
- "compaction": { "enabled": true, "reserveTokens": 8192 }
218
- }
219
- ```
@@ -1,13 +0,0 @@
1
- # Shell Aliases
2
-
3
- Indusagi runs bash in non-interactive mode (`bash -c`), which doesn't expand aliases by default.
4
-
5
- To enable your shell aliases, add to `~/.indusagi/agent/settings.json`:
6
-
7
- ```json
8
- {
9
- "shellCommandPrefix": "shopt -s expand_aliases\neval \"$(grep '^alias ' ~/.zshrc)\""
10
- }
11
- ```
12
-
13
- Adjust the path (`~/.zshrc`, `~/.bashrc`, etc.) to match your shell config.