@mitralab.io/sdk-core 0.3.2 → 0.3.4
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/CHANGELOG.md +32 -0
- package/README.md +3 -3
- package/contracts/README.md +9 -0
- package/contracts/manifest.json +11 -1
- package/contracts/v0.3.3/sdk-parity.json +2902 -0
- package/contracts/v0.3.4/sdk-parity.json +2902 -0
- package/dist/index.cjs +33 -13
- package/dist/index.d.cts +33 -2
- package/dist/index.d.ts +33 -2
- package/dist/index.js +33 -13
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4377,6 +4377,7 @@ var TURN_TAIL_TYPES = /* @__PURE__ */ new Set([
|
|
|
4377
4377
|
"toolResult",
|
|
4378
4378
|
"stepFinish"
|
|
4379
4379
|
]);
|
|
4380
|
+
var STATE_FRAME_TYPES = /* @__PURE__ */ new Set(["providerUsage", "backgroundTasks"]);
|
|
4380
4381
|
var COPILOT_INPUT_TYPES = /* @__PURE__ */ new Set([
|
|
4381
4382
|
"message",
|
|
4382
4383
|
"interrupt",
|
|
@@ -4452,6 +4453,7 @@ function sequenceOf(event) {
|
|
|
4452
4453
|
function toolEventOf(event, payload, phase) {
|
|
4453
4454
|
return {
|
|
4454
4455
|
tool: typeof payload?.name === "string" ? payload.name : "",
|
|
4456
|
+
...typeof payload?.title === "string" ? { title: payload.title } : {},
|
|
4455
4457
|
phase,
|
|
4456
4458
|
timestamp: event.timestamp,
|
|
4457
4459
|
...pieceIdentityOf(event, payload),
|
|
@@ -4494,8 +4496,13 @@ function isChatRow(message) {
|
|
|
4494
4496
|
}
|
|
4495
4497
|
var REQUEST_ROW_KINDS = {
|
|
4496
4498
|
APPROVAL: "approval",
|
|
4497
|
-
USER_INPUT_REQUEST: "userInputRequest"
|
|
4499
|
+
USER_INPUT_REQUEST: "userInputRequest",
|
|
4500
|
+
NOTIFICATION: "notification"
|
|
4498
4501
|
};
|
|
4502
|
+
function notificationFieldsOf(payload) {
|
|
4503
|
+
const { source, outcome, summary, detail } = payload;
|
|
4504
|
+
return { source, outcome, summary, ...detail !== void 0 ? { detail } : {} };
|
|
4505
|
+
}
|
|
4499
4506
|
function parseJson(text) {
|
|
4500
4507
|
try {
|
|
4501
4508
|
return JSON.parse(text);
|
|
@@ -4518,14 +4525,14 @@ function toAgentTimelineItem(message) {
|
|
|
4518
4525
|
if (requestKind) {
|
|
4519
4526
|
const payload = asObject2(parseJson(message.content));
|
|
4520
4527
|
if (payload) {
|
|
4521
|
-
|
|
4528
|
+
const item = {
|
|
4522
4529
|
id: message.id,
|
|
4523
|
-
kind: requestKind,
|
|
4524
4530
|
payload,
|
|
4525
4531
|
at: message.createdAt,
|
|
4526
4532
|
...timelineIdentityOf(message),
|
|
4527
4533
|
...parentToolIdOf(message.parentToolId)
|
|
4528
4534
|
};
|
|
4535
|
+
return requestKind === "notification" ? { ...item, kind: requestKind, ...notificationFieldsOf(payload) } : { ...item, kind: requestKind };
|
|
4529
4536
|
}
|
|
4530
4537
|
}
|
|
4531
4538
|
if (message.type === "TOOL_USE") {
|
|
@@ -4537,6 +4544,7 @@ function toAgentTimelineItem(message) {
|
|
|
4537
4544
|
kind: "tool",
|
|
4538
4545
|
tool: {
|
|
4539
4546
|
tool: typeof payload.name === "string" ? payload.name : "",
|
|
4547
|
+
...typeof payload.title === "string" ? { title: payload.title } : {},
|
|
4540
4548
|
...typeof payload.toolId === "string" ? { toolId: payload.toolId } : {},
|
|
4541
4549
|
...parentToolIdOf(payload.parentToolId ?? message.parentToolId),
|
|
4542
4550
|
...payload.input !== void 0 ? { input: payload.input } : {},
|
|
@@ -5421,6 +5429,15 @@ var CoreAgentTaskSession = class {
|
|
|
5421
5429
|
case "user_input_request":
|
|
5422
5430
|
this.liveRequest(event, payload);
|
|
5423
5431
|
break;
|
|
5432
|
+
case "notification":
|
|
5433
|
+
this.liveRequest(event, payload);
|
|
5434
|
+
if (payload) {
|
|
5435
|
+
this.emit("notification", {
|
|
5436
|
+
...payload,
|
|
5437
|
+
...pieceIdentityOf(event, payload)
|
|
5438
|
+
});
|
|
5439
|
+
}
|
|
5440
|
+
break;
|
|
5424
5441
|
default:
|
|
5425
5442
|
break;
|
|
5426
5443
|
}
|
|
@@ -5532,6 +5549,7 @@ var CoreAgentTaskSession = class {
|
|
|
5532
5549
|
}
|
|
5533
5550
|
repeatsTheRunningTurn(event, lifecycle) {
|
|
5534
5551
|
if (this._status !== "streaming" && this._status !== "cancelled") return false;
|
|
5552
|
+
if (STATE_FRAME_TYPES.has(event.type)) return false;
|
|
5535
5553
|
const turnId = lifecycle?.turnId;
|
|
5536
5554
|
if (typeof turnId !== "string") return false;
|
|
5537
5555
|
if (typeof event.sequence === "number") {
|
|
@@ -5662,21 +5680,23 @@ var CoreAgentTaskSession = class {
|
|
|
5662
5680
|
// reaches the app as a `raw` event, as before.
|
|
5663
5681
|
liveRequest(event, payload, parentToolId) {
|
|
5664
5682
|
if (!payload) return;
|
|
5665
|
-
const kind = event.type === "approval" ? "approval" : "userInputRequest";
|
|
5683
|
+
const kind = event.type === "approval" ? "approval" : event.type === "notification" ? "notification" : "userInputRequest";
|
|
5666
5684
|
const itemId = typeof payload.itemId === "string" ? payload.itemId : void 0;
|
|
5667
5685
|
const sequence = typeof event.sequence === "number" ? event.sequence : void 0;
|
|
5668
5686
|
if (itemId === void 0 && sequence === void 0) return;
|
|
5669
5687
|
this.livePiece(
|
|
5670
5688
|
(item) => item.kind === kind && (itemId !== void 0 ? item.itemId === itemId : item.sequence === sequence),
|
|
5671
|
-
() =>
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5689
|
+
() => {
|
|
5690
|
+
const item = {
|
|
5691
|
+
id: `live:${kind}:${itemId ?? sequence}`,
|
|
5692
|
+
payload,
|
|
5693
|
+
at: liveAtOf(event),
|
|
5694
|
+
...sequence === void 0 ? {} : { sequence },
|
|
5695
|
+
...itemId === void 0 ? {} : { itemId },
|
|
5696
|
+
...parentToolIdOf(parentToolId)
|
|
5697
|
+
};
|
|
5698
|
+
return kind === "notification" ? { ...item, kind, ...notificationFieldsOf(payload) } : { ...item, kind };
|
|
5699
|
+
},
|
|
5680
5700
|
(item) => item
|
|
5681
5701
|
);
|
|
5682
5702
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1232,7 +1232,7 @@ interface AgentMessage {
|
|
|
1232
1232
|
sender: string;
|
|
1233
1233
|
/**
|
|
1234
1234
|
* `TEXT`, `ERROR`, `TOOL_USE`; asked with `kinds: "all"`, also `REASONING`, `SUBAGENT_TEXT`,
|
|
1235
|
-
* `APPROVAL` and `
|
|
1235
|
+
* `APPROVAL`, `USER_INPUT_REQUEST` and `NOTIFICATION`.
|
|
1236
1236
|
*/
|
|
1237
1237
|
type: string;
|
|
1238
1238
|
content: string;
|
|
@@ -2358,8 +2358,26 @@ interface AgentPieceIdentity {
|
|
|
2358
2358
|
/** The `lifecycle.turnId` of the frame. */
|
|
2359
2359
|
turnId?: string;
|
|
2360
2360
|
}
|
|
2361
|
+
/**
|
|
2362
|
+
* Background work that ended, as T3 reports it: what it was (`source.kind` as T3 sends it:
|
|
2363
|
+
* `background_command`, `background_task` with `work: "subagent"`, `monitor`...), how it ended (`outcome`: `completed`, `failed`, `cancelled`,
|
|
2364
|
+
* `updated` or `unknown`), the line T3 shows (`summary`) and, when T3 has it, `detail`. Values are
|
|
2365
|
+
* passed as they come, an unknown one included.
|
|
2366
|
+
*/
|
|
2367
|
+
interface AgentNotification {
|
|
2368
|
+
source: {
|
|
2369
|
+
kind: string;
|
|
2370
|
+
} & Record<string, unknown>;
|
|
2371
|
+
outcome: string;
|
|
2372
|
+
summary: string;
|
|
2373
|
+
detail?: unknown;
|
|
2374
|
+
itemId?: string;
|
|
2375
|
+
[field: string]: unknown;
|
|
2376
|
+
}
|
|
2361
2377
|
interface AgentToolEvent extends AgentPieceIdentity {
|
|
2362
2378
|
tool: string;
|
|
2379
|
+
/** The title the box gave the tool: a subagent's own name (its description), as T3 shows it. */
|
|
2380
|
+
title?: string;
|
|
2363
2381
|
toolId?: string;
|
|
2364
2382
|
/** On a tool a subagent called: the `toolId` of the tool call that spawned the subagent. */
|
|
2365
2383
|
parentToolId?: string;
|
|
@@ -2421,6 +2439,17 @@ type AgentTimelineItem = ({
|
|
|
2421
2439
|
at: string;
|
|
2422
2440
|
parentToolId?: string;
|
|
2423
2441
|
} & AgentTimelineItemIdentity) | ({
|
|
2442
|
+
id: string;
|
|
2443
|
+
/**
|
|
2444
|
+
* Background work that ended (a command, a subagent, a monitor), the item T3 puts in the turn
|
|
2445
|
+
* the provider opens for it (`NOTIFICATION` row): `source`, `outcome`, `summary` and `detail`
|
|
2446
|
+
* as the live `notification` event carries them, and the box's frame as it came in `payload`.
|
|
2447
|
+
*/
|
|
2448
|
+
kind: "notification";
|
|
2449
|
+
payload: Record<string, unknown>;
|
|
2450
|
+
at: string;
|
|
2451
|
+
parentToolId?: string;
|
|
2452
|
+
} & Pick<AgentNotification, "source" | "outcome" | "summary" | "detail"> & AgentTimelineItemIdentity) | ({
|
|
2424
2453
|
id: string;
|
|
2425
2454
|
kind: "tool";
|
|
2426
2455
|
tool: AgentToolEvent;
|
|
@@ -2491,6 +2520,8 @@ interface AgentTaskSessionEventMap {
|
|
|
2491
2520
|
backgroundTasks: {
|
|
2492
2521
|
tasks: readonly AgentBackgroundTask[];
|
|
2493
2522
|
};
|
|
2523
|
+
/** Background work ended: what it was, how it ended and T3's line for it. */
|
|
2524
|
+
notification: AgentNotification & AgentPieceIdentity;
|
|
2494
2525
|
/**
|
|
2495
2526
|
* The box took a message into the running turn at this point, with no turn of its own: the
|
|
2496
2527
|
* place the app shows it in that turn. The turn's `turnEnd` answers it.
|
|
@@ -2678,4 +2709,4 @@ declare function expectPage<T extends object>(value: unknown, context: string, e
|
|
|
2678
2709
|
declare function expectLegacyPage<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory, validateItem?: (value: unknown, context: string, errors: SdkCoreErrorFactory) => T): LegacyPage<T>;
|
|
2679
2710
|
declare function expectEmpty(value: unknown, context: string, errors?: SdkCoreErrorFactory): void;
|
|
2680
2711
|
|
|
2681
|
-
export { API_KEY_EXCHANGE_PATH, type AgentBackgroundTask, type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionCustomProvider, type AgentConnectionCustomProviderInput, type AgentConnectionsModule, type AgentCredentialOptions, type AgentCredentialScope, type AgentCredentialsModule, type AgentDefinition, type AgentDirectChannelOptions, type AgentFetch, type AgentFetchResponse, type AgentHistoryCursor, type AgentInput, type AgentMessage, type AgentMessageListOptions, type AgentModel, type AgentPieceIdentity, type AgentProviderUsage, type AgentQueueItem, type AgentReadyProvider, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentSubagent, type AgentSubagentFrame, type AgentSubagentStatus, type AgentTask, type AgentTaskChannel, type AgentTaskCreateInput, type AgentTaskEvent, type AgentTaskEventConnection, type AgentTaskEventObserver, type AgentTaskEventSource, type AgentTaskInput, type AgentTaskListOptions, type AgentTaskRuntime, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentTimelineItemIdentity, type AgentToolEvent, type AgentTurnResult, type AgentTurnUsage, type AgentTurnUsageRequest, type AgentUpdateItem, type AgentWebSocket, type AgentWebSocketConstructor, type AgentsModule, type ApiKeyExchangeCaller, type AppColor, type AppContext, type AppCreateInput, type AppDefinition, type AppDeploy, type AppDomain, type AppFiles, type AppGetOptions, type AppListOptions, type AppMember, type AppPublishOptions, type AppSummary, type AppUpdateInput, type AppVersion, type AppVersionStatus, type AppsModule, type AuthModule, type AuthenticationResult, type BatchExecution, type BatchStatementResult, type BulkUnsubscribeResult, type ColumnInput, type ConnectionConfig, type ConnectionConfigResponse, type ConnectionTestResult, type ContextModule, type ContextModuleDependencies, type CopilotProvider, type CredentialStatus, type CredentialUsage, type CredentialUsageWindow, type CustomQueriesModule, type CustomQueryDefinition, type CustomQueryInput, type CustomQuerySummary, type CustomQueryUpdateInput, type DataSourceBulkItemResult, type DataSourceBulkResult, type DataSourceCreateInput, type DataSourceDbType, type DataSourceDefinition, type DataSourceInstanceType, type DataSourceUpdateInput, type DataSourcesModule, type DdlStatement, type DeviceAuthorization, type DmlStatement, type EffectiveEmailSender, type EmailSender, type EmailSenderInput, type EmailSettings, type EmailSettingsInput, type EmailTemplate, type EmailTemplateInput, type EmailTemplatePreview, type EmailTemplateType, type EmailTemplateTypeCatalog, type EmailTemplateUpsertResult, type EmailTemplateVariable, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, type FunctionBulkCreateInput, type FunctionBulkDeleteInput, type FunctionBulkDeleteResult, type FunctionBulkPatchInput, type FunctionBulkPatchItem, type FunctionBulkUpdateItem, type FunctionCreateInput, type FunctionDefinition, type FunctionExecution, type FunctionListOptions, type FunctionPatchInput, type FunctionRuntime, type FunctionSecrets, type FunctionSummary, type FunctionUpdateInput, type FunctionVersion, type FunctionVersionListOptions, type FunctionVisibility, type FunctionsAdminModule, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type ImportColumnMapping, type ImportDefinition, type ImportExecution, type ImportExecutionListOptions, type ImportInput, type ImportProcessing, type ImportSchedule, type ImportSource, type ImportSourceResponse, type ImportTarget, type ImportsModule, type IntegrationAdminModule, type IntegrationConnectionStatus, type IntegrationCredentialRule, type IntegrationExecution, type IntegrationFieldSchema, type IntegrationFieldSchemaInput, type IntegrationLoginConfig, type IntegrationModule, type IntegrationProxyMode, type IntegrationRequestConfig, type IntegrationResource, type IntegrationResourceInput, type IntegrationResourceParam, type IntegrationResourceSummary, type IntegrationResourceUpdateInput, type IntegrationResourcesModule, type IntegrationTemplate, type IntegrationTemplateSummary, type IntegrationTemplateType, type IntegrationTemplatesModule, type IntegrationTokenExtraction, type InviteAppUserInput, type InvocationType, type JsonValue, type LegacyPage, type ListTablesOptions, type ListTemplateConfigsOptions, type MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, type Page, type PageOptions, type PlanPrice, type ProviderCredentialStatus, type ProxyInput, type ProxyResult, type PublicFunctionAsyncResult, type PublicFunctionResult, type PublicFunctionsModule, type QueriesModule, type QueryParamPrimitive, type QueryParamValue, type QueryResult, type SchemaModule, type SchemaScope, type SchemaTables, type SdkCore, SdkCoreConfigurationError, type SdkCoreErrorFactory, type SdkCoreOptions, SdkCoreResponseError, type SdkCoreTransports, type SendEmailInput, type SqlModule, type TableColumn, type TableDefinition, type TableForeignKey, type TemplateConfig, type TemplateConfigBulkItemResult, type TemplateConfigBulkResult, type TemplateConfigCreateInput, type TemplateConfigPage, type TemplateConfigSummary, type TemplateConfigUpdateInput, type Tenant, type TestCredentialsInput, type Transport, type TransportRequestOptions, type User, type UserPlan, type WorkflowDefinition, type WorkflowExecution, type WorkflowInput, type WorkflowSummary, type WorkflowsModule, appAccessTokenPath, createAgentConnectionsModule, createAgentCredentialsModule, createAgentTaskSessionManager, createAgentTasksModule, createAgentsModule, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, isWorkspaceSession, readTokenAppId, readTokenExpiry, resolveApiKeyToken, toAgentTimelineItem, tokenAuthorizesApp, withAgentTaskSessions };
|
|
2712
|
+
export { API_KEY_EXCHANGE_PATH, type AgentBackgroundTask, type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionCustomProvider, type AgentConnectionCustomProviderInput, type AgentConnectionsModule, type AgentCredentialOptions, type AgentCredentialScope, type AgentCredentialsModule, type AgentDefinition, type AgentDirectChannelOptions, type AgentFetch, type AgentFetchResponse, type AgentHistoryCursor, type AgentInput, type AgentMessage, type AgentMessageListOptions, type AgentModel, type AgentNotification, type AgentPieceIdentity, type AgentProviderUsage, type AgentQueueItem, type AgentReadyProvider, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentSubagent, type AgentSubagentFrame, type AgentSubagentStatus, type AgentTask, type AgentTaskChannel, type AgentTaskCreateInput, type AgentTaskEvent, type AgentTaskEventConnection, type AgentTaskEventObserver, type AgentTaskEventSource, type AgentTaskInput, type AgentTaskListOptions, type AgentTaskRuntime, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentTimelineItemIdentity, type AgentToolEvent, type AgentTurnResult, type AgentTurnUsage, type AgentTurnUsageRequest, type AgentUpdateItem, type AgentWebSocket, type AgentWebSocketConstructor, type AgentsModule, type ApiKeyExchangeCaller, type AppColor, type AppContext, type AppCreateInput, type AppDefinition, type AppDeploy, type AppDomain, type AppFiles, type AppGetOptions, type AppListOptions, type AppMember, type AppPublishOptions, type AppSummary, type AppUpdateInput, type AppVersion, type AppVersionStatus, type AppsModule, type AuthModule, type AuthenticationResult, type BatchExecution, type BatchStatementResult, type BulkUnsubscribeResult, type ColumnInput, type ConnectionConfig, type ConnectionConfigResponse, type ConnectionTestResult, type ContextModule, type ContextModuleDependencies, type CopilotProvider, type CredentialStatus, type CredentialUsage, type CredentialUsageWindow, type CustomQueriesModule, type CustomQueryDefinition, type CustomQueryInput, type CustomQuerySummary, type CustomQueryUpdateInput, type DataSourceBulkItemResult, type DataSourceBulkResult, type DataSourceCreateInput, type DataSourceDbType, type DataSourceDefinition, type DataSourceInstanceType, type DataSourceUpdateInput, type DataSourcesModule, type DdlStatement, type DeviceAuthorization, type DmlStatement, type EffectiveEmailSender, type EmailSender, type EmailSenderInput, type EmailSettings, type EmailSettingsInput, type EmailTemplate, type EmailTemplateInput, type EmailTemplatePreview, type EmailTemplateType, type EmailTemplateTypeCatalog, type EmailTemplateUpsertResult, type EmailTemplateVariable, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, type FunctionBulkCreateInput, type FunctionBulkDeleteInput, type FunctionBulkDeleteResult, type FunctionBulkPatchInput, type FunctionBulkPatchItem, type FunctionBulkUpdateItem, type FunctionCreateInput, type FunctionDefinition, type FunctionExecution, type FunctionListOptions, type FunctionPatchInput, type FunctionRuntime, type FunctionSecrets, type FunctionSummary, type FunctionUpdateInput, type FunctionVersion, type FunctionVersionListOptions, type FunctionVisibility, type FunctionsAdminModule, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type ImportColumnMapping, type ImportDefinition, type ImportExecution, type ImportExecutionListOptions, type ImportInput, type ImportProcessing, type ImportSchedule, type ImportSource, type ImportSourceResponse, type ImportTarget, type ImportsModule, type IntegrationAdminModule, type IntegrationConnectionStatus, type IntegrationCredentialRule, type IntegrationExecution, type IntegrationFieldSchema, type IntegrationFieldSchemaInput, type IntegrationLoginConfig, type IntegrationModule, type IntegrationProxyMode, type IntegrationRequestConfig, type IntegrationResource, type IntegrationResourceInput, type IntegrationResourceParam, type IntegrationResourceSummary, type IntegrationResourceUpdateInput, type IntegrationResourcesModule, type IntegrationTemplate, type IntegrationTemplateSummary, type IntegrationTemplateType, type IntegrationTemplatesModule, type IntegrationTokenExtraction, type InviteAppUserInput, type InvocationType, type JsonValue, type LegacyPage, type ListTablesOptions, type ListTemplateConfigsOptions, type MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, type Page, type PageOptions, type PlanPrice, type ProviderCredentialStatus, type ProxyInput, type ProxyResult, type PublicFunctionAsyncResult, type PublicFunctionResult, type PublicFunctionsModule, type QueriesModule, type QueryParamPrimitive, type QueryParamValue, type QueryResult, type SchemaModule, type SchemaScope, type SchemaTables, type SdkCore, SdkCoreConfigurationError, type SdkCoreErrorFactory, type SdkCoreOptions, SdkCoreResponseError, type SdkCoreTransports, type SendEmailInput, type SqlModule, type TableColumn, type TableDefinition, type TableForeignKey, type TemplateConfig, type TemplateConfigBulkItemResult, type TemplateConfigBulkResult, type TemplateConfigCreateInput, type TemplateConfigPage, type TemplateConfigSummary, type TemplateConfigUpdateInput, type Tenant, type TestCredentialsInput, type Transport, type TransportRequestOptions, type User, type UserPlan, type WorkflowDefinition, type WorkflowExecution, type WorkflowInput, type WorkflowSummary, type WorkflowsModule, appAccessTokenPath, createAgentConnectionsModule, createAgentCredentialsModule, createAgentTaskSessionManager, createAgentTasksModule, createAgentsModule, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, isWorkspaceSession, readTokenAppId, readTokenExpiry, resolveApiKeyToken, toAgentTimelineItem, tokenAuthorizesApp, withAgentTaskSessions };
|
package/dist/index.d.ts
CHANGED
|
@@ -1232,7 +1232,7 @@ interface AgentMessage {
|
|
|
1232
1232
|
sender: string;
|
|
1233
1233
|
/**
|
|
1234
1234
|
* `TEXT`, `ERROR`, `TOOL_USE`; asked with `kinds: "all"`, also `REASONING`, `SUBAGENT_TEXT`,
|
|
1235
|
-
* `APPROVAL` and `
|
|
1235
|
+
* `APPROVAL`, `USER_INPUT_REQUEST` and `NOTIFICATION`.
|
|
1236
1236
|
*/
|
|
1237
1237
|
type: string;
|
|
1238
1238
|
content: string;
|
|
@@ -2358,8 +2358,26 @@ interface AgentPieceIdentity {
|
|
|
2358
2358
|
/** The `lifecycle.turnId` of the frame. */
|
|
2359
2359
|
turnId?: string;
|
|
2360
2360
|
}
|
|
2361
|
+
/**
|
|
2362
|
+
* Background work that ended, as T3 reports it: what it was (`source.kind` as T3 sends it:
|
|
2363
|
+
* `background_command`, `background_task` with `work: "subagent"`, `monitor`...), how it ended (`outcome`: `completed`, `failed`, `cancelled`,
|
|
2364
|
+
* `updated` or `unknown`), the line T3 shows (`summary`) and, when T3 has it, `detail`. Values are
|
|
2365
|
+
* passed as they come, an unknown one included.
|
|
2366
|
+
*/
|
|
2367
|
+
interface AgentNotification {
|
|
2368
|
+
source: {
|
|
2369
|
+
kind: string;
|
|
2370
|
+
} & Record<string, unknown>;
|
|
2371
|
+
outcome: string;
|
|
2372
|
+
summary: string;
|
|
2373
|
+
detail?: unknown;
|
|
2374
|
+
itemId?: string;
|
|
2375
|
+
[field: string]: unknown;
|
|
2376
|
+
}
|
|
2361
2377
|
interface AgentToolEvent extends AgentPieceIdentity {
|
|
2362
2378
|
tool: string;
|
|
2379
|
+
/** The title the box gave the tool: a subagent's own name (its description), as T3 shows it. */
|
|
2380
|
+
title?: string;
|
|
2363
2381
|
toolId?: string;
|
|
2364
2382
|
/** On a tool a subagent called: the `toolId` of the tool call that spawned the subagent. */
|
|
2365
2383
|
parentToolId?: string;
|
|
@@ -2421,6 +2439,17 @@ type AgentTimelineItem = ({
|
|
|
2421
2439
|
at: string;
|
|
2422
2440
|
parentToolId?: string;
|
|
2423
2441
|
} & AgentTimelineItemIdentity) | ({
|
|
2442
|
+
id: string;
|
|
2443
|
+
/**
|
|
2444
|
+
* Background work that ended (a command, a subagent, a monitor), the item T3 puts in the turn
|
|
2445
|
+
* the provider opens for it (`NOTIFICATION` row): `source`, `outcome`, `summary` and `detail`
|
|
2446
|
+
* as the live `notification` event carries them, and the box's frame as it came in `payload`.
|
|
2447
|
+
*/
|
|
2448
|
+
kind: "notification";
|
|
2449
|
+
payload: Record<string, unknown>;
|
|
2450
|
+
at: string;
|
|
2451
|
+
parentToolId?: string;
|
|
2452
|
+
} & Pick<AgentNotification, "source" | "outcome" | "summary" | "detail"> & AgentTimelineItemIdentity) | ({
|
|
2424
2453
|
id: string;
|
|
2425
2454
|
kind: "tool";
|
|
2426
2455
|
tool: AgentToolEvent;
|
|
@@ -2491,6 +2520,8 @@ interface AgentTaskSessionEventMap {
|
|
|
2491
2520
|
backgroundTasks: {
|
|
2492
2521
|
tasks: readonly AgentBackgroundTask[];
|
|
2493
2522
|
};
|
|
2523
|
+
/** Background work ended: what it was, how it ended and T3's line for it. */
|
|
2524
|
+
notification: AgentNotification & AgentPieceIdentity;
|
|
2494
2525
|
/**
|
|
2495
2526
|
* The box took a message into the running turn at this point, with no turn of its own: the
|
|
2496
2527
|
* place the app shows it in that turn. The turn's `turnEnd` answers it.
|
|
@@ -2678,4 +2709,4 @@ declare function expectPage<T extends object>(value: unknown, context: string, e
|
|
|
2678
2709
|
declare function expectLegacyPage<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory, validateItem?: (value: unknown, context: string, errors: SdkCoreErrorFactory) => T): LegacyPage<T>;
|
|
2679
2710
|
declare function expectEmpty(value: unknown, context: string, errors?: SdkCoreErrorFactory): void;
|
|
2680
2711
|
|
|
2681
|
-
export { API_KEY_EXCHANGE_PATH, type AgentBackgroundTask, type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionCustomProvider, type AgentConnectionCustomProviderInput, type AgentConnectionsModule, type AgentCredentialOptions, type AgentCredentialScope, type AgentCredentialsModule, type AgentDefinition, type AgentDirectChannelOptions, type AgentFetch, type AgentFetchResponse, type AgentHistoryCursor, type AgentInput, type AgentMessage, type AgentMessageListOptions, type AgentModel, type AgentPieceIdentity, type AgentProviderUsage, type AgentQueueItem, type AgentReadyProvider, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentSubagent, type AgentSubagentFrame, type AgentSubagentStatus, type AgentTask, type AgentTaskChannel, type AgentTaskCreateInput, type AgentTaskEvent, type AgentTaskEventConnection, type AgentTaskEventObserver, type AgentTaskEventSource, type AgentTaskInput, type AgentTaskListOptions, type AgentTaskRuntime, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentTimelineItemIdentity, type AgentToolEvent, type AgentTurnResult, type AgentTurnUsage, type AgentTurnUsageRequest, type AgentUpdateItem, type AgentWebSocket, type AgentWebSocketConstructor, type AgentsModule, type ApiKeyExchangeCaller, type AppColor, type AppContext, type AppCreateInput, type AppDefinition, type AppDeploy, type AppDomain, type AppFiles, type AppGetOptions, type AppListOptions, type AppMember, type AppPublishOptions, type AppSummary, type AppUpdateInput, type AppVersion, type AppVersionStatus, type AppsModule, type AuthModule, type AuthenticationResult, type BatchExecution, type BatchStatementResult, type BulkUnsubscribeResult, type ColumnInput, type ConnectionConfig, type ConnectionConfigResponse, type ConnectionTestResult, type ContextModule, type ContextModuleDependencies, type CopilotProvider, type CredentialStatus, type CredentialUsage, type CredentialUsageWindow, type CustomQueriesModule, type CustomQueryDefinition, type CustomQueryInput, type CustomQuerySummary, type CustomQueryUpdateInput, type DataSourceBulkItemResult, type DataSourceBulkResult, type DataSourceCreateInput, type DataSourceDbType, type DataSourceDefinition, type DataSourceInstanceType, type DataSourceUpdateInput, type DataSourcesModule, type DdlStatement, type DeviceAuthorization, type DmlStatement, type EffectiveEmailSender, type EmailSender, type EmailSenderInput, type EmailSettings, type EmailSettingsInput, type EmailTemplate, type EmailTemplateInput, type EmailTemplatePreview, type EmailTemplateType, type EmailTemplateTypeCatalog, type EmailTemplateUpsertResult, type EmailTemplateVariable, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, type FunctionBulkCreateInput, type FunctionBulkDeleteInput, type FunctionBulkDeleteResult, type FunctionBulkPatchInput, type FunctionBulkPatchItem, type FunctionBulkUpdateItem, type FunctionCreateInput, type FunctionDefinition, type FunctionExecution, type FunctionListOptions, type FunctionPatchInput, type FunctionRuntime, type FunctionSecrets, type FunctionSummary, type FunctionUpdateInput, type FunctionVersion, type FunctionVersionListOptions, type FunctionVisibility, type FunctionsAdminModule, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type ImportColumnMapping, type ImportDefinition, type ImportExecution, type ImportExecutionListOptions, type ImportInput, type ImportProcessing, type ImportSchedule, type ImportSource, type ImportSourceResponse, type ImportTarget, type ImportsModule, type IntegrationAdminModule, type IntegrationConnectionStatus, type IntegrationCredentialRule, type IntegrationExecution, type IntegrationFieldSchema, type IntegrationFieldSchemaInput, type IntegrationLoginConfig, type IntegrationModule, type IntegrationProxyMode, type IntegrationRequestConfig, type IntegrationResource, type IntegrationResourceInput, type IntegrationResourceParam, type IntegrationResourceSummary, type IntegrationResourceUpdateInput, type IntegrationResourcesModule, type IntegrationTemplate, type IntegrationTemplateSummary, type IntegrationTemplateType, type IntegrationTemplatesModule, type IntegrationTokenExtraction, type InviteAppUserInput, type InvocationType, type JsonValue, type LegacyPage, type ListTablesOptions, type ListTemplateConfigsOptions, type MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, type Page, type PageOptions, type PlanPrice, type ProviderCredentialStatus, type ProxyInput, type ProxyResult, type PublicFunctionAsyncResult, type PublicFunctionResult, type PublicFunctionsModule, type QueriesModule, type QueryParamPrimitive, type QueryParamValue, type QueryResult, type SchemaModule, type SchemaScope, type SchemaTables, type SdkCore, SdkCoreConfigurationError, type SdkCoreErrorFactory, type SdkCoreOptions, SdkCoreResponseError, type SdkCoreTransports, type SendEmailInput, type SqlModule, type TableColumn, type TableDefinition, type TableForeignKey, type TemplateConfig, type TemplateConfigBulkItemResult, type TemplateConfigBulkResult, type TemplateConfigCreateInput, type TemplateConfigPage, type TemplateConfigSummary, type TemplateConfigUpdateInput, type Tenant, type TestCredentialsInput, type Transport, type TransportRequestOptions, type User, type UserPlan, type WorkflowDefinition, type WorkflowExecution, type WorkflowInput, type WorkflowSummary, type WorkflowsModule, appAccessTokenPath, createAgentConnectionsModule, createAgentCredentialsModule, createAgentTaskSessionManager, createAgentTasksModule, createAgentsModule, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, isWorkspaceSession, readTokenAppId, readTokenExpiry, resolveApiKeyToken, toAgentTimelineItem, tokenAuthorizesApp, withAgentTaskSessions };
|
|
2712
|
+
export { API_KEY_EXCHANGE_PATH, type AgentBackgroundTask, type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionCustomProvider, type AgentConnectionCustomProviderInput, type AgentConnectionsModule, type AgentCredentialOptions, type AgentCredentialScope, type AgentCredentialsModule, type AgentDefinition, type AgentDirectChannelOptions, type AgentFetch, type AgentFetchResponse, type AgentHistoryCursor, type AgentInput, type AgentMessage, type AgentMessageListOptions, type AgentModel, type AgentNotification, type AgentPieceIdentity, type AgentProviderUsage, type AgentQueueItem, type AgentReadyProvider, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentSubagent, type AgentSubagentFrame, type AgentSubagentStatus, type AgentTask, type AgentTaskChannel, type AgentTaskCreateInput, type AgentTaskEvent, type AgentTaskEventConnection, type AgentTaskEventObserver, type AgentTaskEventSource, type AgentTaskInput, type AgentTaskListOptions, type AgentTaskRuntime, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentTimelineItemIdentity, type AgentToolEvent, type AgentTurnResult, type AgentTurnUsage, type AgentTurnUsageRequest, type AgentUpdateItem, type AgentWebSocket, type AgentWebSocketConstructor, type AgentsModule, type ApiKeyExchangeCaller, type AppColor, type AppContext, type AppCreateInput, type AppDefinition, type AppDeploy, type AppDomain, type AppFiles, type AppGetOptions, type AppListOptions, type AppMember, type AppPublishOptions, type AppSummary, type AppUpdateInput, type AppVersion, type AppVersionStatus, type AppsModule, type AuthModule, type AuthenticationResult, type BatchExecution, type BatchStatementResult, type BulkUnsubscribeResult, type ColumnInput, type ConnectionConfig, type ConnectionConfigResponse, type ConnectionTestResult, type ContextModule, type ContextModuleDependencies, type CopilotProvider, type CredentialStatus, type CredentialUsage, type CredentialUsageWindow, type CustomQueriesModule, type CustomQueryDefinition, type CustomQueryInput, type CustomQuerySummary, type CustomQueryUpdateInput, type DataSourceBulkItemResult, type DataSourceBulkResult, type DataSourceCreateInput, type DataSourceDbType, type DataSourceDefinition, type DataSourceInstanceType, type DataSourceUpdateInput, type DataSourcesModule, type DdlStatement, type DeviceAuthorization, type DmlStatement, type EffectiveEmailSender, type EmailSender, type EmailSenderInput, type EmailSettings, type EmailSettingsInput, type EmailTemplate, type EmailTemplateInput, type EmailTemplatePreview, type EmailTemplateType, type EmailTemplateTypeCatalog, type EmailTemplateUpsertResult, type EmailTemplateVariable, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, type FunctionBulkCreateInput, type FunctionBulkDeleteInput, type FunctionBulkDeleteResult, type FunctionBulkPatchInput, type FunctionBulkPatchItem, type FunctionBulkUpdateItem, type FunctionCreateInput, type FunctionDefinition, type FunctionExecution, type FunctionListOptions, type FunctionPatchInput, type FunctionRuntime, type FunctionSecrets, type FunctionSummary, type FunctionUpdateInput, type FunctionVersion, type FunctionVersionListOptions, type FunctionVisibility, type FunctionsAdminModule, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type ImportColumnMapping, type ImportDefinition, type ImportExecution, type ImportExecutionListOptions, type ImportInput, type ImportProcessing, type ImportSchedule, type ImportSource, type ImportSourceResponse, type ImportTarget, type ImportsModule, type IntegrationAdminModule, type IntegrationConnectionStatus, type IntegrationCredentialRule, type IntegrationExecution, type IntegrationFieldSchema, type IntegrationFieldSchemaInput, type IntegrationLoginConfig, type IntegrationModule, type IntegrationProxyMode, type IntegrationRequestConfig, type IntegrationResource, type IntegrationResourceInput, type IntegrationResourceParam, type IntegrationResourceSummary, type IntegrationResourceUpdateInput, type IntegrationResourcesModule, type IntegrationTemplate, type IntegrationTemplateSummary, type IntegrationTemplateType, type IntegrationTemplatesModule, type IntegrationTokenExtraction, type InviteAppUserInput, type InvocationType, type JsonValue, type LegacyPage, type ListTablesOptions, type ListTemplateConfigsOptions, type MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, type Page, type PageOptions, type PlanPrice, type ProviderCredentialStatus, type ProxyInput, type ProxyResult, type PublicFunctionAsyncResult, type PublicFunctionResult, type PublicFunctionsModule, type QueriesModule, type QueryParamPrimitive, type QueryParamValue, type QueryResult, type SchemaModule, type SchemaScope, type SchemaTables, type SdkCore, SdkCoreConfigurationError, type SdkCoreErrorFactory, type SdkCoreOptions, SdkCoreResponseError, type SdkCoreTransports, type SendEmailInput, type SqlModule, type TableColumn, type TableDefinition, type TableForeignKey, type TemplateConfig, type TemplateConfigBulkItemResult, type TemplateConfigBulkResult, type TemplateConfigCreateInput, type TemplateConfigPage, type TemplateConfigSummary, type TemplateConfigUpdateInput, type Tenant, type TestCredentialsInput, type Transport, type TransportRequestOptions, type User, type UserPlan, type WorkflowDefinition, type WorkflowExecution, type WorkflowInput, type WorkflowSummary, type WorkflowsModule, appAccessTokenPath, createAgentConnectionsModule, createAgentCredentialsModule, createAgentTaskSessionManager, createAgentTasksModule, createAgentsModule, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, isWorkspaceSession, readTokenAppId, readTokenExpiry, resolveApiKeyToken, toAgentTimelineItem, tokenAuthorizesApp, withAgentTaskSessions };
|
package/dist/index.js
CHANGED
|
@@ -4305,6 +4305,7 @@ var TURN_TAIL_TYPES = /* @__PURE__ */ new Set([
|
|
|
4305
4305
|
"toolResult",
|
|
4306
4306
|
"stepFinish"
|
|
4307
4307
|
]);
|
|
4308
|
+
var STATE_FRAME_TYPES = /* @__PURE__ */ new Set(["providerUsage", "backgroundTasks"]);
|
|
4308
4309
|
var COPILOT_INPUT_TYPES = /* @__PURE__ */ new Set([
|
|
4309
4310
|
"message",
|
|
4310
4311
|
"interrupt",
|
|
@@ -4380,6 +4381,7 @@ function sequenceOf(event) {
|
|
|
4380
4381
|
function toolEventOf(event, payload, phase) {
|
|
4381
4382
|
return {
|
|
4382
4383
|
tool: typeof payload?.name === "string" ? payload.name : "",
|
|
4384
|
+
...typeof payload?.title === "string" ? { title: payload.title } : {},
|
|
4383
4385
|
phase,
|
|
4384
4386
|
timestamp: event.timestamp,
|
|
4385
4387
|
...pieceIdentityOf(event, payload),
|
|
@@ -4422,8 +4424,13 @@ function isChatRow(message) {
|
|
|
4422
4424
|
}
|
|
4423
4425
|
var REQUEST_ROW_KINDS = {
|
|
4424
4426
|
APPROVAL: "approval",
|
|
4425
|
-
USER_INPUT_REQUEST: "userInputRequest"
|
|
4427
|
+
USER_INPUT_REQUEST: "userInputRequest",
|
|
4428
|
+
NOTIFICATION: "notification"
|
|
4426
4429
|
};
|
|
4430
|
+
function notificationFieldsOf(payload) {
|
|
4431
|
+
const { source, outcome, summary, detail } = payload;
|
|
4432
|
+
return { source, outcome, summary, ...detail !== void 0 ? { detail } : {} };
|
|
4433
|
+
}
|
|
4427
4434
|
function parseJson(text) {
|
|
4428
4435
|
try {
|
|
4429
4436
|
return JSON.parse(text);
|
|
@@ -4446,14 +4453,14 @@ function toAgentTimelineItem(message) {
|
|
|
4446
4453
|
if (requestKind) {
|
|
4447
4454
|
const payload = asObject2(parseJson(message.content));
|
|
4448
4455
|
if (payload) {
|
|
4449
|
-
|
|
4456
|
+
const item = {
|
|
4450
4457
|
id: message.id,
|
|
4451
|
-
kind: requestKind,
|
|
4452
4458
|
payload,
|
|
4453
4459
|
at: message.createdAt,
|
|
4454
4460
|
...timelineIdentityOf(message),
|
|
4455
4461
|
...parentToolIdOf(message.parentToolId)
|
|
4456
4462
|
};
|
|
4463
|
+
return requestKind === "notification" ? { ...item, kind: requestKind, ...notificationFieldsOf(payload) } : { ...item, kind: requestKind };
|
|
4457
4464
|
}
|
|
4458
4465
|
}
|
|
4459
4466
|
if (message.type === "TOOL_USE") {
|
|
@@ -4465,6 +4472,7 @@ function toAgentTimelineItem(message) {
|
|
|
4465
4472
|
kind: "tool",
|
|
4466
4473
|
tool: {
|
|
4467
4474
|
tool: typeof payload.name === "string" ? payload.name : "",
|
|
4475
|
+
...typeof payload.title === "string" ? { title: payload.title } : {},
|
|
4468
4476
|
...typeof payload.toolId === "string" ? { toolId: payload.toolId } : {},
|
|
4469
4477
|
...parentToolIdOf(payload.parentToolId ?? message.parentToolId),
|
|
4470
4478
|
...payload.input !== void 0 ? { input: payload.input } : {},
|
|
@@ -5349,6 +5357,15 @@ var CoreAgentTaskSession = class {
|
|
|
5349
5357
|
case "user_input_request":
|
|
5350
5358
|
this.liveRequest(event, payload);
|
|
5351
5359
|
break;
|
|
5360
|
+
case "notification":
|
|
5361
|
+
this.liveRequest(event, payload);
|
|
5362
|
+
if (payload) {
|
|
5363
|
+
this.emit("notification", {
|
|
5364
|
+
...payload,
|
|
5365
|
+
...pieceIdentityOf(event, payload)
|
|
5366
|
+
});
|
|
5367
|
+
}
|
|
5368
|
+
break;
|
|
5352
5369
|
default:
|
|
5353
5370
|
break;
|
|
5354
5371
|
}
|
|
@@ -5460,6 +5477,7 @@ var CoreAgentTaskSession = class {
|
|
|
5460
5477
|
}
|
|
5461
5478
|
repeatsTheRunningTurn(event, lifecycle) {
|
|
5462
5479
|
if (this._status !== "streaming" && this._status !== "cancelled") return false;
|
|
5480
|
+
if (STATE_FRAME_TYPES.has(event.type)) return false;
|
|
5463
5481
|
const turnId = lifecycle?.turnId;
|
|
5464
5482
|
if (typeof turnId !== "string") return false;
|
|
5465
5483
|
if (typeof event.sequence === "number") {
|
|
@@ -5590,21 +5608,23 @@ var CoreAgentTaskSession = class {
|
|
|
5590
5608
|
// reaches the app as a `raw` event, as before.
|
|
5591
5609
|
liveRequest(event, payload, parentToolId) {
|
|
5592
5610
|
if (!payload) return;
|
|
5593
|
-
const kind = event.type === "approval" ? "approval" : "userInputRequest";
|
|
5611
|
+
const kind = event.type === "approval" ? "approval" : event.type === "notification" ? "notification" : "userInputRequest";
|
|
5594
5612
|
const itemId = typeof payload.itemId === "string" ? payload.itemId : void 0;
|
|
5595
5613
|
const sequence = typeof event.sequence === "number" ? event.sequence : void 0;
|
|
5596
5614
|
if (itemId === void 0 && sequence === void 0) return;
|
|
5597
5615
|
this.livePiece(
|
|
5598
5616
|
(item) => item.kind === kind && (itemId !== void 0 ? item.itemId === itemId : item.sequence === sequence),
|
|
5599
|
-
() =>
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5617
|
+
() => {
|
|
5618
|
+
const item = {
|
|
5619
|
+
id: `live:${kind}:${itemId ?? sequence}`,
|
|
5620
|
+
payload,
|
|
5621
|
+
at: liveAtOf(event),
|
|
5622
|
+
...sequence === void 0 ? {} : { sequence },
|
|
5623
|
+
...itemId === void 0 ? {} : { itemId },
|
|
5624
|
+
...parentToolIdOf(parentToolId)
|
|
5625
|
+
};
|
|
5626
|
+
return kind === "notification" ? { ...item, kind, ...notificationFieldsOf(payload) } : { ...item, kind };
|
|
5627
|
+
},
|
|
5608
5628
|
(item) => item
|
|
5609
5629
|
);
|
|
5610
5630
|
}
|