tycono 0.1.65 → 0.1.66
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/bin/tycono.ts +13 -4
- package/package.json +1 -1
- package/src/api/src/create-server.ts +5 -1
- package/src/api/src/engine/agent-loop.ts +17 -6
- package/src/api/src/engine/context-assembler.ts +156 -48
- package/src/api/src/engine/knowledge-gate.ts +335 -0
- package/src/api/src/engine/llm-adapter.ts +7 -1
- package/src/api/src/engine/runners/claude-cli.ts +98 -116
- package/src/api/src/engine/runners/types.ts +2 -0
- package/src/api/src/engine/tools/executor.ts +3 -5
- package/src/api/src/routes/active-sessions.ts +143 -0
- package/src/api/src/routes/coins.ts +137 -0
- package/src/api/src/routes/execute.ts +158 -48
- package/src/api/src/routes/knowledge.ts +30 -0
- package/src/api/src/routes/operations.ts +48 -11
- package/src/api/src/routes/sessions.ts +1 -1
- package/src/api/src/routes/setup.ts +68 -1
- package/src/api/src/routes/speech.ts +334 -143
- package/src/api/src/services/activity-stream.ts +1 -1
- package/src/api/src/services/job-manager.ts +185 -9
- package/src/api/src/services/port-registry.ts +222 -0
- package/src/api/src/services/scaffold.ts +90 -0
- package/src/api/src/services/session-store.ts +75 -5
- package/src/web/dist/assets/index-BDLT2xew.js +109 -0
- package/src/web/dist/assets/index-LvS5V8aP.css +1 -0
- package/src/web/dist/assets/{preview-app-qIFqrb-y.js → preview-app-AJtyaM6L.js} +1 -1
- package/src/web/dist/index.html +2 -2
- package/templates/skills/_manifest.json +6 -0
- package/templates/skills/agent-browser/SKILL.md +159 -0
- package/templates/skills/agent-browser/meta.json +19 -0
- package/templates/teams/agency.json +3 -3
- package/templates/teams/research.json +3 -3
- package/templates/teams/startup.json +3 -3
- package/src/web/dist/assets/index-B3dNhn76.js +0 -101
- package/src/web/dist/assets/index-C7IEX_o_.css +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { COMPANY_ROOT } from './file-reader.js';
|
|
4
|
+
import type { ActivityEvent } from './activity-stream.js';
|
|
4
5
|
|
|
5
6
|
/* ─── Types ─────────────────────────────── */
|
|
6
7
|
|
|
@@ -11,16 +12,38 @@ export interface ImageAttachment {
|
|
|
11
12
|
mediaType: 'image/png' | 'image/jpeg' | 'image/gif' | 'image/webp';
|
|
12
13
|
}
|
|
13
14
|
|
|
15
|
+
/** Dispatch link — reference to a child session created via dispatch */
|
|
16
|
+
export interface DispatchLink {
|
|
17
|
+
sessionId: string;
|
|
18
|
+
roleId: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
14
21
|
export interface Message {
|
|
15
22
|
id: string;
|
|
16
23
|
from: 'ceo' | 'role';
|
|
17
24
|
content: string;
|
|
18
25
|
type: 'conversation' | 'directive' | 'system';
|
|
19
|
-
status?: 'streaming' | 'done' | 'error';
|
|
26
|
+
status?: 'streaming' | 'done' | 'error' | 'awaiting_input';
|
|
20
27
|
timestamp: string;
|
|
21
28
|
attachments?: ImageAttachment[];
|
|
29
|
+
|
|
30
|
+
/* ─── D-014: Session-Centric extensions ─── */
|
|
31
|
+
/** Execution events embedded in this message (replaces separate JSONL) */
|
|
32
|
+
events?: ActivityEvent[];
|
|
33
|
+
/** Child sessions spawned by dispatch during this message's execution */
|
|
34
|
+
dispatches?: DispatchLink[];
|
|
35
|
+
/** Internal job ID for runtime tracking (not exposed to UI) */
|
|
36
|
+
jobId?: string;
|
|
37
|
+
/** True for consult/ask messages (read-only execution) */
|
|
38
|
+
readOnly?: boolean;
|
|
39
|
+
/** Execution stats */
|
|
40
|
+
turns?: number;
|
|
41
|
+
tokens?: { input: number; output: number };
|
|
22
42
|
}
|
|
23
43
|
|
|
44
|
+
/** How this session was created */
|
|
45
|
+
export type SessionSource = 'chat' | 'wave' | 'dispatch';
|
|
46
|
+
|
|
24
47
|
export interface Session {
|
|
25
48
|
id: string;
|
|
26
49
|
roleId: string;
|
|
@@ -30,6 +53,14 @@ export interface Session {
|
|
|
30
53
|
status: 'active' | 'closed';
|
|
31
54
|
createdAt: string;
|
|
32
55
|
updatedAt: string;
|
|
56
|
+
|
|
57
|
+
/* ─── D-014: Session-Centric extensions ─── */
|
|
58
|
+
/** How this session was created */
|
|
59
|
+
source?: SessionSource;
|
|
60
|
+
/** Parent session ID (when created via dispatch) */
|
|
61
|
+
parentSessionId?: string;
|
|
62
|
+
/** Wave ID (when created via wave) */
|
|
63
|
+
waveId?: string;
|
|
33
64
|
}
|
|
34
65
|
|
|
35
66
|
/* ─── Session directory ─────────────────── */
|
|
@@ -99,7 +130,15 @@ function ensureLoaded(): void {
|
|
|
99
130
|
|
|
100
131
|
/* ─── Public API ────────────────────────── */
|
|
101
132
|
|
|
102
|
-
|
|
133
|
+
/** Options for creating a session with D-014 extensions */
|
|
134
|
+
export interface CreateSessionOptions {
|
|
135
|
+
mode?: 'talk' | 'do';
|
|
136
|
+
source?: SessionSource;
|
|
137
|
+
parentSessionId?: string;
|
|
138
|
+
waveId?: string;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export function createSession(roleId: string, opts: CreateSessionOptions = {}): Session {
|
|
103
142
|
ensureLoaded();
|
|
104
143
|
const id = `ses-${roleId}-${Date.now()}`;
|
|
105
144
|
const now = new Date().toISOString();
|
|
@@ -107,11 +146,14 @@ export function createSession(roleId: string, mode: 'talk' | 'do' = 'talk'): Ses
|
|
|
107
146
|
id,
|
|
108
147
|
roleId,
|
|
109
148
|
title: `New ${roleId.toUpperCase()} session`,
|
|
110
|
-
mode,
|
|
149
|
+
mode: opts.mode ?? 'talk',
|
|
111
150
|
messages: [],
|
|
112
151
|
status: 'active',
|
|
113
152
|
createdAt: now,
|
|
114
153
|
updatedAt: now,
|
|
154
|
+
...(opts.source && { source: opts.source }),
|
|
155
|
+
...(opts.parentSessionId && { parentSessionId: opts.parentSessionId }),
|
|
156
|
+
...(opts.waveId && { waveId: opts.waveId }),
|
|
115
157
|
};
|
|
116
158
|
cache.set(id, session);
|
|
117
159
|
writeImmediate(session);
|
|
@@ -150,7 +192,10 @@ export function addMessage(sessionId: string, msg: Message, streaming = false):
|
|
|
150
192
|
return session;
|
|
151
193
|
}
|
|
152
194
|
|
|
153
|
-
|
|
195
|
+
/** Fields that can be updated on a message */
|
|
196
|
+
export type MessageUpdate = Partial<Pick<Message, 'content' | 'status' | 'turns' | 'tokens' | 'dispatches' | 'readOnly'>>;
|
|
197
|
+
|
|
198
|
+
export function updateMessage(sessionId: string, messageId: string, updates: MessageUpdate): Session | undefined {
|
|
154
199
|
const session = cache.get(sessionId);
|
|
155
200
|
if (!session) return undefined;
|
|
156
201
|
|
|
@@ -159,6 +204,10 @@ export function updateMessage(sessionId: string, messageId: string, updates: Par
|
|
|
159
204
|
|
|
160
205
|
if (updates.content !== undefined) msg.content = updates.content;
|
|
161
206
|
if (updates.status !== undefined) msg.status = updates.status;
|
|
207
|
+
if (updates.turns !== undefined) msg.turns = updates.turns;
|
|
208
|
+
if (updates.tokens !== undefined) msg.tokens = updates.tokens;
|
|
209
|
+
if (updates.dispatches !== undefined) msg.dispatches = updates.dispatches;
|
|
210
|
+
if (updates.readOnly !== undefined) msg.readOnly = updates.readOnly;
|
|
162
211
|
session.updatedAt = new Date().toISOString();
|
|
163
212
|
|
|
164
213
|
if (updates.status === 'done' || updates.status === 'error') {
|
|
@@ -169,12 +218,33 @@ export function updateMessage(sessionId: string, messageId: string, updates: Par
|
|
|
169
218
|
return session;
|
|
170
219
|
}
|
|
171
220
|
|
|
172
|
-
|
|
221
|
+
/** Append an execution event to a message (D-014: events embedded in message) */
|
|
222
|
+
export function appendMessageEvent(sessionId: string, messageId: string, event: ActivityEvent): boolean {
|
|
223
|
+
const session = cache.get(sessionId);
|
|
224
|
+
if (!session) return false;
|
|
225
|
+
|
|
226
|
+
const msg = session.messages.find((m) => m.id === messageId);
|
|
227
|
+
if (!msg) return false;
|
|
228
|
+
|
|
229
|
+
if (!msg.events) msg.events = [];
|
|
230
|
+
msg.events.push(event);
|
|
231
|
+
session.updatedAt = new Date().toISOString();
|
|
232
|
+
|
|
233
|
+
// Debounce during streaming — events come in fast
|
|
234
|
+
debouncedWrite(session);
|
|
235
|
+
return true;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export function updateSession(id: string, updates: Partial<Pick<Session, 'title' | 'mode' | 'status' | 'source' | 'parentSessionId' | 'waveId'>>): Session | undefined {
|
|
173
239
|
const session = cache.get(id);
|
|
174
240
|
if (!session) return undefined;
|
|
175
241
|
|
|
176
242
|
if (updates.title !== undefined) session.title = updates.title;
|
|
177
243
|
if (updates.mode !== undefined) session.mode = updates.mode;
|
|
244
|
+
if (updates.status !== undefined) session.status = updates.status;
|
|
245
|
+
if (updates.source !== undefined) session.source = updates.source;
|
|
246
|
+
if (updates.parentSessionId !== undefined) session.parentSessionId = updates.parentSessionId;
|
|
247
|
+
if (updates.waveId !== undefined) session.waveId = updates.waveId;
|
|
178
248
|
session.updatedAt = new Date().toISOString();
|
|
179
249
|
writeImmediate(session);
|
|
180
250
|
return session;
|