@agent-native/core 0.59.0 → 0.59.1
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/client/AgentPanel.js +1 -1
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +8 -2
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +65 -12
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/extensions/ExtensionViewer.js +1 -1
- package/dist/client/extensions/ExtensionViewer.js.map +1 -1
- package/dist/client/notifications/NotificationsBell.d.ts +3 -1
- package/dist/client/notifications/NotificationsBell.d.ts.map +1 -1
- package/dist/client/notifications/NotificationsBell.js +7 -3
- package/dist/client/notifications/NotificationsBell.js.map +1 -1
- package/dist/org/auto-join-domain.d.ts +11 -3
- package/dist/org/auto-join-domain.d.ts.map +1 -1
- package/dist/org/auto-join-domain.js +7 -6
- package/dist/org/auto-join-domain.js.map +1 -1
- package/dist/org/context.d.ts.map +1 -1
- package/dist/org/context.js +68 -32
- package/dist/org/context.js.map +1 -1
- package/dist/org/migrations.d.ts.map +1 -1
- package/dist/org/migrations.js +6 -0
- package/dist/org/migrations.js.map +1 -1
- package/dist/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +9 -0
- package/dist/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +11 -1
- package/dist/vite/client.d.ts +2 -1
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +121 -2
- package/dist/vite/client.js.map +1 -1
- package/docs/content/context-awareness.md +14 -2
- package/docs/content/creating-templates.md +6 -0
- package/package.json +1 -1
- package/src/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +9 -0
- package/src/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +11 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-chat-adapter.d.ts","sourceRoot":"","sources":["../../src/client/agent-chat-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,qBAAqB,CAAC;AAiBhF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAKrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,MAAM,oBAAoB;AAC9B;;;;GAIG;AACD,KAAK;AACP,0EAA0E;GACxE,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"agent-chat-adapter.d.ts","sourceRoot":"","sources":["../../src/client/agent-chat-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,qBAAqB,CAAC;AAiBhF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAKrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,MAAM,oBAAoB;AAC9B;;;;GAIG;AACD,KAAK;AACP,0EAA0E;GACxE,WAAW,CAAC;AA0jChB;;;;GAIG;AACH;;;GAGG;AACH,MAAM,WAAW,6BAA6B;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC;IAC3C,SAAS,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC;IAC5C,SAAS,CAAC,EAAE;QAAE,OAAO,EAAE,eAAe,GAAG,SAAS,CAAA;KAAE,CAAC;IACrD,WAAW,CAAC,EAAE;QAAE,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE;QAAE,OAAO,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,CAAA;KAAE,CAAC;IAC3D,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC;AAED,wBAAgB,sBAAsB,CACpC,OAAO,CAAC,EAAE,6BAA6B,GACtC,gBAAgB,CAquClB"}
|
|
@@ -20,6 +20,7 @@ const AUTO_CONTINUE_PROMPT = "Continue from where you left off and finish the us
|
|
|
20
20
|
const AUTO_CONTINUE_COMPLETION_GUARD = "Before doing more work, inspect the prior partial assistant output in history. If it already gives a coherent answer, summary, artifact, coverage note, or next-step recommendation, finish with at most one short closing sentence and do not call tools, scan more data, or expand the search. Continue only genuinely unfinished work.";
|
|
21
21
|
const MAX_RECONNECT_ATTEMPTS = 5;
|
|
22
22
|
const MAX_STARTUP_RECOVERY_ATTEMPTS = 8;
|
|
23
|
+
const MAX_QUEUED_CONFLICT_RETRIES = 120;
|
|
23
24
|
const MAX_STALE_RUN_CONTINUATIONS = 3;
|
|
24
25
|
const MAX_STALLED_TRANSIENT_CONTINUATIONS = 8;
|
|
25
26
|
const MAX_TOTAL_TRANSIENT_CONTINUATIONS = 32;
|
|
@@ -978,6 +979,7 @@ export function createAgentChatAdapter(options) {
|
|
|
978
979
|
let includeReferences = Boolean(runConfig?.custom?.references);
|
|
979
980
|
let internalContinuationRequest = false;
|
|
980
981
|
let startupRecoveryAttempts = 0;
|
|
982
|
+
let queuedConflictRetries = 0;
|
|
981
983
|
let staleRunContinuationAttempts = 0;
|
|
982
984
|
let stalledTransientContinuationAttempts = 0;
|
|
983
985
|
let emptyTransientContinuationAttempts = 0;
|
|
@@ -1502,12 +1504,65 @@ export function createAgentChatAdapter(options) {
|
|
|
1502
1504
|
}
|
|
1503
1505
|
if (!res.ok) {
|
|
1504
1506
|
if (res.status === 409) {
|
|
1505
|
-
let
|
|
1507
|
+
let activeRunId = null;
|
|
1506
1508
|
try {
|
|
1507
1509
|
const body = await res.json();
|
|
1508
1510
|
if (body?.activeRunId) {
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
+
activeRunId = String(body.activeRunId);
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
catch {
|
|
1515
|
+
// Fall through to the generic response handling below.
|
|
1516
|
+
}
|
|
1517
|
+
// A 409 means the server still has an active run for this
|
|
1518
|
+
// thread. For a fresh user turn — a queued follow-up OR a normal
|
|
1519
|
+
// send fired shortly after the previous run finished (the server
|
|
1520
|
+
// can report a just-finished run as active for up to
|
|
1521
|
+
// RUN_STALE_MS while its terminal status write lands) — adopting
|
|
1522
|
+
// `activeRunId` below would reconnect to that prior run, replay
|
|
1523
|
+
// its final answer, and silently drop this turn. Wait for the
|
|
1524
|
+
// run to clear and retry THIS prompt instead. Only genuine
|
|
1525
|
+
// internal continuations (deliberate resumes of the active run)
|
|
1526
|
+
// fall through to the reconnect path.
|
|
1527
|
+
if (!internalContinuationRequest && activeRunId) {
|
|
1528
|
+
queuedConflictRetries += 1;
|
|
1529
|
+
if (queuedConflictRetries <= MAX_QUEUED_CONFLICT_RETRIES) {
|
|
1530
|
+
await delay(500, abortSignal);
|
|
1531
|
+
if (abortSignal.aborted)
|
|
1532
|
+
return;
|
|
1533
|
+
continue;
|
|
1534
|
+
}
|
|
1535
|
+
const message = "The previous response is still finishing and the new message could not start yet. Please try again.";
|
|
1536
|
+
const runError = {
|
|
1537
|
+
message,
|
|
1538
|
+
details: `The server kept reporting active run ${activeRunId} for this thread after ${MAX_QUEUED_CONFLICT_RETRIES} retries.`,
|
|
1539
|
+
errorCode: "active_run_conflict",
|
|
1540
|
+
recoverable: true,
|
|
1541
|
+
runId: activeRunId,
|
|
1542
|
+
};
|
|
1543
|
+
if (typeof window !== "undefined") {
|
|
1544
|
+
window.dispatchEvent(new CustomEvent("agent-chat:run-error", {
|
|
1545
|
+
detail: { ...runError, tabId },
|
|
1546
|
+
}));
|
|
1547
|
+
}
|
|
1548
|
+
content.push({
|
|
1549
|
+
type: "text",
|
|
1550
|
+
text: `Something went wrong: ${message}`,
|
|
1551
|
+
});
|
|
1552
|
+
yield {
|
|
1553
|
+
content: [...content],
|
|
1554
|
+
status: {
|
|
1555
|
+
type: "incomplete",
|
|
1556
|
+
reason: "error",
|
|
1557
|
+
},
|
|
1558
|
+
metadata: { custom: { runError } },
|
|
1559
|
+
};
|
|
1560
|
+
clearActiveRun();
|
|
1561
|
+
return;
|
|
1562
|
+
}
|
|
1563
|
+
if (activeRunId) {
|
|
1564
|
+
try {
|
|
1565
|
+
runId = activeRunId;
|
|
1511
1566
|
if (!attemptedRunIds.includes(runId)) {
|
|
1512
1567
|
attemptedRunIds.push(runId);
|
|
1513
1568
|
}
|
|
@@ -1518,16 +1573,14 @@ export function createAgentChatAdapter(options) {
|
|
|
1518
1573
|
const reconnected = yield* reconnectCurrentRun();
|
|
1519
1574
|
if (reconnected)
|
|
1520
1575
|
return;
|
|
1576
|
+
await delay(1000, abortSignal);
|
|
1577
|
+
if (abortSignal.aborted)
|
|
1578
|
+
return;
|
|
1579
|
+
continue;
|
|
1580
|
+
}
|
|
1581
|
+
catch {
|
|
1582
|
+
// Fall through to the generic response handling below.
|
|
1521
1583
|
}
|
|
1522
|
-
}
|
|
1523
|
-
catch {
|
|
1524
|
-
// Fall through to the generic response handling below.
|
|
1525
|
-
}
|
|
1526
|
-
if (handledConflict) {
|
|
1527
|
-
await delay(1000, abortSignal);
|
|
1528
|
-
if (abortSignal.aborted)
|
|
1529
|
-
return;
|
|
1530
|
-
continue;
|
|
1531
1584
|
}
|
|
1532
1585
|
}
|
|
1533
1586
|
if (res.status === 401 || res.status === 403) {
|