pneuma-skills 2.9.0 → 2.9.2
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/backends/claude-code/index.ts +4 -4
- package/core/__tests__/agent-backend.test.ts +8 -8
- package/core/__tests__/mode-loader-external.test.ts +1 -1
- package/core/__tests__/mode-loader.test.ts +9 -9
- package/core/__tests__/mode-manifest.test.ts +7 -7
- package/core/__tests__/mode-resolver.test.ts +6 -6
- package/core/__tests__/viewer-contract.test.ts +12 -12
- package/core/mode-loader.ts +25 -25
- package/core/mode-resolver.ts +6 -6
- package/core/types/agent-backend.ts +48 -48
- package/core/types/index.ts +5 -5
- package/core/types/mode-definition.ts +6 -6
- package/core/types/mode-manifest.ts +82 -82
- package/core/types/viewer-contract.ts +80 -80
- package/core/utils/content-set-matcher.ts +2 -2
- package/core/utils/content-set-resolver.ts +7 -7
- package/modes/doc/manifest.ts +2 -2
- package/modes/doc/pneuma-mode.ts +3 -3
- package/modes/doc/viewer/DocPreview.tsx +7 -7
- package/modes/slide/seed/en-dark/manifest.json +10 -10
- package/modes/slide/seed/en-light/manifest.json +10 -10
- package/package.json +1 -1
- package/server/routes/export.ts +11 -8
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ClaudeCodeBackend —
|
|
2
|
+
* ClaudeCodeBackend — Claude Code implementation of AgentBackend.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Wraps CliLauncher and implements the standard AgentBackend interface.
|
|
5
|
+
* Uses the Claude Code protocol as the source of truth.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import type {
|
|
@@ -74,7 +74,7 @@ export class ClaudeCodeBackend implements AgentBackend {
|
|
|
74
74
|
this.launcher.onSessionExited(cb);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
/** SdkSessionInfo → AgentSessionInfo
|
|
77
|
+
/** SdkSessionInfo → AgentSessionInfo mapping */
|
|
78
78
|
private toAgentSessionInfo(info: SdkSessionInfo): AgentSessionInfo {
|
|
79
79
|
return {
|
|
80
80
|
sessionId: info.sessionId,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* AgentBackend
|
|
2
|
+
* AgentBackend contract tests
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
4
|
+
* Validates AgentBackend interface constraints:
|
|
5
|
+
* - Lifecycle management (launch/kill/getSession)
|
|
6
|
+
* - Capability declaration completeness
|
|
7
|
+
* - Protocol adapter contract
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* Designed with Claude Code as the de facto standard.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { describe, test, expect } from "bun:test";
|
|
@@ -18,7 +18,7 @@ import type {
|
|
|
18
18
|
AgentProtocolAdapter,
|
|
19
19
|
} from "../types/index.js";
|
|
20
20
|
|
|
21
|
-
// ── Mock AgentBackend (
|
|
21
|
+
// ── Mock AgentBackend (simulates ClaudeCodeBackend behavior) ─────────────────
|
|
22
22
|
|
|
23
23
|
function createMockBackend(): AgentBackend {
|
|
24
24
|
const sessions = new Map<string, AgentSessionInfo>();
|
|
@@ -90,7 +90,7 @@ function createMockBackend(): AgentBackend {
|
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
// ── AgentBackend
|
|
93
|
+
// ── AgentBackend lifecycle ───────────────────────────────────────────────────
|
|
94
94
|
|
|
95
95
|
describe("AgentBackend lifecycle", () => {
|
|
96
96
|
test("launch creates a session in starting state", () => {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Mode Loader
|
|
2
|
+
* Mode Loader tests
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
4
|
+
* Validates mode loading mechanics:
|
|
5
|
+
* - Successfully loads built-in modes
|
|
6
|
+
* - Throws error for unknown modes
|
|
7
|
+
* - Loaded modes conform to the ModeDefinition contract
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { describe, test, expect } from "bun:test";
|
|
11
11
|
import type { ModeDefinition } from "../types/index.js";
|
|
12
12
|
|
|
13
|
-
// ── Mode Loader
|
|
13
|
+
// ── Mode Loader not yet implemented; using mocks to define expected behavior ──
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* Mock mode loader —
|
|
17
|
-
*
|
|
16
|
+
* Mock mode loader — defines the expected behavior of loadMode.
|
|
17
|
+
* Actual implementation is in core/mode-loader.ts (created during v1.0 code phase).
|
|
18
18
|
*/
|
|
19
19
|
const builtinModes: Record<string, ModeDefinition> = {};
|
|
20
20
|
|
|
@@ -35,7 +35,7 @@ function listModes(): string[] {
|
|
|
35
35
|
return Object.keys(builtinModes);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
// ──
|
|
38
|
+
// ── Helper: create minimal valid ModeDefinition ─────────────────────────────
|
|
39
39
|
|
|
40
40
|
function createMockModeDefinition(name: string): ModeDefinition {
|
|
41
41
|
return {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ModeManifest
|
|
2
|
+
* ModeManifest contract tests
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
4
|
+
* Validates ModeManifest type constraints:
|
|
5
|
+
* - Required field completeness
|
|
6
|
+
* - Optional field default value semantics
|
|
7
|
+
* - Business constraints on field values
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { describe, test, expect } from "bun:test";
|
|
11
11
|
import type { ModeManifest, SkillConfig, ViewerConfig } from "../types/index.js";
|
|
12
12
|
|
|
13
|
-
// ──
|
|
13
|
+
// ── Helper: create minimal valid manifest ────────────────────────────────────
|
|
14
14
|
|
|
15
15
|
function createMinimalManifest(overrides?: Partial<ModeManifest>): ModeManifest {
|
|
16
16
|
return {
|
|
@@ -31,7 +31,7 @@ function createMinimalManifest(overrides?: Partial<ModeManifest>): ModeManifest
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
// ── ModeManifest
|
|
34
|
+
// ── ModeManifest required fields ─────────────────────────────────────────────
|
|
35
35
|
|
|
36
36
|
describe("ModeManifest required fields", () => {
|
|
37
37
|
test("minimal manifest has all required fields", () => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Mode Resolver
|
|
2
|
+
* Mode Resolver tests
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
4
|
+
* Validates mode source resolution:
|
|
5
|
+
* - Built-in mode name recognition
|
|
6
|
+
* - Local path resolution (absolute paths, relative paths, ~ expansion)
|
|
7
|
+
* - GitHub format parsing
|
|
8
|
+
* - Error handling
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { describe, test, expect } from "bun:test";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ViewerContract
|
|
2
|
+
* ViewerContract contract tests
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* - PreviewComponent
|
|
6
|
-
* - extractContext
|
|
7
|
-
* - updateStrategy
|
|
8
|
-
* - workspace model
|
|
9
|
-
* - action
|
|
10
|
-
* -
|
|
4
|
+
* Validates ViewerContract interface constraints:
|
|
5
|
+
* - PreviewComponent is a valid React component type
|
|
6
|
+
* - extractContext returns a properly formatted context string
|
|
7
|
+
* - updateStrategy is a valid enum value
|
|
8
|
+
* - workspace model constraints
|
|
9
|
+
* - action descriptor structure
|
|
10
|
+
* - backward compatibility
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { describe, test, expect } from "bun:test";
|
|
@@ -21,7 +21,7 @@ import type {
|
|
|
21
21
|
ViewerActionDescriptor,
|
|
22
22
|
} from "../types/index.js";
|
|
23
23
|
|
|
24
|
-
// ──
|
|
24
|
+
// ── Helper: create mock viewer ───────────────────────────────────────────────
|
|
25
25
|
|
|
26
26
|
function createMockViewer(
|
|
27
27
|
overrides?: Partial<ViewerContract>,
|
|
@@ -34,7 +34,7 @@ function createMockViewer(
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
// ── ViewerContract
|
|
37
|
+
// ── ViewerContract basic constraints ─────────────────────────────────────────
|
|
38
38
|
|
|
39
39
|
describe("ViewerContract", () => {
|
|
40
40
|
test("PreviewComponent is a function (React component)", () => {
|
|
@@ -91,7 +91,7 @@ describe("ViewerContract", () => {
|
|
|
91
91
|
});
|
|
92
92
|
});
|
|
93
93
|
|
|
94
|
-
// ── ViewerPreviewProps
|
|
94
|
+
// ── ViewerPreviewProps completeness ──────────────────────────────────────────
|
|
95
95
|
|
|
96
96
|
describe("ViewerPreviewProps shape", () => {
|
|
97
97
|
test("contains all required fields", () => {
|
|
@@ -118,7 +118,7 @@ describe("ViewerPreviewProps shape", () => {
|
|
|
118
118
|
});
|
|
119
119
|
});
|
|
120
120
|
|
|
121
|
-
// ── extractContext
|
|
121
|
+
// ── extractContext edge cases ────────────────────────────────────────────────
|
|
122
122
|
|
|
123
123
|
describe("extractContext edge cases", () => {
|
|
124
124
|
test("handles selection without file context", () => {
|
package/core/mode-loader.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Mode Loader —
|
|
2
|
+
* Mode Loader — resolve, install, and load Modes.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* - builtin:
|
|
6
|
-
* - local:
|
|
7
|
-
* - github: GitHub
|
|
4
|
+
* Supports three sources:
|
|
5
|
+
* - builtin: built-in modes, dynamically imported from the modes/ directory
|
|
6
|
+
* - local: local filesystem path
|
|
7
|
+
* - github: GitHub repository (cloned to local cache via mode-resolver)
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* Core flow: resolveMode → ensureInstalled → loadFromSource
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import type { ModeManifest } from "./types/mode-manifest.js";
|
|
13
13
|
import type { ModeDefinition } from "./types/mode-definition.js";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* Mode
|
|
17
|
-
* - "builtin" —
|
|
18
|
-
* - "external" —
|
|
16
|
+
* Mode source type:
|
|
17
|
+
* - "builtin" — built-in mode, dynamically imported from the modes/ directory
|
|
18
|
+
* - "external" — external mode, dynamically imported from an absolute path (local path or github clone)
|
|
19
19
|
*/
|
|
20
20
|
type ModeSource =
|
|
21
21
|
| {
|
|
@@ -31,7 +31,7 @@ type ModeSource =
|
|
|
31
31
|
definitionLoader: () => Promise<ModeDefinition>;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
/**
|
|
34
|
+
/** Built-in mode registry — all use dynamic import */
|
|
35
35
|
const builtinModes: Record<string, ModeSource> = {
|
|
36
36
|
doc: {
|
|
37
37
|
type: "builtin",
|
|
@@ -84,14 +84,14 @@ const builtinModes: Record<string, ModeSource> = {
|
|
|
84
84
|
},
|
|
85
85
|
};
|
|
86
86
|
|
|
87
|
-
/**
|
|
87
|
+
/** External mode registry — registered by the CLI at startup via registerExternalMode */
|
|
88
88
|
const externalModes: Record<string, ModeSource> = {};
|
|
89
89
|
|
|
90
90
|
// ── Public API ───────────────────────────────────────────────────────────────
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
93
|
+
* Load a Mode's full definition (manifest + viewer).
|
|
94
|
+
* Used by the frontend — requires PreviewComponent.
|
|
95
95
|
*/
|
|
96
96
|
export async function loadMode(name: string): Promise<ModeDefinition> {
|
|
97
97
|
const source = resolveMode(name);
|
|
@@ -100,8 +100,8 @@ export async function loadMode(name: string): Promise<ModeDefinition> {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
103
|
+
* Load only the Mode's manifest (without React components).
|
|
104
|
+
* Used by the backend — only needs config information.
|
|
105
105
|
*/
|
|
106
106
|
export async function loadModeManifest(name: string): Promise<ModeManifest> {
|
|
107
107
|
const source = resolveMode(name);
|
|
@@ -110,27 +110,27 @@ export async function loadModeManifest(name: string): Promise<ModeManifest> {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
|
-
*
|
|
113
|
+
* List all registered mode names (including builtin and registered external).
|
|
114
114
|
*/
|
|
115
115
|
export function listModes(): string[] {
|
|
116
116
|
return [...Object.keys(builtinModes), ...Object.keys(externalModes)];
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
/**
|
|
120
|
-
*
|
|
120
|
+
* List built-in mode names.
|
|
121
121
|
*/
|
|
122
122
|
export function listBuiltinModes(): string[] {
|
|
123
123
|
return Object.keys(builtinModes);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
/**
|
|
127
|
-
*
|
|
127
|
+
* Register an external mode (called by the CLI at startup).
|
|
128
128
|
*
|
|
129
|
-
* Backend context (Bun):
|
|
130
|
-
* Frontend context (browser/Vite):
|
|
129
|
+
* Backend context (Bun): uses import() with absolute path.
|
|
130
|
+
* Frontend context (browser/Vite): uses /@fs/ URL.
|
|
131
131
|
*
|
|
132
|
-
* @param name — Mode
|
|
133
|
-
* @param absPath — Mode
|
|
132
|
+
* @param name — Mode name (for registration and lookup)
|
|
133
|
+
* @param absPath — Absolute path to the Mode package
|
|
134
134
|
*/
|
|
135
135
|
export function registerExternalMode(name: string, absPath: string): void {
|
|
136
136
|
const isBrowser = typeof window !== "undefined";
|
|
@@ -185,7 +185,7 @@ export function registerExternalMode(name: string, absPath: string): void {
|
|
|
185
185
|
|
|
186
186
|
// ── Internal ─────────────────────────────────────────────────────────────────
|
|
187
187
|
|
|
188
|
-
/**
|
|
188
|
+
/** Resolve mode source (checks builtin and external registries) */
|
|
189
189
|
function resolveMode(name: string): ModeSource {
|
|
190
190
|
// Check external modes first (allows overriding builtin names)
|
|
191
191
|
const external = externalModes[name];
|
|
@@ -200,13 +200,13 @@ function resolveMode(name: string): ModeSource {
|
|
|
200
200
|
);
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
/**
|
|
203
|
+
/** Ensure mode is installed (builtin skips directly, external already handled by mode-resolver) */
|
|
204
204
|
async function ensureInstalled(_source: ModeSource): Promise<void> {
|
|
205
205
|
// Both builtin and external modes are already resolved to local paths
|
|
206
206
|
return;
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
/**
|
|
209
|
+
/** Load full ModeDefinition from an installed source */
|
|
210
210
|
async function loadDefinition(source: ModeSource): Promise<ModeDefinition> {
|
|
211
211
|
return source.definitionLoader();
|
|
212
212
|
}
|
package/core/mode-resolver.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Mode Resolver —
|
|
2
|
+
* Mode Resolver — resolve mode sources and ensure local availability.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* - builtin: "doc", "slide" —
|
|
6
|
-
* - local: "/abs/path"
|
|
7
|
-
* - github: "github:user/repo"
|
|
4
|
+
* Supports three mode sources:
|
|
5
|
+
* - builtin: "doc", "slide" — built-in modes, loaded from the modes/ directory
|
|
6
|
+
* - local: "/abs/path" or "./rel/path" — local filesystem path
|
|
7
|
+
* - github: "github:user/repo" or "github:user/repo#branch" — GitHub repository
|
|
8
8
|
*
|
|
9
|
-
* GitHub
|
|
9
|
+
* GitHub repositories are cloned to the ~/.pneuma/modes/{user}-{repo}/ cache directory.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { resolve, join, basename } from "node:path";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* AgentBackend — Agent
|
|
2
|
+
* AgentBackend — Agent runtime abstraction
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* - AgentBackend:
|
|
6
|
-
* - AgentProtocolAdapter:
|
|
4
|
+
* The current implementation uses Claude Code as the first reference backend, but the external contract is split into two layers:
|
|
5
|
+
* - AgentBackend: lifecycle and capability declarations
|
|
6
|
+
* - AgentProtocolAdapter: translation from backend-specific protocol to runtime standard messages
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* The frontend and most server-side logic depend on normalized session state, not a specific backend's wire protocol.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
// ── Agent
|
|
11
|
+
// ── Agent Lifecycle ──────────────────────────────────────────────────────────
|
|
12
12
|
|
|
13
13
|
export type AgentBackendType = "claude-code" | "codex";
|
|
14
14
|
|
|
@@ -19,108 +19,108 @@ export interface AgentBackendDescriptor {
|
|
|
19
19
|
implemented: boolean;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
/** Agent
|
|
22
|
+
/** Agent session info */
|
|
23
23
|
export interface AgentSessionInfo {
|
|
24
|
-
/** Server
|
|
24
|
+
/** Server routing session ID (UUID) */
|
|
25
25
|
sessionId: string;
|
|
26
|
-
/** Agent
|
|
26
|
+
/** Agent's internal session ID (for resume, e.g. Claude Code's --resume) */
|
|
27
27
|
agentSessionId?: string;
|
|
28
|
-
/**
|
|
28
|
+
/** Process PID (if using child process mode) */
|
|
29
29
|
pid?: number;
|
|
30
|
-
/**
|
|
30
|
+
/** Session state */
|
|
31
31
|
state: "starting" | "connected" | "running" | "exited";
|
|
32
|
-
/**
|
|
32
|
+
/** Exit code (present when state=exited) */
|
|
33
33
|
exitCode?: number | null;
|
|
34
|
-
/**
|
|
34
|
+
/** Working directory */
|
|
35
35
|
cwd: string;
|
|
36
|
-
/**
|
|
36
|
+
/** Creation timestamp */
|
|
37
37
|
createdAt: number;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
/** Agent
|
|
40
|
+
/** Agent launch options */
|
|
41
41
|
export interface AgentLaunchOptions {
|
|
42
|
-
/**
|
|
42
|
+
/** Working directory */
|
|
43
43
|
cwd: string;
|
|
44
|
-
/**
|
|
44
|
+
/** Permission mode */
|
|
45
45
|
permissionMode?: string;
|
|
46
|
-
/**
|
|
46
|
+
/** Model */
|
|
47
47
|
model?: string;
|
|
48
|
-
/**
|
|
48
|
+
/** Reuse an existing server session ID (instead of generating a new one) */
|
|
49
49
|
sessionId?: string;
|
|
50
|
-
/** Agent
|
|
50
|
+
/** Agent's internal session ID (for resuming a previous session) */
|
|
51
51
|
resumeSessionId?: string;
|
|
52
|
-
/**
|
|
52
|
+
/** Additional environment variables */
|
|
53
53
|
env?: Record<string, string>;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
/** Agent
|
|
56
|
+
/** Agent backend — manages the Agent process lifecycle */
|
|
57
57
|
export interface AgentBackend {
|
|
58
|
-
/**
|
|
58
|
+
/** Unique backend identifier */
|
|
59
59
|
readonly name: AgentBackendType;
|
|
60
60
|
|
|
61
|
-
/**
|
|
61
|
+
/** Capability declarations */
|
|
62
62
|
readonly capabilities: AgentCapabilities;
|
|
63
63
|
|
|
64
|
-
/**
|
|
64
|
+
/** Launch a new Agent session */
|
|
65
65
|
launch(options: AgentLaunchOptions): AgentSessionInfo;
|
|
66
66
|
|
|
67
|
-
/**
|
|
67
|
+
/** Get session info */
|
|
68
68
|
getSession(sessionId: string): AgentSessionInfo | undefined;
|
|
69
69
|
|
|
70
|
-
/**
|
|
70
|
+
/** Check if a session is alive */
|
|
71
71
|
isAlive(sessionId: string): boolean;
|
|
72
72
|
|
|
73
|
-
/**
|
|
73
|
+
/** Mark session as connected (called when WS is established) */
|
|
74
74
|
markConnected(sessionId: string): void;
|
|
75
75
|
|
|
76
|
-
/**
|
|
76
|
+
/** Store the Agent's internal session ID (obtained from the Agent's init message) */
|
|
77
77
|
setAgentSessionId(sessionId: string, agentSessionId: string): void;
|
|
78
78
|
|
|
79
|
-
/**
|
|
79
|
+
/** Kill a session */
|
|
80
80
|
kill(sessionId: string): Promise<boolean>;
|
|
81
81
|
|
|
82
|
-
/**
|
|
82
|
+
/** Kill all sessions */
|
|
83
83
|
killAll(): Promise<void>;
|
|
84
84
|
|
|
85
|
-
/**
|
|
85
|
+
/** Register exit callback */
|
|
86
86
|
onSessionExited(cb: (sessionId: string, exitCode: number | null) => void): void;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
/** Agent
|
|
89
|
+
/** Agent capability declarations — describes which features this Agent supports */
|
|
90
90
|
export interface AgentCapabilities {
|
|
91
|
-
/**
|
|
91
|
+
/** Supports token-level streaming output */
|
|
92
92
|
streaming: boolean;
|
|
93
|
-
/**
|
|
93
|
+
/** Supports session resume (--resume) */
|
|
94
94
|
resume: boolean;
|
|
95
|
-
/**
|
|
95
|
+
/** Supports permission approval flow (control_request → permission_request) */
|
|
96
96
|
permissions: boolean;
|
|
97
|
-
/**
|
|
97
|
+
/** Supports tool execution progress reporting (tool_progress) */
|
|
98
98
|
toolProgress: boolean;
|
|
99
|
-
/**
|
|
99
|
+
/** Supports runtime model switching */
|
|
100
100
|
modelSwitch: boolean;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
// ── Agent
|
|
103
|
+
// ── Agent Protocol Adaptation ────────────────────────────────────────────────
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
|
-
*
|
|
106
|
+
* Standard message types — runtime format between ws-bridge and the frontend.
|
|
107
107
|
*
|
|
108
|
-
* v1
|
|
109
|
-
*
|
|
108
|
+
* v1 still directly reuses existing session/browser types rather than extracting a separate StandardMessage AST.
|
|
109
|
+
* This keeps the Claude path zero-regression and leaves an adaptation point for the second backend.
|
|
110
110
|
*
|
|
111
|
-
*
|
|
111
|
+
* When the second backend's message mapping clearly exceeds the current type's expressiveness, a more formal standard message subset will be extracted.
|
|
112
112
|
*/
|
|
113
113
|
|
|
114
114
|
/**
|
|
115
|
-
* AgentProtocolAdapter —
|
|
115
|
+
* AgentProtocolAdapter — message protocol adapter
|
|
116
116
|
*
|
|
117
|
-
*
|
|
118
|
-
* Claude Code
|
|
117
|
+
* Translates between the Agent's raw message format and the ws-bridge runtime format.
|
|
118
|
+
* Claude Code currently uses near-passthrough NDJSON; other backends adapt through their own adapters.
|
|
119
119
|
*/
|
|
120
120
|
export interface AgentProtocolAdapter {
|
|
121
|
-
/**
|
|
121
|
+
/** Parse raw data from the Agent into structured messages (null = skip this message) */
|
|
122
122
|
parseIncoming(raw: string): unknown | null;
|
|
123
123
|
|
|
124
|
-
/**
|
|
124
|
+
/** Encode standard messages into a format the Agent can accept */
|
|
125
125
|
encodeOutgoing(msg: unknown): string;
|
|
126
126
|
}
|
package/core/types/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Core type exports — Pneuma Skills v1.0
|
|
2
|
+
* Core type exports — Pneuma Skills v1.0 contract layer
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* - Layer 4: ModeManifest + ModeDefinition (
|
|
6
|
-
* - Layer 3: ViewerContract (
|
|
7
|
-
* - Layer 2: AgentBackend + AgentProtocolAdapter (Agent
|
|
4
|
+
* Three-layer contracts:
|
|
5
|
+
* - Layer 4: ModeManifest + ModeDefinition (capability declaration protocol)
|
|
6
|
+
* - Layer 3: ViewerContract (content viewer contract)
|
|
7
|
+
* - Layer 2: AgentBackend + AgentProtocolAdapter (Agent communication abstraction)
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
export type {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ModeDefinition —
|
|
2
|
+
* ModeDefinition — Runtime Mode object
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Binds ModeManifest (declarative config) and ViewerContract (UI component) together.
|
|
5
|
+
* Default-exported from the Mode package's entry file.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```typescript
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
import type { ModeManifest } from "./mode-manifest.js";
|
|
22
22
|
import type { ViewerContract } from "./viewer-contract.js";
|
|
23
23
|
|
|
24
|
-
/**
|
|
24
|
+
/** Complete runtime Mode definition */
|
|
25
25
|
export interface ModeDefinition {
|
|
26
|
-
/**
|
|
26
|
+
/** Declarative configuration */
|
|
27
27
|
manifest: ModeManifest;
|
|
28
|
-
/**
|
|
28
|
+
/** Content viewer implementation */
|
|
29
29
|
viewer: ViewerContract;
|
|
30
30
|
}
|