@microsoft/copilot-sdk 1.0.29-unstable.42916223485.gfff36db → 2.0.0-preview.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -62
- package/dist/canvas.d.ts +4 -0
- package/dist/canvas.js +1 -0
- package/dist/cjs/canvas.js +1 -0
- package/dist/cjs/cliVersion.js +1 -1
- package/dist/cjs/client.js +294 -107
- package/dist/cjs/copilotRequestHandler.js +24 -1
- package/dist/cjs/extension.js +4 -1
- package/dist/cjs/generated/rpc.js +295 -16
- package/dist/cjs/index.js +12 -2
- package/dist/cjs/localModelJson.js +103 -0
- package/dist/cjs/providerConfiguration.js +39 -0
- package/dist/cjs/rpcCancellation.js +49 -0
- package/dist/cjs/session.js +155 -10
- package/dist/cjs/taskAnalyticsJson.js +47 -0
- package/dist/cjs/types.js +14 -3
- package/dist/cjs/workflow.js +145 -1
- package/dist/cliVersion.d.ts +1 -1
- package/dist/cliVersion.js +1 -1
- package/dist/client.d.ts +33 -14
- package/dist/client.js +294 -107
- package/dist/copilotRequestHandler.js +24 -1
- package/dist/extension.d.ts +12 -2
- package/dist/extension.js +4 -1
- package/dist/generated/lifecycle-diagnostics.d.ts +48 -40
- package/dist/generated/rpc.d.ts +3668 -500
- package/dist/generated/rpc.js +295 -16
- package/dist/generated/session-events.d.ts +358 -115
- package/dist/index.d.ts +9 -5
- package/dist/index.js +14 -2
- package/dist/localModelJson.d.ts +1 -0
- package/dist/localModelJson.js +69 -0
- package/dist/providerConfiguration.d.ts +3 -0
- package/dist/providerConfiguration.js +15 -0
- package/dist/rpcCancellation.d.ts +3 -0
- package/dist/rpcCancellation.js +25 -0
- package/dist/session.d.ts +64 -5
- package/dist/session.js +156 -10
- package/dist/taskAnalyticsJson.d.ts +8 -0
- package/dist/taskAnalyticsJson.js +12 -0
- package/dist/types.d.ts +223 -43
- package/dist/types.js +13 -3
- package/dist/workflow.d.ts +60 -14
- package/dist/workflow.js +143 -1
- package/docs/agent-author.md +11 -11
- package/docs/extensions.md +41 -2
- package/docs/workflows.md +52 -17
- package/package.json +16 -15
|
@@ -220,11 +220,25 @@ class CopilotRequestHandler {
|
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
+
const MAX_FINISHED_REQUEST_IDS = 256;
|
|
223
224
|
function createCopilotRequestAdapter(handler, getServerRpc) {
|
|
224
225
|
const pending = /* @__PURE__ */ new Map();
|
|
226
|
+
const finished = /* @__PURE__ */ new Set();
|
|
227
|
+
function rememberFinished(requestId) {
|
|
228
|
+
if (finished.has(requestId)) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
finished.add(requestId);
|
|
232
|
+
if (finished.size > MAX_FINISHED_REQUEST_IDS) {
|
|
233
|
+
finished.delete(finished.values().next().value);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
225
236
|
function getOrCreate(requestId) {
|
|
226
237
|
let exchange = pending.get(requestId);
|
|
227
238
|
if (!exchange) {
|
|
239
|
+
if (finished.has(requestId)) {
|
|
240
|
+
return void 0;
|
|
241
|
+
}
|
|
228
242
|
exchange = new CopilotRequestExchange(requestId, getServerRpc);
|
|
229
243
|
pending.set(requestId, exchange);
|
|
230
244
|
}
|
|
@@ -251,17 +265,26 @@ function createCopilotRequestAdapter(handler, getServerRpc) {
|
|
|
251
265
|
if (pending.get(exchange.requestId) === exchange) {
|
|
252
266
|
pending.delete(exchange.requestId);
|
|
253
267
|
}
|
|
268
|
+
rememberFinished(exchange.requestId);
|
|
254
269
|
}
|
|
255
270
|
}
|
|
256
271
|
return {
|
|
257
272
|
async httpRequestStart(params) {
|
|
258
273
|
const exchange = getOrCreate(params.requestId);
|
|
274
|
+
if (!exchange) {
|
|
275
|
+
throw new Error(
|
|
276
|
+
`llmInference.httpRequestStart for request "${params.requestId}", which already finished`
|
|
277
|
+
);
|
|
278
|
+
}
|
|
259
279
|
exchange.setContext(params);
|
|
260
280
|
void run(exchange);
|
|
261
281
|
return {};
|
|
262
282
|
},
|
|
263
283
|
async httpRequestChunk(params) {
|
|
264
|
-
|
|
284
|
+
const exchange = getOrCreate(params.requestId);
|
|
285
|
+
if (exchange) {
|
|
286
|
+
routeChunk(exchange, params);
|
|
287
|
+
}
|
|
265
288
|
return {};
|
|
266
289
|
},
|
|
267
290
|
cancelPending() {
|
package/dist/extension.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CopilotClient } from "./client.js";
|
|
1
2
|
import type { CopilotSession } from "./session.js";
|
|
2
3
|
import { type PermissionHandler, type ResumeSessionConfig } from "./types.js";
|
|
3
4
|
import type { WorkflowHandle } from "./workflow.js";
|
|
@@ -42,7 +43,16 @@ export type JoinSessionConfig = Omit<ResumeSessionConfig, "onPermissionRequest"
|
|
|
42
43
|
workflows?: WorkflowHandle[];
|
|
43
44
|
};
|
|
44
45
|
export type { ExtensionInfo } from "./types.js";
|
|
45
|
-
|
|
46
|
+
/** A joined session with HTTP transport owned by the extension's connection. */
|
|
47
|
+
export interface JoinedSession extends CopilotSession {
|
|
48
|
+
/**
|
|
49
|
+
* Create, send, read, and cancel HTTP requests through the shared runtime transport.
|
|
50
|
+
*
|
|
51
|
+
* @experimental These methods may change or be removed in future SDK or CLI releases.
|
|
52
|
+
*/
|
|
53
|
+
readonly fetch: CopilotClient["rpc"]["fetch"];
|
|
54
|
+
}
|
|
55
|
+
export { defineWorkflow, WorkflowResumeError, isWorkflowRunTerminal, type WorkflowRunOptions, type WorkflowResumeOptions, type WorkflowLimitOverrides, type WorkflowResumeErrorCode, type SessionWorkflowApi, type WorkflowAgentOptions, type WorkflowContext, type WorkflowDefinition, type WorkflowHandle, type WorkflowAgentReference, type JsonValue, type WorkflowJsonSchema, type WorkflowLimits, type WorkflowMeta, type WorkflowPipelineStage, type WorkflowStepOptions, type WorkflowRunResult, type WorkflowRunStatus, type WorkflowRunSummary, type WorkflowListRunsOptions, type WorkflowRunsPage, type WorkflowRunDetail, type WorkflowProgressPage, type WorkflowProgressLine, type WorkflowPhaseObservation, type WorkflowPhaseStatus, type WorkflowAgentContextObservation, type WorkflowAgentModelObservation, type WorkflowAgentReasoningEffortObservation, type WorkflowAgentSummary, } from "./workflow.js";
|
|
46
56
|
/**
|
|
47
57
|
* Joins the current foreground session.
|
|
48
58
|
*
|
|
@@ -56,4 +66,4 @@ export { defineWorkflow, WorkflowResumeError, isWorkflowRunTerminal, type Workfl
|
|
|
56
66
|
* const session = await joinSession({ tools: [myTool] });
|
|
57
67
|
* ```
|
|
58
68
|
*/
|
|
59
|
-
export declare function joinSession(config?: JoinSessionConfig): Promise<
|
|
69
|
+
export declare function joinSession(config?: JoinSessionConfig): Promise<JoinedSession>;
|
package/dist/extension.js
CHANGED
|
@@ -34,7 +34,7 @@ async function joinSession(config = {}) {
|
|
|
34
34
|
void _stripped;
|
|
35
35
|
void _strippedSkillProvider;
|
|
36
36
|
void _strippedImageGeneration;
|
|
37
|
-
|
|
37
|
+
const session = await client.resumeSessionForExtension(
|
|
38
38
|
sessionId,
|
|
39
39
|
{
|
|
40
40
|
...rest,
|
|
@@ -44,6 +44,9 @@ async function joinSession(config = {}) {
|
|
|
44
44
|
{ workflows },
|
|
45
45
|
requestedEnvironmentVariables?.length ? { requestedEnvironmentVariables } : void 0
|
|
46
46
|
);
|
|
47
|
+
return Object.defineProperty(session, "fetch", {
|
|
48
|
+
get: () => client.rpc.fetch
|
|
49
|
+
});
|
|
47
50
|
}
|
|
48
51
|
export {
|
|
49
52
|
Canvas,
|
|
@@ -58,6 +58,10 @@ export interface RuntimeLifecycleSystemStateData {
|
|
|
58
58
|
* Observed state of one readiness or convergence operation.
|
|
59
59
|
*/
|
|
60
60
|
export interface RuntimeLifecycleOperation {
|
|
61
|
+
/**
|
|
62
|
+
* Complete dependency blocker set after this operation change.
|
|
63
|
+
*/
|
|
64
|
+
blockers: RuntimeLifecycleBlocker[];
|
|
61
65
|
disposition?: RuntimeLifecycleDisposition;
|
|
62
66
|
/**
|
|
63
67
|
* Opaque operation identifier, unique within the lifecycle incarnation and system.
|
|
@@ -81,6 +85,50 @@ export interface RuntimeLifecycleOperation {
|
|
|
81
85
|
*/
|
|
82
86
|
trigger: string;
|
|
83
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Exact lifecycle operation awaited by a real dependency wait.
|
|
90
|
+
*/
|
|
91
|
+
export interface RuntimeLifecycleBlocker {
|
|
92
|
+
/**
|
|
93
|
+
* Opaque blocker identifier, stable for one guard lifetime and scoped to its owner.
|
|
94
|
+
*/
|
|
95
|
+
blockerId: string;
|
|
96
|
+
/**
|
|
97
|
+
* Current phase of the awaited operation.
|
|
98
|
+
*/
|
|
99
|
+
currentPhase: string;
|
|
100
|
+
/**
|
|
101
|
+
* Current production boundary of the awaited operation.
|
|
102
|
+
*/
|
|
103
|
+
currentStep: string;
|
|
104
|
+
operationDisposition?: RuntimeLifecycleDisposition;
|
|
105
|
+
/**
|
|
106
|
+
* Opaque awaited operation identifier.
|
|
107
|
+
*/
|
|
108
|
+
operationId: string;
|
|
109
|
+
/**
|
|
110
|
+
* Awaited operation revision observed by this blocker.
|
|
111
|
+
*/
|
|
112
|
+
operationRevision: number;
|
|
113
|
+
/**
|
|
114
|
+
* System-owned capability required by the blocker owner.
|
|
115
|
+
*/
|
|
116
|
+
requirement: string;
|
|
117
|
+
/**
|
|
118
|
+
* System that owns the awaited operation.
|
|
119
|
+
*/
|
|
120
|
+
system: string;
|
|
121
|
+
timing: RuntimeLifecycleBlockerTiming;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Timing of one real dependency wait.
|
|
125
|
+
*/
|
|
126
|
+
export interface RuntimeLifecycleBlockerTiming {
|
|
127
|
+
/**
|
|
128
|
+
* ISO 8601 timestamp when this dependency began blocking its owner.
|
|
129
|
+
*/
|
|
130
|
+
blockingSince: string;
|
|
131
|
+
}
|
|
84
132
|
/**
|
|
85
133
|
* Fixed timestamps for one observed operation revision.
|
|
86
134
|
*/
|
|
@@ -152,46 +200,6 @@ export interface RuntimeLifecycleProgressStateData {
|
|
|
152
200
|
sessionId: string;
|
|
153
201
|
timing: RuntimeLifecycleProgressTiming;
|
|
154
202
|
}
|
|
155
|
-
/**
|
|
156
|
-
* Exact lifecycle operation awaited by a real dependency wait.
|
|
157
|
-
*/
|
|
158
|
-
export interface RuntimeLifecycleBlocker {
|
|
159
|
-
/**
|
|
160
|
-
* Current phase of the awaited operation.
|
|
161
|
-
*/
|
|
162
|
-
currentPhase: string;
|
|
163
|
-
/**
|
|
164
|
-
* Current production boundary of the awaited operation.
|
|
165
|
-
*/
|
|
166
|
-
currentStep: string;
|
|
167
|
-
operationDisposition?: RuntimeLifecycleDisposition;
|
|
168
|
-
/**
|
|
169
|
-
* Opaque awaited operation identifier.
|
|
170
|
-
*/
|
|
171
|
-
operationId: string;
|
|
172
|
-
/**
|
|
173
|
-
* Awaited operation revision observed by this blocker.
|
|
174
|
-
*/
|
|
175
|
-
operationRevision: number;
|
|
176
|
-
/**
|
|
177
|
-
* System-owned capability required by the progress owner.
|
|
178
|
-
*/
|
|
179
|
-
requirement: string;
|
|
180
|
-
/**
|
|
181
|
-
* System that owns the awaited operation.
|
|
182
|
-
*/
|
|
183
|
-
system: string;
|
|
184
|
-
timing: RuntimeLifecycleBlockerTiming;
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Timing of one real dependency wait.
|
|
188
|
-
*/
|
|
189
|
-
export interface RuntimeLifecycleBlockerTiming {
|
|
190
|
-
/**
|
|
191
|
-
* ISO 8601 timestamp when this dependency began blocking progress.
|
|
192
|
-
*/
|
|
193
|
-
blockingSince: string;
|
|
194
|
-
}
|
|
195
203
|
/**
|
|
196
204
|
* Immutable causal origin of a progress record with independent identity and settlement.
|
|
197
205
|
*/
|