@mitralab.io/sdk-core 0.3.1 → 0.3.3
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 +40 -0
- package/README.md +3 -3
- package/contracts/README.md +9 -0
- package/contracts/manifest.json +11 -1
- package/contracts/v0.3.2/sdk-parity.json +2902 -0
- package/contracts/v0.3.3/sdk-parity.json +2902 -0
- package/dist/index.cjs +38 -12
- package/dist/index.d.cts +41 -4
- package/dist/index.d.ts +41 -4
- package/dist/index.js +38 -12
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4386,7 +4386,8 @@ function providerUsageOf(payload) {
|
|
|
4386
4386
|
if (!payload) return null;
|
|
4387
4387
|
try {
|
|
4388
4388
|
const { harness, observedAt, status, windows } = expectCredentialUsage(payload, "providerUsage");
|
|
4389
|
-
|
|
4389
|
+
const provider = typeof payload.provider === "string" && payload.provider ? payload.provider : null;
|
|
4390
|
+
return { harness, observedAt, status, windows, ...provider ? { provider } : {} };
|
|
4390
4391
|
} catch {
|
|
4391
4392
|
return null;
|
|
4392
4393
|
}
|
|
@@ -4451,6 +4452,7 @@ function sequenceOf(event) {
|
|
|
4451
4452
|
function toolEventOf(event, payload, phase) {
|
|
4452
4453
|
return {
|
|
4453
4454
|
tool: typeof payload?.name === "string" ? payload.name : "",
|
|
4455
|
+
...typeof payload?.title === "string" ? { title: payload.title } : {},
|
|
4454
4456
|
phase,
|
|
4455
4457
|
timestamp: event.timestamp,
|
|
4456
4458
|
...pieceIdentityOf(event, payload),
|
|
@@ -4493,7 +4495,8 @@ function isChatRow(message) {
|
|
|
4493
4495
|
}
|
|
4494
4496
|
var REQUEST_ROW_KINDS = {
|
|
4495
4497
|
APPROVAL: "approval",
|
|
4496
|
-
USER_INPUT_REQUEST: "userInputRequest"
|
|
4498
|
+
USER_INPUT_REQUEST: "userInputRequest",
|
|
4499
|
+
NOTIFICATION: "notification"
|
|
4497
4500
|
};
|
|
4498
4501
|
function parseJson(text) {
|
|
4499
4502
|
try {
|
|
@@ -4536,6 +4539,7 @@ function toAgentTimelineItem(message) {
|
|
|
4536
4539
|
kind: "tool",
|
|
4537
4540
|
tool: {
|
|
4538
4541
|
tool: typeof payload.name === "string" ? payload.name : "",
|
|
4542
|
+
...typeof payload.title === "string" ? { title: payload.title } : {},
|
|
4539
4543
|
...typeof payload.toolId === "string" ? { toolId: payload.toolId } : {},
|
|
4540
4544
|
...parentToolIdOf(payload.parentToolId ?? message.parentToolId),
|
|
4541
4545
|
...payload.input !== void 0 ? { input: payload.input } : {},
|
|
@@ -4930,19 +4934,19 @@ var CoreAgentTaskSession = class {
|
|
|
4930
4934
|
this.dispatch = dispatch;
|
|
4931
4935
|
}
|
|
4932
4936
|
async dispatchSend(prompt, options, clientMessageId, handedOver, waiter) {
|
|
4933
|
-
if (this.openingPromise && !await this.openingPromise) {
|
|
4937
|
+
if (this.openingPromise && !await this.openingPromise && !this.isClosed()) {
|
|
4934
4938
|
throw new Error("Agent task session could not be opened.");
|
|
4935
4939
|
}
|
|
4936
|
-
if (this.isClosed()) return false;
|
|
4940
|
+
if (this.isClosed() && !this._taskId) return false;
|
|
4937
4941
|
await this.ensureTask();
|
|
4938
4942
|
const input = messageInput(prompt, options);
|
|
4939
|
-
if (this.isClosed())
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
}
|
|
4943
|
-
|
|
4944
|
-
if (this.isClosed()) return false;
|
|
4943
|
+
if (this.isClosed()) return this.handOverAfterClose(input, clientMessageId, waiter);
|
|
4944
|
+
await this.ensureChannel().catch((error) => {
|
|
4945
|
+
if (!this.isClosed()) throw error;
|
|
4946
|
+
});
|
|
4947
|
+
if (this.isClosed()) return this.handOverAfterClose(input, clientMessageId, waiter);
|
|
4945
4948
|
await this.captureTurnBaseline();
|
|
4949
|
+
if (this.isClosed()) return this.handOverAfterClose(input, clientMessageId, waiter);
|
|
4946
4950
|
this._content = "";
|
|
4947
4951
|
this.recoveryUsed = false;
|
|
4948
4952
|
this.recoveredTerminalReason = void 0;
|
|
@@ -4960,6 +4964,17 @@ var CoreAgentTaskSession = class {
|
|
|
4960
4964
|
this.acceptOnce(clientMessageId);
|
|
4961
4965
|
return true;
|
|
4962
4966
|
}
|
|
4967
|
+
// A prompt whose task exists is never dropped by close; the task outlives the session. Apps
|
|
4968
|
+
// close the creating session inside taskCreated and reopen by task id, so the input still goes
|
|
4969
|
+
// out over REST. Only a prompt that never reached `handOver` comes here: the Copilot does not
|
|
4970
|
+
// dedupe POST /inputs by `clientMessageId`, and a second copy would run a second turn. No
|
|
4971
|
+
// channel, status, or event for a closed session, and a failure has no listener left to hear it.
|
|
4972
|
+
// `close()` rejects only the waiter of a turn already open; this one has none yet.
|
|
4973
|
+
async handOverAfterClose(input, clientMessageId, waiter) {
|
|
4974
|
+
await this.handOver(input, clientMessageId).catch(() => void 0);
|
|
4975
|
+
waiter?.reject(new Error("Agent task session is closed."));
|
|
4976
|
+
return false;
|
|
4977
|
+
}
|
|
4963
4978
|
// A message sent while a turn runs, or is being opened, goes out at once: the box takes it into
|
|
4964
4979
|
// that turn (the provider's own steering), queues it for a turn of its own, or gives it one when
|
|
4965
4980
|
// that turn already ended. Nothing waits in this session. On the direct channel it goes with an
|
|
@@ -5237,11 +5252,13 @@ var CoreAgentTaskSession = class {
|
|
|
5237
5252
|
}
|
|
5238
5253
|
const turnRunning = this._status === "streaming" || this._status === "cancelled";
|
|
5239
5254
|
const id = clientMessageId === void 0 ? {} : { clientMessageId };
|
|
5240
|
-
const
|
|
5255
|
+
const mode = input.type === "message" && input.mode ? { mode: input.mode } : {};
|
|
5256
|
+
const rest = input.type !== "message" ? input : steering && turnRunning ? { type: "message", content: input.content, ...mode, ...id } : {
|
|
5241
5257
|
type: "message",
|
|
5242
5258
|
content: input.content,
|
|
5243
5259
|
...input.agentType ? { agentType: input.agentType } : {},
|
|
5244
5260
|
...input.reasoningEffort ? { reasoningEffort: input.reasoningEffort } : {},
|
|
5261
|
+
...mode,
|
|
5245
5262
|
...id
|
|
5246
5263
|
};
|
|
5247
5264
|
await this.dependencies.tasks.sendInput(this._taskId, rest);
|
|
@@ -5407,6 +5424,15 @@ var CoreAgentTaskSession = class {
|
|
|
5407
5424
|
case "user_input_request":
|
|
5408
5425
|
this.liveRequest(event, payload);
|
|
5409
5426
|
break;
|
|
5427
|
+
case "notification":
|
|
5428
|
+
this.liveRequest(event, payload);
|
|
5429
|
+
if (payload) {
|
|
5430
|
+
this.emit("notification", {
|
|
5431
|
+
...payload,
|
|
5432
|
+
...pieceIdentityOf(event, payload)
|
|
5433
|
+
});
|
|
5434
|
+
}
|
|
5435
|
+
break;
|
|
5410
5436
|
default:
|
|
5411
5437
|
break;
|
|
5412
5438
|
}
|
|
@@ -5648,7 +5674,7 @@ var CoreAgentTaskSession = class {
|
|
|
5648
5674
|
// reaches the app as a `raw` event, as before.
|
|
5649
5675
|
liveRequest(event, payload, parentToolId) {
|
|
5650
5676
|
if (!payload) return;
|
|
5651
|
-
const kind = event.type === "approval" ? "approval" : "userInputRequest";
|
|
5677
|
+
const kind = event.type === "approval" ? "approval" : event.type === "notification" ? "notification" : "userInputRequest";
|
|
5652
5678
|
const itemId = typeof payload.itemId === "string" ? payload.itemId : void 0;
|
|
5653
5679
|
const sequence = typeof event.sequence === "number" ? event.sequence : void 0;
|
|
5654
5680
|
if (itemId === void 0 && sequence === void 0) return;
|
package/dist/index.d.cts
CHANGED
|
@@ -1101,8 +1101,8 @@ type AgentTaskInput = {
|
|
|
1101
1101
|
reasoningEffort?: string;
|
|
1102
1102
|
/**
|
|
1103
1103
|
* With a turn running, as T3's composer: `queue` puts the message in T3's queue behind it and
|
|
1104
|
-
* `steer` takes it into the running turn. A box given none lets T3 decide. The Copilot
|
|
1105
|
-
*
|
|
1104
|
+
* `steer` takes it into the running turn. A box given none lets T3 decide. The Copilot passes
|
|
1105
|
+
* it to the box and steers a message sent without one.
|
|
1106
1106
|
*/
|
|
1107
1107
|
mode?: "queue" | "steer";
|
|
1108
1108
|
/**
|
|
@@ -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;
|
|
@@ -2420,6 +2438,17 @@ type AgentTimelineItem = ({
|
|
|
2420
2438
|
payload: Record<string, unknown>;
|
|
2421
2439
|
at: string;
|
|
2422
2440
|
parentToolId?: string;
|
|
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): the box's `notification` frame as it came,
|
|
2446
|
+
* with `source`, `outcome`, `summary` and `detail`.
|
|
2447
|
+
*/
|
|
2448
|
+
kind: "notification";
|
|
2449
|
+
payload: Record<string, unknown>;
|
|
2450
|
+
at: string;
|
|
2451
|
+
parentToolId?: string;
|
|
2423
2452
|
} & AgentTimelineItemIdentity) | ({
|
|
2424
2453
|
id: string;
|
|
2425
2454
|
kind: "tool";
|
|
@@ -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.
|
|
@@ -2537,7 +2568,13 @@ interface AgentTaskSessionEventMap {
|
|
|
2537
2568
|
raw: AgentTaskEvent;
|
|
2538
2569
|
}
|
|
2539
2570
|
/** The same shape `agentCredentials.usage` answers with. */
|
|
2540
|
-
type AgentProviderUsage = CredentialUsage
|
|
2571
|
+
type AgentProviderUsage = CredentialUsage & {
|
|
2572
|
+
/**
|
|
2573
|
+
* The provider the reading is of, as `agentCredentials.providers()` names it in
|
|
2574
|
+
* `AgentReadyProvider.provider`. Absent from a box that does not send it.
|
|
2575
|
+
*/
|
|
2576
|
+
provider?: CopilotProvider;
|
|
2577
|
+
};
|
|
2541
2578
|
interface AgentTaskSession {
|
|
2542
2579
|
readonly taskId: string | null;
|
|
2543
2580
|
readonly task: AgentTask | null;
|
|
@@ -2672,4 +2709,4 @@ declare function expectPage<T extends object>(value: unknown, context: string, e
|
|
|
2672
2709
|
declare function expectLegacyPage<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory, validateItem?: (value: unknown, context: string, errors: SdkCoreErrorFactory) => T): LegacyPage<T>;
|
|
2673
2710
|
declare function expectEmpty(value: unknown, context: string, errors?: SdkCoreErrorFactory): void;
|
|
2674
2711
|
|
|
2675
|
-
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
|
@@ -1101,8 +1101,8 @@ type AgentTaskInput = {
|
|
|
1101
1101
|
reasoningEffort?: string;
|
|
1102
1102
|
/**
|
|
1103
1103
|
* With a turn running, as T3's composer: `queue` puts the message in T3's queue behind it and
|
|
1104
|
-
* `steer` takes it into the running turn. A box given none lets T3 decide. The Copilot
|
|
1105
|
-
*
|
|
1104
|
+
* `steer` takes it into the running turn. A box given none lets T3 decide. The Copilot passes
|
|
1105
|
+
* it to the box and steers a message sent without one.
|
|
1106
1106
|
*/
|
|
1107
1107
|
mode?: "queue" | "steer";
|
|
1108
1108
|
/**
|
|
@@ -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;
|
|
@@ -2420,6 +2438,17 @@ type AgentTimelineItem = ({
|
|
|
2420
2438
|
payload: Record<string, unknown>;
|
|
2421
2439
|
at: string;
|
|
2422
2440
|
parentToolId?: string;
|
|
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): the box's `notification` frame as it came,
|
|
2446
|
+
* with `source`, `outcome`, `summary` and `detail`.
|
|
2447
|
+
*/
|
|
2448
|
+
kind: "notification";
|
|
2449
|
+
payload: Record<string, unknown>;
|
|
2450
|
+
at: string;
|
|
2451
|
+
parentToolId?: string;
|
|
2423
2452
|
} & AgentTimelineItemIdentity) | ({
|
|
2424
2453
|
id: string;
|
|
2425
2454
|
kind: "tool";
|
|
@@ -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.
|
|
@@ -2537,7 +2568,13 @@ interface AgentTaskSessionEventMap {
|
|
|
2537
2568
|
raw: AgentTaskEvent;
|
|
2538
2569
|
}
|
|
2539
2570
|
/** The same shape `agentCredentials.usage` answers with. */
|
|
2540
|
-
type AgentProviderUsage = CredentialUsage
|
|
2571
|
+
type AgentProviderUsage = CredentialUsage & {
|
|
2572
|
+
/**
|
|
2573
|
+
* The provider the reading is of, as `agentCredentials.providers()` names it in
|
|
2574
|
+
* `AgentReadyProvider.provider`. Absent from a box that does not send it.
|
|
2575
|
+
*/
|
|
2576
|
+
provider?: CopilotProvider;
|
|
2577
|
+
};
|
|
2541
2578
|
interface AgentTaskSession {
|
|
2542
2579
|
readonly taskId: string | null;
|
|
2543
2580
|
readonly task: AgentTask | null;
|
|
@@ -2672,4 +2709,4 @@ declare function expectPage<T extends object>(value: unknown, context: string, e
|
|
|
2672
2709
|
declare function expectLegacyPage<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory, validateItem?: (value: unknown, context: string, errors: SdkCoreErrorFactory) => T): LegacyPage<T>;
|
|
2673
2710
|
declare function expectEmpty(value: unknown, context: string, errors?: SdkCoreErrorFactory): void;
|
|
2674
2711
|
|
|
2675
|
-
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
|
@@ -4314,7 +4314,8 @@ function providerUsageOf(payload) {
|
|
|
4314
4314
|
if (!payload) return null;
|
|
4315
4315
|
try {
|
|
4316
4316
|
const { harness, observedAt, status, windows } = expectCredentialUsage(payload, "providerUsage");
|
|
4317
|
-
|
|
4317
|
+
const provider = typeof payload.provider === "string" && payload.provider ? payload.provider : null;
|
|
4318
|
+
return { harness, observedAt, status, windows, ...provider ? { provider } : {} };
|
|
4318
4319
|
} catch {
|
|
4319
4320
|
return null;
|
|
4320
4321
|
}
|
|
@@ -4379,6 +4380,7 @@ function sequenceOf(event) {
|
|
|
4379
4380
|
function toolEventOf(event, payload, phase) {
|
|
4380
4381
|
return {
|
|
4381
4382
|
tool: typeof payload?.name === "string" ? payload.name : "",
|
|
4383
|
+
...typeof payload?.title === "string" ? { title: payload.title } : {},
|
|
4382
4384
|
phase,
|
|
4383
4385
|
timestamp: event.timestamp,
|
|
4384
4386
|
...pieceIdentityOf(event, payload),
|
|
@@ -4421,7 +4423,8 @@ function isChatRow(message) {
|
|
|
4421
4423
|
}
|
|
4422
4424
|
var REQUEST_ROW_KINDS = {
|
|
4423
4425
|
APPROVAL: "approval",
|
|
4424
|
-
USER_INPUT_REQUEST: "userInputRequest"
|
|
4426
|
+
USER_INPUT_REQUEST: "userInputRequest",
|
|
4427
|
+
NOTIFICATION: "notification"
|
|
4425
4428
|
};
|
|
4426
4429
|
function parseJson(text) {
|
|
4427
4430
|
try {
|
|
@@ -4464,6 +4467,7 @@ function toAgentTimelineItem(message) {
|
|
|
4464
4467
|
kind: "tool",
|
|
4465
4468
|
tool: {
|
|
4466
4469
|
tool: typeof payload.name === "string" ? payload.name : "",
|
|
4470
|
+
...typeof payload.title === "string" ? { title: payload.title } : {},
|
|
4467
4471
|
...typeof payload.toolId === "string" ? { toolId: payload.toolId } : {},
|
|
4468
4472
|
...parentToolIdOf(payload.parentToolId ?? message.parentToolId),
|
|
4469
4473
|
...payload.input !== void 0 ? { input: payload.input } : {},
|
|
@@ -4858,19 +4862,19 @@ var CoreAgentTaskSession = class {
|
|
|
4858
4862
|
this.dispatch = dispatch;
|
|
4859
4863
|
}
|
|
4860
4864
|
async dispatchSend(prompt, options, clientMessageId, handedOver, waiter) {
|
|
4861
|
-
if (this.openingPromise && !await this.openingPromise) {
|
|
4865
|
+
if (this.openingPromise && !await this.openingPromise && !this.isClosed()) {
|
|
4862
4866
|
throw new Error("Agent task session could not be opened.");
|
|
4863
4867
|
}
|
|
4864
|
-
if (this.isClosed()) return false;
|
|
4868
|
+
if (this.isClosed() && !this._taskId) return false;
|
|
4865
4869
|
await this.ensureTask();
|
|
4866
4870
|
const input = messageInput(prompt, options);
|
|
4867
|
-
if (this.isClosed())
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
}
|
|
4871
|
-
|
|
4872
|
-
if (this.isClosed()) return false;
|
|
4871
|
+
if (this.isClosed()) return this.handOverAfterClose(input, clientMessageId, waiter);
|
|
4872
|
+
await this.ensureChannel().catch((error) => {
|
|
4873
|
+
if (!this.isClosed()) throw error;
|
|
4874
|
+
});
|
|
4875
|
+
if (this.isClosed()) return this.handOverAfterClose(input, clientMessageId, waiter);
|
|
4873
4876
|
await this.captureTurnBaseline();
|
|
4877
|
+
if (this.isClosed()) return this.handOverAfterClose(input, clientMessageId, waiter);
|
|
4874
4878
|
this._content = "";
|
|
4875
4879
|
this.recoveryUsed = false;
|
|
4876
4880
|
this.recoveredTerminalReason = void 0;
|
|
@@ -4888,6 +4892,17 @@ var CoreAgentTaskSession = class {
|
|
|
4888
4892
|
this.acceptOnce(clientMessageId);
|
|
4889
4893
|
return true;
|
|
4890
4894
|
}
|
|
4895
|
+
// A prompt whose task exists is never dropped by close; the task outlives the session. Apps
|
|
4896
|
+
// close the creating session inside taskCreated and reopen by task id, so the input still goes
|
|
4897
|
+
// out over REST. Only a prompt that never reached `handOver` comes here: the Copilot does not
|
|
4898
|
+
// dedupe POST /inputs by `clientMessageId`, and a second copy would run a second turn. No
|
|
4899
|
+
// channel, status, or event for a closed session, and a failure has no listener left to hear it.
|
|
4900
|
+
// `close()` rejects only the waiter of a turn already open; this one has none yet.
|
|
4901
|
+
async handOverAfterClose(input, clientMessageId, waiter) {
|
|
4902
|
+
await this.handOver(input, clientMessageId).catch(() => void 0);
|
|
4903
|
+
waiter?.reject(new Error("Agent task session is closed."));
|
|
4904
|
+
return false;
|
|
4905
|
+
}
|
|
4891
4906
|
// A message sent while a turn runs, or is being opened, goes out at once: the box takes it into
|
|
4892
4907
|
// that turn (the provider's own steering), queues it for a turn of its own, or gives it one when
|
|
4893
4908
|
// that turn already ended. Nothing waits in this session. On the direct channel it goes with an
|
|
@@ -5165,11 +5180,13 @@ var CoreAgentTaskSession = class {
|
|
|
5165
5180
|
}
|
|
5166
5181
|
const turnRunning = this._status === "streaming" || this._status === "cancelled";
|
|
5167
5182
|
const id = clientMessageId === void 0 ? {} : { clientMessageId };
|
|
5168
|
-
const
|
|
5183
|
+
const mode = input.type === "message" && input.mode ? { mode: input.mode } : {};
|
|
5184
|
+
const rest = input.type !== "message" ? input : steering && turnRunning ? { type: "message", content: input.content, ...mode, ...id } : {
|
|
5169
5185
|
type: "message",
|
|
5170
5186
|
content: input.content,
|
|
5171
5187
|
...input.agentType ? { agentType: input.agentType } : {},
|
|
5172
5188
|
...input.reasoningEffort ? { reasoningEffort: input.reasoningEffort } : {},
|
|
5189
|
+
...mode,
|
|
5173
5190
|
...id
|
|
5174
5191
|
};
|
|
5175
5192
|
await this.dependencies.tasks.sendInput(this._taskId, rest);
|
|
@@ -5335,6 +5352,15 @@ var CoreAgentTaskSession = class {
|
|
|
5335
5352
|
case "user_input_request":
|
|
5336
5353
|
this.liveRequest(event, payload);
|
|
5337
5354
|
break;
|
|
5355
|
+
case "notification":
|
|
5356
|
+
this.liveRequest(event, payload);
|
|
5357
|
+
if (payload) {
|
|
5358
|
+
this.emit("notification", {
|
|
5359
|
+
...payload,
|
|
5360
|
+
...pieceIdentityOf(event, payload)
|
|
5361
|
+
});
|
|
5362
|
+
}
|
|
5363
|
+
break;
|
|
5338
5364
|
default:
|
|
5339
5365
|
break;
|
|
5340
5366
|
}
|
|
@@ -5576,7 +5602,7 @@ var CoreAgentTaskSession = class {
|
|
|
5576
5602
|
// reaches the app as a `raw` event, as before.
|
|
5577
5603
|
liveRequest(event, payload, parentToolId) {
|
|
5578
5604
|
if (!payload) return;
|
|
5579
|
-
const kind = event.type === "approval" ? "approval" : "userInputRequest";
|
|
5605
|
+
const kind = event.type === "approval" ? "approval" : event.type === "notification" ? "notification" : "userInputRequest";
|
|
5580
5606
|
const itemId = typeof payload.itemId === "string" ? payload.itemId : void 0;
|
|
5581
5607
|
const sequence = typeof event.sequence === "number" ? event.sequence : void 0;
|
|
5582
5608
|
if (itemId === void 0 && sequence === void 0) return;
|