@mono-agent/web 0.12.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/LICENSE +674 -0
- package/README.md +169 -0
- package/dist/contracts.d.ts +151 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +11 -0
- package/dist/contracts.js.map +1 -0
- package/dist/discovery.d.ts +17 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +137 -0
- package/dist/discovery.js.map +1 -0
- package/dist/errors.d.ts +9 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +25 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/operator-client.d.ts +42 -0
- package/dist/operator-client.d.ts.map +1 -0
- package/dist/operator-client.js +257 -0
- package/dist/operator-client.js.map +1 -0
- package/dist/server.d.ts +22 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +566 -0
- package/dist/server.js.map +1 -0
- package/dist/service.d.ts +89 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +644 -0
- package/dist/service.js.map +1 -0
- package/dist/state-paths.d.ts +25 -0
- package/dist/state-paths.d.ts.map +1 -0
- package/dist/state-paths.js +226 -0
- package/dist/state-paths.js.map +1 -0
- package/dist/store.d.ts +112 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +953 -0
- package/dist/store.js.map +1 -0
- package/package.json +48 -0
- package/webapp/dist/apple-touch-icon.png +0 -0
- package/webapp/dist/assets/assistant-ui-CU4gqU0g.js +70 -0
- package/webapp/dist/assets/index-Ck3BY0Ti.js +47 -0
- package/webapp/dist/assets/index-CoB6Xwh-.css +1 -0
- package/webapp/dist/assets/markdown-qFW9VWmB.js +18 -0
- package/webapp/dist/assets/workbox-window.prod.es5-BBnX5xw4.js +2 -0
- package/webapp/dist/favicon.ico +0 -0
- package/webapp/dist/icon-192.png +0 -0
- package/webapp/dist/icon-512.png +0 -0
- package/webapp/dist/icon.svg +22 -0
- package/webapp/dist/index.html +20 -0
- package/webapp/dist/manifest.webmanifest +1 -0
- package/webapp/dist/sw.js +1 -0
- package/webapp/dist/workbox-9c191d2f.js +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# @mono-agent/web
|
|
2
|
+
|
|
3
|
+
The persistent browser console for mono-agent. It discovers every running local
|
|
4
|
+
agent, keeps multiple independent conversations in owner-private SQLite state,
|
|
5
|
+
and serves the assistant-ui PWA from one always-on process.
|
|
6
|
+
|
|
7
|
+
## Category
|
|
8
|
+
|
|
9
|
+
Category: `operator-surface`
|
|
10
|
+
|
|
11
|
+
## Responsibility
|
|
12
|
+
|
|
13
|
+
- Discover local agents through the shared trace-source registry and probe their
|
|
14
|
+
loopback operator endpoints.
|
|
15
|
+
- Persist agents, threads, messages, structured reasoning/tool/telemetry parts,
|
|
16
|
+
revisions, turns, attachments, and agent pin preferences under
|
|
17
|
+
`~/.mono-agent/web`.
|
|
18
|
+
- Keep an upstream turn running when a browser reloads or disconnects, and expose
|
|
19
|
+
state invalidations over SSE so any connected browser can catch up.
|
|
20
|
+
- Accept browser-selected files through bounded staged uploads and forward the
|
|
21
|
+
exact transport-neutral `AgentAttachment` contract used by Telegram.
|
|
22
|
+
- Serve the assistant-ui PWA and its versioned JSON/SSE API.
|
|
23
|
+
|
|
24
|
+
## Install / Usage
|
|
25
|
+
|
|
26
|
+
The `mono-agent web` command owns normal lifecycle management. The embeddable
|
|
27
|
+
server API is also available:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { startWebServer } from "@mono-agent/web";
|
|
31
|
+
|
|
32
|
+
const server = await startWebServer(); // 0.0.0.0:5050
|
|
33
|
+
console.log(server.url);
|
|
34
|
+
await server.stop();
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The interface is deliberately single-user and has no application login. Anyone
|
|
38
|
+
who can reach port 5050 can inspect conversations and operate discovered agents;
|
|
39
|
+
use host firewall/LAN policy and Tailscale ACLs as the access boundary. The
|
|
40
|
+
server emits no CORS permission and rejects cross-origin mutations.
|
|
41
|
+
|
|
42
|
+
Private IP literals, localhost, the machine hostname, and its exact `.local`
|
|
43
|
+
name are accepted as browser hosts. Set `MONO_AGENT_WEB_ALLOWED_HOSTS` to a
|
|
44
|
+
comma-separated list of any additional exact DNS names (for example the node's
|
|
45
|
+
Tailscale DNS name); suffix wildcards are intentionally not trusted. When a
|
|
46
|
+
managed agent protects its loopback operator endpoint, discovery reads only
|
|
47
|
+
`MONO_AGENT_TUI_API_KEY` from that agent's attested, owner-owned dotenv file.
|
|
48
|
+
|
|
49
|
+
On desktop, drag the agent rail's right edge to reveal full agent names. The
|
|
50
|
+
resize separator is keyboard-operable, and its width is remembered by that
|
|
51
|
+
browser so each device can keep an appropriate layout. Pin or unpin an agent
|
|
52
|
+
with its star control in the desktop rail or mobile agent picker. Pins are
|
|
53
|
+
stored by the web service rather than in browser storage, so the same favorites
|
|
54
|
+
appear over localhost, LAN, and Tailscale; pinned agents sort before the
|
|
55
|
+
remaining discovered agents.
|
|
56
|
+
|
|
57
|
+
The assistant-ui run-settings popover combines searchable model selection with
|
|
58
|
+
the selected model's supported reasoning-effort choices and becomes a
|
|
59
|
+
viewport-safe bottom sheet on narrow screens. Usage telemetry remains internal
|
|
60
|
+
and is summarized through a context display that accumulates the conversation's
|
|
61
|
+
newest per-turn snapshots; it reports a percentage only when the agent advertises
|
|
62
|
+
a trustworthy context-window size. Structured reasoning is grouped into a
|
|
63
|
+
stream-aware disclosure without reordering adjacent tool or answer parts.
|
|
64
|
+
Typing `/` in an empty composer opens the available command triggers.
|
|
65
|
+
|
|
66
|
+
## Public API
|
|
67
|
+
|
|
68
|
+
<!-- public-api-inventory:start -->
|
|
69
|
+
<!-- Generated by scripts/generate-public-api-docs.mjs. Do not edit by hand. -->
|
|
70
|
+
|
|
71
|
+
Every symbol exported by each public code entrypoint is listed below.
|
|
72
|
+
|
|
73
|
+
**`@mono-agent/web`**
|
|
74
|
+
|
|
75
|
+
```text
|
|
76
|
+
CreateWebThreadInput
|
|
77
|
+
CreateWebUploadInput
|
|
78
|
+
DEFAULT_WEB_HOST
|
|
79
|
+
DEFAULT_WEB_PORT
|
|
80
|
+
DiscoverOperatorAgentsOptions
|
|
81
|
+
DiscoveredOperatorAgent
|
|
82
|
+
PatchWebAgentInput
|
|
83
|
+
PatchWebThreadInput
|
|
84
|
+
StartWebServerOptions
|
|
85
|
+
StartWebTurnInput
|
|
86
|
+
WEB_API_VERSION
|
|
87
|
+
WEB_MAX_ACTIVE_ATTACHMENT_TURN_BYTES
|
|
88
|
+
WEB_MAX_CONCURRENT_UPLOADS
|
|
89
|
+
WEB_MAX_FILES_PER_TURN
|
|
90
|
+
WEB_MAX_QUEUED_ATTACHMENT_TURNS
|
|
91
|
+
WEB_MAX_STAGED_UPLOADS
|
|
92
|
+
WEB_MAX_STAGED_UPLOAD_BYTES
|
|
93
|
+
WEB_MAX_TURN_ATTACHMENT_BYTES
|
|
94
|
+
WEB_STAGED_UPLOAD_TTL_MS
|
|
95
|
+
WebAgentStatus
|
|
96
|
+
WebAgentSummary
|
|
97
|
+
WebAttachment
|
|
98
|
+
WebBootstrap
|
|
99
|
+
WebConsoleError
|
|
100
|
+
WebEvent
|
|
101
|
+
WebEventType
|
|
102
|
+
WebMessage
|
|
103
|
+
WebMessagePart
|
|
104
|
+
WebMessageStatus
|
|
105
|
+
WebModelOption
|
|
106
|
+
WebRunState
|
|
107
|
+
WebRunStatus
|
|
108
|
+
WebServerHandle
|
|
109
|
+
WebStatePathOptions
|
|
110
|
+
WebStatePaths
|
|
111
|
+
WebThread
|
|
112
|
+
WebThreadDetail
|
|
113
|
+
defaultTraceRegistryDir
|
|
114
|
+
defaultWebStateDir
|
|
115
|
+
discoverOperatorAgents
|
|
116
|
+
isTrustedOperatorBaseUrl
|
|
117
|
+
operatorBaseUrlFromMetadata
|
|
118
|
+
prepareWebState
|
|
119
|
+
prepareWebStatePaths
|
|
120
|
+
resetWebState
|
|
121
|
+
resolveWebStatePaths
|
|
122
|
+
startWebServer
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
<!-- public-api-inventory:end -->
|
|
126
|
+
|
|
127
|
+
The primary exports are `startWebServer`, `prepareWebState`, `resetWebState`,
|
|
128
|
+
`defaultWebStateDir`, the versioned `Web*` DTOs, API/upload limit constants, and
|
|
129
|
+
the trace-registry discovery helpers. `startWebServer()` returns a handle with
|
|
130
|
+
the actual bound address/port plus idempotent `stop()` and `close()` methods.
|
|
131
|
+
|
|
132
|
+
The browser API is rooted at `/api/v1`:
|
|
133
|
+
|
|
134
|
+
- `GET /bootstrap`, `PATCH /agents/:id`, and `GET/PATCH /threads/:id`
|
|
135
|
+
- `POST /threads`, `/threads/:id/turns`, and `/threads/:id/cancel`
|
|
136
|
+
- `POST /uploads`, `PUT/GET /uploads/:id/content`, and `DELETE /uploads/:id`
|
|
137
|
+
- `GET /events` (SSE)
|
|
138
|
+
|
|
139
|
+
`GET /healthz` is intentionally outside the versioned API for service probes.
|
|
140
|
+
|
|
141
|
+
## Dependency Boundary
|
|
142
|
+
|
|
143
|
+
The server depends only on the `core` `@mono-agent/agent-contracts` and
|
|
144
|
+
`@mono-agent/config` packages, the `observability` trace-source registry, and
|
|
145
|
+
Express. Its compiled browser bundle additionally contains the production graph
|
|
146
|
+
from the isolated `webapp` lockfile: assistant-ui, Base UI, cmdk, React, and
|
|
147
|
+
Workbox plus their transitive dependencies. The repository advisory and license
|
|
148
|
+
gates audit that nested production graph separately because it ships inside this
|
|
149
|
+
package even though it is not part of the root pnpm workspace. Running agents
|
|
150
|
+
are reached over their loopback HTTP operator endpoints; this package does not
|
|
151
|
+
import a communication adapter or another operator surface.
|
|
152
|
+
|
|
153
|
+
## What This Package Does Not Own
|
|
154
|
+
|
|
155
|
+
- Agent runtime/provider execution or conversation history inside an agent.
|
|
156
|
+
- The operator-adapter HTTP server published by each agent.
|
|
157
|
+
- CLI background-process, launchd, or conflict-safe Tailscale Serve lifecycle.
|
|
158
|
+
- Session Recorder history/replay, which remains in `@mono-agent/session-web`.
|
|
159
|
+
- Authentication. Network reachability is the intentional security boundary.
|
|
160
|
+
- Host filesystem browsing: attachments come only from the browser device's
|
|
161
|
+
native file picker.
|
|
162
|
+
|
|
163
|
+
## Verification
|
|
164
|
+
|
|
165
|
+
```sh
|
|
166
|
+
pnpm --filter @mono-agent/web run typecheck
|
|
167
|
+
pnpm --filter @mono-agent/web run test
|
|
168
|
+
pnpm --filter @mono-agent/web run build
|
|
169
|
+
```
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/** Version of the browser-facing JSON and SSE contract. */
|
|
2
|
+
export declare const WEB_API_VERSION: 1;
|
|
3
|
+
export declare const WEB_MAX_FILES_PER_TURN = 10;
|
|
4
|
+
export declare const WEB_MAX_TURN_ATTACHMENT_BYTES: number;
|
|
5
|
+
export declare const WEB_STAGED_UPLOAD_TTL_MS: number;
|
|
6
|
+
export declare const WEB_MAX_STAGED_UPLOAD_BYTES: number;
|
|
7
|
+
export declare const WEB_MAX_STAGED_UPLOADS = 100;
|
|
8
|
+
export declare const WEB_MAX_CONCURRENT_UPLOADS = 4;
|
|
9
|
+
export declare const WEB_MAX_ACTIVE_ATTACHMENT_TURN_BYTES: number;
|
|
10
|
+
export declare const WEB_MAX_QUEUED_ATTACHMENT_TURNS = 32;
|
|
11
|
+
export type WebAgentStatus = "online" | "offline" | "degraded";
|
|
12
|
+
export interface WebModelOption {
|
|
13
|
+
readonly effortLevels?: readonly string[];
|
|
14
|
+
readonly reasoning?: boolean;
|
|
15
|
+
readonly reasoningMode?: string;
|
|
16
|
+
readonly label?: string;
|
|
17
|
+
readonly contextWindow?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface WebAgentSummary {
|
|
20
|
+
readonly sourceId: string;
|
|
21
|
+
readonly label: string;
|
|
22
|
+
readonly status: WebAgentStatus;
|
|
23
|
+
readonly pinned?: boolean;
|
|
24
|
+
readonly health?: string;
|
|
25
|
+
readonly supportsAttachments: boolean;
|
|
26
|
+
readonly models?: readonly string[];
|
|
27
|
+
readonly defaultModel?: string;
|
|
28
|
+
readonly defaultEffort?: string;
|
|
29
|
+
readonly efforts?: readonly string[];
|
|
30
|
+
readonly modelOptions?: Readonly<Record<string, WebModelOption>>;
|
|
31
|
+
readonly updatedAt: string;
|
|
32
|
+
}
|
|
33
|
+
export type WebRunStatus = "idle" | "running" | "complete" | "failed" | "cancelled" | "interrupted";
|
|
34
|
+
export interface WebRunState {
|
|
35
|
+
readonly id?: string;
|
|
36
|
+
readonly status: WebRunStatus;
|
|
37
|
+
readonly startedAt?: string;
|
|
38
|
+
readonly finishedAt?: string;
|
|
39
|
+
readonly error?: {
|
|
40
|
+
readonly code?: string;
|
|
41
|
+
readonly message: string;
|
|
42
|
+
};
|
|
43
|
+
readonly model?: string;
|
|
44
|
+
readonly effort?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface WebThread {
|
|
47
|
+
readonly id: string;
|
|
48
|
+
readonly sourceId: string;
|
|
49
|
+
readonly title: string;
|
|
50
|
+
readonly archivedAt: string | null;
|
|
51
|
+
readonly createdAt: string;
|
|
52
|
+
readonly updatedAt: string;
|
|
53
|
+
readonly revision: number;
|
|
54
|
+
readonly lastMessagePreview?: string;
|
|
55
|
+
readonly messageCount: number;
|
|
56
|
+
readonly runState: WebRunState;
|
|
57
|
+
readonly canSend: boolean;
|
|
58
|
+
readonly canUpload: boolean;
|
|
59
|
+
}
|
|
60
|
+
export type WebMessageStatus = "running" | "complete" | "failed" | "cancelled" | "interrupted";
|
|
61
|
+
export type WebMessagePart = {
|
|
62
|
+
readonly type: "text";
|
|
63
|
+
readonly text: string;
|
|
64
|
+
} | {
|
|
65
|
+
readonly type: "reasoning";
|
|
66
|
+
readonly text: string;
|
|
67
|
+
} | {
|
|
68
|
+
readonly type: "tool-call";
|
|
69
|
+
readonly toolCallId: string;
|
|
70
|
+
readonly toolName: string;
|
|
71
|
+
readonly args?: unknown;
|
|
72
|
+
readonly result?: unknown;
|
|
73
|
+
readonly status: "running" | "complete" | "failed";
|
|
74
|
+
} | {
|
|
75
|
+
readonly type: "telemetry";
|
|
76
|
+
readonly event: string;
|
|
77
|
+
readonly data?: unknown;
|
|
78
|
+
} | {
|
|
79
|
+
readonly type: "error";
|
|
80
|
+
readonly code?: string;
|
|
81
|
+
readonly message: string;
|
|
82
|
+
};
|
|
83
|
+
export interface WebAttachment {
|
|
84
|
+
readonly id: string;
|
|
85
|
+
readonly name: string;
|
|
86
|
+
readonly contentType: string;
|
|
87
|
+
readonly sizeBytes: number;
|
|
88
|
+
readonly kind: "image" | "document";
|
|
89
|
+
readonly status: "staged" | "committed";
|
|
90
|
+
readonly uploaded: boolean;
|
|
91
|
+
readonly createdAt: string;
|
|
92
|
+
readonly contentUrl?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface WebMessage {
|
|
95
|
+
readonly id: string;
|
|
96
|
+
readonly threadId: string;
|
|
97
|
+
readonly turnId?: string;
|
|
98
|
+
readonly role: "user" | "assistant" | "system";
|
|
99
|
+
readonly parts: readonly WebMessagePart[];
|
|
100
|
+
readonly attachments: readonly WebAttachment[];
|
|
101
|
+
readonly createdAt: string;
|
|
102
|
+
readonly updatedAt: string;
|
|
103
|
+
readonly status: WebMessageStatus;
|
|
104
|
+
}
|
|
105
|
+
export interface WebThreadDetail {
|
|
106
|
+
readonly thread: WebThread;
|
|
107
|
+
readonly messages: readonly WebMessage[];
|
|
108
|
+
}
|
|
109
|
+
export interface WebBootstrap {
|
|
110
|
+
readonly version: typeof WEB_API_VERSION;
|
|
111
|
+
readonly agents: readonly WebAgentSummary[];
|
|
112
|
+
readonly threads: readonly WebThread[];
|
|
113
|
+
readonly currentThreadId?: string;
|
|
114
|
+
readonly limits: {
|
|
115
|
+
readonly maxFileBytes: number;
|
|
116
|
+
readonly maxFilesPerTurn: number;
|
|
117
|
+
readonly maxTurnBytes: number;
|
|
118
|
+
readonly accept: readonly string[];
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
export type WebEventType = "ready" | "agents.changed" | "threads.changed" | "thread.changed" | "message.changed" | "turn.changed" | "attachment.changed";
|
|
122
|
+
export interface WebEvent {
|
|
123
|
+
readonly id: string;
|
|
124
|
+
readonly version: typeof WEB_API_VERSION;
|
|
125
|
+
readonly type: WebEventType;
|
|
126
|
+
readonly at: string;
|
|
127
|
+
readonly threadId?: string;
|
|
128
|
+
readonly payload?: unknown;
|
|
129
|
+
}
|
|
130
|
+
export interface CreateWebThreadInput {
|
|
131
|
+
readonly sourceId: string;
|
|
132
|
+
}
|
|
133
|
+
export interface PatchWebAgentInput {
|
|
134
|
+
readonly pinned: boolean;
|
|
135
|
+
}
|
|
136
|
+
export interface PatchWebThreadInput {
|
|
137
|
+
readonly title?: string;
|
|
138
|
+
readonly archived?: boolean;
|
|
139
|
+
}
|
|
140
|
+
export interface StartWebTurnInput {
|
|
141
|
+
readonly text?: string;
|
|
142
|
+
readonly attachmentIds?: readonly string[];
|
|
143
|
+
readonly model?: string;
|
|
144
|
+
readonly effort?: string;
|
|
145
|
+
}
|
|
146
|
+
export interface CreateWebUploadInput {
|
|
147
|
+
readonly name: string;
|
|
148
|
+
readonly contentType: string;
|
|
149
|
+
readonly sizeBytes?: number;
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,eAAO,MAAM,eAAe,EAAG,CAAU,CAAC;AAE1C,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,eAAO,MAAM,6BAA6B,QAAmB,CAAC;AAC9D,eAAO,MAAM,wBAAwB,QAAsB,CAAC;AAC5D,eAAO,MAAM,2BAA2B,QAAoB,CAAC;AAC7D,eAAO,MAAM,sBAAsB,MAAM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QAAQ;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,OAAO,eAAe,CAAC;IACzC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Version of the browser-facing JSON and SSE contract. */
|
|
2
|
+
export const WEB_API_VERSION = 1;
|
|
3
|
+
export const WEB_MAX_FILES_PER_TURN = 10;
|
|
4
|
+
export const WEB_MAX_TURN_ATTACHMENT_BYTES = 64 * 1024 * 1024;
|
|
5
|
+
export const WEB_STAGED_UPLOAD_TTL_MS = 24 * 60 * 60 * 1000;
|
|
6
|
+
export const WEB_MAX_STAGED_UPLOAD_BYTES = 256 * 1024 * 1024;
|
|
7
|
+
export const WEB_MAX_STAGED_UPLOADS = 100;
|
|
8
|
+
export const WEB_MAX_CONCURRENT_UPLOADS = 4;
|
|
9
|
+
export const WEB_MAX_ACTIVE_ATTACHMENT_TURN_BYTES = 64 * 1024 * 1024;
|
|
10
|
+
export const WEB_MAX_QUEUED_ATTACHMENT_TURNS = 32;
|
|
11
|
+
//# sourceMappingURL=contracts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAU,CAAC;AAE1C,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AACzC,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAC9D,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC5D,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AAC7D,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAC1C,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC;AAC5C,MAAM,CAAC,MAAM,oCAAoC,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AACrE,MAAM,CAAC,MAAM,+BAA+B,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type TraceSourceListItem } from "@mono-agent/observability";
|
|
2
|
+
export interface DiscoverOperatorAgentsOptions {
|
|
3
|
+
readonly registryDirs?: readonly string[];
|
|
4
|
+
readonly staleAfterMs?: number;
|
|
5
|
+
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
6
|
+
}
|
|
7
|
+
export interface DiscoveredOperatorAgent {
|
|
8
|
+
readonly source: TraceSourceListItem;
|
|
9
|
+
readonly baseUrl?: string;
|
|
10
|
+
readonly apiKey?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function defaultTraceRegistryDir(env?: Readonly<Record<string, string | undefined>>): string;
|
|
13
|
+
export declare function discoverOperatorAgents(options?: DiscoverOperatorAgentsOptions): Promise<readonly DiscoveredOperatorAgent[]>;
|
|
14
|
+
export declare function operatorBaseUrlFromMetadata(metadata: Record<string, unknown> | undefined): string | undefined;
|
|
15
|
+
/** Only loopback operator endpoints are trusted; manifests are local files but not an SSRF authority. */
|
|
16
|
+
export declare function isTrustedOperatorBaseUrl(value: string): boolean;
|
|
17
|
+
//# sourceMappingURL=discovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAOA,OAAO,EAAuC,KAAK,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAK1G,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;CAC7D;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IACrC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,uBAAuB,CAAC,GAAG,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAe,GAAG,MAAM,CAK/G;AAED,wBAAsB,sBAAsB,CAC1C,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,SAAS,uBAAuB,EAAE,CAAC,CAmB7C;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAK7G;AAED,yGAAyG;AACzG,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAW/D"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { constants as fsConstants } from "node:fs";
|
|
2
|
+
import { open } from "node:fs/promises";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { isAbsolute, resolve } from "node:path";
|
|
5
|
+
import { parseEnv } from "node:util";
|
|
6
|
+
import { isLoopbackHost } from "@mono-agent/agent-contracts";
|
|
7
|
+
import { listTraceSources, mergeTraceSources } from "@mono-agent/observability";
|
|
8
|
+
const BACKGROUND_SNAPSHOT_SCHEMA = "mono-agent.background-snapshot.v1";
|
|
9
|
+
const MAX_LOCAL_CONFIGURATION_BYTES = 1024 * 1024;
|
|
10
|
+
export function defaultTraceRegistryDir(env = process.env) {
|
|
11
|
+
const override = env.MONO_AGENT_TRACE_REGISTRY_DIR?.trim();
|
|
12
|
+
return resolve(override === undefined || override.length === 0
|
|
13
|
+
? resolve(homedir(), ".mono-agent", "trace-sources")
|
|
14
|
+
: override);
|
|
15
|
+
}
|
|
16
|
+
export async function discoverOperatorAgents(options = {}) {
|
|
17
|
+
const env = options.env ?? process.env;
|
|
18
|
+
const registryDirs = normalizeRegistryDirs(options.registryDirs, env);
|
|
19
|
+
const results = await Promise.all(registryDirs.map(async (registryDir) => listTraceSources({
|
|
20
|
+
registryDir,
|
|
21
|
+
...(options.staleAfterMs === undefined ? {} : { staleAfterMs: options.staleAfterMs }),
|
|
22
|
+
})));
|
|
23
|
+
const sources = mergeTraceSources(...results.map((result) => result.sources));
|
|
24
|
+
return Promise.all(sources
|
|
25
|
+
.filter((source) => source.health !== "stopped")
|
|
26
|
+
.map(async (source) => {
|
|
27
|
+
const baseUrl = operatorBaseUrlFromMetadata(source.metadata);
|
|
28
|
+
const apiKey = baseUrl === undefined ? undefined : await resolveOperatorApiKey(source, env);
|
|
29
|
+
return {
|
|
30
|
+
source,
|
|
31
|
+
...(baseUrl === undefined ? {} : { baseUrl }),
|
|
32
|
+
...(apiKey === undefined ? {} : { apiKey }),
|
|
33
|
+
};
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
export function operatorBaseUrlFromMetadata(metadata) {
|
|
37
|
+
const channels = record(metadata?.channels);
|
|
38
|
+
const operator = record(channels?.tui);
|
|
39
|
+
if (operator?.kind !== "running" || typeof operator.baseUrl !== "string")
|
|
40
|
+
return undefined;
|
|
41
|
+
return isTrustedOperatorBaseUrl(operator.baseUrl) ? operator.baseUrl.replace(/\/+$/u, "") : undefined;
|
|
42
|
+
}
|
|
43
|
+
/** Only loopback operator endpoints are trusted; manifests are local files but not an SSRF authority. */
|
|
44
|
+
export function isTrustedOperatorBaseUrl(value) {
|
|
45
|
+
if (value.trim().length === 0)
|
|
46
|
+
return false;
|
|
47
|
+
try {
|
|
48
|
+
const url = new URL(value);
|
|
49
|
+
return (url.protocol === "http:" || url.protocol === "https:")
|
|
50
|
+
&& isLoopbackHost(url.hostname)
|
|
51
|
+
&& url.username.length === 0
|
|
52
|
+
&& url.password.length === 0;
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async function resolveOperatorApiKey(source, env) {
|
|
59
|
+
const fromEnv = env.MONO_AGENT_TUI_API_KEY?.trim();
|
|
60
|
+
if (fromEnv !== undefined && fromEnv.length > 0)
|
|
61
|
+
return fromEnv;
|
|
62
|
+
if (source.configPath === undefined)
|
|
63
|
+
return undefined;
|
|
64
|
+
// Managed workers publish only the path/fingerprint of their selected
|
|
65
|
+
// dotenv. Read the one exact key locally; never copy secret values into the
|
|
66
|
+
// trace registry or browser-facing agent metadata.
|
|
67
|
+
const dotenvPath = dotenvPathFromMetadata(source);
|
|
68
|
+
if (dotenvPath !== undefined) {
|
|
69
|
+
const fromDotenv = await readDotenvOperatorApiKey(dotenvPath);
|
|
70
|
+
if (fromDotenv !== undefined)
|
|
71
|
+
return fromDotenv;
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
const parsed = JSON.parse(await readOwnerRegularFile(source.configPath));
|
|
75
|
+
const key = typeof parsed.tui?.apiKey === "string" ? parsed.tui.apiKey.trim() : "";
|
|
76
|
+
return key.length === 0 ? undefined : key;
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function dotenvPathFromMetadata(source) {
|
|
83
|
+
if (source.configPath === undefined)
|
|
84
|
+
return undefined;
|
|
85
|
+
const snapshot = record(source.metadata?.backgroundSnapshot);
|
|
86
|
+
if (snapshot?.schema !== BACKGROUND_SNAPSHOT_SCHEMA
|
|
87
|
+
|| typeof snapshot.configPath !== "string"
|
|
88
|
+
|| typeof snapshot.configFingerprint !== "string"
|
|
89
|
+
|| typeof snapshot.dotenvPath !== "string"
|
|
90
|
+
|| typeof snapshot.dotenvFingerprint !== "string"
|
|
91
|
+
|| snapshot.configFingerprint.length === 0
|
|
92
|
+
|| snapshot.dotenvFingerprint.length === 0
|
|
93
|
+
|| !isAbsolute(snapshot.configPath)
|
|
94
|
+
|| !isAbsolute(snapshot.dotenvPath)
|
|
95
|
+
|| resolve(snapshot.configPath) !== resolve(source.configPath))
|
|
96
|
+
return undefined;
|
|
97
|
+
return resolve(snapshot.dotenvPath);
|
|
98
|
+
}
|
|
99
|
+
async function readDotenvOperatorApiKey(path) {
|
|
100
|
+
try {
|
|
101
|
+
const parsed = parseEnv(await readOwnerRegularFile(path));
|
|
102
|
+
const key = parsed.MONO_AGENT_TUI_API_KEY?.trim();
|
|
103
|
+
return key === undefined || key.length === 0 ? undefined : key;
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
// Discovery is best effort. A keyed agent will surface as unavailable
|
|
107
|
+
// rather than weakening the local-file checks or leaking parser details.
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
async function readOwnerRegularFile(path) {
|
|
112
|
+
const handle = await open(path, fsConstants.O_RDONLY | fsConstants.O_NOFOLLOW | fsConstants.O_NONBLOCK);
|
|
113
|
+
try {
|
|
114
|
+
const info = await handle.stat();
|
|
115
|
+
const currentUid = typeof process.getuid === "function" ? process.getuid() : undefined;
|
|
116
|
+
if (!info.isFile() || (currentUid !== undefined && info.uid !== currentUid)) {
|
|
117
|
+
throw new Error("Local agent configuration is not an owner-owned regular file.");
|
|
118
|
+
}
|
|
119
|
+
if (info.size > MAX_LOCAL_CONFIGURATION_BYTES) {
|
|
120
|
+
throw new Error("Local agent configuration exceeds its size limit.");
|
|
121
|
+
}
|
|
122
|
+
return await handle.readFile({ encoding: "utf8" });
|
|
123
|
+
}
|
|
124
|
+
finally {
|
|
125
|
+
await handle.close();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function normalizeRegistryDirs(values, env) {
|
|
129
|
+
const requested = values !== undefined && values.length > 0 ? values : [defaultTraceRegistryDir(env)];
|
|
130
|
+
return [...new Set(requested.map((value) => resolve(value)))];
|
|
131
|
+
}
|
|
132
|
+
function record(value) {
|
|
133
|
+
return typeof value === "object" && value !== null && !Array.isArray(value)
|
|
134
|
+
? value
|
|
135
|
+
: undefined;
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.js","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CA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AqC,EACrC,GAAiD;IAEjD,MAAM,SAAS,GAAG,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,uBAAuB,CAAC,GAAG,CAAC,CAAC,CAAC;IACtG,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,MAAM,CAAC,KAAc;IAC5B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACzE,CAAC,CAAC,KAAgC;QAClC,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class WebConsoleError extends Error {
|
|
2
|
+
readonly code: string;
|
|
3
|
+
readonly status: number;
|
|
4
|
+
readonly details?: Readonly<Record<string, unknown>>;
|
|
5
|
+
constructor(code: string, message: string, status?: number, details?: Record<string, unknown>);
|
|
6
|
+
}
|
|
7
|
+
export declare function errorMessage(error: unknown): string;
|
|
8
|
+
export declare function errorCode(error: unknown): string | undefined;
|
|
9
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;gBAEzC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAS3F;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEnD;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAK5D"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export class WebConsoleError extends Error {
|
|
2
|
+
code;
|
|
3
|
+
status;
|
|
4
|
+
details;
|
|
5
|
+
constructor(code, message, status = 400, details) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = "WebConsoleError";
|
|
8
|
+
this.code = code;
|
|
9
|
+
this.status = status;
|
|
10
|
+
if (details !== undefined) {
|
|
11
|
+
this.details = details;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export function errorMessage(error) {
|
|
16
|
+
return error instanceof Error ? error.message : String(error);
|
|
17
|
+
}
|
|
18
|
+
export function errorCode(error) {
|
|
19
|
+
if (typeof error !== "object" || error === null)
|
|
20
|
+
return undefined;
|
|
21
|
+
return typeof error.code === "string"
|
|
22
|
+
? error.code
|
|
23
|
+
: undefined;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAC/B,IAAI,CAAS;IACb,MAAM,CAAS;IACf,OAAO,CAAqC;IAErD,YAAY,IAAY,EAAE,OAAe,EAAE,MAAM,GAAG,GAAG,EAAE,OAAiC;QACxF,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACzB,CAAC;IACH,CAAC;CACF;AAED,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAClE,OAAO,OAAQ,KAA4B,CAAC,IAAI,KAAK,QAAQ;QAC3D,CAAC,CAAE,KAA0B,CAAC,IAAI;QAClC,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@mono-agent/web` — persistent, always-on local/LAN browser console for
|
|
3
|
+
* discovering mono-agent instances and driving independent conversations.
|
|
4
|
+
*/
|
|
5
|
+
export { DEFAULT_WEB_HOST, DEFAULT_WEB_PORT, startWebServer, } from "./server.js";
|
|
6
|
+
export type { StartWebServerOptions, WebServerHandle } from "./server.js";
|
|
7
|
+
export { defaultWebStateDir, prepareWebState, prepareWebStatePaths, resetWebState, resolveWebStatePaths, } from "./state-paths.js";
|
|
8
|
+
export type { WebStatePathOptions, WebStatePaths } from "./state-paths.js";
|
|
9
|
+
export { defaultTraceRegistryDir, discoverOperatorAgents, isTrustedOperatorBaseUrl, operatorBaseUrlFromMetadata, } from "./discovery.js";
|
|
10
|
+
export type { DiscoverOperatorAgentsOptions, DiscoveredOperatorAgent, } from "./discovery.js";
|
|
11
|
+
export { WEB_API_VERSION, WEB_MAX_CONCURRENT_UPLOADS, WEB_MAX_ACTIVE_ATTACHMENT_TURN_BYTES, WEB_MAX_FILES_PER_TURN, WEB_MAX_STAGED_UPLOAD_BYTES, WEB_MAX_STAGED_UPLOADS, WEB_MAX_QUEUED_ATTACHMENT_TURNS, WEB_MAX_TURN_ATTACHMENT_BYTES, WEB_STAGED_UPLOAD_TTL_MS, } from "./contracts.js";
|
|
12
|
+
export type { CreateWebThreadInput, CreateWebUploadInput, PatchWebAgentInput, PatchWebThreadInput, StartWebTurnInput, WebAgentStatus, WebAgentSummary, WebAttachment, WebBootstrap, WebEvent, WebEventType, WebMessage, WebMessagePart, WebMessageStatus, WebModelOption, WebRunState, WebRunStatus, WebThread, WebThreadDetail, } from "./contracts.js";
|
|
13
|
+
export { WebConsoleError } from "./errors.js";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE1E,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,aAAa,EACb,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE3E,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,6BAA6B,EAC7B,uBAAuB,GACxB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,eAAe,EACf,0BAA0B,EAC1B,oCAAoC,EACpC,sBAAsB,EACtB,2BAA2B,EAC3B,sBAAsB,EACtB,+BAA+B,EAC/B,6BAA6B,EAC7B,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,YAAY,EACZ,SAAS,EACT,eAAe,GAChB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@mono-agent/web` — persistent, always-on local/LAN browser console for
|
|
3
|
+
* discovering mono-agent instances and driving independent conversations.
|
|
4
|
+
*/
|
|
5
|
+
export { DEFAULT_WEB_HOST, DEFAULT_WEB_PORT, startWebServer, } from "./server.js";
|
|
6
|
+
export { defaultWebStateDir, prepareWebState, prepareWebStatePaths, resetWebState, resolveWebStatePaths, } from "./state-paths.js";
|
|
7
|
+
export { defaultTraceRegistryDir, discoverOperatorAgents, isTrustedOperatorBaseUrl, operatorBaseUrlFromMetadata, } from "./discovery.js";
|
|
8
|
+
export { WEB_API_VERSION, WEB_MAX_CONCURRENT_UPLOADS, WEB_MAX_ACTIVE_ATTACHMENT_TURN_BYTES, WEB_MAX_FILES_PER_TURN, WEB_MAX_STAGED_UPLOAD_BYTES, WEB_MAX_STAGED_UPLOADS, WEB_MAX_QUEUED_ATTACHMENT_TURNS, WEB_MAX_TURN_ATTACHMENT_BYTES, WEB_STAGED_UPLOAD_TTL_MS, } from "./contracts.js";
|
|
9
|
+
export { WebConsoleError } from "./errors.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,GACf,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,aAAa,EACb,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AAMxB,OAAO,EACL,eAAe,EACf,0BAA0B,EAC1B,oCAAoC,EACpC,sBAAsB,EACtB,2BAA2B,EAC3B,sBAAsB,EACtB,+BAA+B,EAC/B,6BAA6B,EAC7B,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AAuBxB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type AgentAttachment, type AgentStreamWireFrame } from "@mono-agent/agent-contracts";
|
|
2
|
+
import type { WebModelOption } from "./contracts.js";
|
|
3
|
+
export interface OperatorConnection {
|
|
4
|
+
readonly baseUrl: string;
|
|
5
|
+
readonly apiKey?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface OperatorInfo {
|
|
8
|
+
readonly schema: number;
|
|
9
|
+
readonly label?: string;
|
|
10
|
+
readonly model?: string;
|
|
11
|
+
readonly effort?: string;
|
|
12
|
+
readonly models?: readonly string[];
|
|
13
|
+
readonly modelOptions?: Readonly<Record<string, WebModelOption>>;
|
|
14
|
+
readonly supportsAttachments: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface OperatorTurnInput {
|
|
17
|
+
readonly conversationId: string;
|
|
18
|
+
readonly text: string;
|
|
19
|
+
readonly attachments: readonly AgentAttachment[];
|
|
20
|
+
readonly metadata: Readonly<Record<string, unknown>>;
|
|
21
|
+
readonly signal: AbortSignal;
|
|
22
|
+
readonly onFrame: (frame: AgentStreamWireFrame) => void | Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
export interface OperatorTurnResult {
|
|
25
|
+
readonly finalText?: string;
|
|
26
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
27
|
+
}
|
|
28
|
+
export interface OperatorClientOptions extends OperatorConnection {
|
|
29
|
+
readonly fetchImpl?: typeof fetch;
|
|
30
|
+
}
|
|
31
|
+
export declare class OperatorClient {
|
|
32
|
+
private readonly baseUrl;
|
|
33
|
+
private readonly apiKey;
|
|
34
|
+
private readonly fetchImpl;
|
|
35
|
+
constructor(options: OperatorClientOptions);
|
|
36
|
+
info(signal?: AbortSignal): Promise<OperatorInfo>;
|
|
37
|
+
turn(input: OperatorTurnInput): Promise<OperatorTurnResult>;
|
|
38
|
+
cancel(conversationId: string): Promise<void>;
|
|
39
|
+
private headers;
|
|
40
|
+
private request;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=operator-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operator-client.d.ts","sourceRoot":"","sources":["../src/operator-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,oBAAoB,EAC1B,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAUrD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;IACjE,QAAQ,CAAC,mBAAmB,EAA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