@xenosystem/agent-interface-ui 0.1.16 → 0.1.17
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentInterface.d.ts","sourceRoot":"","sources":["../../../src/components/agent/AgentInterface.tsx"],"names":[],"mappings":"AAYA,OAAO,KAA4D,MAAM,OAAO,CAAA;AAqFhF,OAAO,EAEL,KAAK,KAAK,IAAI,mBAAmB,EACjC,KAAK,iBAAiB,IAAI,+BAA+B,EACzD,KAAK,iBAAiB,IAAI,+BAA+B,EACzD,KAAK,0BAA0B,IAAI,wCAAwC,EAC3E,KAAK,mBAAmB,IAAI,0BAA0B,EACtD,KAAK,IAAI,IAAI,kBAAkB,EAC/B,KAAK,SAAS,IAAI,uBAAuB,EACzC,KAAK,YAAY,IAAI,iBAAiB,EACvC,MAAM,gCAAgC,CAAA;AAmBvC,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,sCAAsC,CAAA;AAgnF7C,MAAM,MAAM,YAAY,GAAG,0BAA0B,CAAA;AACrD,MAAM,MAAM,iBAAiB,GAAG,+BAA+B,CAAA;AAC/D,MAAM,MAAM,iBAAiB,GAAG,+BAA+B,CAAA;AAC/D,MAAM,MAAM,0BAA0B,GAAG,wCAAwC,CAAA;AACjF,MAAM,MAAM,YAAY,GAAG,iBAAiB,CAAA;AAC5C,MAAM,MAAM,KAAK,GAAG,mBAAmB,CAAA;AACvC,MAAM,MAAM,IAAI,GAAG,kBAAkB,CAAA;AACrC,MAAM,MAAM,SAAS,GAAG,uBAAuB,CAAA;AAwxE/C,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,UAAU,GAAG,oBAAoB,CAAA;IAC3C,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,iBAAiB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACpC,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B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CAAA;IAC3C,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,iBAAiB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACpC,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,cAAc,CAAC,EAAE;QACf,UAAU,CAAC,EAAE,qBAAqB,CAAA;QAClC,UAAU,CAAC,EAAE,qBAAqB,CAAA;QAClC,OAAO,CAAC,EAAE,qBAAqB,CAAA;KAChC,CAAA;CACF;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,OAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,GACf,GAAE,mBAAwB,qBAuuL1B"}
|
|
@@ -3262,96 +3262,6 @@ export default function AgentInterface({ surface = 'embedded', initialSdkSession
|
|
|
3262
3262
|
const setCenterPaneMode = useAgentIdeStore(s => s.setMode);
|
|
3263
3263
|
const setAgentIdeHasOpenFiles = useAgentIdeStore(s => s.setHasOpenFiles);
|
|
3264
3264
|
const authDisplayName = useAuthStore(s => s.user?.display_name);
|
|
3265
|
-
useEffect(() => {
|
|
3266
|
-
if (!initialLaunchMode || initialSdkSessionId || initialLaunchModeHandledRef.current)
|
|
3267
|
-
return;
|
|
3268
|
-
initialLaunchModeHandledRef.current = true;
|
|
3269
|
-
const conversationId = createConversation(MAIN_ASSISTANT_ID);
|
|
3270
|
-
const workspaceMode = initialLaunchMode === 'agent' && initialWorkspaceRoot ? 'workspace' : 'chat-only';
|
|
3271
|
-
updateConversation(conversationId, {
|
|
3272
|
-
schemaVersion: 3,
|
|
3273
|
-
workspaceMode,
|
|
3274
|
-
rootDirectory: workspaceMode === 'workspace' ? initialWorkspaceRoot : undefined,
|
|
3275
|
-
grantedDirectories: workspaceMode === 'workspace' && initialWorkspaceRoot ? [initialWorkspaceRoot] : [],
|
|
3276
|
-
});
|
|
3277
|
-
setViewMode('inbox');
|
|
3278
|
-
setSelectedInboxConversationId(conversationId);
|
|
3279
|
-
}, [createConversation, initialLaunchMode, initialSdkSessionId, initialWorkspaceRoot, updateConversation]);
|
|
3280
|
-
useEffect(() => {
|
|
3281
|
-
const sessionId = initialSdkSessionId?.trim();
|
|
3282
|
-
if (!sessionId || initialSdkSessionHandledRef.current)
|
|
3283
|
-
return;
|
|
3284
|
-
initialSdkSessionHandledRef.current = true;
|
|
3285
|
-
let cancelled = false;
|
|
3286
|
-
const openSdkSession = async () => {
|
|
3287
|
-
const state = useAgentChatStore.getState();
|
|
3288
|
-
const existing = Object.values(state.conversations).find((conversation) => (conversation.sessionUi?.sdkSessionId === sessionId));
|
|
3289
|
-
const conversationId = existing?.id || createConversation(MAIN_ASSISTANT_ID);
|
|
3290
|
-
setViewMode('inbox');
|
|
3291
|
-
setSelectedInboxConversationId(conversationId);
|
|
3292
|
-
updateConversation(conversationId, {
|
|
3293
|
-
workspaceMode: initialLaunchMode === 'agent' && initialWorkspaceRoot ? 'workspace' : 'chat-only',
|
|
3294
|
-
rootDirectory: initialLaunchMode === 'agent' ? initialWorkspaceRoot : undefined,
|
|
3295
|
-
grantedDirectories: initialLaunchMode === 'agent' && initialWorkspaceRoot ? [initialWorkspaceRoot] : [],
|
|
3296
|
-
model: MAIN_ASSISTANT_MODEL,
|
|
3297
|
-
runtime: createConversationRuntimeBinding({
|
|
3298
|
-
selection: runtimeSelectionForSdk('user'),
|
|
3299
|
-
model: MAIN_ASSISTANT_MODEL,
|
|
3300
|
-
reasoningModel: MAIN_ASSISTANT_MODEL,
|
|
3301
|
-
inferenceMode: 'cloud',
|
|
3302
|
-
}),
|
|
3303
|
-
});
|
|
3304
|
-
const attach = getAgentPlatformBridge()?.agent?.attachSdkSession;
|
|
3305
|
-
if (!attach) {
|
|
3306
|
-
appendMessage(conversationId, {
|
|
3307
|
-
role: 'assistant',
|
|
3308
|
-
content: `Unable to resume SDK session ${sessionId}: the Agent host session bridge is unavailable.`,
|
|
3309
|
-
error: 'Agent host session bridge unavailable',
|
|
3310
|
-
hideToolbar: true,
|
|
3311
|
-
});
|
|
3312
|
-
return;
|
|
3313
|
-
}
|
|
3314
|
-
try {
|
|
3315
|
-
const result = await attach({ conversationId, sessionId });
|
|
3316
|
-
if (cancelled)
|
|
3317
|
-
return;
|
|
3318
|
-
if (!result.success) {
|
|
3319
|
-
const message = result.error || 'unknown host error';
|
|
3320
|
-
console.error(`[agent-interface] Unable to attach SDK session ${sessionId}: ${message}`);
|
|
3321
|
-
appendMessage(conversationId, {
|
|
3322
|
-
role: 'assistant',
|
|
3323
|
-
content: `Unable to resume SDK session ${sessionId}: ${message}`,
|
|
3324
|
-
error: message,
|
|
3325
|
-
hideToolbar: true,
|
|
3326
|
-
});
|
|
3327
|
-
return;
|
|
3328
|
-
}
|
|
3329
|
-
const current = useAgentChatStore.getState().getConversation(conversationId);
|
|
3330
|
-
updateConversation(conversationId, {
|
|
3331
|
-
sessionUi: {
|
|
3332
|
-
...(current?.sessionUi || {}),
|
|
3333
|
-
sdkSessionId: sessionId,
|
|
3334
|
-
sdkSessionDir: result.sessionDir,
|
|
3335
|
-
sdkSessionHistoryPath: result.sessionHistoryPath,
|
|
3336
|
-
},
|
|
3337
|
-
});
|
|
3338
|
-
}
|
|
3339
|
-
catch (error) {
|
|
3340
|
-
if (cancelled)
|
|
3341
|
-
return;
|
|
3342
|
-
const message = error instanceof Error ? error.message : 'unknown host error';
|
|
3343
|
-
console.error(`[agent-interface] Unable to attach SDK session ${sessionId}: ${message}`);
|
|
3344
|
-
appendMessage(conversationId, {
|
|
3345
|
-
role: 'assistant',
|
|
3346
|
-
content: `Unable to resume SDK session ${sessionId}: ${message}`,
|
|
3347
|
-
error: message,
|
|
3348
|
-
hideToolbar: true,
|
|
3349
|
-
});
|
|
3350
|
-
}
|
|
3351
|
-
};
|
|
3352
|
-
void openSdkSession();
|
|
3353
|
-
return () => { cancelled = true; };
|
|
3354
|
-
}, [appendMessage, createConversation, initialLaunchMode, initialSdkSessionId, initialWorkspaceRoot, updateConversation]);
|
|
3355
3265
|
// Dynamic context for system prompt enrichment (fetched from main process)
|
|
3356
3266
|
const [runtimeContext, setRuntimeContext] = useState(null);
|
|
3357
3267
|
// Fetch runtime context on mount and every 60 seconds
|
|
@@ -4386,6 +4296,118 @@ export default function AgentInterface({ surface = 'embedded', initialSdkSession
|
|
|
4386
4296
|
setSelectedConversationId(conversationId);
|
|
4387
4297
|
setSelectedInboxConversationId(null);
|
|
4388
4298
|
}, [setCenterPaneMode, updateConversation]);
|
|
4299
|
+
// Explicit desktop/CLI launch profiles must win over persisted session-tab
|
|
4300
|
+
// restoration. Wait until persisted conversations are loaded, then create and
|
|
4301
|
+
// activate the requested profile so an existing Chat tab cannot make an Agent
|
|
4302
|
+
// launch cosmetic (or vice versa).
|
|
4303
|
+
useEffect(() => {
|
|
4304
|
+
if (!sessionTabsHydrated
|
|
4305
|
+
|| !initialLaunchMode
|
|
4306
|
+
|| initialSdkSessionId
|
|
4307
|
+
|| initialLaunchModeHandledRef.current)
|
|
4308
|
+
return;
|
|
4309
|
+
initialLaunchModeHandledRef.current = true;
|
|
4310
|
+
const conversationId = createConversation(MAIN_ASSISTANT_ID);
|
|
4311
|
+
const workspaceMode = initialLaunchMode === 'agent' && initialWorkspaceRoot ? 'workspace' : 'chat-only';
|
|
4312
|
+
updateConversation(conversationId, {
|
|
4313
|
+
schemaVersion: 3,
|
|
4314
|
+
workspaceMode,
|
|
4315
|
+
rootDirectory: workspaceMode === 'workspace' ? initialWorkspaceRoot : undefined,
|
|
4316
|
+
grantedDirectories: workspaceMode === 'workspace' && initialWorkspaceRoot ? [initialWorkspaceRoot] : [],
|
|
4317
|
+
});
|
|
4318
|
+
activateSessionConversation(conversationId);
|
|
4319
|
+
}, [
|
|
4320
|
+
activateSessionConversation,
|
|
4321
|
+
createConversation,
|
|
4322
|
+
initialLaunchMode,
|
|
4323
|
+
initialSdkSessionId,
|
|
4324
|
+
initialWorkspaceRoot,
|
|
4325
|
+
sessionTabsHydrated,
|
|
4326
|
+
updateConversation,
|
|
4327
|
+
]);
|
|
4328
|
+
useEffect(() => {
|
|
4329
|
+
const sessionId = initialSdkSessionId?.trim();
|
|
4330
|
+
if (!sessionTabsHydrated || !sessionId || initialSdkSessionHandledRef.current)
|
|
4331
|
+
return;
|
|
4332
|
+
initialSdkSessionHandledRef.current = true;
|
|
4333
|
+
let cancelled = false;
|
|
4334
|
+
const openSdkSession = async () => {
|
|
4335
|
+
const state = useAgentChatStore.getState();
|
|
4336
|
+
const existing = Object.values(state.conversations).find((conversation) => (conversation.sessionUi?.sdkSessionId === sessionId));
|
|
4337
|
+
const conversationId = existing?.id || createConversation(MAIN_ASSISTANT_ID);
|
|
4338
|
+
updateConversation(conversationId, {
|
|
4339
|
+
workspaceMode: initialLaunchMode === 'agent' && initialWorkspaceRoot ? 'workspace' : 'chat-only',
|
|
4340
|
+
rootDirectory: initialLaunchMode === 'agent' ? initialWorkspaceRoot : undefined,
|
|
4341
|
+
grantedDirectories: initialLaunchMode === 'agent' && initialWorkspaceRoot ? [initialWorkspaceRoot] : [],
|
|
4342
|
+
model: MAIN_ASSISTANT_MODEL,
|
|
4343
|
+
runtime: createConversationRuntimeBinding({
|
|
4344
|
+
selection: runtimeSelectionForSdk('user'),
|
|
4345
|
+
model: MAIN_ASSISTANT_MODEL,
|
|
4346
|
+
reasoningModel: MAIN_ASSISTANT_MODEL,
|
|
4347
|
+
inferenceMode: 'cloud',
|
|
4348
|
+
}),
|
|
4349
|
+
});
|
|
4350
|
+
activateSessionConversation(conversationId);
|
|
4351
|
+
const attach = getAgentPlatformBridge()?.agent?.attachSdkSession;
|
|
4352
|
+
if (!attach) {
|
|
4353
|
+
appendMessage(conversationId, {
|
|
4354
|
+
role: 'assistant',
|
|
4355
|
+
content: `Unable to resume SDK session ${sessionId}: the Agent host session bridge is unavailable.`,
|
|
4356
|
+
error: 'Agent host session bridge unavailable',
|
|
4357
|
+
hideToolbar: true,
|
|
4358
|
+
});
|
|
4359
|
+
return;
|
|
4360
|
+
}
|
|
4361
|
+
try {
|
|
4362
|
+
const result = await attach({ conversationId, sessionId });
|
|
4363
|
+
if (cancelled)
|
|
4364
|
+
return;
|
|
4365
|
+
if (!result.success) {
|
|
4366
|
+
const message = result.error || 'unknown host error';
|
|
4367
|
+
console.error(`[agent-interface] Unable to attach SDK session ${sessionId}: ${message}`);
|
|
4368
|
+
appendMessage(conversationId, {
|
|
4369
|
+
role: 'assistant',
|
|
4370
|
+
content: `Unable to resume SDK session ${sessionId}: ${message}`,
|
|
4371
|
+
error: message,
|
|
4372
|
+
hideToolbar: true,
|
|
4373
|
+
});
|
|
4374
|
+
return;
|
|
4375
|
+
}
|
|
4376
|
+
const current = useAgentChatStore.getState().getConversation(conversationId);
|
|
4377
|
+
updateConversation(conversationId, {
|
|
4378
|
+
sessionUi: {
|
|
4379
|
+
...(current?.sessionUi || {}),
|
|
4380
|
+
sdkSessionId: sessionId,
|
|
4381
|
+
sdkSessionDir: result.sessionDir,
|
|
4382
|
+
sdkSessionHistoryPath: result.sessionHistoryPath,
|
|
4383
|
+
},
|
|
4384
|
+
});
|
|
4385
|
+
}
|
|
4386
|
+
catch (error) {
|
|
4387
|
+
if (cancelled)
|
|
4388
|
+
return;
|
|
4389
|
+
const message = error instanceof Error ? error.message : 'unknown host error';
|
|
4390
|
+
console.error(`[agent-interface] Unable to attach SDK session ${sessionId}: ${message}`);
|
|
4391
|
+
appendMessage(conversationId, {
|
|
4392
|
+
role: 'assistant',
|
|
4393
|
+
content: `Unable to resume SDK session ${sessionId}: ${message}`,
|
|
4394
|
+
error: message,
|
|
4395
|
+
hideToolbar: true,
|
|
4396
|
+
});
|
|
4397
|
+
}
|
|
4398
|
+
};
|
|
4399
|
+
void openSdkSession();
|
|
4400
|
+
return () => { cancelled = true; };
|
|
4401
|
+
}, [
|
|
4402
|
+
activateSessionConversation,
|
|
4403
|
+
appendMessage,
|
|
4404
|
+
createConversation,
|
|
4405
|
+
initialLaunchMode,
|
|
4406
|
+
initialSdkSessionId,
|
|
4407
|
+
initialWorkspaceRoot,
|
|
4408
|
+
sessionTabsHydrated,
|
|
4409
|
+
updateConversation,
|
|
4410
|
+
]);
|
|
4389
4411
|
const createSessionConversation = useCallback(() => {
|
|
4390
4412
|
const conversationId = createConversation(MAIN_ASSISTANT_ID);
|
|
4391
4413
|
activateSessionConversation(conversationId);
|
|
@@ -4518,6 +4540,8 @@ export default function AgentInterface({ surface = 'embedded', initialSdkSession
|
|
|
4518
4540
|
if (!sessionTabsHydrated || sessionTabsRestoreAttemptedRef.current)
|
|
4519
4541
|
return;
|
|
4520
4542
|
sessionTabsRestoreAttemptedRef.current = true;
|
|
4543
|
+
if (initialLaunchMode || initialSdkSessionId?.trim())
|
|
4544
|
+
return;
|
|
4521
4545
|
if (activeSessionTabId || orderedSessionConversations.length === 0)
|
|
4522
4546
|
return;
|
|
4523
4547
|
const mostRecent = [...orderedSessionConversations].sort((left, right) => ((right.sessionTab?.lastActiveAt || 0) - (left.sessionTab?.lastActiveAt || 0)))[0];
|
|
@@ -4526,6 +4550,8 @@ export default function AgentInterface({ surface = 'embedded', initialSdkSession
|
|
|
4526
4550
|
}, [
|
|
4527
4551
|
activateSessionConversation,
|
|
4528
4552
|
activeSessionTabId,
|
|
4553
|
+
initialLaunchMode,
|
|
4554
|
+
initialSdkSessionId,
|
|
4529
4555
|
orderedSessionConversations,
|
|
4530
4556
|
sessionTabsHydrated,
|
|
4531
4557
|
]);
|