@noodleseed/assistant 1.24.0 → 1.25.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/README.md +4 -9
- package/dist/{app-view-element-DSPtyEul.d.cts → app-view-element-9ojWWYov.d.cts} +3 -2
- package/dist/{app-view-element-DDtXu08a.d.ts → app-view-element-BM4lral-.d.ts} +3 -2
- package/dist/app-view.cjs +213 -41
- package/dist/app-view.cjs.map +1 -1
- package/dist/app-view.d.cts +3 -3
- package/dist/app-view.d.ts +3 -3
- package/dist/app-view.js +2 -2
- package/dist/{appearance-0nS2LFjb.d.cts → appearance-B6vSg8Ub.d.cts} +4 -0
- package/dist/{appearance-0nS2LFjb.d.ts → appearance-B6vSg8Ub.d.ts} +4 -0
- package/dist/{chunk-IBDP6PXQ.js → chunk-7BQHW37I.js} +71 -3
- package/dist/chunk-7BQHW37I.js.map +1 -0
- package/dist/{chunk-5NBHHNI3.js → chunk-LNBUYHL7.js} +2 -2
- package/dist/chunk-LNBUYHL7.js.map +1 -0
- package/dist/{chunk-XKTUXFGX.js → chunk-P32MAR4K.js} +214 -42
- package/dist/chunk-P32MAR4K.js.map +1 -0
- package/dist/{chunk-6PVDV7SO.js → chunk-SGMECNNU.js} +55 -21
- package/dist/chunk-SGMECNNU.js.map +1 -0
- package/dist/{client-By4gqB1k.d.cts → client-BkogON2A.d.ts} +11 -1
- package/dist/{client-Cf38TgwN.d.ts → client-C07ppTU_.d.cts} +11 -1
- package/dist/client.cjs +70 -2
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +2 -2
- package/dist/client.d.ts +2 -2
- package/dist/client.js +1 -1
- package/dist/embed.global.js +149 -114
- package/dist/index.cjs +357 -83
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/react/client.cjs +70 -2
- package/dist/react/client.cjs.map +1 -1
- package/dist/react/client.d.cts +2 -2
- package/dist/react/client.d.ts +2 -2
- package/dist/react/client.js +1 -1
- package/dist/react.cjs +357 -83
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +3 -3
- package/dist/react.d.ts +3 -3
- package/dist/react.js +4 -4
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +3 -1
- package/dist/server.d.ts +3 -1
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-5NBHHNI3.js.map +0 -1
- package/dist/chunk-6PVDV7SO.js.map +0 -1
- package/dist/chunk-IBDP6PXQ.js.map +0 -1
- package/dist/chunk-XKTUXFGX.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as AssistantViewAvailableDetail, g as AssistantClientEvent, c as AssistantContext, f as AssistantModelContextUpdate, b as AssistantPageContext, h as AssistantInteractionResponse } from './client-
|
|
2
|
-
export { e as AssistantErrorDetail, i as AssistantEvent, j as AssistantViewAvailableEvent } from './client-
|
|
3
|
-
import './appearance-
|
|
1
|
+
import { a as AssistantViewAvailableDetail, g as AssistantClientEvent, c as AssistantContext, f as AssistantModelContextUpdate, b as AssistantPageContext, h as AssistantInteractionResponse } from './client-C07ppTU_.cjs';
|
|
2
|
+
export { e as AssistantErrorDetail, i as AssistantEvent, j as AssistantViewAvailableEvent } from './client-C07ppTU_.cjs';
|
|
3
|
+
import './appearance-B6vSg8Ub.cjs';
|
|
4
4
|
import 'ai';
|
|
5
5
|
|
|
6
6
|
interface AssistantSurfaceAppearance {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as AssistantViewAvailableDetail, g as AssistantClientEvent, c as AssistantContext, f as AssistantModelContextUpdate, b as AssistantPageContext, h as AssistantInteractionResponse } from './client-
|
|
2
|
-
export { e as AssistantErrorDetail, i as AssistantEvent, j as AssistantViewAvailableEvent } from './client-
|
|
3
|
-
import './appearance-
|
|
1
|
+
import { a as AssistantViewAvailableDetail, g as AssistantClientEvent, c as AssistantContext, f as AssistantModelContextUpdate, b as AssistantPageContext, h as AssistantInteractionResponse } from './client-BkogON2A.js';
|
|
2
|
+
export { e as AssistantErrorDetail, i as AssistantEvent, j as AssistantViewAvailableEvent } from './client-BkogON2A.js';
|
|
3
|
+
import './appearance-B6vSg8Ub.js';
|
|
4
4
|
import 'ai';
|
|
5
5
|
|
|
6
6
|
interface AssistantSurfaceAppearance {
|
package/dist/index.js
CHANGED
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
ASSISTANT_TAG_NAME,
|
|
3
3
|
NoodleAssistantElement,
|
|
4
4
|
registerNoodleAssistant
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-SGMECNNU.js";
|
|
6
|
+
import "./chunk-P32MAR4K.js";
|
|
7
|
+
import "./chunk-7BQHW37I.js";
|
|
8
8
|
import "./chunk-P223CYPO.js";
|
|
9
9
|
import "./chunk-3YYTUJPJ.js";
|
|
10
10
|
import "./chunk-5FUTL2UF.js";
|
package/dist/react/client.cjs
CHANGED
|
@@ -22666,6 +22666,9 @@ var AssistantChatStateStore = class {
|
|
|
22666
22666
|
})
|
|
22667
22667
|
);
|
|
22668
22668
|
return;
|
|
22669
|
+
case "auth_requested":
|
|
22670
|
+
this.#writeStandaloneData(() => this.#writeData("sign-in", event.data.id, event.data));
|
|
22671
|
+
return;
|
|
22669
22672
|
case "tool_completed":
|
|
22670
22673
|
this.#writeData("tool-result", event.data.id, event.data);
|
|
22671
22674
|
return;
|
|
@@ -22930,7 +22933,8 @@ function parseSession(value) {
|
|
|
22930
22933
|
const interactions = value.endpoints.interactions;
|
|
22931
22934
|
const apps = value.endpoints.apps;
|
|
22932
22935
|
const sandbox = value.endpoints.sandbox;
|
|
22933
|
-
|
|
22936
|
+
const transcript = value.endpoints.transcript;
|
|
22937
|
+
if (typeof value.token !== "string" || typeof value.expiresAt !== "string" || typeof value.endpoints.turns !== "string" || typeof value.endpoints.toolConfirmations !== "string" || interactions !== void 0 && typeof interactions !== "string" || apps !== void 0 && typeof apps !== "string" || sandbox !== void 0 && typeof sandbox !== "string" || transcript !== void 0 && typeof transcript !== "string") {
|
|
22934
22938
|
throw clientError("session_failed", "Assistant session response is invalid", true);
|
|
22935
22939
|
}
|
|
22936
22940
|
return {
|
|
@@ -22941,7 +22945,8 @@ function parseSession(value) {
|
|
|
22941
22945
|
toolConfirmations: value.endpoints.toolConfirmations,
|
|
22942
22946
|
...typeof interactions === "string" ? { interactions } : {},
|
|
22943
22947
|
...typeof apps === "string" ? { apps } : {},
|
|
22944
|
-
...typeof sandbox === "string" ? { sandbox } : {}
|
|
22948
|
+
...typeof sandbox === "string" ? { sandbox } : {},
|
|
22949
|
+
...typeof transcript === "string" ? { transcript } : {}
|
|
22945
22950
|
},
|
|
22946
22951
|
...isRecord2(value.configuration) ? { configuration: value.configuration } : {},
|
|
22947
22952
|
...isRecord2(value.resume) && typeof value.resume.tool === "string" ? { resume: { tool: value.resume.tool } } : {}
|
|
@@ -23206,6 +23211,43 @@ function resolveSessionSource(options) {
|
|
|
23206
23211
|
return { kind: "exchange", url: sessionEndpoint };
|
|
23207
23212
|
}
|
|
23208
23213
|
|
|
23214
|
+
// src/transcript-replay.ts
|
|
23215
|
+
function parseTranscriptEntries(value) {
|
|
23216
|
+
if (typeof value !== "object" || value === null) return [];
|
|
23217
|
+
const entries = value.entries;
|
|
23218
|
+
if (!Array.isArray(entries)) return [];
|
|
23219
|
+
const parsed = [];
|
|
23220
|
+
for (const entry of entries) {
|
|
23221
|
+
const { role, text: text2 } = entry ?? {};
|
|
23222
|
+
if (role !== "user" && role !== "assistant" || typeof text2 !== "string") return [];
|
|
23223
|
+
parsed.push({ role, text: text2 });
|
|
23224
|
+
}
|
|
23225
|
+
return parsed;
|
|
23226
|
+
}
|
|
23227
|
+
function transcriptReplayEvents(entries) {
|
|
23228
|
+
const events = [];
|
|
23229
|
+
let open = false;
|
|
23230
|
+
let awaitingAssistant = false;
|
|
23231
|
+
for (const entry of entries) {
|
|
23232
|
+
if (entry.role === "user") {
|
|
23233
|
+
if (open) events.push({ event: "message_completed", data: {} });
|
|
23234
|
+
events.push({ event: "message_started", data: { message: entry.text } });
|
|
23235
|
+
open = true;
|
|
23236
|
+
awaitingAssistant = true;
|
|
23237
|
+
continue;
|
|
23238
|
+
}
|
|
23239
|
+
if (!open || !awaitingAssistant) {
|
|
23240
|
+
if (open) events.push({ event: "message_completed", data: {} });
|
|
23241
|
+
events.push({ event: "resume_started", data: { tool: "" } });
|
|
23242
|
+
open = true;
|
|
23243
|
+
}
|
|
23244
|
+
events.push({ event: "content", data: { delta: entry.text } });
|
|
23245
|
+
awaitingAssistant = false;
|
|
23246
|
+
}
|
|
23247
|
+
if (open) events.push({ event: "message_completed", data: {} });
|
|
23248
|
+
return events;
|
|
23249
|
+
}
|
|
23250
|
+
|
|
23209
23251
|
// src/transport.ts
|
|
23210
23252
|
var AssistantTransportError = class extends Error {
|
|
23211
23253
|
code = "invalid_response";
|
|
@@ -23376,6 +23418,12 @@ var DefaultAssistantClient = class {
|
|
|
23376
23418
|
await this.#singleFlight(async (signal) => {
|
|
23377
23419
|
if (this.#session) return;
|
|
23378
23420
|
const session = await this.#createSession(signal);
|
|
23421
|
+
if (this.#source.kind !== "public" && session.endpoints.transcript) {
|
|
23422
|
+
try {
|
|
23423
|
+
await this.#replayTranscript(session, signal);
|
|
23424
|
+
} catch {
|
|
23425
|
+
}
|
|
23426
|
+
}
|
|
23379
23427
|
if (session.resume) {
|
|
23380
23428
|
try {
|
|
23381
23429
|
await this.#runChatOperation(signal, () => this.#resumeTurn(session, signal));
|
|
@@ -23384,6 +23432,26 @@ var DefaultAssistantClient = class {
|
|
|
23384
23432
|
}
|
|
23385
23433
|
});
|
|
23386
23434
|
}
|
|
23435
|
+
/** Fetch and re-emit the bounded visible transcript through the standard event path. */
|
|
23436
|
+
async #replayTranscript(session, signal) {
|
|
23437
|
+
const endpoint = session.endpoints.transcript;
|
|
23438
|
+
if (!endpoint) return;
|
|
23439
|
+
const response = await this.#request(
|
|
23440
|
+
endpoint,
|
|
23441
|
+
{
|
|
23442
|
+
method: "POST",
|
|
23443
|
+
headers: authorizedHeaders(session.token, "application/json"),
|
|
23444
|
+
body: "{}",
|
|
23445
|
+
signal
|
|
23446
|
+
},
|
|
23447
|
+
"turn_failed"
|
|
23448
|
+
);
|
|
23449
|
+
if (!response.ok) return;
|
|
23450
|
+
for (const event of transcriptReplayEvents(parseTranscriptEntries(await response.json()))) {
|
|
23451
|
+
this.#emit(event);
|
|
23452
|
+
if (event.event === "message_completed") await this.#chat.flush();
|
|
23453
|
+
}
|
|
23454
|
+
}
|
|
23387
23455
|
/** POST the one-shot resume trigger; a 409 means nothing was pending, which renders as silence. */
|
|
23388
23456
|
async #resumeTurn(session, signal) {
|
|
23389
23457
|
const response = await this.#request(
|