newmark-agent 0.5.14 → 0.6.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/dist/conversation-utility-host.bundle.cjs +4565 -2998
- package/dist/conversation-utility-host.js +1 -1
- package/dist/core/agent.d.ts +108 -16
- package/dist/core/agent.js +698 -195
- package/dist/core/agentKernel/agent.d.ts +1 -0
- package/dist/core/agentKernel/agent.js +9 -0
- package/dist/core/agentKernelDiagnostics.d.ts +4 -6
- package/dist/core/agentKernelDiagnostics.js +12 -9
- package/dist/core/agentKernelRunner.d.ts +5 -0
- package/dist/core/agentKernelRunner.js +250 -107
- package/dist/core/autoRouter.js +17 -27
- package/dist/core/config.d.ts +2 -0
- package/dist/core/config.js +7 -1
- package/dist/core/conversationCommandState.d.ts +17 -0
- package/dist/core/conversationCommandState.js +140 -0
- package/dist/core/conversationKernel.d.ts +25 -4
- package/dist/core/conversationKernel.js +360 -89
- package/dist/core/conversationListEvent.d.ts +6 -0
- package/dist/core/conversationListEvent.js +14 -0
- package/dist/core/electronUtilityAgentClient.d.ts +4 -1
- package/dist/core/electronUtilityAgentClient.js +4 -4
- package/dist/core/electronUtilityRuntimePool.d.ts +8 -2
- package/dist/core/electronUtilityRuntimePool.js +11 -5
- package/dist/core/installUpdate.js +41 -29
- package/dist/core/modelResponseHealth.d.ts +17 -0
- package/dist/core/modelResponseHealth.js +193 -0
- package/dist/core/providerUsageAccounting.d.ts +47 -0
- package/dist/core/providerUsageAccounting.js +71 -0
- package/dist/core/requestContextEstimate.d.ts +18 -0
- package/dist/core/requestContextEstimate.js +54 -0
- package/dist/core/subagent.d.ts +89 -5
- package/dist/core/subagent.js +264 -41
- package/dist/core/subagentCommunication.d.ts +43 -0
- package/dist/core/subagentCommunication.js +167 -0
- package/dist/core/types.d.ts +34 -1
- package/dist/core/utilityAgentProtocol.d.ts +4 -0
- package/dist/core/workEventCoalescer.js +4 -1
- package/dist/core/wslAgentClient.d.ts +18 -5
- package/dist/core/wslAgentClient.js +79 -27
- package/dist/core/wslAgentProtocol.d.ts +7 -0
- package/dist/core/wslAgentRuntimePool.d.ts +8 -2
- package/dist/core/wslAgentRuntimePool.js +19 -6
- package/dist/core/wslRuntimeProcessTree.d.ts +10 -0
- package/dist/core/wslRuntimeProcessTree.js +104 -0
- package/dist/llm/provider.d.ts +5 -12
- package/dist/llm/provider.js +150 -269
- package/dist/main.js +582 -356
- package/dist/preload.js +3 -3
- package/dist/providers/chat-completions.adapter.d.ts +2 -0
- package/dist/providers/chat-completions.adapter.js +84 -36
- package/dist/providers/provider-adapter.d.ts +2 -0
- package/dist/providers/provider-events.d.ts +23 -14
- package/dist/providers/provider-events.js +148 -43
- package/dist/providers/provider-headers.d.ts +7 -3
- package/dist/providers/provider-headers.js +109 -39
- package/dist/providers/provider-request-compat.d.ts +6 -0
- package/dist/providers/provider-request-compat.js +37 -0
- package/dist/providers/responses.adapter.d.ts +2 -0
- package/dist/providers/responses.adapter.js +192 -126
- package/dist/server.d.ts +9 -2
- package/dist/server.js +100 -24
- package/dist/tools/index.js +17 -1
- package/dist/ui/index.html +2515 -693
- package/dist/ui/lucide-sprite.svg +7 -0
- package/dist/ui/startup.html +6 -6
- package/dist/wsl-agent-host.bundle.cjs +4575 -3006
- package/dist/wsl-agent-host.js +9 -4
- package/package.json +23 -4
package/dist/core/autoRouter.js
CHANGED
|
@@ -34,19 +34,6 @@ function inSubset(deployment, subset) {
|
|
|
34
34
|
function inScope(deployment, scope) {
|
|
35
35
|
return scope.kind === 'global' || deployment.providerId === scope.providerId;
|
|
36
36
|
}
|
|
37
|
-
function validationEligible(candidate, now) {
|
|
38
|
-
const reasons = [];
|
|
39
|
-
if (candidate.validation.level !== 'standard' && candidate.validation.level !== 'extended') {
|
|
40
|
-
reasons.push(`validation_level:${candidate.validation.level}`);
|
|
41
|
-
}
|
|
42
|
-
if (candidate.validation.status !== 'verified' && candidate.validation.status !== 'degraded') {
|
|
43
|
-
reasons.push(`validation_status:${candidate.validation.status}`);
|
|
44
|
-
}
|
|
45
|
-
const checkedAt = Date.parse(candidate.validation.checkedAt);
|
|
46
|
-
if (!Number.isFinite(checkedAt) || now - checkedAt > VALIDATION_TTL_MS)
|
|
47
|
-
reasons.push('validation_expired');
|
|
48
|
-
return reasons;
|
|
49
|
-
}
|
|
50
37
|
function normalizeAutoPreference(value) {
|
|
51
38
|
switch (String(value || '').toLowerCase()) {
|
|
52
39
|
case 'performance':
|
|
@@ -93,6 +80,18 @@ function classifyTaskClasses(taskText, requiredCapabilities, estimatedInputToken
|
|
|
93
80
|
}
|
|
94
81
|
function classifyRouteFailure(error) {
|
|
95
82
|
const text = error instanceof Error ? `${error.name} ${error.message}` : String(error || '');
|
|
83
|
+
// Gateways may return HTTP 200 followed by a structured provider error.
|
|
84
|
+
// Match actual code/type fields, never incidental overload words in prose.
|
|
85
|
+
let structuredCodes = [];
|
|
86
|
+
const jsonStart = text.indexOf('{');
|
|
87
|
+
if (jsonStart >= 0) {
|
|
88
|
+
try {
|
|
89
|
+
const payload = JSON.parse(text.slice(jsonStart));
|
|
90
|
+
const detail = payload?.error || payload?.response?.error || payload;
|
|
91
|
+
structuredCodes = [detail?.code, detail?.type].filter(value => typeof value === 'string').map(value => value.toLowerCase());
|
|
92
|
+
}
|
|
93
|
+
catch { /* Ordinary non-JSON errors retain their existing classification. */ }
|
|
94
|
+
}
|
|
96
95
|
const statusMatch = text.match(/(?:http|error|status)?\s*[:=]?\s*(408|429|4\d\d|5\d\d)\b/i);
|
|
97
96
|
const statusCode = statusMatch ? Number(statusMatch[1]) : undefined;
|
|
98
97
|
const retryAfterMatch = text.match(/retry[- ]after\s*[:=]?\s*(\d+(?:\.\d+)?)\s*(ms|s|seconds?)?/i);
|
|
@@ -122,10 +121,11 @@ function classifyRouteFailure(error) {
|
|
|
122
121
|
return { type: 'rate_limited', retryable: true, switchAllowed: true, statusCode: 429, retryAfterMs };
|
|
123
122
|
}
|
|
124
123
|
if (statusCode === 408 || /timeout|timed out|aborterror/i.test(text)) {
|
|
125
|
-
return { type: 'timeout', retryable: true, switchAllowed: true, statusCode };
|
|
124
|
+
return { type: 'timeout', retryable: true, switchAllowed: true, statusCode, ...(retryAfterMs === undefined ? {} : { retryAfterMs }) };
|
|
126
125
|
}
|
|
127
|
-
if (statusCode !== undefined && statusCode >= 500)
|
|
128
|
-
|
|
126
|
+
if ((statusCode !== undefined && statusCode >= 500)
|
|
127
|
+
|| structuredCodes.some(code => ['server_is_overloaded', 'overloaded_error', 'service_unavailable_error', 'server_error', 'internal_server_error'].includes(code))) {
|
|
128
|
+
return { type: 'server_error', retryable: true, switchAllowed: true, statusCode, ...(retryAfterMs === undefined ? {} : { retryAfterMs }) };
|
|
129
129
|
}
|
|
130
130
|
if (/empty response|no response body|empty completion/i.test(text))
|
|
131
131
|
return { type: 'empty_response', retryable: true, switchAllowed: true };
|
|
@@ -178,7 +178,6 @@ class AutoRouter {
|
|
|
178
178
|
this.claimEndpointAttempt(fixed.deployment);
|
|
179
179
|
return decision;
|
|
180
180
|
}
|
|
181
|
-
const requiredCapabilities = new Set([...policy.requiredCapabilities, ...request.requiredCapabilities].map(item => String(item).toLowerCase()));
|
|
182
181
|
const eligible = [];
|
|
183
182
|
for (const candidate of candidates) {
|
|
184
183
|
const reasons = [];
|
|
@@ -192,13 +191,8 @@ class AutoRouter {
|
|
|
192
191
|
reasons.push('fallback_only');
|
|
193
192
|
if (candidate.preview && !policy.allowPreview)
|
|
194
193
|
reasons.push('preview_disallowed');
|
|
195
|
-
reasons.push(...validationEligible(candidate, now));
|
|
196
194
|
if (request.estimatedInputTokens + request.expectedOutputTokens > Math.max(0, candidate.maxContextTokens || 0))
|
|
197
195
|
reasons.push('context_too_small');
|
|
198
|
-
const capabilities = new Set(candidate.capabilities.map(item => String(item).toLowerCase()));
|
|
199
|
-
for (const capability of requiredCapabilities)
|
|
200
|
-
if (!capabilities.has(capability))
|
|
201
|
-
reasons.push(`missing_capability:${capability}`);
|
|
202
196
|
if (policy.privacy !== 'default' && !candidate.privacy.includes(policy.privacy))
|
|
203
197
|
reasons.push(`privacy:${policy.privacy}`);
|
|
204
198
|
if (policy.dataRegion) {
|
|
@@ -217,8 +211,6 @@ class AutoRouter {
|
|
|
217
211
|
if (policy.maxExpectedCostUsd !== undefined && (expectedCost === undefined || expectedCost > policy.maxExpectedCostUsd)) {
|
|
218
212
|
reasons.push(expectedCost === undefined ? 'unknown_cost' : 'budget_exceeded');
|
|
219
213
|
}
|
|
220
|
-
if (this.circuitState(candidate.deployment, now, false) === 'open')
|
|
221
|
-
reasons.push('circuit_open');
|
|
222
214
|
if (reasons.length)
|
|
223
215
|
decision.excludedCandidates.push({ deployment: { ...candidate.deployment }, reasons: [...new Set(reasons)] });
|
|
224
216
|
else
|
|
@@ -312,9 +304,7 @@ class AutoRouter {
|
|
|
312
304
|
&& inSubset(candidate.deployment, subset)
|
|
313
305
|
&& !sameDeployment(candidate.deployment, current)
|
|
314
306
|
&& !attemptedDeployments.some(attempted => sameDeployment(candidate.deployment, attempted))
|
|
315
|
-
&&
|
|
316
|
-
&& this.passedInitialHardFilters(decision, candidate)
|
|
317
|
-
&& this.circuitState(candidate.deployment, now, false) !== 'open');
|
|
307
|
+
&& this.passedInitialHardFilters(decision, candidate));
|
|
318
308
|
const equivalent = currentGroup
|
|
319
309
|
? eligible.find(candidate => candidate.deployment.logicalModelGroupId === currentGroup && !candidate.fallbackOnly)
|
|
320
310
|
: undefined;
|
package/dist/core/config.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ModelResponseHealth } from './modelResponseHealth';
|
|
1
2
|
export interface JsonValue {
|
|
2
3
|
[key: string]: unknown;
|
|
3
4
|
}
|
|
@@ -20,6 +21,7 @@ export interface ProviderConfig {
|
|
|
20
21
|
models: ModelConfig[];
|
|
21
22
|
}
|
|
22
23
|
export interface ModelConfig {
|
|
24
|
+
response_health?: ModelResponseHealth;
|
|
23
25
|
name: string;
|
|
24
26
|
display: string;
|
|
25
27
|
description: string;
|
package/dist/core/config.js
CHANGED
|
@@ -44,6 +44,7 @@ exports.mergeProviderSecrets = mergeProviderSecrets;
|
|
|
44
44
|
exports.defaultModelConfig = defaultModelConfig;
|
|
45
45
|
exports.stableProviderId = stableProviderId;
|
|
46
46
|
exports.defaultConfig = defaultConfig;
|
|
47
|
+
const modelResponseHealth_1 = require("./modelResponseHealth");
|
|
47
48
|
const fs = __importStar(require("fs"));
|
|
48
49
|
const path = __importStar(require("path"));
|
|
49
50
|
const crypto_1 = require("crypto");
|
|
@@ -191,7 +192,12 @@ class ConfigManager {
|
|
|
191
192
|
this.workspaceOverrides.clear();
|
|
192
193
|
}
|
|
193
194
|
providers() {
|
|
194
|
-
return this.normalizeProviders((this.getGlobal('models', 'providers')) || [])
|
|
195
|
+
return this.normalizeProviders((this.getGlobal('models', 'providers')) || []).map(provider => ({
|
|
196
|
+
...provider,
|
|
197
|
+
models: provider.models.map(model => ({ ...model, response_health: (0, modelResponseHealth_1.readModelResponseHealth)(this.rootPath, {
|
|
198
|
+
providerId: provider.id, modelId: model.name, endpoint: provider.base_url, protocol: provider.protocol, credential: provider.api_key,
|
|
199
|
+
}) })),
|
|
200
|
+
}));
|
|
195
201
|
}
|
|
196
202
|
allModels() {
|
|
197
203
|
const models = [];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ConversationCommandState {
|
|
2
|
+
mode?: 'build' | 'plan' | 'chat' | 'goal' | 'flow';
|
|
3
|
+
inputMode?: 'guide' | 'next';
|
|
4
|
+
queuePaused?: boolean;
|
|
5
|
+
}
|
|
6
|
+
/** GUI command owner only; execution and continuation payloads remain owned by their Agent. */
|
|
7
|
+
export declare class ConversationCommandStateStore {
|
|
8
|
+
private readonly file;
|
|
9
|
+
private records;
|
|
10
|
+
constructor(root: string);
|
|
11
|
+
get(key: string): ConversationCommandState | undefined;
|
|
12
|
+
set(key: string, patch: ConversationCommandState): ConversationCommandState;
|
|
13
|
+
delete(key: string): void;
|
|
14
|
+
private key;
|
|
15
|
+
private persist;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=conversationCommandState.d.ts.map
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ConversationCommandStateStore = void 0;
|
|
37
|
+
const fs = __importStar(require("node:fs"));
|
|
38
|
+
const path = __importStar(require("node:path"));
|
|
39
|
+
const node_crypto_1 = require("node:crypto");
|
|
40
|
+
const modes = new Set(['build', 'plan', 'chat', 'goal', 'flow']);
|
|
41
|
+
function stateValue(value) {
|
|
42
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
43
|
+
throw new Error('Invalid conversation command state');
|
|
44
|
+
const row = value;
|
|
45
|
+
const result = {};
|
|
46
|
+
if (row.mode !== undefined) {
|
|
47
|
+
if (typeof row.mode !== 'string' || !modes.has(row.mode))
|
|
48
|
+
throw new Error('Invalid conversation mode');
|
|
49
|
+
result.mode = row.mode;
|
|
50
|
+
}
|
|
51
|
+
if (row.inputMode !== undefined) {
|
|
52
|
+
if (row.inputMode !== 'guide' && row.inputMode !== 'next')
|
|
53
|
+
throw new Error('Invalid conversation input mode');
|
|
54
|
+
result.inputMode = row.inputMode;
|
|
55
|
+
}
|
|
56
|
+
if (row.queuePaused !== undefined) {
|
|
57
|
+
if (typeof row.queuePaused !== 'boolean')
|
|
58
|
+
throw new Error('Invalid conversation queue pause state');
|
|
59
|
+
result.queuePaused = row.queuePaused;
|
|
60
|
+
}
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
/** GUI command owner only; execution and continuation payloads remain owned by their Agent. */
|
|
64
|
+
class ConversationCommandStateStore {
|
|
65
|
+
file;
|
|
66
|
+
records = new Map();
|
|
67
|
+
constructor(root) {
|
|
68
|
+
this.file = path.join(path.resolve(root), 'conversation-command-state.json');
|
|
69
|
+
let source;
|
|
70
|
+
try {
|
|
71
|
+
source = fs.readFileSync(this.file, 'utf8');
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
if (error.code === 'ENOENT')
|
|
75
|
+
return;
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
78
|
+
const saved = JSON.parse(source);
|
|
79
|
+
if (saved?.version !== 1 || !saved.targets || typeof saved.targets !== 'object' || Array.isArray(saved.targets)) {
|
|
80
|
+
throw new Error('Unsupported conversation command state file');
|
|
81
|
+
}
|
|
82
|
+
for (const [key, value] of Object.entries(saved.targets))
|
|
83
|
+
this.records.set(this.key(key), stateValue(value));
|
|
84
|
+
}
|
|
85
|
+
get(key) {
|
|
86
|
+
const value = this.records.get(this.key(key));
|
|
87
|
+
return value ? { ...value } : undefined;
|
|
88
|
+
}
|
|
89
|
+
set(key, patch) {
|
|
90
|
+
const target = this.key(key);
|
|
91
|
+
const before = this.records.get(target);
|
|
92
|
+
const after = { ...before, ...stateValue(patch) };
|
|
93
|
+
if (before && before.mode === after.mode && before.inputMode === after.inputMode && before.queuePaused === after.queuePaused)
|
|
94
|
+
return { ...before };
|
|
95
|
+
const next = new Map(this.records);
|
|
96
|
+
next.set(target, after);
|
|
97
|
+
this.persist(next);
|
|
98
|
+
return { ...after };
|
|
99
|
+
}
|
|
100
|
+
delete(key) {
|
|
101
|
+
const target = this.key(key);
|
|
102
|
+
if (!this.records.has(target))
|
|
103
|
+
return;
|
|
104
|
+
const next = new Map(this.records);
|
|
105
|
+
next.delete(target);
|
|
106
|
+
this.persist(next);
|
|
107
|
+
}
|
|
108
|
+
key(value) {
|
|
109
|
+
if (typeof value !== 'string' || !value.trim())
|
|
110
|
+
throw new Error('Conversation target key is required');
|
|
111
|
+
return value;
|
|
112
|
+
}
|
|
113
|
+
persist(next) {
|
|
114
|
+
fs.mkdirSync(path.dirname(this.file), { recursive: true });
|
|
115
|
+
const temp = this.file + '.' + (0, node_crypto_1.randomUUID)() + '.tmp';
|
|
116
|
+
let descriptor;
|
|
117
|
+
try {
|
|
118
|
+
descriptor = fs.openSync(temp, 'wx', 0o600);
|
|
119
|
+
fs.writeFileSync(descriptor, JSON.stringify({ version: 1, targets: Object.fromEntries(next) }) + '\n');
|
|
120
|
+
fs.fsyncSync(descriptor);
|
|
121
|
+
fs.closeSync(descriptor);
|
|
122
|
+
descriptor = undefined;
|
|
123
|
+
fs.renameSync(temp, this.file);
|
|
124
|
+
this.records = next;
|
|
125
|
+
}
|
|
126
|
+
finally {
|
|
127
|
+
if (descriptor !== undefined)
|
|
128
|
+
fs.closeSync(descriptor);
|
|
129
|
+
try {
|
|
130
|
+
fs.unlinkSync(temp);
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
if (error.code !== 'ENOENT')
|
|
134
|
+
throw error;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
exports.ConversationCommandStateStore = ConversationCommandStateStore;
|
|
140
|
+
//# sourceMappingURL=conversationCommandState.js.map
|
|
@@ -11,8 +11,9 @@ export interface ConversationQueueItemSnapshot {
|
|
|
11
11
|
goalObjective?: string;
|
|
12
12
|
runId?: string;
|
|
13
13
|
createdAt: string;
|
|
14
|
+
images?: AgentPromptMessage['images'];
|
|
14
15
|
}
|
|
15
|
-
export type ConversationQueueAction = 'enqueue' | 'update' | 'delete' | 'reorder' | 'toggle_pause' | 'guide';
|
|
16
|
+
export type ConversationQueueAction = 'enqueue' | 'update' | 'delete' | 'reorder' | 'toggle_pause' | 'set_pause' | 'guide';
|
|
16
17
|
export interface ConversationQueueActionInput {
|
|
17
18
|
id?: string;
|
|
18
19
|
text?: string;
|
|
@@ -21,6 +22,7 @@ export interface ConversationQueueActionInput {
|
|
|
21
22
|
createdAt?: string;
|
|
22
23
|
images?: AgentPromptMessage['images'];
|
|
23
24
|
orderedIds?: string[];
|
|
25
|
+
paused?: boolean;
|
|
24
26
|
}
|
|
25
27
|
export interface AgentPromptMessage {
|
|
26
28
|
text: string;
|
|
@@ -38,6 +40,9 @@ export interface AgentPromptMessage {
|
|
|
38
40
|
}>;
|
|
39
41
|
attachments?: ConversationImageAttachment[];
|
|
40
42
|
clientMessageId?: string;
|
|
43
|
+
/** Stable ordinary user identity; unlike clientMessageId alone, never denotes a Guide. */
|
|
44
|
+
userMessageId?: string;
|
|
45
|
+
createdAt?: string;
|
|
41
46
|
guideId?: string;
|
|
42
47
|
runId?: string;
|
|
43
48
|
/**
|
|
@@ -189,7 +194,19 @@ export declare class ConversationKernel {
|
|
|
189
194
|
constructor(root: string, host: Agent, automation: AutomationManager | null, lifecycle?: ConversationKernelLifecycle);
|
|
190
195
|
subscribe(listener: WorkListener): () => void;
|
|
191
196
|
isRunning(target: ConversationTargetInput): boolean;
|
|
197
|
+
conversationOwner(target: ConversationTargetInput): Agent | null;
|
|
198
|
+
/** Branch mutations retain the Agent but reload that branch's durable queue. */
|
|
199
|
+
refreshIdleConversation(target: ConversationTargetInput): void;
|
|
200
|
+
/** Detach idle owners before config replacement or workspace removal. */
|
|
201
|
+
disposeIdle(workspaceKey?: string): string[];
|
|
202
|
+
/** A Flow and its queue share one Agent; no second history writer is created. */
|
|
203
|
+
beginExternalRun(targetInput: ConversationTargetInput, options: ConversationKernelRunOptions, createOwner: () => Agent, previousQueuePaused?: boolean): Agent;
|
|
204
|
+
settleExternalRun(target: ConversationTargetInput, completed: boolean): void;
|
|
205
|
+
releaseExternalRun(target: ConversationTargetInput, paused: boolean): void;
|
|
206
|
+
prepareForArchive(target: ConversationTargetInput): Promise<Agent | null>;
|
|
207
|
+
finishArchive(target: ConversationTargetInput, completed: boolean, preserveOwner?: boolean): void;
|
|
192
208
|
isAnyRunning(): boolean;
|
|
209
|
+
hasRetainedWork(): boolean;
|
|
193
210
|
flushPersistence(): void;
|
|
194
211
|
queued(target: ConversationTargetInput): {
|
|
195
212
|
steering: string[];
|
|
@@ -216,7 +233,7 @@ export declare class ConversationKernel {
|
|
|
216
233
|
createdAt?: string;
|
|
217
234
|
images?: AgentPromptMessage['images'];
|
|
218
235
|
}): ConversationQueueItemSnapshot;
|
|
219
|
-
updateQueueItem(target: ConversationTargetInput, idInput: string, textInput: string): ConversationQueueItemSnapshot;
|
|
236
|
+
updateQueueItem(target: ConversationTargetInput, idInput: string, textInput: string, input?: ConversationQueueActionInput): ConversationQueueItemSnapshot;
|
|
220
237
|
deleteQueueItem(target: ConversationTargetInput, idInput: string): boolean;
|
|
221
238
|
reorderQueueItems(target: ConversationTargetInput, orderedIdsInput: string[]): ConversationQueueItemSnapshot[];
|
|
222
239
|
setQueuePaused(target: ConversationTargetInput, paused: boolean): boolean;
|
|
@@ -233,7 +250,10 @@ export declare class ConversationKernel {
|
|
|
233
250
|
events(target: ConversationTargetInput): AgentWorkEvent[];
|
|
234
251
|
waitForIdle(target: ConversationTargetInput): Promise<void>;
|
|
235
252
|
pendingOptions(target: ConversationTargetInput): OptionQuestion[] | undefined;
|
|
236
|
-
snapshot(target: ConversationTargetInput
|
|
253
|
+
snapshot(target: ConversationTargetInput, options?: {
|
|
254
|
+
window?: number;
|
|
255
|
+
before?: number;
|
|
256
|
+
}): ReturnType<Agent['getConversationSnapshot']> & {
|
|
237
257
|
target: NormalizedConversationTarget;
|
|
238
258
|
queued: {
|
|
239
259
|
steering: string[];
|
|
@@ -277,6 +297,7 @@ export declare class ConversationKernel {
|
|
|
277
297
|
setMode(target: ConversationTargetInput, mode: AgentMode): AgentMode;
|
|
278
298
|
setModel(target: ConversationTargetInput, model: string): string;
|
|
279
299
|
toggleGoalPause(target: ConversationTargetInput): Promise<boolean>;
|
|
300
|
+
updateGoal(target: ConversationTargetInput, objective: string): ReturnType<Agent['getConversationSnapshot']>['goal'];
|
|
280
301
|
clearGoal(target: ConversationTargetInput): boolean;
|
|
281
302
|
updateSetting(section: string, key: string, value: unknown): void;
|
|
282
303
|
runtimeState(target: ConversationTargetInput): ConversationRuntimeState | null;
|
|
@@ -304,6 +325,7 @@ export declare class ConversationKernel {
|
|
|
304
325
|
private runtime;
|
|
305
326
|
private scheduleGoalContinuation;
|
|
306
327
|
private schedulePendingRuntimeContinuation;
|
|
328
|
+
private runPendingQueueItem;
|
|
307
329
|
private startGoalDrivenBuild;
|
|
308
330
|
private createRunner;
|
|
309
331
|
private enqueueRootInboxWake;
|
|
@@ -320,7 +342,6 @@ export declare class ConversationKernel {
|
|
|
320
342
|
private enqueueSameSession;
|
|
321
343
|
private trackQueuedMessage;
|
|
322
344
|
private consumeQueuedMessage;
|
|
323
|
-
private replaceTrackedQueuedMessage;
|
|
324
345
|
private emitQueueUpdate;
|
|
325
346
|
private clearQueued;
|
|
326
347
|
private queueState;
|