@wrongstack/webui-server 0.298.3 → 0.299.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.
@@ -75,6 +75,15 @@ export interface StaticServeOptions {
75
75
  deferListen?: boolean | undefined;
76
76
  /** Package-resolution/build seams supplied by the owning host. */
77
77
  ensureDistDeps?: EnsureDistDeps | undefined;
78
+ /**
79
+ * Requirements Intake service backing `/api/requirement-intakes*`. Omitted by
80
+ * every real host — a per-project service is constructed from `projectRoot` +
81
+ * `globalRoot` below, so the CLI-hosted WebUI serves the same intake records
82
+ * as the standalone server. Pass one only to override (tests/embeds); when
83
+ * `projectRoot` is absent there is no project to scope a store to and the
84
+ * routes correctly answer 503.
85
+ */
86
+ intakeService?: CreateHttpServerOptions['intakeService'];
78
87
  }
79
88
  /**
80
89
  * Resolve the webui package's built `dist` directory.
@@ -74,6 +74,13 @@ export interface CreateHttpServerOptions {
74
74
  } | undefined) | undefined;
75
75
  /** Permission-governed language_package bridge for approved remediation. */
76
76
  executePackageOperation?: import('./techstack-handlers.js').TechStackHandlerDeps['executePackageOperation'];
77
+ /**
78
+ * Optional Requirements Intake service. When provided, the
79
+ * /api/projects/:projectId/requirement-intakes and
80
+ * /api/requirement-intakes/:intakeId endpoints are enabled; otherwise they
81
+ * respond 503.
82
+ */
83
+ intakeService?: import('@wrongstack/requirement-intake').RequirementIntakeService | undefined;
77
84
  }
78
85
  export declare function injectWsConfig(html: string, opts: {
79
86
  publicWsUrl?: string | undefined;
@@ -0,0 +1,13 @@
1
+ import { RequirementIntakeService } from '@wrongstack/requirement-intake';
2
+ /**
3
+ * Build the intake service backed by this project's
4
+ * `~/.wrongstack/projects/<slug>/requirement-intakes` directory.
5
+ *
6
+ * The HTTP token gate is the authorization boundary, so the service itself
7
+ * runs with a permissive authorizer inside it (see requirement-intake-handlers).
8
+ */
9
+ export declare function createProjectIntakeService(opts: {
10
+ projectRoot: string;
11
+ globalRoot: string;
12
+ }): RequirementIntakeService;
13
+ //# sourceMappingURL=intake-service.d.ts.map
@@ -0,0 +1,41 @@
1
+ /**
2
+ * HTTP handlers for the Requirements Intake REST API.
3
+ *
4
+ * Routes (registered in http-server.ts):
5
+ * POST /api/projects/:projectId/requirement-intakes
6
+ * GET /api/projects/:projectId/requirement-intakes
7
+ * GET /api/requirement-intakes/:intakeId
8
+ * PATCH /api/requirement-intakes/:intakeId
9
+ * POST /api/requirement-intakes/:intakeId/answers
10
+ * POST /api/requirement-intakes/:intakeId/suggestions
11
+ * POST /api/requirement-intakes/:intakeId/submit
12
+ * POST /api/requirement-intakes/:intakeId/cancel
13
+ * POST /api/requirement-intakes/:intakeId/archive
14
+ *
15
+ * The HTTP token gate (see http-server.ts) is the authorization boundary;
16
+ * the service runs with a permissive authorizer inside that boundary. Every
17
+ * handler maps `IntakeError` codes to conventional HTTP statuses and never
18
+ * echoes request content into logs.
19
+ */
20
+ import type * as http from 'node:http';
21
+ import { type RequirementIntakeService } from '@wrongstack/requirement-intake';
22
+ /** Map a domain error to an HTTP status + JSON error body. */
23
+ export declare function sendIntakeError(res: http.ServerResponse, error: unknown): void;
24
+ /**
25
+ * List intake records for the server's own project. The webui-server serves
26
+ * one project; the canonical `proj_<ulid>` id lives in `.wrongstack/project.json`,
27
+ * which the frontend cannot read — so this route resolves it server-side and
28
+ * returns it alongside the records (the frontend uses it for the project-scoped
29
+ * create endpoint).
30
+ */
31
+ export declare function handleRequirementIntakeListForServer(res: http.ServerResponse, service: RequirementIntakeService | undefined, projectRoot: string | undefined): Promise<void>;
32
+ export declare function handleRequirementIntakeCreate(res: http.ServerResponse, req: http.IncomingMessage, service: RequirementIntakeService | undefined, projectId: string): Promise<void>;
33
+ export declare function handleRequirementIntakeList(res: http.ServerResponse, service: RequirementIntakeService | undefined, projectId: string): Promise<void>;
34
+ export declare function handleRequirementIntakeGet(res: http.ServerResponse, service: RequirementIntakeService | undefined, intakeId: string): Promise<void>;
35
+ export declare function handleRequirementIntakeUpdate(res: http.ServerResponse, req: http.IncomingMessage, service: RequirementIntakeService | undefined, intakeId: string): Promise<void>;
36
+ export declare function handleRequirementIntakeAnswers(res: http.ServerResponse, req: http.IncomingMessage, service: RequirementIntakeService | undefined, intakeId: string): Promise<void>;
37
+ export declare function handleRequirementIntakeSuggestions(res: http.ServerResponse, req: http.IncomingMessage, service: RequirementIntakeService | undefined, intakeId: string): Promise<void>;
38
+ export declare function handleRequirementIntakeSubmit(res: http.ServerResponse, service: RequirementIntakeService | undefined, intakeId: string): Promise<void>;
39
+ export declare function handleRequirementIntakeCancel(res: http.ServerResponse, req: http.IncomingMessage, service: RequirementIntakeService | undefined, intakeId: string): Promise<void>;
40
+ export declare function handleRequirementIntakeArchive(res: http.ServerResponse, service: RequirementIntakeService | undefined, intakeId: string): Promise<void>;
41
+ //# sourceMappingURL=requirement-intake-handlers.d.ts.map
@@ -102,6 +102,9 @@ export declare function startHttpServer(opts: {
102
102
  } | undefined) | undefined;
103
103
  executePackageOperation?: import('./techstack-handlers.js').TechStackHandlerDeps['executePackageOperation'];
104
104
  distDir?: string | undefined;
105
+ /** Optional pre-built intake service (tests/embeds). Defaults to a fresh
106
+ * per-project service backed by `projectRequirementIntakes`. */
107
+ intakeService?: import('@wrongstack/requirement-intake').RequirementIntakeService | undefined;
105
108
  }): import('node:http').Server;
106
109
  interface ShutdownDeps {
107
110
  flushSession: () => Promise<void>;
@@ -1,4 +1,4 @@
1
- import type { SessionSummary } from '@wrongstack/core/types';
1
+ import type { SessionEvent, SessionSummary } from '@wrongstack/core/types';
2
2
  /**
3
3
  * Stable WebSocket projection for the WebUI history surfaces.
4
4
  *
@@ -27,6 +27,47 @@ export interface SessionHistoryWireEntry {
27
27
  outcome?: SessionSummary['outcome'];
28
28
  isCurrent: boolean;
29
29
  }
30
+ export interface SessionInspectEvent {
31
+ ts: string;
32
+ type: SessionEvent['type'];
33
+ label: string;
34
+ detail: string;
35
+ }
36
+ export interface SessionInspectFileEntry {
37
+ operation: string;
38
+ filePath: string;
39
+ toolName: string;
40
+ ts: string;
41
+ }
42
+ export interface SessionInspectPayload {
43
+ id: string;
44
+ title: string;
45
+ name?: string | undefined;
46
+ model: string;
47
+ provider: string;
48
+ startedAt: string;
49
+ endedAt?: string | undefined;
50
+ tokenTotal: number;
51
+ outcome?: SessionSummary['outcome'];
52
+ messageCount: number;
53
+ iterationCount: number;
54
+ toolCallCount: number;
55
+ toolErrorCount: number;
56
+ fileChangeCount: number;
57
+ compactionCount: number;
58
+ toolBreakdown: Record<string, number>;
59
+ events: SessionInspectEvent[];
60
+ fileEvents: SessionInspectFileEntry[];
61
+ lastUserMessage?: string | undefined;
62
+ }
63
+ export declare function buildInspectPayload(summary: SessionSummary | undefined, events: SessionEvent[], fallback: {
64
+ id: string;
65
+ title: string;
66
+ model: string;
67
+ provider: string;
68
+ startedAt: string;
69
+ endedAt?: string | undefined;
70
+ }): SessionInspectPayload;
30
71
  export declare function toSessionHistoryEntry(summary: SessionSummary, currentSessionId: string): SessionHistoryWireEntry;
31
72
  export declare function toSessionHistoryEntries(summaries: SessionSummary[], currentSessionId: string): SessionHistoryWireEntry[];
32
73
  //# sourceMappingURL=session-history.d.ts.map
@@ -19,6 +19,7 @@ export interface SessionRouteHandlers {
19
19
  deleteSession: (ws: WebSocket, msg: WSClientMessage) => Promise<void>;
20
20
  resumeSession: (ws: WebSocket, msg: WSClientMessage) => Promise<void>;
21
21
  saveSession: (ws: WebSocket, msg: WSClientMessage) => Promise<void>;
22
+ inspectSession: (ws: WebSocket, msg: WSClientMessage) => Promise<void>;
22
23
  listCheckpoints: (ws: WebSocket, msg: WSClientMessage) => Promise<void>;
23
24
  rewindSession: (ws: WebSocket, msg: WSClientMessage) => Promise<void>;
24
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/webui-server",
3
- "version": "0.298.3",
3
+ "version": "0.299.0",
4
4
  "license": "MIT",
5
5
  "description": "WrongStack WebUI HTTP/WebSocket server module — extracted from @wrongstack/webui in PR #243/244 to remove the CLI -> @wrongstack/webui/server cross-package edge (audit §3.1.1). Pure backend: HTTP routes, WebSocket handlers, MCP tool wrappers, HTML serving. The web frontend lives in @wrongstack/webui; this package is the standalone server it can run on.",
6
6
  "keywords": [
@@ -40,15 +40,16 @@
40
40
  ],
41
41
  "dependencies": {
42
42
  "ws": "^8.21.1",
43
- "@wrongstack/core": "0.298.3",
44
- "@wrongstack/providers": "0.298.3",
45
- "@wrongstack/runtime": "0.298.3",
46
- "@wrongstack/kanban": "0.298.3",
47
- "@wrongstack/sdd": "0.298.3",
48
- "@wrongstack/sage": "0.298.3",
49
- "@wrongstack/techstack": "0.298.3",
50
- "@wrongstack/tools": "0.298.3",
51
- "@wrongstack/mcp": "0.298.3"
43
+ "@wrongstack/providers": "0.299.0",
44
+ "@wrongstack/core": "0.299.0",
45
+ "@wrongstack/techstack": "0.299.0",
46
+ "@wrongstack/mcp": "0.299.0",
47
+ "@wrongstack/requirement-intake": "0.299.0",
48
+ "@wrongstack/sdd": "0.299.0",
49
+ "@wrongstack/kanban": "0.299.0",
50
+ "@wrongstack/tools": "0.299.0",
51
+ "@wrongstack/sage": "0.299.0",
52
+ "@wrongstack/runtime": "0.299.0"
52
53
  },
53
54
  "devDependencies": {
54
55
  "@types/node": "^26.1.2",