newmark-agent 0.6.2 → 0.6.3
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/dist/conversation-utility-host.bundle.cjs +1947 -470
- package/dist/core/agent.d.ts +14 -0
- package/dist/core/agent.js +44 -3
- package/dist/core/agentKernelRunner.js +24 -2
- package/dist/core/continuation/contracts.d.ts +197 -0
- package/dist/core/continuation/contracts.js +72 -0
- package/dist/core/continuation/store.d.ts +178 -0
- package/dist/core/continuation/store.js +989 -0
- package/dist/core/conversationKernel.d.ts +80 -1
- package/dist/core/conversationKernel.js +586 -36
- package/dist/core/requestContextEstimate.d.ts +5 -1
- package/dist/llm/provider.js +9 -2
- package/dist/main.js +39 -4
- package/dist/providers/chat-completions.adapter.js +6 -1
- package/dist/providers/responses.adapter.js +4 -1
- package/dist/server.d.ts +1 -0
- package/dist/server.js +1 -0
- package/dist/ui/index.html +70 -11
- package/dist/wsl-agent-host.bundle.cjs +1950 -473
- package/package.json +3 -2
|
@@ -5,6 +5,8 @@ import { ConversationRuntimeTarget, NormalizedConversationTarget } from './conve
|
|
|
5
5
|
export type ConversationQueueMode = 'steer' | 'followUp';
|
|
6
6
|
export interface ConversationQueueItemSnapshot {
|
|
7
7
|
id: string;
|
|
8
|
+
/** Authoritative continuation-v1 build id (null for legacy/in-memory rows). */
|
|
9
|
+
buildId?: string;
|
|
8
10
|
text: string;
|
|
9
11
|
queueMode: ConversationQueueMode;
|
|
10
12
|
requestedMode?: string;
|
|
@@ -12,6 +14,11 @@ export interface ConversationQueueItemSnapshot {
|
|
|
12
14
|
runId?: string;
|
|
13
15
|
createdAt: string;
|
|
14
16
|
images?: AgentPromptMessage['images'];
|
|
17
|
+
branchNodeId?: string;
|
|
18
|
+
branchPath?: string[];
|
|
19
|
+
/** Exact workspace ledger branch id used when this row was admitted. */
|
|
20
|
+
ledgerBranchId?: string;
|
|
21
|
+
modelSelection?: string;
|
|
15
22
|
}
|
|
16
23
|
export type ConversationQueueAction = 'enqueue' | 'update' | 'delete' | 'reorder' | 'toggle_pause' | 'set_pause' | 'guide';
|
|
17
24
|
export interface ConversationQueueActionInput {
|
|
@@ -21,11 +28,22 @@ export interface ConversationQueueActionInput {
|
|
|
21
28
|
goalObjective?: string;
|
|
22
29
|
createdAt?: string;
|
|
23
30
|
images?: AgentPromptMessage['images'];
|
|
31
|
+
/** Runtime branch node that owns this queued user turn. */
|
|
32
|
+
branchNodeId?: string;
|
|
33
|
+
/** Full runtime branch path captured when the item was enqueued. */
|
|
34
|
+
branchPath?: string[];
|
|
35
|
+
/** Exact conversation runtime identity captured at enqueue time. */
|
|
36
|
+
targetRuntimeKey?: string;
|
|
37
|
+
workspaceKey?: string;
|
|
38
|
+
/** Provider-qualified model selected when the user enqueued this turn. */
|
|
39
|
+
modelSelection?: string;
|
|
24
40
|
orderedIds?: string[];
|
|
25
41
|
paused?: boolean;
|
|
26
42
|
}
|
|
27
43
|
export interface AgentPromptMessage {
|
|
28
44
|
text: string;
|
|
45
|
+
/** Authoritative continuation-v1 build id for a queued user turn. */
|
|
46
|
+
buildId?: string;
|
|
29
47
|
/** Public transcript text when the execution prompt contains hidden orchestration instructions. */
|
|
30
48
|
visibleUserInput?: string;
|
|
31
49
|
/** Public semantic mode label; execution policy still follows the runner mode. */
|
|
@@ -45,6 +63,13 @@ export interface AgentPromptMessage {
|
|
|
45
63
|
createdAt?: string;
|
|
46
64
|
guideId?: string;
|
|
47
65
|
runId?: string;
|
|
66
|
+
/** Stable conversation/branch ownership for queued user turns. */
|
|
67
|
+
branchNodeId?: string;
|
|
68
|
+
branchPath?: string[];
|
|
69
|
+
ledgerBranchId?: string;
|
|
70
|
+
targetRuntimeKey?: string;
|
|
71
|
+
workspaceKey?: string;
|
|
72
|
+
modelSelection?: string;
|
|
48
73
|
/**
|
|
49
74
|
* dev-0.4.3: 同一 Build block 内连续到达的多个 Guide 会被 conversation
|
|
50
75
|
* kernel 合并为一次 provider 续接,而不是每来一个 Guide 就响应一次。
|
|
@@ -200,7 +225,31 @@ export declare class ConversationKernel {
|
|
|
200
225
|
/** Detach idle owners before config replacement or workspace removal. */
|
|
201
226
|
disposeIdle(workspaceKey?: string): string[];
|
|
202
227
|
/** A Flow and its queue share one Agent; no second history writer is created. */
|
|
203
|
-
beginExternalRun(targetInput: ConversationTargetInput, options: ConversationKernelRunOptions, createOwner: () => Agent, previousQueuePaused?: boolean
|
|
228
|
+
beginExternalRun(targetInput: ConversationTargetInput, options: ConversationKernelRunOptions, createOwner: () => Agent, previousQueuePaused?: boolean, buildInput?: {
|
|
229
|
+
commandId?: string;
|
|
230
|
+
text: string;
|
|
231
|
+
requestedMode?: string;
|
|
232
|
+
goalObjective?: string;
|
|
233
|
+
modelSelection?: string;
|
|
234
|
+
branchNodeId?: string;
|
|
235
|
+
branchPath?: string[];
|
|
236
|
+
resume?: boolean;
|
|
237
|
+
existingBuildId?: string;
|
|
238
|
+
}): Agent;
|
|
239
|
+
/**
|
|
240
|
+
* Admit a Flow build at command-acceptance time. The Flow may wait behind a
|
|
241
|
+
* running Build, but its queue position (and therefore the parent of every
|
|
242
|
+
* later Next item) is fixed now, not when the Flow finally starts.
|
|
243
|
+
*/
|
|
244
|
+
admitExternalBuild(targetInput: ConversationTargetInput, buildInput: {
|
|
245
|
+
commandId: string;
|
|
246
|
+
text: string;
|
|
247
|
+
requestedMode?: string;
|
|
248
|
+
goalObjective?: string;
|
|
249
|
+
modelSelection?: string;
|
|
250
|
+
branchNodeId?: string;
|
|
251
|
+
branchPath?: string[];
|
|
252
|
+
}): string | null;
|
|
204
253
|
settleExternalRun(target: ConversationTargetInput, completed: boolean): void;
|
|
205
254
|
releaseExternalRun(target: ConversationTargetInput, paused: boolean): void;
|
|
206
255
|
prepareForArchive(target: ConversationTargetInput): Promise<Agent | null>;
|
|
@@ -225,6 +274,19 @@ export declare class ConversationKernel {
|
|
|
225
274
|
*/
|
|
226
275
|
private drainQueuedFollowUpMessage;
|
|
227
276
|
queueItems(target: ConversationTargetInput): ConversationQueueItemSnapshot[];
|
|
277
|
+
/**
|
|
278
|
+
* Capture the exact runtime branch that owns a queued user turn. A queued
|
|
279
|
+
* Next is a new user turn, but it must still land on the branch the user was
|
|
280
|
+
* viewing when they enqueued it, not on whatever branch happens to be active
|
|
281
|
+
* when the previous Build settles.
|
|
282
|
+
*/
|
|
283
|
+
private runtimeBranchIdentity;
|
|
284
|
+
/**
|
|
285
|
+
* Map the current conversation/branch model onto the continuation-v1
|
|
286
|
+
* Root/Branch identity. The ledger is workspace-scoped and shared by the
|
|
287
|
+
* PC GUI, hosted mobile API and isolated runtimes.
|
|
288
|
+
*/
|
|
289
|
+
private continuationStore;
|
|
228
290
|
enqueueNext(target: ConversationTargetInput, input: {
|
|
229
291
|
id: string;
|
|
230
292
|
text: string;
|
|
@@ -232,6 +294,10 @@ export declare class ConversationKernel {
|
|
|
232
294
|
goalObjective?: string;
|
|
233
295
|
createdAt?: string;
|
|
234
296
|
images?: AgentPromptMessage['images'];
|
|
297
|
+
branchNodeId?: string;
|
|
298
|
+
branchPath?: string[];
|
|
299
|
+
modelSelection?: string;
|
|
300
|
+
targetRuntimeKey?: string;
|
|
235
301
|
}): ConversationQueueItemSnapshot;
|
|
236
302
|
updateQueueItem(target: ConversationTargetInput, idInput: string, textInput: string, input?: ConversationQueueActionInput): ConversationQueueItemSnapshot;
|
|
237
303
|
deleteQueueItem(target: ConversationTargetInput, idInput: string): boolean;
|
|
@@ -325,6 +391,12 @@ export declare class ConversationKernel {
|
|
|
325
391
|
private runtime;
|
|
326
392
|
private scheduleGoalContinuation;
|
|
327
393
|
private schedulePendingRuntimeContinuation;
|
|
394
|
+
/**
|
|
395
|
+
* Restore the runtime branch captured by a queued user turn. If the branch
|
|
396
|
+
* disappeared (manual deletion/rewind), fail the queued item into the
|
|
397
|
+
* existing pause/retry path instead of appending it to a different branch.
|
|
398
|
+
*/
|
|
399
|
+
private bindQueuedTurnBranch;
|
|
328
400
|
private runPendingQueueItem;
|
|
329
401
|
private startGoalDrivenBuild;
|
|
330
402
|
private createRunner;
|
|
@@ -345,6 +417,13 @@ export declare class ConversationKernel {
|
|
|
345
417
|
private emitQueueUpdate;
|
|
346
418
|
private clearQueued;
|
|
347
419
|
private queueState;
|
|
420
|
+
/**
|
|
421
|
+
* Merge queue continuations persisted by another owner/kernel into this
|
|
422
|
+
* runtime's in-memory projection. Flow takeover, cold restore and a pool
|
|
423
|
+
* hand-off must not lose an already-admitted Next row. Deduplication is by
|
|
424
|
+
* the stable clientMessageId, never by text.
|
|
425
|
+
*/
|
|
426
|
+
private reconcilePendingContinuations;
|
|
348
427
|
private normalizeTarget;
|
|
349
428
|
private workspaceForId;
|
|
350
429
|
private findRuntime;
|