@abelxiaoxing/cadence 2.0.12 → 2.0.14
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 +141 -54
- package/THIRD_PARTY_NOTICES.md +1 -0
- package/docs/remote-access.md +13 -0
- package/docs/reuse-and-distribution.md +13 -2
- package/docs/service-management.md +31 -12
- package/licenses/pi-web-ui-reuse.md +2 -0
- package/package.json +5 -2
- package/src/conversation-context.mjs +147 -0
- package/src/conversation-resources.mjs +47 -0
- package/src/native-build.ts +1 -1
- package/src/native-client.ts +2 -2
- package/src/operator-cli.mjs +4 -7
- package/src/sdk-worker.mjs +41 -8
- package/src/service/contracts/workbench.ts +303 -0
- package/src/service/coordination.ts +1 -0
- package/src/service-cli.mjs +1227 -577
- package/src/service-client.ts +49 -0
- package/src/service-host.mjs +15768 -13011
- package/src/service-http-client.ts +50 -24
- package/src/service-wire.ts +26 -4
- package/src/task-store.ts +12 -11
- package/web/dist/assets/cadence.css +1 -1
- package/web/dist/assets/cadence.js +13 -7
- package/web/dist/manifest.json +7 -7
package/src/service-client.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
decodeWorkbenchCommand,
|
|
3
|
+
decodeWorkbenchRead,
|
|
4
|
+
decodeWorkbenchResult,
|
|
5
|
+
type WorkbenchCommand,
|
|
6
|
+
type WorkbenchRead,
|
|
7
|
+
type WorkbenchResult,
|
|
8
|
+
} from "./service/contracts/workbench.ts";
|
|
1
9
|
import {
|
|
2
10
|
type Action,
|
|
3
11
|
type ActiveRuns,
|
|
@@ -82,6 +90,11 @@ import {
|
|
|
82
90
|
* Text transports use parseWireJson BEFORE handing unknown values to this client.
|
|
83
91
|
*/
|
|
84
92
|
export interface ServiceTransport {
|
|
93
|
+
workbenchRead?(
|
|
94
|
+
request: WorkbenchRead,
|
|
95
|
+
signal?: AbortSignal,
|
|
96
|
+
): Promise<unknown>;
|
|
97
|
+
workbenchCommand?(request: WorkbenchCommand): Promise<unknown>;
|
|
85
98
|
current?(request: CurrentRequest, signal?: AbortSignal): Promise<unknown>;
|
|
86
99
|
currentChanges?(
|
|
87
100
|
request: CurrentRequest,
|
|
@@ -123,6 +136,42 @@ const unavailable = <T>(mutation: boolean): Reply<T> => ({
|
|
|
123
136
|
|
|
124
137
|
export class ServiceClient {
|
|
125
138
|
constructor(private readonly transport: ServiceTransport) {}
|
|
139
|
+
async workbenchRead(
|
|
140
|
+
input: WorkbenchRead,
|
|
141
|
+
signal?: AbortSignal,
|
|
142
|
+
): Promise<Reply<WorkbenchResult>> {
|
|
143
|
+
const request = decodeWorkbenchRead(input);
|
|
144
|
+
try {
|
|
145
|
+
if (!this.transport.workbenchRead) return unavailable(false);
|
|
146
|
+
return decodeReply(
|
|
147
|
+
await this.transport.workbenchRead(request, signal),
|
|
148
|
+
decodeWorkbenchResult,
|
|
149
|
+
);
|
|
150
|
+
} catch {
|
|
151
|
+
return unavailable(false);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
async workbenchCommand(
|
|
155
|
+
input: WorkbenchCommand,
|
|
156
|
+
): Promise<Reply<WorkbenchResult>> {
|
|
157
|
+
const request = decodeWorkbenchCommand(input);
|
|
158
|
+
try {
|
|
159
|
+
if (!this.transport.workbenchCommand) return unavailable(true);
|
|
160
|
+
const reply = decodeReply(
|
|
161
|
+
await this.transport.workbenchCommand(request),
|
|
162
|
+
decodeWorkbenchResult,
|
|
163
|
+
);
|
|
164
|
+
if (
|
|
165
|
+
reply.kind === "ok" &&
|
|
166
|
+
(!("commandId" in reply.value) ||
|
|
167
|
+
reply.value.commandId !== request.commandId)
|
|
168
|
+
)
|
|
169
|
+
return unavailable(true);
|
|
170
|
+
return reply;
|
|
171
|
+
} catch {
|
|
172
|
+
return unavailable(true);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
126
175
|
async current(
|
|
127
176
|
input: CurrentRequest,
|
|
128
177
|
signal?: AbortSignal,
|