@inixiative/agent-session 0.7.0 → 0.9.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.
- package/README.md +24 -10
- package/package.json +4 -3
- package/src/claude-agent-sdk-session.ts +11 -0
- package/src/claude-code-session.ts +197 -10
- package/src/codex-session.ts +16 -11
- package/src/harness-session.ts +16 -10
- package/src/index.ts +20 -0
- package/src/limits.ts +38 -2
- package/src/muse-session.ts +2115 -0
- package/src/pool.ts +6 -1
- package/src/transport.ts +40 -3
- package/src/transports.ts +5 -1
package/src/pool.ts
CHANGED
|
@@ -217,7 +217,12 @@ export class SubscriptionPool {
|
|
|
217
217
|
if (!config.id || this._instances.has(config.id))
|
|
218
218
|
throw Error(`Duplicate or empty instance id "${config.id}"`);
|
|
219
219
|
const descriptor = TRANSPORTS[config.transport];
|
|
220
|
-
|
|
220
|
+
// Muse keeps its login and sessions under two XDG homes, not one profile variable; not pooled yet.
|
|
221
|
+
if (
|
|
222
|
+
descriptor?.status !== 'implemented' ||
|
|
223
|
+
descriptor.runtime === 'external' ||
|
|
224
|
+
descriptor.runtime === 'muse'
|
|
225
|
+
)
|
|
221
226
|
throw Error(`Instance ${config.id}: transport "${config.transport}" cannot be pooled`);
|
|
222
227
|
const runtime = descriptor.runtime;
|
|
223
228
|
const variable = PROFILE_VARIABLE[runtime];
|
package/src/transport.ts
CHANGED
|
@@ -13,9 +13,15 @@
|
|
|
13
13
|
// is declared absent, with a note.
|
|
14
14
|
// ---------------------------------------------------------------------------
|
|
15
15
|
|
|
16
|
-
export type TransportKind =
|
|
16
|
+
export type TransportKind =
|
|
17
|
+
| 'claude-cli'
|
|
18
|
+
| 'codex-app-server'
|
|
19
|
+
| 'muse-serve'
|
|
20
|
+
| 'claude-agent-sdk'
|
|
21
|
+
| 'acp'
|
|
22
|
+
| 'api';
|
|
17
23
|
|
|
18
|
-
export type TransportRuntime = 'claude' | 'codex' | 'external';
|
|
24
|
+
export type TransportRuntime = 'claude' | 'codex' | 'muse' | 'external';
|
|
19
25
|
|
|
20
26
|
export interface TransportCapabilities {
|
|
21
27
|
/** Continue a thread by native ID in a new process. */
|
|
@@ -67,7 +73,7 @@ export const TRANSPORTS: Readonly<Record<TransportKind, TransportDescriptor>> =
|
|
|
67
73
|
fork: 'native',
|
|
68
74
|
rollback: 'none',
|
|
69
75
|
interrupt: 'acknowledged',
|
|
70
|
-
push: '
|
|
76
|
+
push: 'steer',
|
|
71
77
|
approvals: 'callback',
|
|
72
78
|
usage: true,
|
|
73
79
|
limits: { stream: true, poll: true },
|
|
@@ -81,6 +87,7 @@ export const TRANSPORTS: Readonly<Record<TransportKind, TransportDescriptor>> =
|
|
|
81
87
|
'textOnly launches with no tools, MCP servers, slash commands or user settings.',
|
|
82
88
|
'Primed decisions (ClaudePrimedSessions) fork a persisted primed session per cycle with a pre-spawned spare.',
|
|
83
89
|
"interruptNative() and readLimits() use the CLI's stdio control protocol (`interrupt`, `get_usage`).",
|
|
90
|
+
'push() steers: a stream-json user message with `priority: "next"` and a `uuid`, tracked by its `command_lifecycle` frames; one the turn had not taken in when its result came runs as a follow-on result of the same turn, and a stop withdraws it (`cancel_async_message`). Live-verified on claude 2.1.316.',
|
|
84
91
|
'toolGate: true launches with `--permission-prompt-tool stdio` and registers a PreToolUse callback over the control protocol: onToolRequest() gates see every call (`pre-use`, any mode, bypass included; only a deny counts) and the asks the permission mode raises (`permission`, final).',
|
|
85
92
|
'Rollback (`--resume-session-at`) exists natively but is not wired here.',
|
|
86
93
|
'Images ride in the same stream-json user message as base64 `image` content blocks, before the text.',
|
|
@@ -115,6 +122,35 @@ export const TRANSPORTS: Readonly<Record<TransportKind, TransportDescriptor>> =
|
|
|
115
122
|
'Images go to turn/start as `image` inputs with a `data:` URL, after the text.',
|
|
116
123
|
],
|
|
117
124
|
},
|
|
125
|
+
'muse-serve': {
|
|
126
|
+
kind: 'muse-serve',
|
|
127
|
+
runtime: 'muse',
|
|
128
|
+
status: 'implemented',
|
|
129
|
+
verified: 'live',
|
|
130
|
+
capabilities: {
|
|
131
|
+
resume: 'native',
|
|
132
|
+
fork: 'native',
|
|
133
|
+
rollback: 'none',
|
|
134
|
+
interrupt: 'acknowledged',
|
|
135
|
+
push: 'steer',
|
|
136
|
+
approvals: 'callback',
|
|
137
|
+
usage: true,
|
|
138
|
+
limits: { stream: true, poll: true },
|
|
139
|
+
textOnly: false,
|
|
140
|
+
images: true,
|
|
141
|
+
primed: 'none',
|
|
142
|
+
billing: 'subscription',
|
|
143
|
+
},
|
|
144
|
+
notes: [
|
|
145
|
+
"`muse serve --trust-workspace` (plus `--disable-sandbox` under bypassPermissions) driven through Meta's `@muse-code/sdk` MuseClient, pinned to the installed CLI's version.",
|
|
146
|
+
'Billing is the saved Muse Code login: metered keys and endpoints (META_, LLM_, MODEL_, LLAMA_, OPENROUTER_, ANTHROPIC_, OPENAI_), Meta auth endpoints (TBH_) and the MUSE_ model, experiment, contributor, approval-judge and fail-open switches are removed from the child environment; a resumed or forked session must report provider `meta`.',
|
|
147
|
+
'Approvals use an explicit permission profile (`:ask-me` supervised, `:read-only` plan, `:unrestricted` bypass), never the host default `:auto-review`, whose AI reviewer would decide instead of the gates; the committed profile, approval mode and (gated) a human reviewer are read back before any turn.',
|
|
148
|
+
"Work Muse starts itself (cron firings, monitor and background-terminal wakes, goals, reminder agents, workflows, another client's messages) is folded like a turn's and emitted with `unattributedReason: 'task'`, plus a `task` lifecycle typed `muse-cron`, `muse-monitor`, `muse-goal`, `muse-reminder`, `muse-workflow` or `muse-turn`; it is seen only while this host has the session loaded.",
|
|
149
|
+
"interruptNative() sends turn/interrupt; push() sends turn/steer; fork() runs session/fork on the new session's own host; readLimits() sends usage/read.",
|
|
150
|
+
'userInput/request questions go to onUserInput(); without an answer they are cancelled with a reason, so a turn never waits on them.',
|
|
151
|
+
'Live-verified (muse 1.4.14): start, profile read-back, multi-stage shell and network approvals, text and tool events, token usage, usage/changed and usage/read (recorded in fixtures/muse); fork, resume with setApprovalMode and sessionNotFound were checked live without a model turn (not recorded). A steer (`turn/steer` into a running shell turn, answered in that turn) was checked live 2026-11-02 (not recorded). Images, interrupt, questions and Muse-initiated turns follow the SDK wire types without a live run.',
|
|
152
|
+
],
|
|
153
|
+
},
|
|
118
154
|
'claude-agent-sdk': {
|
|
119
155
|
kind: 'claude-agent-sdk',
|
|
120
156
|
runtime: 'claude',
|
|
@@ -137,6 +173,7 @@ export const TRANSPORTS: Readonly<Record<TransportKind, TransportDescriptor>> =
|
|
|
137
173
|
notes: [
|
|
138
174
|
'Drives `@anthropic-ai/claude-agent-sdk` query() supplied by the caller; this package keeps zero dependencies.',
|
|
139
175
|
"Reuses ClaudeCodeSession's event classification and admission evidence over the SDK message stream.",
|
|
176
|
+
'push() is not wired: whether the SDK stream surfaces `command_lifecycle` (which a steer is tracked by) is unverified.',
|
|
140
177
|
],
|
|
141
178
|
},
|
|
142
179
|
acp: {
|
package/src/transports.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
import { ClaudeCodeSession, type ClaudeCodeSessionConfig } from './claude-code-session';
|
|
9
9
|
import { CodexAppServerSession, type CodexSessionConfig } from './codex-session';
|
|
10
10
|
import type { HarnessSession } from './harness-session';
|
|
11
|
+
import { MuseSession, type MuseSessionConfig } from './muse-session';
|
|
11
12
|
import {
|
|
12
13
|
TRANSPORTS,
|
|
13
14
|
type TransportDescriptor,
|
|
@@ -37,6 +38,7 @@ export interface ApiSessionConfig {
|
|
|
37
38
|
export interface TransportConfigs {
|
|
38
39
|
'claude-cli': ClaudeCodeSessionConfig;
|
|
39
40
|
'codex-app-server': CodexSessionConfig;
|
|
41
|
+
'muse-serve': MuseSessionConfig;
|
|
40
42
|
'claude-agent-sdk': ClaudeAgentSdkSessionConfig;
|
|
41
43
|
acp: AcpSessionConfig;
|
|
42
44
|
api: ApiSessionConfig;
|
|
@@ -47,7 +49,7 @@ export class AcpSession {
|
|
|
47
49
|
constructor(_config: AcpSessionConfig) {
|
|
48
50
|
throw new TransportUnavailableError(
|
|
49
51
|
'acp',
|
|
50
|
-
'no ACP client is implemented in this package; use claude-cli, claude-agent-sdk
|
|
52
|
+
'no ACP client is implemented in this package; use claude-cli, claude-agent-sdk, codex-app-server or muse-serve',
|
|
51
53
|
);
|
|
52
54
|
}
|
|
53
55
|
}
|
|
@@ -82,6 +84,8 @@ export function createSession<K extends TransportKind>(
|
|
|
82
84
|
return new ClaudeCodeSession(config as ClaudeCodeSessionConfig);
|
|
83
85
|
case 'codex-app-server':
|
|
84
86
|
return new CodexAppServerSession(config as CodexSessionConfig);
|
|
87
|
+
case 'muse-serve':
|
|
88
|
+
return new MuseSession(config as MuseSessionConfig);
|
|
85
89
|
case 'claude-agent-sdk':
|
|
86
90
|
return new ClaudeAgentSdkSession(config as ClaudeAgentSdkSessionConfig);
|
|
87
91
|
case 'acp':
|