@agentuity/coder 2.0.7 → 2.0.9

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 (113) hide show
  1. package/AGENTS.md +43 -0
  2. package/README.md +75 -37
  3. package/dist/index.d.ts +1 -3
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +1 -1669
  6. package/dist/index.js.map +1 -1
  7. package/package.json +9 -12
  8. package/src/index.ts +51 -1996
  9. package/dist/chain-preview.d.ts +0 -55
  10. package/dist/chain-preview.d.ts.map +0 -1
  11. package/dist/chain-preview.js +0 -472
  12. package/dist/chain-preview.js.map +0 -1
  13. package/dist/client.d.ts +0 -44
  14. package/dist/client.d.ts.map +0 -1
  15. package/dist/client.js +0 -411
  16. package/dist/client.js.map +0 -1
  17. package/dist/commands.d.ts +0 -22
  18. package/dist/commands.d.ts.map +0 -1
  19. package/dist/commands.js +0 -99
  20. package/dist/commands.js.map +0 -1
  21. package/dist/footer.d.ts +0 -34
  22. package/dist/footer.d.ts.map +0 -1
  23. package/dist/footer.js +0 -249
  24. package/dist/footer.js.map +0 -1
  25. package/dist/handlers.d.ts +0 -24
  26. package/dist/handlers.d.ts.map +0 -1
  27. package/dist/handlers.js +0 -83
  28. package/dist/handlers.js.map +0 -1
  29. package/dist/hub-overlay-state.d.ts +0 -31
  30. package/dist/hub-overlay-state.d.ts.map +0 -1
  31. package/dist/hub-overlay-state.js +0 -78
  32. package/dist/hub-overlay-state.js.map +0 -1
  33. package/dist/hub-overlay.d.ts +0 -146
  34. package/dist/hub-overlay.d.ts.map +0 -1
  35. package/dist/hub-overlay.js +0 -2354
  36. package/dist/hub-overlay.js.map +0 -1
  37. package/dist/native-remote-ui-context.d.ts +0 -5
  38. package/dist/native-remote-ui-context.d.ts.map +0 -1
  39. package/dist/native-remote-ui-context.js +0 -30
  40. package/dist/native-remote-ui-context.js.map +0 -1
  41. package/dist/output-viewer.d.ts +0 -49
  42. package/dist/output-viewer.d.ts.map +0 -1
  43. package/dist/output-viewer.js +0 -389
  44. package/dist/output-viewer.js.map +0 -1
  45. package/dist/overlay.d.ts +0 -40
  46. package/dist/overlay.d.ts.map +0 -1
  47. package/dist/overlay.js +0 -225
  48. package/dist/overlay.js.map +0 -1
  49. package/dist/protocol.d.ts +0 -605
  50. package/dist/protocol.d.ts.map +0 -1
  51. package/dist/protocol.js +0 -4
  52. package/dist/protocol.js.map +0 -1
  53. package/dist/remote-lifecycle.d.ts +0 -61
  54. package/dist/remote-lifecycle.d.ts.map +0 -1
  55. package/dist/remote-lifecycle.js +0 -190
  56. package/dist/remote-lifecycle.js.map +0 -1
  57. package/dist/remote-session.d.ts +0 -128
  58. package/dist/remote-session.d.ts.map +0 -1
  59. package/dist/remote-session.js +0 -876
  60. package/dist/remote-session.js.map +0 -1
  61. package/dist/remote-tui.d.ts +0 -40
  62. package/dist/remote-tui.d.ts.map +0 -1
  63. package/dist/remote-tui.js +0 -867
  64. package/dist/remote-tui.js.map +0 -1
  65. package/dist/remote-ui-handler.d.ts +0 -5
  66. package/dist/remote-ui-handler.d.ts.map +0 -1
  67. package/dist/remote-ui-handler.js +0 -53
  68. package/dist/remote-ui-handler.js.map +0 -1
  69. package/dist/renderers.d.ts +0 -34
  70. package/dist/renderers.d.ts.map +0 -1
  71. package/dist/renderers.js +0 -669
  72. package/dist/renderers.js.map +0 -1
  73. package/dist/review.d.ts +0 -15
  74. package/dist/review.d.ts.map +0 -1
  75. package/dist/review.js +0 -154
  76. package/dist/review.js.map +0 -1
  77. package/dist/titlebar.d.ts +0 -3
  78. package/dist/titlebar.d.ts.map +0 -1
  79. package/dist/titlebar.js +0 -59
  80. package/dist/titlebar.js.map +0 -1
  81. package/dist/todo/index.d.ts +0 -3
  82. package/dist/todo/index.d.ts.map +0 -1
  83. package/dist/todo/index.js +0 -3
  84. package/dist/todo/index.js.map +0 -1
  85. package/dist/todo/store.d.ts +0 -6
  86. package/dist/todo/store.d.ts.map +0 -1
  87. package/dist/todo/store.js +0 -43
  88. package/dist/todo/store.js.map +0 -1
  89. package/dist/todo/types.d.ts +0 -13
  90. package/dist/todo/types.d.ts.map +0 -1
  91. package/dist/todo/types.js +0 -2
  92. package/dist/todo/types.js.map +0 -1
  93. package/src/chain-preview.ts +0 -621
  94. package/src/client.ts +0 -527
  95. package/src/commands.ts +0 -132
  96. package/src/footer.ts +0 -305
  97. package/src/handlers.ts +0 -113
  98. package/src/hub-overlay-state.ts +0 -127
  99. package/src/hub-overlay.ts +0 -3037
  100. package/src/native-remote-ui-context.ts +0 -41
  101. package/src/output-viewer.ts +0 -480
  102. package/src/overlay.ts +0 -294
  103. package/src/protocol.ts +0 -758
  104. package/src/remote-lifecycle.ts +0 -270
  105. package/src/remote-session.ts +0 -1080
  106. package/src/remote-tui.ts +0 -1020
  107. package/src/remote-ui-handler.ts +0 -86
  108. package/src/renderers.ts +0 -740
  109. package/src/review.ts +0 -201
  110. package/src/titlebar.ts +0 -63
  111. package/src/todo/index.ts +0 -2
  112. package/src/todo/store.ts +0 -49
  113. package/src/todo/types.ts +0 -14
package/AGENTS.md ADDED
@@ -0,0 +1,43 @@
1
+ # Agent Guidelines for @agentuity/coder
2
+
3
+ ## Package Overview
4
+
5
+ Standalone package for the Agentuity Coder service. Provides a simple, ergonomic client for managing Coder Hub sessions, participants, replay data, loop state, and users.
6
+
7
+ ## Commands
8
+
9
+ - **Build**: `bun run build`
10
+ - **Typecheck**: `bun run typecheck`
11
+ - **Clean**: `rm -rf dist`
12
+
13
+ ## Architecture
14
+
15
+ - **Runtime**: Node.js and Bun compatible
16
+ - **Exports**: CoderClient and all types from @agentuity/core/coder
17
+ - **Dependencies**: @agentuity/core
18
+
19
+ ## Usage
20
+
21
+ ```typescript
22
+ import { CoderClient } from '@agentuity/coder';
23
+
24
+ const client = new CoderClient();
25
+
26
+ // List sessions
27
+ const { sessions } = await client.listSessions({ limit: 10 });
28
+ for (const session of sessions) {
29
+ console.log(`${session.sessionId}: ${session.label}`);
30
+ }
31
+
32
+ // Create a new session
33
+ const session = await client.createSession({
34
+ task: 'Implement feature X',
35
+ workflowMode: 'standard',
36
+ });
37
+ console.log(`Created session: ${session.sessionId}`);
38
+ ```
39
+
40
+ ## Publishing
41
+
42
+ 1. Run `bun run build`
43
+ 2. Must publish **after** @agentuity/core
package/README.md CHANGED
@@ -1,57 +1,95 @@
1
1
  # @agentuity/coder
2
2
 
3
- Lightweight [Pi TUI](https://github.com/mariozechner/pi-coding-agent) extension that connects to the Agentuity Coder Hub.
3
+ Standalone package for the Agentuity Coder service. Provides a simple, ergonomic client for managing Coder Hub sessions, participants, replay data, loop state, and users.
4
4
 
5
- ## Purpose
5
+ ## Installation
6
6
 
7
- This package is a **pure protocol adapter** between Pi's extension API and the Coder Hub server. It contains zero hardcoded tool schemas or agent definitions — everything is driven by the server's `InitMessage` at startup.
7
+ ```bash
8
+ npm install @agentuity/coder
9
+ ```
8
10
 
9
- The extension runs inside **Pi's Node.js process**, not the Agentuity runtime.
11
+ ## Quick Start
10
12
 
11
- ## Architecture
13
+ ```typescript
14
+ import { CoderClient } from '@agentuity/coder';
12
15
 
13
- | File | Lines | Role |
14
- |------|-------|------|
15
- | `src/index.ts` | ~660 | Main extension entry — tool/event registration, sub-agent execution |
16
- | `src/handlers.ts` | ~100 | Action processing (ACK, BLOCK, RETURN, NOTIFY, CONFIRM, etc.) |
17
- | `src/protocol.ts` | ~130 | TypeBox protocol types (InitMessage, requests, actions, responses) |
18
- | `src/client.ts` | ~145 | HubClient — WebSocket client with request/response correlation |
16
+ const client = new CoderClient();
19
17
 
20
- ## Connection Flow
18
+ // List sessions
19
+ const { sessions } = await client.listSessions({ limit: 10 });
20
+ for (const session of sessions) {
21
+ console.log(`${session.sessionId}: ${session.label} (${session.status})`);
22
+ }
21
23
 
22
- 1. **Extension loads** `agentuityCoderHub(pi)` is called by Pi
23
- 2. **Sync bootstrap** `fetchInitMessageSync()` calls Hub's REST `/api/hub/init` endpoint via `curl` + `execFileSync` to discover available tools and agents _before_ registration returns
24
- 3. **Tool registration** — Hub tools (memory, context7, etc.) are registered with Pi using server-provided JSON Schemas
25
- 4. **Lazy WebSocket** — On first event (`session_start`), a persistent WebSocket connection is established for runtime communication
26
- 5. **Event proxy** — Pi lifecycle events are forwarded to Hub; Hub responds with actions (ACK, BLOCK, SYSTEM_PROMPT, etc.)
27
- 6. **Tool execution** — When Pi invokes a Hub tool, the request is sent over WebSocket and the RETURN action result is passed back
24
+ // Create a new session
25
+ const session = await client.createSession({
26
+ task: 'Implement feature X',
27
+ workflowMode: 'standard',
28
+ });
29
+ console.log(`Created session: ${session.sessionId}`);
28
30
 
29
- ## Sub-Agent Flow
31
+ // Get session details
32
+ const details = await client.getSession(session.sessionId);
33
+ console.log(`Task: ${details.task}`);
30
34
 
31
- 1. **Lead delegates** — Lead agent calls the `task` or `parallel_tasks` tool
32
- 2. **In-process session** — `runSubAgent()` creates a Pi `createAgentSession()` inside the same process (no subprocess spawning)
33
- 3. **Hub tools via extensionFactories** — Sub-agents receive Hub tools (memory, context7, etc.) through Pi's `extensionFactories` mechanism, sharing the parent's WebSocket connection
34
- 4. **Isolation** — Sub-agents run with `noExtensions: true` to prevent recursive task tool registration
35
- 5. **Output limits** — Results are truncated to 200KB / 5K lines to prevent context bloat
35
+ // Archive a session
36
+ await client.archiveSession(session.sessionId);
37
+ ```
36
38
 
37
- ## Requirements
39
+ ## Configuration
38
40
 
39
- - **`curl` binary** — Required for the synchronous REST bootstrap (`fetchInitMessageSync`). Available by default on macOS, Linux, and Windows 10+.
40
- - **Pi coding agent** — This extension is loaded by Pi's extension system.
41
+ ```typescript
42
+ const client = new CoderClient({
43
+ apiKey: 'your-api-key',
44
+ url: 'https://your-coder-hub-url.example.com',
45
+ orgId: 'your-org-id',
46
+ });
47
+ ```
41
48
 
42
- ## Environment Variables
49
+ ### Environment Variables
43
50
 
44
- | Variable | Required | Description |
45
- |----------|----------|-------------|
46
- | `AGENTUITY_CODER_HUB_URL` | Yes | WebSocket URL for the Coder Hub (e.g., `ws://localhost:3000/api/ws`) |
47
- | `AGENTUITY_CODER_AGENT` | No | Agent role name. If set, the extension runs as a sub-agent (not lead). |
51
+ | Variable | Description | Default |
52
+ |----------|-------------|---------|
53
+ | `AGENTUITY_SDK_KEY` | API key for authentication | Required |
54
+ | `AGENTUITY_REGION` | Region for API endpoints | `usc` |
55
+ | `AGENTUITY_CODER_URL` | Override Coder Hub API URL | Auto-discovered via Catalyst |
48
56
 
49
- ## Design Decisions
57
+ ## API Reference
50
58
 
51
- ### Why `curl` + `execFileSync`?
59
+ ### `CoderClient`
52
60
 
53
- Pi's extension registration is **synchronous** — tools must be registered before the extension function returns. Node's `fetch()` is async-only, and `Bun.spawnSync` isn't available in Pi's Node.js runtime. Using `curl` via `execFileSync` is the simplest way to make a synchronous HTTP request without adding dependencies.
61
+ Main client for interacting with the Coder Hub API.
54
62
 
55
- ### Why no hardcoded schemas?
63
+ #### Constructor
56
64
 
57
- The Hub server is the single source of truth for tool definitions, agent configurations, and system prompts. This keeps the extension thin and allows the Hub to evolve without extension updates.
65
+ ```typescript
66
+ new CoderClient(options?: CoderClientOptions)
67
+ ```
68
+
69
+ Options:
70
+ - `apiKey` - API key (defaults to `AGENTUITY_SDK_KEY` env var)
71
+ - `url` - Coder Hub API URL (defaults to `AGENTUITY_CODER_URL` env var, or auto-discovered)
72
+ - `region` - Region for Catalyst URL resolution (defaults to `AGENTUITY_REGION` env var)
73
+ - `orgId` - Organization ID for multi-tenant operations
74
+ - `logger` - Custom logger instance
75
+
76
+ #### Methods
77
+
78
+ - `getUrl()` - Get the resolved Coder Hub base URL
79
+ - `createSession(body)` - Create a new coder session
80
+ - `getSession(sessionId)` - Get session details
81
+ - `updateSession(sessionId, body)` - Update a session
82
+ - `listSessions(params?)` - List sessions with optional filtering
83
+ - `deleteSession(sessionId)` - Permanently delete a session
84
+ - `archiveSession(sessionId)` - Archive an active session
85
+ - `resumeSession(sessionId)` - Resume an archived session
86
+ - `listConnectableSessions(params?)` - List sessions the caller can connect to
87
+ - `getReplay(sessionId, params?)` - Get replay data for a session
88
+ - `listParticipants(sessionId, params?)` - List session participants
89
+ - `listEventHistory(sessionId, params?)` - List historical events for a session
90
+ - `getLoopState(sessionId, params?)` - Get loop-mode state for a session
91
+ - `listUsers(params?)` - List known users in the coder hub
92
+
93
+ ## License
94
+
95
+ Apache-2.0
package/dist/index.d.ts CHANGED
@@ -1,4 +1,2 @@
1
- import type { ExtensionAPI } from '@mariozechner/pi-coding-agent';
2
- export declare function agentuityCoderHub(pi: ExtensionAPI): void;
3
- export default agentuityCoderHub;
1
+ export { CoderClient, type CoderClientOptions, CoderClientOptionsSchema, type CoderSession, type CoderSessionListItem, type CoderSessionListResponse, type CoderCreateSessionRequest, type CoderUpdateSessionRequest, type CoderListSessionsParams, type CoderSessionVisibility, type CoderWorkflowMode, type CoderSessionMode, type CoderSessionBucket, type CoderSkillRef, type CoderSessionRepositoryRef, type CoderSessionLoopConfig, type CoderSessionOwner, type CoderSessionOrigin, type CoderSessionWorkspace, type CoderLoopStateResponse, type CoderSessionLoopState, type CoderLoopStatus, type CoderSessionReplay, type CoderSessionParticipants, type CoderParticipant, type CoderSessionEventHistory, type CoderSessionEvent, type CoderUser, type CoderListUsersResponse, type CoderListUsersParams, type CoderSavedSkill, type CoderSkillBucket, type CoderWorkspaceDetail, type CoderSavedSkillListResponse, type CoderSkillBucketListResponse, type CoderWorkspaceListResponse, type CoderCreateWorkspaceRequest, type CoderSaveSkillRequest, type CoderGitHubAccount, type CoderGitHubRepository, type CoderGitHubAccountListResponse, type CoderGitHubRepositoryListResponse, } from '@agentuity/core/coder';
4
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEX,YAAY,EAIZ,MAAM,+BAA+B,CAAC;AAgRvC,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,YAAY,QAu1CjD;AA8VD,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,WAAW,EACX,KAAK,kBAAkB,EACvB,wBAAwB,EAExB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAE5B,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAE1B,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EAEpB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EAEtB,KAAK,SAAS,EACd,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EAEzB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,qBAAqB,EAE1B,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,8BAA8B,EACnC,KAAK,iCAAiC,GACtC,MAAM,uBAAuB,CAAC"}