@microsoft/copilot-sdk 0.0.0-stage → 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 +2531 -2
- package/dist/canvas.d.ts +135 -0
- package/dist/canvas.js +51 -0
- package/dist/cjs/canvas.js +77 -0
- package/dist/cjs/cliVersion.js +31 -0
- package/dist/cjs/client.js +3941 -0
- package/dist/cjs/copilotRequestHandler.js +815 -0
- package/dist/cjs/decisions.js +139 -0
- package/dist/cjs/entra.js +83 -0
- package/dist/cjs/extension.js +79 -0
- package/dist/cjs/ffiRuntimeHost.js +400 -0
- package/dist/cjs/generated/lifecycle-diagnostics.js +16 -0
- package/dist/cjs/generated/rpc.js +5883 -0
- package/dist/cjs/generated/session-events.js +16 -0
- package/dist/cjs/host.js +83 -0
- package/dist/cjs/index.js +100 -0
- package/dist/cjs/installationConfirmation.js +98 -0
- package/dist/cjs/jsonrpcTypes.js +41 -0
- package/dist/cjs/localModelJson.js +103 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/providerConfiguration.js +39 -0
- package/dist/cjs/rpcCancellation.js +49 -0
- package/dist/cjs/runtimeArtifacts.js +255 -0
- package/dist/cjs/schema.js +40 -0
- package/dist/cjs/sdkProtocolVersion.js +33 -0
- package/dist/cjs/session.js +2764 -0
- package/dist/cjs/sessionFsProvider.js +283 -0
- package/dist/cjs/taskAnalyticsJson.js +47 -0
- package/dist/cjs/telemetry.js +35 -0
- package/dist/cjs/toolSet.js +107 -0
- package/dist/cjs/types.js +204 -0
- package/dist/cjs/workflow.js +278 -0
- package/dist/cliVersion.d.ts +2 -0
- package/dist/cliVersion.js +6 -0
- package/dist/client.d.ts +576 -0
- package/dist/client.js +3924 -0
- package/dist/copilotRequestHandler.d.ts +91 -0
- package/dist/copilotRequestHandler.js +787 -0
- package/dist/decisions.d.ts +65 -0
- package/dist/decisions.js +113 -0
- package/dist/entra.d.ts +3 -0
- package/dist/entra.js +59 -0
- package/dist/extension.d.ts +69 -0
- package/dist/extension.js +59 -0
- package/dist/ffiRuntimeHost.d.ts +44 -0
- package/dist/ffiRuntimeHost.js +366 -0
- package/dist/generated/lifecycle-diagnostics.d.ts +232 -0
- package/dist/generated/lifecycle-diagnostics.js +0 -0
- package/dist/generated/rpc.d.ts +47706 -0
- package/dist/generated/rpc.js +5854 -0
- package/dist/generated/session-events.d.ts +17349 -0
- package/dist/generated/session-events.js +0 -0
- package/dist/host.d.ts +143 -0
- package/dist/host.js +59 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +74 -0
- package/dist/installationConfirmation.d.ts +19 -0
- package/dist/installationConfirmation.js +74 -0
- package/dist/jsonrpcTypes.d.ts +16 -0
- package/dist/jsonrpcTypes.js +17 -0
- 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/runtimeArtifacts.d.ts +18 -0
- package/dist/runtimeArtifacts.js +233 -0
- package/dist/schema.d.ts +4 -0
- package/dist/schema.js +14 -0
- package/dist/sdkProtocolVersion.d.ts +10 -0
- package/dist/sdkProtocolVersion.js +8 -0
- package/dist/session.d.ts +524 -0
- package/dist/session.js +2751 -0
- package/dist/sessionFsProvider.d.ts +130 -0
- package/dist/sessionFsProvider.js +257 -0
- package/dist/taskAnalyticsJson.d.ts +8 -0
- package/dist/taskAnalyticsJson.js +12 -0
- package/dist/telemetry.d.ts +14 -0
- package/dist/telemetry.js +11 -0
- package/dist/toolSet.d.ts +75 -0
- package/dist/toolSet.js +82 -0
- package/dist/types.d.ts +3864 -0
- package/dist/types.js +169 -0
- package/dist/workflow.d.ts +413 -0
- package/dist/workflow.js +248 -0
- package/docs/agent-author.md +372 -0
- package/docs/examples.md +747 -0
- package/docs/extensions.md +121 -0
- package/docs/workflows.md +303 -0
- package/package.json +135 -5
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var session_events_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(session_events_exports);
|
package/dist/cjs/host.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var host_exports = {};
|
|
20
|
+
__export(host_exports, {
|
|
21
|
+
AhpHost: () => AhpHost
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(host_exports);
|
|
24
|
+
class AhpHost {
|
|
25
|
+
/** @internal */
|
|
26
|
+
constructor(info, disposeHost, publishHostSession, listHostSessions, unpublishHostSession, updateCreationPolicy) {
|
|
27
|
+
this.disposeHost = disposeHost;
|
|
28
|
+
this.publishHostSession = publishHostSession;
|
|
29
|
+
this.listHostSessions = listHostSessions;
|
|
30
|
+
this.unpublishHostSession = unpublishHostSession;
|
|
31
|
+
this.updateCreationPolicy = updateCreationPolicy;
|
|
32
|
+
this.hostId = info.hostId;
|
|
33
|
+
this.url = info.url;
|
|
34
|
+
this.environmentId = info.environmentId;
|
|
35
|
+
this.token = info.token;
|
|
36
|
+
this.pid = info.pid;
|
|
37
|
+
}
|
|
38
|
+
disposeHost;
|
|
39
|
+
publishHostSession;
|
|
40
|
+
listHostSessions;
|
|
41
|
+
unpublishHostSession;
|
|
42
|
+
updateCreationPolicy;
|
|
43
|
+
hostId;
|
|
44
|
+
/** Local WebSocket URL. Absent when only the GitHub environment is enabled. */
|
|
45
|
+
url;
|
|
46
|
+
/** Mission Control environment ID, when GitHub hosting is enabled. */
|
|
47
|
+
environmentId;
|
|
48
|
+
/** Connection token, when required by the listener. Treat this value as a secret. */
|
|
49
|
+
token;
|
|
50
|
+
/** Legacy separate host process ID. Absent for in-process listeners; use dispose() to stop. */
|
|
51
|
+
pid;
|
|
52
|
+
/** Ask the runtime to stop the listener and await its cleanup, on every call. */
|
|
53
|
+
dispose() {
|
|
54
|
+
return this.disposeHost();
|
|
55
|
+
}
|
|
56
|
+
/** Change subsequent remote admissions without disconnecting clients; admitted creation may finish. */
|
|
57
|
+
setAllowCreatingNewSessions(allowed) {
|
|
58
|
+
return this.updateCreationPolicy(allowed);
|
|
59
|
+
}
|
|
60
|
+
/** Publish an attached application session into the durable compute-scoped host catalog. */
|
|
61
|
+
publishSession(sessionId) {
|
|
62
|
+
return this.publishHostSession(sessionId);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Withdraw a live or dormant application publication and revoke AHP attachments.
|
|
66
|
+
* Preserves local history, worktrees and ongoing work; returns false when already absent.
|
|
67
|
+
* Rejects nonapplication publications. Does not stop the host.
|
|
68
|
+
*/
|
|
69
|
+
unpublishSession(sessionId) {
|
|
70
|
+
return this.unpublishHostSession(sessionId);
|
|
71
|
+
}
|
|
72
|
+
/** List all live and dormant catalog sessions advertised by this host. */
|
|
73
|
+
listSessions() {
|
|
74
|
+
return this.listHostSessions();
|
|
75
|
+
}
|
|
76
|
+
async [Symbol.asyncDispose]() {
|
|
77
|
+
await this.dispose();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
81
|
+
0 && (module.exports = {
|
|
82
|
+
AhpHost
|
|
83
|
+
});
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var index_exports = {};
|
|
20
|
+
__export(index_exports, {
|
|
21
|
+
AhpHost: () => import_host.AhpHost,
|
|
22
|
+
BuiltInTools: () => import_toolSet.BuiltInTools,
|
|
23
|
+
Canvas: () => import_canvas.Canvas,
|
|
24
|
+
CanvasError: () => import_canvas.CanvasError,
|
|
25
|
+
CopilotClient: () => import_client.CopilotClient,
|
|
26
|
+
CopilotDecisions: () => import_decisions.CopilotDecisions,
|
|
27
|
+
CopilotRequestHandler: () => import_types2.CopilotRequestHandler,
|
|
28
|
+
CopilotSession: () => import_session.CopilotSession,
|
|
29
|
+
CopilotWebSocketCloseStatus: () => import_types2.CopilotWebSocketCloseStatus,
|
|
30
|
+
CopilotWebSocketForwarder: () => import_types2.CopilotWebSocketForwarder,
|
|
31
|
+
CopilotWebSocketHandler: () => import_types2.CopilotWebSocketHandler,
|
|
32
|
+
DisableBypassPermissionsModes: () => import_types.DisableBypassPermissionsModes,
|
|
33
|
+
RuntimeConnection: () => import_types.RuntimeConnection,
|
|
34
|
+
SYSTEM_MESSAGE_SECTIONS: () => import_types2.SYSTEM_MESSAGE_SECTIONS,
|
|
35
|
+
SessionFsSqliteTransactionFailure: () => import_types2.SessionFsSqliteTransactionFailure,
|
|
36
|
+
SessionFsWriteFailure: () => import_types2.SessionFsWriteFailure,
|
|
37
|
+
ToolSet: () => import_toolSet.ToolSet,
|
|
38
|
+
WORKFLOW_AGENT_OPTION_KEYS: () => import_workflow.WORKFLOW_AGENT_OPTION_KEYS,
|
|
39
|
+
WorkflowResumeError: () => import_workflow.WorkflowResumeError,
|
|
40
|
+
approveAll: () => import_types2.approveAll,
|
|
41
|
+
convertMcpCallToolResult: () => import_types2.convertMcpCallToolResult,
|
|
42
|
+
createAttributedPermissionResult: () => import_types2.createAttributedPermissionResult,
|
|
43
|
+
createAttributedResult: () => import_types2.createAttributedResult,
|
|
44
|
+
createCanvas: () => import_canvas.createCanvas,
|
|
45
|
+
createSessionFsAdapter: () => import_types2.createSessionFsAdapter,
|
|
46
|
+
decisionErrorData: () => import_decisions.decisionErrorData,
|
|
47
|
+
decisionErrorKind: () => import_decisions.decisionErrorKind,
|
|
48
|
+
defineTool: () => import_types2.defineTool,
|
|
49
|
+
defineWorkflow: () => import_workflow.defineWorkflow,
|
|
50
|
+
isWorkflowRunTerminal: () => import_workflow.isWorkflowRunTerminal,
|
|
51
|
+
parseTrajectoryJson: () => import_taskAnalyticsJson.parseTrajectoryJson,
|
|
52
|
+
toSavedProviderConfiguration: () => import_providerConfiguration.toSavedProviderConfiguration
|
|
53
|
+
});
|
|
54
|
+
module.exports = __toCommonJS(index_exports);
|
|
55
|
+
var import_client = require("./client.js");
|
|
56
|
+
var import_taskAnalyticsJson = require("./taskAnalyticsJson.js");
|
|
57
|
+
var import_providerConfiguration = require("./providerConfiguration.js");
|
|
58
|
+
var import_decisions = require("./decisions.js");
|
|
59
|
+
var import_host = require("./host.js");
|
|
60
|
+
var import_types = require("./types.js");
|
|
61
|
+
var import_toolSet = require("./toolSet.js");
|
|
62
|
+
var import_session = require("./session.js");
|
|
63
|
+
var import_workflow = require("./workflow.js");
|
|
64
|
+
var import_canvas = require("./canvas.js");
|
|
65
|
+
var import_types2 = require("./types.js");
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
AhpHost,
|
|
69
|
+
BuiltInTools,
|
|
70
|
+
Canvas,
|
|
71
|
+
CanvasError,
|
|
72
|
+
CopilotClient,
|
|
73
|
+
CopilotDecisions,
|
|
74
|
+
CopilotRequestHandler,
|
|
75
|
+
CopilotSession,
|
|
76
|
+
CopilotWebSocketCloseStatus,
|
|
77
|
+
CopilotWebSocketForwarder,
|
|
78
|
+
CopilotWebSocketHandler,
|
|
79
|
+
DisableBypassPermissionsModes,
|
|
80
|
+
RuntimeConnection,
|
|
81
|
+
SYSTEM_MESSAGE_SECTIONS,
|
|
82
|
+
SessionFsSqliteTransactionFailure,
|
|
83
|
+
SessionFsWriteFailure,
|
|
84
|
+
ToolSet,
|
|
85
|
+
WORKFLOW_AGENT_OPTION_KEYS,
|
|
86
|
+
WorkflowResumeError,
|
|
87
|
+
approveAll,
|
|
88
|
+
convertMcpCallToolResult,
|
|
89
|
+
createAttributedPermissionResult,
|
|
90
|
+
createAttributedResult,
|
|
91
|
+
createCanvas,
|
|
92
|
+
createSessionFsAdapter,
|
|
93
|
+
decisionErrorData,
|
|
94
|
+
decisionErrorKind,
|
|
95
|
+
defineTool,
|
|
96
|
+
defineWorkflow,
|
|
97
|
+
isWorkflowRunTerminal,
|
|
98
|
+
parseTrajectoryJson,
|
|
99
|
+
toSavedProviderConfiguration
|
|
100
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var installationConfirmation_exports = {};
|
|
20
|
+
__export(installationConfirmation_exports, {
|
|
21
|
+
createInstallationConfirmationAdapter: () => createInstallationConfirmationAdapter
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(installationConfirmation_exports);
|
|
24
|
+
var import_node = require("vscode-jsonrpc/node");
|
|
25
|
+
function createInstallationConfirmationAdapter(connection, handler) {
|
|
26
|
+
const closed = new import_node.CancellationTokenSource();
|
|
27
|
+
const closeSubscription = connection.onClose(() => closed.cancel());
|
|
28
|
+
const disposeSubscription = connection.onDispose(() => {
|
|
29
|
+
closed.cancel();
|
|
30
|
+
closed.dispose();
|
|
31
|
+
closeSubscription.dispose();
|
|
32
|
+
disposeSubscription.dispose();
|
|
33
|
+
});
|
|
34
|
+
return {
|
|
35
|
+
async confirm(request, token) {
|
|
36
|
+
if (!token) {
|
|
37
|
+
throw new Error("Installation confirmation request cancellation is unavailable");
|
|
38
|
+
}
|
|
39
|
+
const { confirmationId, reviewFingerprint } = request;
|
|
40
|
+
const combined = new import_node.CancellationTokenSource();
|
|
41
|
+
const subscriptions = [];
|
|
42
|
+
const cancelRequest = () => combined.cancel();
|
|
43
|
+
const cancelConnection = () => combined.cancel();
|
|
44
|
+
const checkCancellation = () => {
|
|
45
|
+
if (closed.token.isCancellationRequested) {
|
|
46
|
+
throw new Error("Installation confirmation connection closed");
|
|
47
|
+
}
|
|
48
|
+
if (token.isCancellationRequested) {
|
|
49
|
+
throw new import_node.ResponseError(-32800, "Installation confirmation request cancelled");
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
try {
|
|
53
|
+
subscriptions.push(
|
|
54
|
+
token.onCancellationRequested(cancelRequest),
|
|
55
|
+
closed.token.onCancellationRequested(cancelConnection)
|
|
56
|
+
);
|
|
57
|
+
if (token.isCancellationRequested || closed.token.isCancellationRequested) {
|
|
58
|
+
combined.cancel();
|
|
59
|
+
}
|
|
60
|
+
checkCancellation();
|
|
61
|
+
const cancelled = new Promise((_resolve, reject) => {
|
|
62
|
+
subscriptions.push(
|
|
63
|
+
token.onCancellationRequested(
|
|
64
|
+
() => reject(
|
|
65
|
+
new import_node.ResponseError(
|
|
66
|
+
-32800,
|
|
67
|
+
"Installation confirmation request cancelled"
|
|
68
|
+
)
|
|
69
|
+
)
|
|
70
|
+
),
|
|
71
|
+
closed.token.onCancellationRequested(
|
|
72
|
+
() => reject(new Error("Installation confirmation connection closed"))
|
|
73
|
+
)
|
|
74
|
+
);
|
|
75
|
+
});
|
|
76
|
+
const decision = await Promise.race([
|
|
77
|
+
Promise.resolve().then(() => {
|
|
78
|
+
checkCancellation();
|
|
79
|
+
return handler(request, combined.token);
|
|
80
|
+
}),
|
|
81
|
+
cancelled
|
|
82
|
+
]);
|
|
83
|
+
checkCancellation();
|
|
84
|
+
if (decision !== "confirm" && decision !== "decline" && decision !== "cancel") {
|
|
85
|
+
throw new Error("Invalid installation confirmation decision");
|
|
86
|
+
}
|
|
87
|
+
return { confirmationId, reviewFingerprint, decision };
|
|
88
|
+
} finally {
|
|
89
|
+
for (const subscription of subscriptions) subscription.dispose();
|
|
90
|
+
combined.dispose();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
96
|
+
0 && (module.exports = {
|
|
97
|
+
createInstallationConfirmationAdapter
|
|
98
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var jsonrpcTypes_exports = {};
|
|
20
|
+
__export(jsonrpcTypes_exports, {
|
|
21
|
+
sendRequestWithSignal: () => sendRequestWithSignal
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(jsonrpcTypes_exports);
|
|
24
|
+
var import_node = require("vscode-jsonrpc/node");
|
|
25
|
+
async function sendRequestWithSignal(connection, method, params, signal) {
|
|
26
|
+
if (!signal) return connection.sendRequest(method, params);
|
|
27
|
+
signal.throwIfAborted();
|
|
28
|
+
const cancellation = new import_node.CancellationTokenSource();
|
|
29
|
+
const abort = () => cancellation.cancel();
|
|
30
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
31
|
+
try {
|
|
32
|
+
return await connection.sendRequest(method, params, cancellation.token);
|
|
33
|
+
} finally {
|
|
34
|
+
signal.removeEventListener("abort", abort);
|
|
35
|
+
cancellation.dispose();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
sendRequestWithSignal
|
|
41
|
+
});
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var localModelJson_exports = {};
|
|
30
|
+
__export(localModelJson_exports, {
|
|
31
|
+
createLocalModelJsonCodec: () => createLocalModelJsonCodec
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(localModelJson_exports);
|
|
34
|
+
var import_node = require("vscode-jsonrpc/node");
|
|
35
|
+
var import_taskAnalyticsJson = require("./taskAnalyticsJson.js");
|
|
36
|
+
function createLocalModelJsonCodec() {
|
|
37
|
+
const pending = /* @__PURE__ */ new Map();
|
|
38
|
+
const snapshots = /* @__PURE__ */ new Set([
|
|
39
|
+
"localModels.configure",
|
|
40
|
+
"localModels.inspect",
|
|
41
|
+
"localModels.watch"
|
|
42
|
+
]);
|
|
43
|
+
const modelRequests = /* @__PURE__ */ new Set([
|
|
44
|
+
"localModels.prepare",
|
|
45
|
+
"localModels.setup",
|
|
46
|
+
"localModels.deleteModel"
|
|
47
|
+
]);
|
|
48
|
+
return {
|
|
49
|
+
async encode(message) {
|
|
50
|
+
const method = import_node.Message.isRequest(message) ? message.method : void 0;
|
|
51
|
+
const rawHistory = method === "session.getMessages" && message.params?.[import_taskAnalyticsJson.rawHistoryResponse];
|
|
52
|
+
const analytics = method === "taskAnalytics.classifyTrajectory";
|
|
53
|
+
const json = method && (snapshots.has(method) || modelRequests.has(method) || rawHistory || analytics) ? await import("lossless-json") : void 0;
|
|
54
|
+
const text = method && (modelRequests.has(method) || analytics) && json ? json.stringify(
|
|
55
|
+
message,
|
|
56
|
+
analytics ? (_key, value) => {
|
|
57
|
+
const nativeJson = JSON;
|
|
58
|
+
return nativeJson.isRawJSON?.(value) ? json.parse(JSON.stringify(value)) : value;
|
|
59
|
+
} : void 0
|
|
60
|
+
) : JSON.stringify(message);
|
|
61
|
+
if (import_node.Message.isRequest(message) && json && (snapshots.has(message.method) || message.method === "localModels.prepare" || rawHistory)) {
|
|
62
|
+
pending.set(message.id, { method: message.method, json });
|
|
63
|
+
}
|
|
64
|
+
return text;
|
|
65
|
+
},
|
|
66
|
+
async decode(text) {
|
|
67
|
+
const message = JSON.parse(text);
|
|
68
|
+
if (!import_node.Message.isResponse(message)) return message;
|
|
69
|
+
const request = pending.get(message.id);
|
|
70
|
+
pending.delete(message.id);
|
|
71
|
+
if (!request || !("result" in message)) return message;
|
|
72
|
+
if (request.method === "session.getMessages") {
|
|
73
|
+
return await (0, import_taskAnalyticsJson.parseTrajectoryJson)(text);
|
|
74
|
+
}
|
|
75
|
+
const {
|
|
76
|
+
method,
|
|
77
|
+
json: { parse, parseNumberAndBigInt }
|
|
78
|
+
} = request;
|
|
79
|
+
const precise = parse(text, void 0, (token) => {
|
|
80
|
+
const value = parseNumberAndBigInt(token);
|
|
81
|
+
return typeof value === "bigint" && Number.isSafeInteger(Number(value)) ? Number(value) : value;
|
|
82
|
+
});
|
|
83
|
+
if (method === "localModels.prepare") {
|
|
84
|
+
const result = message.result;
|
|
85
|
+
const source = precise.result;
|
|
86
|
+
result.metadata = source.metadata;
|
|
87
|
+
result.serveOptions = source.serveOptions;
|
|
88
|
+
} else {
|
|
89
|
+
const result = message.result;
|
|
90
|
+
const source = precise.result;
|
|
91
|
+
for (const [index, row] of result.state.machine.rows.entries()) {
|
|
92
|
+
row.descriptor.metadata = source.state.machine.rows[index].descriptor.metadata;
|
|
93
|
+
row.descriptor.serveOptions = source.state.machine.rows[index].descriptor.serveOptions;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return message;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
101
|
+
0 && (module.exports = {
|
|
102
|
+
createLocalModelJsonCodec
|
|
103
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var providerConfiguration_exports = {};
|
|
20
|
+
__export(providerConfiguration_exports, {
|
|
21
|
+
toSavedProviderConfiguration: () => toSavedProviderConfiguration
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(providerConfiguration_exports);
|
|
24
|
+
function toSavedProviderConfiguration(provider) {
|
|
25
|
+
return {
|
|
26
|
+
name: provider.name,
|
|
27
|
+
type: provider.type,
|
|
28
|
+
wireApi: provider.wireApi,
|
|
29
|
+
transport: provider.transport,
|
|
30
|
+
baseUrl: provider.baseUrl,
|
|
31
|
+
localModel: provider.localModel,
|
|
32
|
+
azure: provider.azure,
|
|
33
|
+
modelProvider: provider.modelProvider
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
toSavedProviderConfiguration
|
|
39
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var rpcCancellation_exports = {};
|
|
20
|
+
__export(rpcCancellation_exports, {
|
|
21
|
+
sendCancellableRequest: () => sendCancellableRequest
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(rpcCancellation_exports);
|
|
24
|
+
var import_node = require("vscode-jsonrpc/node");
|
|
25
|
+
async function sendCancellableRequest(connection, method, params, signal, rejectOnAbort = false) {
|
|
26
|
+
signal?.throwIfAborted();
|
|
27
|
+
if (!signal) return connection.sendRequest(method, params);
|
|
28
|
+
const cancellation = new import_node.CancellationTokenSource();
|
|
29
|
+
let rejectAbort;
|
|
30
|
+
const aborted = rejectOnAbort ? new Promise((_, reject) => {
|
|
31
|
+
rejectAbort = reject;
|
|
32
|
+
}) : void 0;
|
|
33
|
+
const abort = () => {
|
|
34
|
+
cancellation.cancel();
|
|
35
|
+
rejectAbort?.(signal.reason);
|
|
36
|
+
};
|
|
37
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
38
|
+
try {
|
|
39
|
+
const request = connection.sendRequest(method, params, cancellation.token);
|
|
40
|
+
return await (aborted ? Promise.race([request, aborted]) : request);
|
|
41
|
+
} finally {
|
|
42
|
+
signal.removeEventListener("abort", abort);
|
|
43
|
+
cancellation.dispose();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
+
0 && (module.exports = {
|
|
48
|
+
sendCancellableRequest
|
|
49
|
+
});
|