@shardworks/nexus-core 0.1.99 → 0.1.101
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/README.md +95 -166
- package/dist/guild-config.d.ts +14 -52
- package/dist/guild-config.d.ts.map +1 -1
- package/dist/guild-config.js +7 -10
- package/dist/guild-config.js.map +1 -1
- package/dist/guild.d.ts +83 -0
- package/dist/guild.d.ts.map +1 -0
- package/dist/guild.js +45 -0
- package/dist/guild.js.map +1 -0
- package/dist/id.d.ts +14 -0
- package/dist/id.d.ts.map +1 -0
- package/dist/id.js +19 -0
- package/dist/id.js.map +1 -0
- package/dist/index.d.ts +6 -30
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -32
- package/dist/index.js.map +1 -1
- package/dist/nexus-home.d.ts +0 -4
- package/dist/nexus-home.d.ts.map +1 -1
- package/dist/nexus-home.js +1 -9
- package/dist/nexus-home.js.map +1 -1
- package/dist/plugin.d.ts +115 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +39 -0
- package/dist/plugin.js.map +1 -0
- package/dist/resolve-package.d.ts +58 -0
- package/dist/resolve-package.d.ts.map +1 -0
- package/dist/resolve-package.js +123 -0
- package/dist/resolve-package.js.map +1 -0
- package/package.json +5 -14
- package/dist/book.d.ts +0 -110
- package/dist/book.d.ts.map +0 -1
- package/dist/book.js +0 -16
- package/dist/book.js.map +0 -1
- package/dist/legacy/1/anima.d.ts +0 -79
- package/dist/legacy/1/anima.d.ts.map +0 -1
- package/dist/legacy/1/anima.js +0 -285
- package/dist/legacy/1/anima.js.map +0 -1
- package/dist/legacy/1/audit.d.ts +0 -23
- package/dist/legacy/1/audit.d.ts.map +0 -1
- package/dist/legacy/1/audit.js +0 -61
- package/dist/legacy/1/audit.js.map +0 -1
- package/dist/legacy/1/bundle.d.ts +0 -111
- package/dist/legacy/1/bundle.d.ts.map +0 -1
- package/dist/legacy/1/bundle.js +0 -452
- package/dist/legacy/1/bundle.js.map +0 -1
- package/dist/legacy/1/clock-daemon.d.ts +0 -2
- package/dist/legacy/1/clock-daemon.d.ts.map +0 -1
- package/dist/legacy/1/clock-daemon.js +0 -72
- package/dist/legacy/1/clock-daemon.js.map +0 -1
- package/dist/legacy/1/clockworks.d.ts +0 -98
- package/dist/legacy/1/clockworks.d.ts.map +0 -1
- package/dist/legacy/1/clockworks.js +0 -359
- package/dist/legacy/1/clockworks.js.map +0 -1
- package/dist/legacy/1/conversation.d.ts +0 -165
- package/dist/legacy/1/conversation.d.ts.map +0 -1
- package/dist/legacy/1/conversation.js +0 -457
- package/dist/legacy/1/conversation.js.map +0 -1
- package/dist/legacy/1/engine.d.ts +0 -90
- package/dist/legacy/1/engine.d.ts.map +0 -1
- package/dist/legacy/1/engine.js +0 -89
- package/dist/legacy/1/engine.js.map +0 -1
- package/dist/legacy/1/events.d.ts +0 -88
- package/dist/legacy/1/events.d.ts.map +0 -1
- package/dist/legacy/1/events.js +0 -239
- package/dist/legacy/1/events.js.map +0 -1
- package/dist/legacy/1/guild-config.d.ts +0 -74
- package/dist/legacy/1/guild-config.d.ts.map +0 -1
- package/dist/legacy/1/guild-config.js +0 -51
- package/dist/legacy/1/guild-config.js.map +0 -1
- package/dist/legacy/1/id.d.ts +0 -8
- package/dist/legacy/1/id.d.ts.map +0 -1
- package/dist/legacy/1/id.js +0 -27
- package/dist/legacy/1/id.js.map +0 -1
- package/dist/legacy/1/index.d.ts +0 -28
- package/dist/legacy/1/index.d.ts.map +0 -1
- package/dist/legacy/1/index.js +0 -32
- package/dist/legacy/1/index.js.map +0 -1
- package/dist/legacy/1/init-guild.d.ts +0 -24
- package/dist/legacy/1/init-guild.d.ts.map +0 -1
- package/dist/legacy/1/init-guild.js +0 -230
- package/dist/legacy/1/init-guild.js.map +0 -1
- package/dist/legacy/1/install-tool.d.ts +0 -73
- package/dist/legacy/1/install-tool.d.ts.map +0 -1
- package/dist/legacy/1/install-tool.js +0 -436
- package/dist/legacy/1/install-tool.js.map +0 -1
- package/dist/legacy/1/instantiate.d.ts +0 -33
- package/dist/legacy/1/instantiate.d.ts.map +0 -1
- package/dist/legacy/1/instantiate.js +0 -137
- package/dist/legacy/1/instantiate.js.map +0 -1
- package/dist/legacy/1/manifest.d.ts +0 -132
- package/dist/legacy/1/manifest.d.ts.map +0 -1
- package/dist/legacy/1/manifest.js +0 -321
- package/dist/legacy/1/manifest.js.map +0 -1
- package/dist/legacy/1/migrate.d.ts +0 -84
- package/dist/legacy/1/migrate.d.ts.map +0 -1
- package/dist/legacy/1/migrate.js +0 -228
- package/dist/legacy/1/migrate.js.map +0 -1
- package/dist/legacy/1/nexus-home.d.ts +0 -11
- package/dist/legacy/1/nexus-home.d.ts.map +0 -1
- package/dist/legacy/1/nexus-home.js +0 -16
- package/dist/legacy/1/nexus-home.js.map +0 -1
- package/dist/legacy/1/plugin-descriptor.d.ts +0 -3
- package/dist/legacy/1/plugin-descriptor.d.ts.map +0 -1
- package/dist/legacy/1/plugin-descriptor.js +0 -2
- package/dist/legacy/1/plugin-descriptor.js.map +0 -1
- package/dist/legacy/1/preconditions.d.ts +0 -100
- package/dist/legacy/1/preconditions.d.ts.map +0 -1
- package/dist/legacy/1/preconditions.js +0 -189
- package/dist/legacy/1/preconditions.js.map +0 -1
- package/dist/legacy/1/rehydrate.d.ts +0 -22
- package/dist/legacy/1/rehydrate.d.ts.map +0 -1
- package/dist/legacy/1/rehydrate.js +0 -109
- package/dist/legacy/1/rehydrate.js.map +0 -1
- package/dist/legacy/1/remove-tool.d.ts +0 -19
- package/dist/legacy/1/remove-tool.d.ts.map +0 -1
- package/dist/legacy/1/remove-tool.js +0 -105
- package/dist/legacy/1/remove-tool.js.map +0 -1
- package/dist/legacy/1/session.d.ts +0 -343
- package/dist/legacy/1/session.d.ts.map +0 -1
- package/dist/legacy/1/session.js +0 -499
- package/dist/legacy/1/session.js.map +0 -1
- package/dist/legacy/1/tool-registry.d.ts +0 -12
- package/dist/legacy/1/tool-registry.d.ts.map +0 -1
- package/dist/legacy/1/tool-registry.js +0 -28
- package/dist/legacy/1/tool-registry.js.map +0 -1
- package/dist/legacy/1/tool.d.ts +0 -10
- package/dist/legacy/1/tool.d.ts.map +0 -1
- package/dist/legacy/1/tool.js +0 -2
- package/dist/legacy/1/tool.js.map +0 -1
- package/dist/legacy/1/upgrade.d.ts +0 -129
- package/dist/legacy/1/upgrade.d.ts.map +0 -1
- package/dist/legacy/1/upgrade.js +0 -355
- package/dist/legacy/1/upgrade.js.map +0 -1
- package/dist/legacy/1/workshop.d.ts +0 -95
- package/dist/legacy/1/workshop.d.ts.map +0 -1
- package/dist/legacy/1/workshop.js +0 -229
- package/dist/legacy/1/workshop.js.map +0 -1
- package/dist/legacy/1/worktree.d.ts +0 -67
- package/dist/legacy/1/worktree.d.ts.map +0 -1
- package/dist/legacy/1/worktree.js +0 -117
- package/dist/legacy/1/worktree.js.map +0 -1
- package/dist/legacy/1/writ.d.ts +0 -130
- package/dist/legacy/1/writ.d.ts.map +0 -1
- package/dist/legacy/1/writ.js +0 -599
- package/dist/legacy/1/writ.js.map +0 -1
- package/dist/rig-context.d.ts +0 -47
- package/dist/rig-context.d.ts.map +0 -1
- package/dist/rig-context.js +0 -11
- package/dist/rig-context.js.map +0 -1
- package/dist/rig-descriptor.d.ts +0 -39
- package/dist/rig-descriptor.d.ts.map +0 -1
- package/dist/rig-descriptor.js +0 -12
- package/dist/rig-descriptor.js.map +0 -1
- package/dist/rig.d.ts +0 -70
- package/dist/rig.d.ts.map +0 -1
- package/dist/rig.js +0 -14
- package/dist/rig.js.map +0 -1
- package/dist/tool.d.ts +0 -136
- package/dist/tool.d.ts.map +0 -1
- package/dist/tool.js +0 -135
- package/dist/tool.js.map +0 -1
- package/migrations/001-schema.sql +0 -177
- package/migrations/002-writs.sql +0 -44
- package/migrations/003-conversations.sql +0 -43
- package/migrations/004-remove-commissions.sql +0 -24
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Conversation — multi-turn interaction with animas.
|
|
3
|
-
*
|
|
4
|
-
* Conversations group multiple sessions (turns) into a single logical
|
|
5
|
-
* interaction. Each turn is a full launchSession() call through the
|
|
6
|
-
* standard session funnel — same manifest pipeline, same metrics,
|
|
7
|
-
* same session records.
|
|
8
|
-
*
|
|
9
|
-
* Two kinds:
|
|
10
|
-
* - **consult** — human talks to an anima (from dashboard or CLI)
|
|
11
|
-
* - **convene** — multiple animas hold a turn-limited dialogue
|
|
12
|
-
*
|
|
13
|
-
* State is fully persistent in the database. The core primitive is
|
|
14
|
-
* `takeTurn()` — a stateless function that reads conversation state,
|
|
15
|
-
* runs one turn through the session funnel, and updates the records.
|
|
16
|
-
* No in-memory state is held between turns. Any component (dashboard,
|
|
17
|
-
* CLI, clockworks) can drive a turn with just a conversation ID and
|
|
18
|
-
* participant ID.
|
|
19
|
-
*
|
|
20
|
-
* Human participants don't launch sessions. Their messages are captured
|
|
21
|
-
* as the `prompt` field on the anima's session record. This means the
|
|
22
|
-
* sessions table only contains anima turns — cost, tokens, and duration
|
|
23
|
-
* are always agent-side metrics. For dialogue reconstruction,
|
|
24
|
-
* `showConversation()` interleaves anima session rows with their prompts
|
|
25
|
-
* to show the full exchange.
|
|
26
|
-
*/
|
|
27
|
-
import type { SessionChunk } from './session.ts';
|
|
28
|
-
/** A chunk emitted during a conversation turn. Re-exports SessionChunk
|
|
29
|
-
* with an additional turn_complete variant. */
|
|
30
|
-
export type ConversationChunk = SessionChunk | {
|
|
31
|
-
type: 'turn_complete';
|
|
32
|
-
turnNumber: number;
|
|
33
|
-
costUsd?: number;
|
|
34
|
-
};
|
|
35
|
-
/** Options for creating a conversation. */
|
|
36
|
-
export interface CreateConversationOptions {
|
|
37
|
-
kind: 'consult' | 'convene';
|
|
38
|
-
topic?: string;
|
|
39
|
-
turnLimit?: number;
|
|
40
|
-
participants: Array<{
|
|
41
|
-
kind: 'anima' | 'human';
|
|
42
|
-
name: string;
|
|
43
|
-
}>;
|
|
44
|
-
/** For convene: the triggering event ID. */
|
|
45
|
-
eventId?: string;
|
|
46
|
-
}
|
|
47
|
-
/** Result of creating a conversation. */
|
|
48
|
-
export interface CreateConversationResult {
|
|
49
|
-
conversationId: string;
|
|
50
|
-
participants: Array<{
|
|
51
|
-
id: string;
|
|
52
|
-
name: string;
|
|
53
|
-
kind: string;
|
|
54
|
-
}>;
|
|
55
|
-
}
|
|
56
|
-
/** Summary view for listing conversations. */
|
|
57
|
-
export interface ConversationSummary {
|
|
58
|
-
id: string;
|
|
59
|
-
status: string;
|
|
60
|
-
kind: string;
|
|
61
|
-
topic: string | null;
|
|
62
|
-
turnLimit: number | null;
|
|
63
|
-
createdAt: string;
|
|
64
|
-
endedAt: string | null;
|
|
65
|
-
participants: Array<{
|
|
66
|
-
id: string;
|
|
67
|
-
name: string;
|
|
68
|
-
kind: string;
|
|
69
|
-
}>;
|
|
70
|
-
/** Computed from sessions table. */
|
|
71
|
-
turnCount: number;
|
|
72
|
-
totalCostUsd: number;
|
|
73
|
-
}
|
|
74
|
-
/** Full detail view of a conversation including turns. */
|
|
75
|
-
export interface ConversationDetail extends ConversationSummary {
|
|
76
|
-
/** Turns are session rows, enriched with participant name. */
|
|
77
|
-
turns: Array<{
|
|
78
|
-
sessionId: string;
|
|
79
|
-
turnNumber: number;
|
|
80
|
-
participant: string;
|
|
81
|
-
prompt: string | null;
|
|
82
|
-
exitCode: number | null;
|
|
83
|
-
costUsd: number | null;
|
|
84
|
-
durationMs: number | null;
|
|
85
|
-
startedAt: string;
|
|
86
|
-
endedAt: string | null;
|
|
87
|
-
}>;
|
|
88
|
-
}
|
|
89
|
-
/** Options for listing conversations. */
|
|
90
|
-
export interface ListConversationsOptions {
|
|
91
|
-
status?: string;
|
|
92
|
-
kind?: string;
|
|
93
|
-
limit?: number;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Create a new conversation.
|
|
97
|
-
*
|
|
98
|
-
* Sets up conversation and participant records. Does NOT take a first
|
|
99
|
-
* turn — that's a separate call to takeTurn().
|
|
100
|
-
*
|
|
101
|
-
* Anima participants are identified by name. Manifesting happens at
|
|
102
|
-
* turn time, not creation time.
|
|
103
|
-
*/
|
|
104
|
-
export declare function createConversation(home: string, options: CreateConversationOptions): CreateConversationResult;
|
|
105
|
-
/**
|
|
106
|
-
* Take a turn in a conversation.
|
|
107
|
-
*
|
|
108
|
-
* For anima participants:
|
|
109
|
-
* 1. Reads conversation state (checks status, turn limit)
|
|
110
|
-
* 2. Manifests the anima through the standard pipeline
|
|
111
|
-
* 3. Calls launchSession() with claudeSessionId for --resume
|
|
112
|
-
* 4. Captures providerSessionId and updates participant record
|
|
113
|
-
* 5. Yields ConversationChunks as they stream from the provider
|
|
114
|
-
*
|
|
115
|
-
* For human participants:
|
|
116
|
-
* - No session launched. Human messages are passed as the prompt
|
|
117
|
-
* to the next anima turn. This function is a no-op for humans
|
|
118
|
-
* (the caller passes the human's message directly to the anima's
|
|
119
|
-
* takeTurn call).
|
|
120
|
-
*
|
|
121
|
-
* Throws if conversation is not active or turn limit reached.
|
|
122
|
-
*/
|
|
123
|
-
export declare function takeTurn(home: string, conversationId: string, participantId: string, message: string): AsyncGenerator<ConversationChunk>;
|
|
124
|
-
/**
|
|
125
|
-
* End a conversation explicitly.
|
|
126
|
-
*
|
|
127
|
-
* Sets status to 'concluded' (normal end) or 'abandoned' (e.g.
|
|
128
|
-
* browser disconnect, timeout).
|
|
129
|
-
*/
|
|
130
|
-
export declare function endConversation(home: string, conversationId: string, reason?: 'concluded' | 'abandoned'): void;
|
|
131
|
-
/**
|
|
132
|
-
* Get the next participant in a convene rotation.
|
|
133
|
-
*
|
|
134
|
-
* Reads turn history and returns whose turn it is (round-robin by
|
|
135
|
-
* participant creation order). Returns null if conversation is not
|
|
136
|
-
* active or turn limit reached.
|
|
137
|
-
*/
|
|
138
|
-
export declare function nextParticipant(home: string, conversationId: string): {
|
|
139
|
-
participantId: string;
|
|
140
|
-
name: string;
|
|
141
|
-
} | null;
|
|
142
|
-
/**
|
|
143
|
-
* List conversations with optional filters.
|
|
144
|
-
*/
|
|
145
|
-
export declare function listConversations(home: string, opts?: ListConversationsOptions): ConversationSummary[];
|
|
146
|
-
/**
|
|
147
|
-
* Show full detail for a conversation, including all turns.
|
|
148
|
-
*
|
|
149
|
-
* Turns are session rows ordered by turn_number. Each turn includes
|
|
150
|
-
* the prompt (which, in a consult, is the human's message — this is
|
|
151
|
-
* how human contributions appear in the dialogue reconstruction).
|
|
152
|
-
*/
|
|
153
|
-
export declare function showConversation(home: string, conversationId: string): ConversationDetail | null;
|
|
154
|
-
/**
|
|
155
|
-
* Format a message for the next participant in a convene.
|
|
156
|
-
*
|
|
157
|
-
* Each anima has their own claude session via --resume. Their session
|
|
158
|
-
* already contains their own prior messages and responses. We only
|
|
159
|
-
* send them what happened since their last turn — the other
|
|
160
|
-
* participants' contributions.
|
|
161
|
-
*
|
|
162
|
-
* On the first turn (no prior turns), returns the conversation topic.
|
|
163
|
-
*/
|
|
164
|
-
export declare function formatConveneMessage(home: string, conversationId: string, participantId: string): string;
|
|
165
|
-
//# sourceMappingURL=conversation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../src/legacy/1/conversation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAOH,OAAO,KAAK,EAAE,YAAY,EAAqB,MAAM,cAAc,CAAC;AAIpE;gDACgD;AAChD,MAAM,MAAM,iBAAiB,GACzB,YAAY,GACZ;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpE,2CAA2C;AAC3C,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE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,MAAM,CAyFR"}
|
|
@@ -1,457 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Conversation — multi-turn interaction with animas.
|
|
3
|
-
*
|
|
4
|
-
* Conversations group multiple sessions (turns) into a single logical
|
|
5
|
-
* interaction. Each turn is a full launchSession() call through the
|
|
6
|
-
* standard session funnel — same manifest pipeline, same metrics,
|
|
7
|
-
* same session records.
|
|
8
|
-
*
|
|
9
|
-
* Two kinds:
|
|
10
|
-
* - **consult** — human talks to an anima (from dashboard or CLI)
|
|
11
|
-
* - **convene** — multiple animas hold a turn-limited dialogue
|
|
12
|
-
*
|
|
13
|
-
* State is fully persistent in the database. The core primitive is
|
|
14
|
-
* `takeTurn()` — a stateless function that reads conversation state,
|
|
15
|
-
* runs one turn through the session funnel, and updates the records.
|
|
16
|
-
* No in-memory state is held between turns. Any component (dashboard,
|
|
17
|
-
* CLI, clockworks) can drive a turn with just a conversation ID and
|
|
18
|
-
* participant ID.
|
|
19
|
-
*
|
|
20
|
-
* Human participants don't launch sessions. Their messages are captured
|
|
21
|
-
* as the `prompt` field on the anima's session record. This means the
|
|
22
|
-
* sessions table only contains anima turns — cost, tokens, and duration
|
|
23
|
-
* are always agent-side metrics. For dialogue reconstruction,
|
|
24
|
-
* `showConversation()` interleaves anima session rows with their prompts
|
|
25
|
-
* to show the full exchange.
|
|
26
|
-
*/
|
|
27
|
-
import Database from 'better-sqlite3';
|
|
28
|
-
import { booksPath } from "./nexus-home.js";
|
|
29
|
-
import { generateId } from "./id.js";
|
|
30
|
-
import { manifest } from "./manifest.js";
|
|
31
|
-
import { launchSession } from "./session.js";
|
|
32
|
-
// ── Lifecycle Functions ────────────────────────────────────────────────
|
|
33
|
-
/**
|
|
34
|
-
* Create a new conversation.
|
|
35
|
-
*
|
|
36
|
-
* Sets up conversation and participant records. Does NOT take a first
|
|
37
|
-
* turn — that's a separate call to takeTurn().
|
|
38
|
-
*
|
|
39
|
-
* Anima participants are identified by name. Manifesting happens at
|
|
40
|
-
* turn time, not creation time.
|
|
41
|
-
*/
|
|
42
|
-
export function createConversation(home, options) {
|
|
43
|
-
const db = new Database(booksPath(home));
|
|
44
|
-
db.pragma('foreign_keys = ON');
|
|
45
|
-
try {
|
|
46
|
-
const conversationId = generateId('conv');
|
|
47
|
-
const now = new Date().toISOString();
|
|
48
|
-
db.prepare(`INSERT INTO conversations (id, status, kind, topic, turn_limit, created_at, event_id)
|
|
49
|
-
VALUES (?, 'active', ?, ?, ?, ?, ?)`).run(conversationId, options.kind, options.topic ?? null, options.turnLimit ?? null, now, options.eventId ?? null);
|
|
50
|
-
const participants = [];
|
|
51
|
-
for (const p of options.participants) {
|
|
52
|
-
const participantId = generateId('cpart');
|
|
53
|
-
// Look up anima_id for anima participants
|
|
54
|
-
let animaId = null;
|
|
55
|
-
if (p.kind === 'anima') {
|
|
56
|
-
const row = db.prepare(`SELECT id FROM animas WHERE name = ? AND status = 'active'`).get(p.name);
|
|
57
|
-
if (row) {
|
|
58
|
-
animaId = row.id;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
db.prepare(`INSERT INTO conversation_participants (id, conversation_id, kind, name, anima_id)
|
|
62
|
-
VALUES (?, ?, ?, ?, ?)`).run(participantId, conversationId, p.kind, p.name, animaId);
|
|
63
|
-
participants.push({ id: participantId, name: p.name, kind: p.kind });
|
|
64
|
-
}
|
|
65
|
-
return { conversationId, participants };
|
|
66
|
-
}
|
|
67
|
-
finally {
|
|
68
|
-
db.close();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Take a turn in a conversation.
|
|
73
|
-
*
|
|
74
|
-
* For anima participants:
|
|
75
|
-
* 1. Reads conversation state (checks status, turn limit)
|
|
76
|
-
* 2. Manifests the anima through the standard pipeline
|
|
77
|
-
* 3. Calls launchSession() with claudeSessionId for --resume
|
|
78
|
-
* 4. Captures providerSessionId and updates participant record
|
|
79
|
-
* 5. Yields ConversationChunks as they stream from the provider
|
|
80
|
-
*
|
|
81
|
-
* For human participants:
|
|
82
|
-
* - No session launched. Human messages are passed as the prompt
|
|
83
|
-
* to the next anima turn. This function is a no-op for humans
|
|
84
|
-
* (the caller passes the human's message directly to the anima's
|
|
85
|
-
* takeTurn call).
|
|
86
|
-
*
|
|
87
|
-
* Throws if conversation is not active or turn limit reached.
|
|
88
|
-
*/
|
|
89
|
-
export async function* takeTurn(home, conversationId, participantId, message) {
|
|
90
|
-
// 1. Read conversation and participant state
|
|
91
|
-
const db = new Database(booksPath(home));
|
|
92
|
-
db.pragma('foreign_keys = ON');
|
|
93
|
-
let conversation;
|
|
94
|
-
let participant;
|
|
95
|
-
let currentTurnCount;
|
|
96
|
-
try {
|
|
97
|
-
const convRow = db.prepare(`SELECT status, kind, turn_limit FROM conversations WHERE id = ?`).get(conversationId);
|
|
98
|
-
if (!convRow) {
|
|
99
|
-
throw new Error(`Conversation "${conversationId}" not found.`);
|
|
100
|
-
}
|
|
101
|
-
conversation = convRow;
|
|
102
|
-
if (conversation.status !== 'active') {
|
|
103
|
-
throw new Error(`Conversation "${conversationId}" is not active (status: ${conversation.status}).`);
|
|
104
|
-
}
|
|
105
|
-
const partRow = db.prepare(`SELECT kind, name, anima_id, claude_session_id
|
|
106
|
-
FROM conversation_participants WHERE id = ? AND conversation_id = ?`).get(participantId, conversationId);
|
|
107
|
-
if (!partRow) {
|
|
108
|
-
throw new Error(`Participant "${participantId}" not found in conversation "${conversationId}".`);
|
|
109
|
-
}
|
|
110
|
-
participant = partRow;
|
|
111
|
-
// Count existing turns for this conversation
|
|
112
|
-
const countRow = db.prepare(`SELECT COUNT(*) as count FROM sessions WHERE conversation_id = ?`).get(conversationId);
|
|
113
|
-
currentTurnCount = countRow.count;
|
|
114
|
-
// Check turn limit
|
|
115
|
-
if (conversation.turn_limit !== null && currentTurnCount >= conversation.turn_limit) {
|
|
116
|
-
// Auto-conclude if at limit
|
|
117
|
-
db.prepare(`UPDATE conversations SET status = 'concluded', ended_at = ? WHERE id = ?`).run(new Date().toISOString(), conversationId);
|
|
118
|
-
throw new Error(`Conversation "${conversationId}" has reached its turn limit (${conversation.turn_limit}).`);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
finally {
|
|
122
|
-
db.close();
|
|
123
|
-
}
|
|
124
|
-
// 2. Human participants don't launch sessions
|
|
125
|
-
if (participant.kind === 'human') {
|
|
126
|
-
// Nothing to do — the message will be passed as the prompt
|
|
127
|
-
// to the next anima turn by the caller.
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
// 3. Manifest the anima
|
|
131
|
-
const animaManifest = await manifest(home, participant.name);
|
|
132
|
-
// 4. Determine turn number (1-indexed)
|
|
133
|
-
const turnNumber = currentTurnCount + 1;
|
|
134
|
-
// 5. Launch session through the funnel
|
|
135
|
-
const workspace = { kind: 'guildhall' };
|
|
136
|
-
// Collect chunks from the streaming provider
|
|
137
|
-
const collectedChunks = [];
|
|
138
|
-
const sessionResult = await launchSession({
|
|
139
|
-
home,
|
|
140
|
-
manifest: animaManifest,
|
|
141
|
-
prompt: message,
|
|
142
|
-
interactive: false,
|
|
143
|
-
workspace,
|
|
144
|
-
trigger: conversation.kind,
|
|
145
|
-
name: `${conversation.kind}-${participant.name}-turn-${turnNumber}`,
|
|
146
|
-
conversationId,
|
|
147
|
-
turnNumber,
|
|
148
|
-
claudeSessionId: participant.claude_session_id ?? undefined,
|
|
149
|
-
onChunk: (chunk) => {
|
|
150
|
-
collectedChunks.push(chunk);
|
|
151
|
-
},
|
|
152
|
-
});
|
|
153
|
-
// Yield all collected chunks
|
|
154
|
-
for (const chunk of collectedChunks) {
|
|
155
|
-
yield chunk;
|
|
156
|
-
}
|
|
157
|
-
// 6. Update participant's claude_session_id for --resume on next turn
|
|
158
|
-
if (sessionResult.providerSessionId) {
|
|
159
|
-
const db2 = new Database(booksPath(home));
|
|
160
|
-
db2.pragma('foreign_keys = ON');
|
|
161
|
-
try {
|
|
162
|
-
db2.prepare(`UPDATE conversation_participants SET claude_session_id = ? WHERE id = ?`).run(sessionResult.providerSessionId, participantId);
|
|
163
|
-
}
|
|
164
|
-
finally {
|
|
165
|
-
db2.close();
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
// 7. Check if we've hit the turn limit after this turn
|
|
169
|
-
if (conversation.turn_limit !== null && turnNumber >= conversation.turn_limit) {
|
|
170
|
-
const db3 = new Database(booksPath(home));
|
|
171
|
-
db3.pragma('foreign_keys = ON');
|
|
172
|
-
try {
|
|
173
|
-
db3.prepare(`UPDATE conversations SET status = 'concluded', ended_at = ? WHERE id = ?`).run(new Date().toISOString(), conversationId);
|
|
174
|
-
}
|
|
175
|
-
finally {
|
|
176
|
-
db3.close();
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
// 8. Yield turn_complete
|
|
180
|
-
yield {
|
|
181
|
-
type: 'turn_complete',
|
|
182
|
-
turnNumber,
|
|
183
|
-
costUsd: sessionResult.costUsd,
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* End a conversation explicitly.
|
|
188
|
-
*
|
|
189
|
-
* Sets status to 'concluded' (normal end) or 'abandoned' (e.g.
|
|
190
|
-
* browser disconnect, timeout).
|
|
191
|
-
*/
|
|
192
|
-
export function endConversation(home, conversationId, reason = 'concluded') {
|
|
193
|
-
const db = new Database(booksPath(home));
|
|
194
|
-
db.pragma('foreign_keys = ON');
|
|
195
|
-
try {
|
|
196
|
-
const result = db.prepare(`UPDATE conversations SET status = ?, ended_at = ? WHERE id = ? AND status = 'active'`).run(reason, new Date().toISOString(), conversationId);
|
|
197
|
-
if (result.changes === 0) {
|
|
198
|
-
// Either not found or already ended — check which
|
|
199
|
-
const row = db.prepare(`SELECT status FROM conversations WHERE id = ?`).get(conversationId);
|
|
200
|
-
if (!row) {
|
|
201
|
-
throw new Error(`Conversation "${conversationId}" not found.`);
|
|
202
|
-
}
|
|
203
|
-
// Already ended — no-op (idempotent)
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
finally {
|
|
207
|
-
db.close();
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Get the next participant in a convene rotation.
|
|
212
|
-
*
|
|
213
|
-
* Reads turn history and returns whose turn it is (round-robin by
|
|
214
|
-
* participant creation order). Returns null if conversation is not
|
|
215
|
-
* active or turn limit reached.
|
|
216
|
-
*/
|
|
217
|
-
export function nextParticipant(home, conversationId) {
|
|
218
|
-
const db = new Database(booksPath(home));
|
|
219
|
-
db.pragma('foreign_keys = ON');
|
|
220
|
-
try {
|
|
221
|
-
// Check conversation is active
|
|
222
|
-
const conv = db.prepare(`SELECT status, turn_limit FROM conversations WHERE id = ?`).get(conversationId);
|
|
223
|
-
if (!conv || conv.status !== 'active')
|
|
224
|
-
return null;
|
|
225
|
-
// Count existing turns
|
|
226
|
-
const countRow = db.prepare(`SELECT COUNT(*) as count FROM sessions WHERE conversation_id = ?`).get(conversationId);
|
|
227
|
-
if (conv.turn_limit !== null && countRow.count >= conv.turn_limit)
|
|
228
|
-
return null;
|
|
229
|
-
// Get participants in creation order (by rowid)
|
|
230
|
-
const participants = db.prepare(`SELECT id, name FROM conversation_participants
|
|
231
|
-
WHERE conversation_id = ? AND kind = 'anima'
|
|
232
|
-
ORDER BY rowid ASC`).all(conversationId);
|
|
233
|
-
if (participants.length === 0)
|
|
234
|
-
return null;
|
|
235
|
-
// Round-robin: turn count mod participant count
|
|
236
|
-
const nextIdx = countRow.count % participants.length;
|
|
237
|
-
const next = participants[nextIdx];
|
|
238
|
-
return { participantId: next.id, name: next.name };
|
|
239
|
-
}
|
|
240
|
-
finally {
|
|
241
|
-
db.close();
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
// ── Read Functions ─────────────────────────────────────────────────────
|
|
245
|
-
/**
|
|
246
|
-
* List conversations with optional filters.
|
|
247
|
-
*/
|
|
248
|
-
export function listConversations(home, opts = {}) {
|
|
249
|
-
const db = new Database(booksPath(home));
|
|
250
|
-
db.pragma('foreign_keys = ON');
|
|
251
|
-
try {
|
|
252
|
-
let query = `SELECT c.id, c.status, c.kind, c.topic, c.turn_limit,
|
|
253
|
-
c.created_at, c.ended_at
|
|
254
|
-
FROM conversations c`;
|
|
255
|
-
const conditions = [];
|
|
256
|
-
const params = [];
|
|
257
|
-
if (opts.status) {
|
|
258
|
-
conditions.push('c.status = ?');
|
|
259
|
-
params.push(opts.status);
|
|
260
|
-
}
|
|
261
|
-
if (opts.kind) {
|
|
262
|
-
conditions.push('c.kind = ?');
|
|
263
|
-
params.push(opts.kind);
|
|
264
|
-
}
|
|
265
|
-
if (conditions.length > 0) {
|
|
266
|
-
query += ` WHERE ${conditions.join(' AND ')}`;
|
|
267
|
-
}
|
|
268
|
-
query += ` ORDER BY c.created_at DESC`;
|
|
269
|
-
if (opts.limit) {
|
|
270
|
-
query += ` LIMIT ?`;
|
|
271
|
-
params.push(opts.limit);
|
|
272
|
-
}
|
|
273
|
-
const rows = db.prepare(query).all(...params);
|
|
274
|
-
return rows.map(row => {
|
|
275
|
-
// Get participants
|
|
276
|
-
const parts = db.prepare(`SELECT id, name, kind FROM conversation_participants WHERE conversation_id = ?`).all(row.id);
|
|
277
|
-
// Get turn count and total cost from sessions
|
|
278
|
-
const metrics = db.prepare(`SELECT COUNT(*) as turn_count, COALESCE(SUM(cost_usd), 0) as total_cost
|
|
279
|
-
FROM sessions WHERE conversation_id = ?`).get(row.id);
|
|
280
|
-
return {
|
|
281
|
-
id: row.id,
|
|
282
|
-
status: row.status,
|
|
283
|
-
kind: row.kind,
|
|
284
|
-
topic: row.topic,
|
|
285
|
-
turnLimit: row.turn_limit,
|
|
286
|
-
createdAt: row.created_at,
|
|
287
|
-
endedAt: row.ended_at,
|
|
288
|
-
participants: parts,
|
|
289
|
-
turnCount: metrics.turn_count,
|
|
290
|
-
totalCostUsd: metrics.total_cost,
|
|
291
|
-
};
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
finally {
|
|
295
|
-
db.close();
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Show full detail for a conversation, including all turns.
|
|
300
|
-
*
|
|
301
|
-
* Turns are session rows ordered by turn_number. Each turn includes
|
|
302
|
-
* the prompt (which, in a consult, is the human's message — this is
|
|
303
|
-
* how human contributions appear in the dialogue reconstruction).
|
|
304
|
-
*/
|
|
305
|
-
export function showConversation(home, conversationId) {
|
|
306
|
-
const db = new Database(booksPath(home));
|
|
307
|
-
db.pragma('foreign_keys = ON');
|
|
308
|
-
try {
|
|
309
|
-
const row = db.prepare(`SELECT id, status, kind, topic, turn_limit, created_at, ended_at
|
|
310
|
-
FROM conversations WHERE id = ?`).get(conversationId);
|
|
311
|
-
if (!row)
|
|
312
|
-
return null;
|
|
313
|
-
// Get participants
|
|
314
|
-
const parts = db.prepare(`SELECT id, name, kind FROM conversation_participants WHERE conversation_id = ?`).all(row.id);
|
|
315
|
-
// Get turns (sessions for this conversation)
|
|
316
|
-
const turns = db.prepare(`SELECT s.id, s.turn_number, a.name as participant,
|
|
317
|
-
s.started_at, s.ended_at, s.exit_code, s.cost_usd, s.duration_ms
|
|
318
|
-
FROM sessions s
|
|
319
|
-
JOIN animas a ON a.id = s.anima_id
|
|
320
|
-
WHERE s.conversation_id = ?
|
|
321
|
-
ORDER BY s.turn_number ASC`).all(conversationId);
|
|
322
|
-
// Get prompts from session records for dialogue reconstruction
|
|
323
|
-
const turnDetails = turns.map(t => {
|
|
324
|
-
// Read the prompt from the session record JSON if available
|
|
325
|
-
let prompt = null;
|
|
326
|
-
const recordRow = db.prepare(`SELECT record_path FROM sessions WHERE id = ?`).get(t.id);
|
|
327
|
-
if (recordRow?.record_path) {
|
|
328
|
-
try {
|
|
329
|
-
const fs = require('node:fs');
|
|
330
|
-
const path = require('node:path');
|
|
331
|
-
const fullPath = path.join(home, recordRow.record_path);
|
|
332
|
-
if (fs.existsSync(fullPath)) {
|
|
333
|
-
const record = JSON.parse(fs.readFileSync(fullPath, 'utf-8'));
|
|
334
|
-
prompt = record.userPrompt ?? null;
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
catch {
|
|
338
|
-
// If we can't read the record, skip the prompt
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
return {
|
|
342
|
-
sessionId: t.id,
|
|
343
|
-
turnNumber: t.turn_number,
|
|
344
|
-
participant: t.participant,
|
|
345
|
-
prompt,
|
|
346
|
-
exitCode: t.exit_code,
|
|
347
|
-
costUsd: t.cost_usd,
|
|
348
|
-
durationMs: t.duration_ms,
|
|
349
|
-
startedAt: t.started_at,
|
|
350
|
-
endedAt: t.ended_at,
|
|
351
|
-
};
|
|
352
|
-
});
|
|
353
|
-
// Metrics
|
|
354
|
-
const metrics = db.prepare(`SELECT COUNT(*) as turn_count, COALESCE(SUM(cost_usd), 0) as total_cost
|
|
355
|
-
FROM sessions WHERE conversation_id = ?`).get(conversationId);
|
|
356
|
-
return {
|
|
357
|
-
id: row.id,
|
|
358
|
-
status: row.status,
|
|
359
|
-
kind: row.kind,
|
|
360
|
-
topic: row.topic,
|
|
361
|
-
turnLimit: row.turn_limit,
|
|
362
|
-
createdAt: row.created_at,
|
|
363
|
-
endedAt: row.ended_at,
|
|
364
|
-
participants: parts,
|
|
365
|
-
turnCount: metrics.turn_count,
|
|
366
|
-
totalCostUsd: metrics.total_cost,
|
|
367
|
-
turns: turnDetails,
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
finally {
|
|
371
|
-
db.close();
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
// ── Convene Helpers ────────────────────────────────────────────────────
|
|
375
|
-
/**
|
|
376
|
-
* Format a message for the next participant in a convene.
|
|
377
|
-
*
|
|
378
|
-
* Each anima has their own claude session via --resume. Their session
|
|
379
|
-
* already contains their own prior messages and responses. We only
|
|
380
|
-
* send them what happened since their last turn — the other
|
|
381
|
-
* participants' contributions.
|
|
382
|
-
*
|
|
383
|
-
* On the first turn (no prior turns), returns the conversation topic.
|
|
384
|
-
*/
|
|
385
|
-
export function formatConveneMessage(home, conversationId, participantId) {
|
|
386
|
-
const db = new Database(booksPath(home));
|
|
387
|
-
db.pragma('foreign_keys = ON');
|
|
388
|
-
try {
|
|
389
|
-
// Get the conversation topic
|
|
390
|
-
const conv = db.prepare(`SELECT topic FROM conversations WHERE id = ?`).get(conversationId);
|
|
391
|
-
// Find this participant's last turn number
|
|
392
|
-
const participant = db.prepare(`SELECT name, anima_id FROM conversation_participants WHERE id = ?`).get(participantId);
|
|
393
|
-
if (!participant?.anima_id) {
|
|
394
|
-
return conv?.topic ?? '';
|
|
395
|
-
}
|
|
396
|
-
const lastTurn = db.prepare(`SELECT MAX(turn_number) as last_turn FROM sessions
|
|
397
|
-
WHERE conversation_id = ? AND anima_id = ?`).get(conversationId, participant.anima_id);
|
|
398
|
-
if (lastTurn.last_turn === null) {
|
|
399
|
-
// First turn for this participant — use the topic
|
|
400
|
-
return conv?.topic ?? '';
|
|
401
|
-
}
|
|
402
|
-
// Get all turns since this participant's last turn
|
|
403
|
-
const newTurns = db.prepare(`SELECT s.turn_number, a.name as participant_name, s.record_path
|
|
404
|
-
FROM sessions s
|
|
405
|
-
JOIN animas a ON a.id = s.anima_id
|
|
406
|
-
WHERE s.conversation_id = ? AND s.turn_number > ?
|
|
407
|
-
ORDER BY s.turn_number ASC`).all(conversationId, lastTurn.last_turn);
|
|
408
|
-
if (newTurns.length === 0) {
|
|
409
|
-
return conv?.topic ?? '';
|
|
410
|
-
}
|
|
411
|
-
// Build the message from session records
|
|
412
|
-
const fs = require('node:fs');
|
|
413
|
-
const path = require('node:path');
|
|
414
|
-
const lines = [];
|
|
415
|
-
for (const turn of newTurns) {
|
|
416
|
-
let responseText = '[response not available]';
|
|
417
|
-
if (turn.record_path) {
|
|
418
|
-
try {
|
|
419
|
-
const fullPath = path.join(home, turn.record_path);
|
|
420
|
-
if (fs.existsSync(fullPath)) {
|
|
421
|
-
const record = JSON.parse(fs.readFileSync(fullPath, 'utf-8'));
|
|
422
|
-
// Extract text from transcript
|
|
423
|
-
const transcript = record.transcript;
|
|
424
|
-
if (transcript) {
|
|
425
|
-
const textParts = [];
|
|
426
|
-
for (const msg of transcript) {
|
|
427
|
-
if (msg.type === 'assistant') {
|
|
428
|
-
const message = msg.message;
|
|
429
|
-
const content = message?.content;
|
|
430
|
-
if (content) {
|
|
431
|
-
for (const block of content) {
|
|
432
|
-
if (block.type === 'text' && typeof block.text === 'string') {
|
|
433
|
-
textParts.push(block.text);
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
if (textParts.length > 0) {
|
|
440
|
-
responseText = textParts.join('');
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
catch {
|
|
446
|
-
// If we can't read the record, use placeholder
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
lines.push(`[${turn.participant_name}]: ${responseText}`);
|
|
450
|
-
}
|
|
451
|
-
return lines.join('\n\n');
|
|
452
|
-
}
|
|
453
|
-
finally {
|
|
454
|
-
db.close();
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
//# sourceMappingURL=conversation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../../src/legacy/1/conversation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAoE7C,0EAA0E;AAE1E;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAChC,IAAY,EACZ,OAAkC;IAElC,MAAM,E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