moderado 0.3.7 → 0.3.8

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 (58) hide show
  1. package/README.md +215 -215
  2. package/dist/args.js +29 -29
  3. package/dist/chat_mode.d.ts +14 -0
  4. package/dist/chat_mode.d.ts.map +1 -0
  5. package/dist/chat_mode.js +13 -0
  6. package/dist/chat_mode.js.map +1 -0
  7. package/dist/commands/chat.d.ts.map +1 -1
  8. package/dist/commands/chat.js +2 -2
  9. package/dist/commands/chat.js.map +1 -1
  10. package/dist/commands/host.d.ts +4 -0
  11. package/dist/commands/host.d.ts.map +1 -0
  12. package/dist/commands/host.js +30 -0
  13. package/dist/commands/host.js.map +1 -0
  14. package/dist/commands/models.d.ts.map +1 -1
  15. package/dist/commands/models.js +2 -2
  16. package/dist/commands/models.js.map +1 -1
  17. package/dist/host/approval_queue.d.ts +9 -0
  18. package/dist/host/approval_queue.d.ts.map +1 -0
  19. package/dist/host/approval_queue.js +63 -0
  20. package/dist/host/approval_queue.js.map +1 -0
  21. package/dist/host/auto_approve.d.ts +22 -0
  22. package/dist/host/auto_approve.d.ts.map +1 -0
  23. package/dist/host/auto_approve.js +36 -0
  24. package/dist/host/auto_approve.js.map +1 -0
  25. package/dist/host/ndjson.d.ts +3 -0
  26. package/dist/host/ndjson.d.ts.map +1 -0
  27. package/dist/host/ndjson.js +68 -0
  28. package/dist/host/ndjson.js.map +1 -0
  29. package/dist/host/protocol_server.d.ts +9 -0
  30. package/dist/host/protocol_server.d.ts.map +1 -0
  31. package/dist/host/protocol_server.js +101 -0
  32. package/dist/host/protocol_server.js.map +1 -0
  33. package/dist/host/runtime.d.ts +30 -0
  34. package/dist/host/runtime.d.ts.map +1 -0
  35. package/dist/host/runtime.js +603 -0
  36. package/dist/host/runtime.js.map +1 -0
  37. package/dist/skills.js +2 -2
  38. package/dist/ui/session_screen.d.ts +32 -0
  39. package/dist/ui/session_screen.d.ts.map +1 -0
  40. package/dist/ui/session_screen.js +148 -0
  41. package/dist/ui/session_screen.js.map +1 -0
  42. package/dist/ui/session_terminal.d.ts +46 -0
  43. package/dist/ui/session_terminal.d.ts.map +1 -0
  44. package/dist/ui/session_terminal.js +342 -0
  45. package/dist/ui/session_terminal.js.map +1 -0
  46. package/dist/ui/welcome.d.ts.map +1 -1
  47. package/dist/ui/welcome.js +11 -12
  48. package/dist/ui/welcome.js.map +1 -1
  49. package/dist/vendor/contracts/host_protocol.d.ts +3545 -0
  50. package/dist/vendor/contracts/host_protocol.d.ts.map +1 -0
  51. package/dist/vendor/contracts/host_protocol.js +292 -0
  52. package/dist/vendor/contracts/host_protocol.js.map +1 -0
  53. package/dist/vendor/core/agent.js +24 -24
  54. package/dist/web_search_route.d.ts +16 -0
  55. package/dist/web_search_route.d.ts.map +1 -0
  56. package/dist/web_search_route.js +60 -0
  57. package/dist/web_search_route.js.map +1 -0
  58. package/package.json +28 -28
@@ -0,0 +1,68 @@
1
+ export async function* readHostMessages(input, maxLineBytes = 1_048_576) {
2
+ let chunks = [];
3
+ let bufferedBytes = 0;
4
+ for await (const chunk of input) {
5
+ const buf = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
6
+ let start = 0;
7
+ for (let i = 0; i < buf.length; i++) {
8
+ if (bufferedBytes + (i - start) > maxLineBytes) {
9
+ throw new Error(`Line exceeds maximum allowed size of ${maxLineBytes} bytes`);
10
+ }
11
+ if (buf[i] === 0x0a) {
12
+ // Found '\n'
13
+ const slice = buf.subarray(start, i);
14
+ chunks.push(slice);
15
+ bufferedBytes += slice.length;
16
+ if (bufferedBytes > maxLineBytes) {
17
+ throw new Error(`Line exceeds maximum allowed size of ${maxLineBytes} bytes`);
18
+ }
19
+ const lineBuf = Buffer.concat(chunks, bufferedBytes);
20
+ chunks = [];
21
+ bufferedBytes = 0;
22
+ start = i + 1;
23
+ let str = lineBuf.toString('utf8');
24
+ if (str.endsWith('\r')) {
25
+ str = str.slice(0, -1);
26
+ }
27
+ if (str.trim().length === 0) {
28
+ continue;
29
+ }
30
+ yield JSON.parse(str);
31
+ }
32
+ }
33
+ if (start < buf.length) {
34
+ const remaining = buf.subarray(start);
35
+ chunks.push(remaining);
36
+ bufferedBytes += remaining.length;
37
+ if (bufferedBytes > maxLineBytes) {
38
+ throw new Error(`Line exceeds maximum allowed size of ${maxLineBytes} bytes`);
39
+ }
40
+ }
41
+ }
42
+ if (bufferedBytes > 0) {
43
+ throw new Error('Unexpected EOF: incomplete line in stream');
44
+ }
45
+ }
46
+ export async function writeHostMessage(output, message) {
47
+ const line = JSON.stringify(message) + '\n';
48
+ const canContinue = output.write(line, 'utf8');
49
+ if (!canContinue) {
50
+ await new Promise((resolve, reject) => {
51
+ const onDrain = () => {
52
+ cleanup();
53
+ resolve();
54
+ };
55
+ const onError = (err) => {
56
+ cleanup();
57
+ reject(err);
58
+ };
59
+ const cleanup = () => {
60
+ output.off('drain', onDrain);
61
+ output.off('error', onError);
62
+ };
63
+ output.on('drain', onDrain);
64
+ output.on('error', onError);
65
+ });
66
+ }
67
+ }
68
+ //# sourceMappingURL=ndjson.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ndjson.js","sourceRoot":"","sources":["../../src/host/ndjson.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,gBAAgB,CACrC,KAA4B,EAC5B,YAAY,GAAG,SAAS;IAExB,IAAI,MAAM,GAAa,EAAE,CAAC;IAC1B,IAAI,aAAa,GAAG,CAAC,CAAC;IAEtB,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,KAAK,EAAE,CAAC;QAChC,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChE,IAAI,KAAK,GAAG,CAAC,CAAC;QAEd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAA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AAO,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { type HostNotification, type HostRequest, type InitializeRequest, type InitializeResult } from '@moderado/contracts';
2
+ export interface HostSessionRuntime {
3
+ initialize(request: InitializeRequest): Promise<InitializeResult>;
4
+ dispatch(request: HostRequest): Promise<unknown>;
5
+ close(): Promise<void>;
6
+ }
7
+ export type HostSessionFactory = (emit: (notification: HostNotification) => Promise<void>) => HostSessionRuntime | Promise<HostSessionRuntime>;
8
+ export declare function serveHostProtocol(input: NodeJS.ReadableStream, output: NodeJS.WritableStream, sessionFactory: HostSessionFactory, signal?: AbortSignal): Promise<void>;
9
+ //# sourceMappingURL=protocol_server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol_server.d.ts","sourceRoot":"","sources":["../../src/host/protocol_server.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAC;AAG7B,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAClE,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,MAAM,MAAM,kBAAkB,GAAG,CAC/B,IAAI,EAAE,CAAC,YAAY,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,KACpD,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAEtD,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,MAAM,CAAC,cAAc,EAC5B,MAAM,EAAE,MAAM,CAAC,cAAc,EAC7B,cAAc,EAAE,kBAAkB,EAClC,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CA0Gf"}
@@ -0,0 +1,101 @@
1
+ import { HostRequestSchema, } from '../vendor/contracts/index.js';
2
+ import { readHostMessages, writeHostMessage } from './ndjson.js';
3
+ export async function serveHostProtocol(input, output, sessionFactory, signal) {
4
+ const emit = async (notification) => {
5
+ await writeHostMessage(output, notification);
6
+ };
7
+ const runtime = await sessionFactory(emit);
8
+ const inFlightRequestIds = new Set();
9
+ const sendResponse = async (id, ok, resultOrError) => {
10
+ if (ok) {
11
+ await writeHostMessage(output, {
12
+ type: 'response',
13
+ id,
14
+ ok: true,
15
+ result: resultOrError.result,
16
+ });
17
+ }
18
+ else {
19
+ await writeHostMessage(output, {
20
+ type: 'response',
21
+ id,
22
+ ok: false,
23
+ error: resultOrError.error,
24
+ });
25
+ }
26
+ };
27
+ try {
28
+ for await (const raw of readHostMessages(input)) {
29
+ if (signal?.aborted) {
30
+ break;
31
+ }
32
+ const hasStringId = typeof raw?.id === 'string' && raw.id.length > 0;
33
+ const rawId = hasStringId ? raw.id : undefined;
34
+ // Check for unsupported protocol version in initialize
35
+ if (raw?.method === 'initialize') {
36
+ const proto = raw?.params?.protocolVersion;
37
+ if (proto !== 1) {
38
+ if (rawId) {
39
+ await sendResponse(rawId, false, {
40
+ error: {
41
+ code: 'UNSUPPORTED_VERSION',
42
+ message: `Unsupported protocol version ${proto}. Expected 1.`,
43
+ },
44
+ });
45
+ }
46
+ break;
47
+ }
48
+ }
49
+ const parseResult = HostRequestSchema.safeParse(raw);
50
+ if (!parseResult.success) {
51
+ if (rawId) {
52
+ await sendResponse(rawId, false, {
53
+ error: {
54
+ code: 'INVALID_REQUEST',
55
+ message: parseResult.error.message,
56
+ },
57
+ });
58
+ }
59
+ continue;
60
+ }
61
+ const request = parseResult.data;
62
+ if (inFlightRequestIds.has(request.id)) {
63
+ await sendResponse(request.id, false, {
64
+ error: {
65
+ code: 'BUSY',
66
+ message: `Request ID ${request.id} is already in flight`,
67
+ },
68
+ });
69
+ continue;
70
+ }
71
+ inFlightRequestIds.add(request.id);
72
+ (async () => {
73
+ try {
74
+ let result;
75
+ if (request.method === 'initialize') {
76
+ result = await runtime.initialize(request);
77
+ }
78
+ else {
79
+ result = await runtime.dispatch(request);
80
+ }
81
+ await sendResponse(request.id, true, { result });
82
+ }
83
+ catch (err) {
84
+ await sendResponse(request.id, false, {
85
+ error: {
86
+ code: err.code || 'INTERNAL_ERROR',
87
+ message: err.message || 'Internal host error',
88
+ },
89
+ });
90
+ }
91
+ finally {
92
+ inFlightRequestIds.delete(request.id);
93
+ }
94
+ })();
95
+ }
96
+ }
97
+ finally {
98
+ await runtime.close();
99
+ }
100
+ }
101
+ //# sourceMappingURL=protocol_server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol_server.js","sourceRoot":"","sources":["../../src/host/protocol_server.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,GAKlB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAYjE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,KAA4B,EAC5B,MAA6B,EAC7B,cAAkC,EAClC,MAAoB;IAEpB,MAAM,IAAI,GAAG,KAAK,EAAE,YAA8B,EAAE,EAAE;QACpD,MAAM,gBAAgB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAC/C,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAU,CAAC;IAE7C,MAAM,YAAY,GAAG,KAAK,EACxB,EAAU,EACV,EAAW,EACX,aAA8E,EAC9E,EAAE;QACF,IAAI,EAAE,EAAE,CAAC;YACP,MAAM,gBAAgB,CAAC,MAAM,EAAE;gBAC7B,IAAI,EAAE,UAAU;gBAChB,EAAE;gBACF,EAAE,EAAE,IAAI;gBACR,MAAM,EAAE,aAAa,CAAC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M,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;gBACxC,CAAC;YACH,CAAC,CAAC,EAAE,CAAC;QACP,CAAC;IACH,CAAC;YAAS,CAAC;QACT,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;AACH,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { HostNotification, HostRequest, InitializeRequest, InitializeResult, IProviderAdapter, IToolRegistry } from '@moderado/contracts';
2
+ import { AgentLoop } from '@moderado/core';
3
+ import { CredentialStore } from '../credentials.js';
4
+ import { SessionStore } from '../sessions.js';
5
+ import { ApprovalQueue } from './approval_queue.js';
6
+ export interface HostRuntimeDependencies {
7
+ provider?: IProviderAdapter;
8
+ credentialStore?: CredentialStore;
9
+ customHome?: string;
10
+ tools?: IToolRegistry;
11
+ sessionStore?: SessionStore;
12
+ agentLoop?: AgentLoop;
13
+ }
14
+ export interface CreateHostRuntimeOptions {
15
+ workspaceRoot: string;
16
+ emit: (notification: HostNotification) => Promise<void>;
17
+ dependencies?: HostRuntimeDependencies;
18
+ providerId?: string;
19
+ modelId?: string;
20
+ }
21
+ export interface HostRuntime {
22
+ readonly approvalQueue: ApprovalQueue;
23
+ readonly canonicalWorkspaceRoot: string;
24
+ initialize(request?: InitializeRequest): Promise<InitializeResult>;
25
+ dispatch(request: HostRequest): Promise<unknown>;
26
+ waitForActiveGeneration?(): Promise<void>;
27
+ close(): Promise<void>;
28
+ }
29
+ export declare function createHostRuntime(options: CreateHostRuntimeOptions): Promise<HostRuntime>;
30
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/host/runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EAId,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,SAAS,EAA0C,MAAM,gBAAgB,CA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