@opencode/client 2.2.7 → 2.3.1
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/dist/chunks/{shared-events-2r38e168.js → service-3v8v7cjx.js} +42 -28
- package/dist/chunks/{shared-events-sdjh9vmn.js → service-6hqrj29e.js} +5 -3
- package/dist/chunks/{shared-events-y2etg5bs.js → service-7f0py9js.js} +2 -2
- package/dist/chunks/{shared-events-2ny4vxct.js → service-8ye1ye6f.js} +2 -2
- package/dist/chunks/{shared-events-15p82y03.js → service-anregfhs.js} +5 -5
- package/dist/chunks/service-az3r2kmr.js +30 -0
- package/dist/chunks/{shared-events-gecjxyvt.js → service-gecjxyvt.js} +1 -1
- package/dist/chunks/{shared-events-nwcpakzx.js → service-js54wxgp.js} +2 -2
- package/dist/chunks/{shared-events-yn39sb5p.js → service-mqnb71k6.js} +49 -16
- package/dist/chunks/{shared-events-c49mnkv6.js → service-n22dhmav.js} +17 -17
- package/dist/chunks/{shared-events-qdgaygb4.js → service-nmmc7qpz.js} +68 -32
- package/dist/chunks/{shared-events-ryy6kscr.js → service-ryy6kscr.js} +1 -1
- package/dist/chunks/{shared-events-xj1v5np5.js → service-th5q8fjm.js} +2 -2
- package/dist/chunks/{shared-events-xqwq6bgr.js → service-xafd70ys.js} +1 -1
- package/dist/contract.js +1 -1
- package/dist/effect/api/api.d.ts +81 -39
- package/dist/effect/client.d.ts +53 -240
- package/dist/effect/client.js +12 -12
- package/dist/effect/generated/client-error.js +3 -3
- package/dist/effect/generated/client.d.ts +53 -240
- package/dist/effect/generated/client.js +5 -5
- package/dist/effect/generated/index.js +8 -8
- package/dist/effect/index.js +12 -12
- package/dist/effect/rpc.js +4 -4
- package/dist/effect/service.js +6 -6
- package/dist/promise/client.d.ts +15 -8
- package/dist/promise/client.js +11 -11
- package/dist/promise/generated/client-error.js +3 -3
- package/dist/promise/generated/client.d.ts +15 -8
- package/dist/promise/generated/client.js +4 -4
- package/dist/promise/generated/index.js +16 -12
- package/dist/promise/generated/types.d.ts +268 -144
- package/dist/promise/generated/types.js +8 -4
- package/dist/promise/index.js +23 -19
- package/dist/promise/media.d.ts +15 -8
- package/dist/promise/media.js +1 -1
- package/dist/promise/rpc.js +2 -2
- package/dist/promise/service.js +6 -6
- package/dist/pty-handoff.js +4 -4
- package/dist/rpc-runtime.js +1 -1
- package/dist/service-contender.js +1 -1
- package/dist/service-probe.js +3 -3
- package/dist/service-timing.js +1 -1
- package/dist/service-version.js +1 -1
- package/dist/service.js +1 -1
- package/dist/shared-events.js +1 -1
- package/dist/solid/connection.js +1 -1
- package/dist/solid/data.d.ts +5 -2
- package/dist/solid/data.js +10 -10
- package/dist/solid/index.js +14 -14
- package/dist/solid/pty.js +1 -1
- package/dist/solid/retention.js +1 -1
- package/dist/solid/usage.js +1 -1
- package/package.json +4 -4
- package/dist/chunks/shared-events-dqjrwhzg.js +0 -30
- /package/dist/chunks/{shared-events-3eaz3m83.js → service-3eaz3m83.js} +0 -0
- /package/dist/chunks/{shared-events-60xe5cbf.js → service-60xe5cbf.js} +0 -0
- /package/dist/chunks/{shared-events-6mptkzbc.js → service-6mptkzbc.js} +0 -0
- /package/dist/chunks/{shared-events-6mq2wh8y.js → service-6mq2wh8y.js} +0 -0
- /package/dist/chunks/{shared-events-6r38tsk5.js → service-6r38tsk5.js} +0 -0
- /package/dist/chunks/{shared-events-8s2anffy.js → service-8s2anffy.js} +0 -0
- /package/dist/chunks/{shared-events-9rqn6x4v.js → service-9rqn6x4v.js} +0 -0
- /package/dist/chunks/{shared-events-mwrzahmf.js → service-mwrzahmf.js} +0 -0
- /package/dist/chunks/{shared-events-qav6mfdz.js → service-qav6mfdz.js} +0 -0
- /package/dist/chunks/{shared-events-sxt88q69.js → service-sxt88q69.js} +0 -0
- /package/dist/chunks/{shared-events-ve4aws36.js → service-ve4aws36.js} +0 -0
- /package/dist/chunks/{shared-events-vyas3vgt.js → service-vyas3vgt.js} +0 -0
- /package/dist/chunks/{shared-events-xgnj2w4v.js → service-xgnj2w4v.js} +0 -0
- /package/dist/chunks/{shared-events-ydhz1zrh.js → service-ydhz1zrh.js} +0 -0
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ClientApi2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./service-60xe5cbf.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./
|
|
5
|
+
ClientError3
|
|
6
|
+
} from "./service-7f0py9js.js";
|
|
7
7
|
import {
|
|
8
8
|
__export
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./service-9rqn6x4v.js";
|
|
10
10
|
|
|
11
11
|
// src/effect/generated/client.ts
|
|
12
|
-
var
|
|
13
|
-
__export(
|
|
14
|
-
make: () =>
|
|
12
|
+
var exports_client4 = {};
|
|
13
|
+
__export(exports_client4, {
|
|
14
|
+
make: () => make6
|
|
15
15
|
});
|
|
16
16
|
import { Effect, Stream, Schema } from "effect";
|
|
17
17
|
import { Sse } from "effect/encoding";
|
|
18
18
|
import { HttpClientError } from "effect/http";
|
|
19
19
|
import { HttpApiClient } from "effect/http-api";
|
|
20
|
-
var mapClientError = (error) => HttpClientError.isHttpClientError(error) || Schema.isSchemaError(error) || Sse.Retry.is(error) ? new
|
|
20
|
+
var mapClientError = (error) => HttpClientError.isHttpClientError(error) || Schema.isSchemaError(error) || Sse.Retry.is(error) ? new ClientError3({ cause: error }) : error;
|
|
21
21
|
var preserveEffect = () => (effect) => effect;
|
|
22
22
|
var preserveStream = () => (stream) => stream;
|
|
23
23
|
var EndpointServerInfo = (raw) => () => preserveEffect()(raw["server.info"]({}).pipe(Effect.mapError(mapClientError)));
|
|
@@ -284,12 +284,27 @@ var EndpointExperimentalGenerateImage = (raw) => (input) => preserveEffect()(raw
|
|
|
284
284
|
resolution: input["resolution"]
|
|
285
285
|
}
|
|
286
286
|
}).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
287
|
+
var EndpointExperimentalGenerateVideoCreate = (raw) => (input) => preserveEffect()(raw["generate.video.create"]({
|
|
288
|
+
payload: {
|
|
289
|
+
model: input["model"],
|
|
290
|
+
prompt: input["prompt"],
|
|
291
|
+
start: input["start"],
|
|
292
|
+
end: input["end"],
|
|
293
|
+
references: input["references"],
|
|
294
|
+
duration: input["duration"],
|
|
295
|
+
aspect: input["aspect"],
|
|
296
|
+
resolution: input["resolution"],
|
|
297
|
+
sound: input["sound"]
|
|
298
|
+
}
|
|
299
|
+
}).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
300
|
+
var EndpointExperimentalGenerateVideoGet = (raw) => (input) => preserveEffect()(raw["generate.video.get"]({ params: { id: input["id"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
287
301
|
var EndpointExperimentalGenerateDecisions = (raw) => (input) => preserveEffect()(raw["generate.decisions"]({
|
|
288
302
|
payload: { model: input["model"], input: input["input"], questions: input["questions"] }
|
|
289
303
|
}).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
290
304
|
var adaptGroupExperimentalGenerate = (raw) => ({
|
|
291
305
|
text: EndpointExperimentalGenerateText(raw),
|
|
292
306
|
image: EndpointExperimentalGenerateImage(raw),
|
|
307
|
+
video: { create: EndpointExperimentalGenerateVideoCreate(raw), get: EndpointExperimentalGenerateVideoGet(raw) },
|
|
293
308
|
decisions: EndpointExperimentalGenerateDecisions(raw)
|
|
294
309
|
});
|
|
295
310
|
var EndpointExperimentalVoiceModels = (raw) => () => preserveEffect()(raw["voice.models"]({}).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
@@ -548,22 +563,21 @@ var EndpointExperimentalPersistentPtyConnectToken = (raw) => (input) => preserve
|
|
|
548
563
|
params: { ptyID: input["ptyID"] },
|
|
549
564
|
headers: { "x-opencode-ticket": input["x-opencode-ticket"] }
|
|
550
565
|
}).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
551
|
-
var
|
|
566
|
+
var EndpointExperimentalAutomationCreate = (raw) => (input) => preserveEffect()(raw["automation.create"]({
|
|
552
567
|
payload: {
|
|
553
568
|
sessionID: input["sessionID"],
|
|
569
|
+
directory: input["directory"],
|
|
554
570
|
name: input["name"],
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
ends: input["ends"],
|
|
559
|
-
prompt: input["prompt"]
|
|
571
|
+
trigger: input["trigger"],
|
|
572
|
+
action: input["action"],
|
|
573
|
+
expires: input["expires"]
|
|
560
574
|
}
|
|
561
575
|
}).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
562
|
-
var
|
|
563
|
-
var
|
|
564
|
-
var
|
|
565
|
-
var
|
|
566
|
-
var
|
|
576
|
+
var EndpointExperimentalAutomationList = (raw) => (input) => preserveEffect()(raw["automation.list"]({ query: { sessionID: input?.["sessionID"], directory: input?.["directory"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
577
|
+
var EndpointExperimentalAutomationGet = (raw) => (input) => preserveEffect()(raw["automation.get"]({ params: { automationID: input["automationID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
578
|
+
var EndpointExperimentalAutomationPause = (raw) => (input) => preserveEffect()(raw["automation.pause"]({ params: { automationID: input["automationID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
579
|
+
var EndpointExperimentalAutomationResume = (raw) => (input) => preserveEffect()(raw["automation.resume"]({ params: { automationID: input["automationID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
580
|
+
var EndpointExperimentalAutomationDelete = (raw) => (input) => preserveEffect()(raw["automation.delete"]({ params: { automationID: input["automationID"] } }).pipe(Effect.mapError(mapClientError)));
|
|
567
581
|
var EndpointExperimentalArtifactsProviders = (raw) => (input) => preserveEffect()(raw["artifacts.providers"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
568
582
|
var EndpointExperimentalArtifactsList = (raw) => (input) => preserveEffect()(raw["artifacts.list"]({
|
|
569
583
|
query: { location: input?.["location"], sessionID: input?.["sessionID"], provider: input?.["provider"] }
|
|
@@ -612,13 +626,13 @@ var adaptGroupExperimental = (raw) => ({
|
|
|
612
626
|
remove: EndpointExperimentalPersistentPtyRemove(raw),
|
|
613
627
|
connectToken: EndpointExperimentalPersistentPtyConnectToken(raw)
|
|
614
628
|
},
|
|
615
|
-
|
|
616
|
-
create:
|
|
617
|
-
list:
|
|
618
|
-
get:
|
|
619
|
-
pause:
|
|
620
|
-
resume:
|
|
621
|
-
delete:
|
|
629
|
+
automation: {
|
|
630
|
+
create: EndpointExperimentalAutomationCreate(raw),
|
|
631
|
+
list: EndpointExperimentalAutomationList(raw),
|
|
632
|
+
get: EndpointExperimentalAutomationGet(raw),
|
|
633
|
+
pause: EndpointExperimentalAutomationPause(raw),
|
|
634
|
+
resume: EndpointExperimentalAutomationResume(raw),
|
|
635
|
+
delete: EndpointExperimentalAutomationDelete(raw)
|
|
622
636
|
},
|
|
623
637
|
artifacts: {
|
|
624
638
|
providers: EndpointExperimentalArtifactsProviders(raw),
|
|
@@ -832,6 +846,6 @@ var adaptClient = (raw) => {
|
|
|
832
846
|
}
|
|
833
847
|
};
|
|
834
848
|
};
|
|
835
|
-
var
|
|
849
|
+
var make6 = (options) => HttpApiClient.make(ClientApi2, options).pipe(Effect.map(adaptClient));
|
|
836
850
|
|
|
837
|
-
export {
|
|
851
|
+
export { make6, exports_client4 };
|
|
@@ -22,11 +22,12 @@ var isProviderNotFoundError2 = (value) => typeof value === "object" && value !==
|
|
|
22
22
|
var isModelNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ModelNotFoundError";
|
|
23
23
|
var isUnsupportedModelError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "UnsupportedModelError";
|
|
24
24
|
var isProviderRequestError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ProviderRequestError";
|
|
25
|
+
var isForbiddenError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ForbiddenError";
|
|
26
|
+
var isVideoNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "VideoNotFoundError";
|
|
25
27
|
var isIntegrationNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "IntegrationNotFoundError";
|
|
26
28
|
var isIntegrationAttemptNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "IntegrationAttemptNotFoundError";
|
|
27
29
|
var isIntegrationMethodNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "IntegrationMethodNotFoundError";
|
|
28
30
|
var isMcpServerNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "McpServerNotFoundError";
|
|
29
|
-
var isForbiddenError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ForbiddenError";
|
|
30
31
|
var isProjectNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ProjectNotFoundError";
|
|
31
32
|
var isPermissionSavedNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "PermissionSavedNotFoundError";
|
|
32
33
|
var isPermissionNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "PermissionNotFoundError";
|
|
@@ -35,10 +36,11 @@ var isRpcError2 = (value) => typeof value === "object" && value !== null && ("_t
|
|
|
35
36
|
var isRpcInternalError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "RpcInternalError";
|
|
36
37
|
var isPtyNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "PtyNotFoundError";
|
|
37
38
|
var isPtyFeatureUnsupportedError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "PtyFeatureUnsupportedError";
|
|
38
|
-
var
|
|
39
|
+
var isBlobNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "BlobNotFoundError";
|
|
40
|
+
var isAutomationNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "AutomationNotFoundError";
|
|
39
41
|
var isArtifactNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ArtifactNotFoundError";
|
|
40
42
|
var isShellNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ShellNotFoundError";
|
|
41
43
|
var isWorktreeError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "WorktreeError";
|
|
42
44
|
var isVcsInitNotSupportedError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "VcsInitNotSupportedError";
|
|
43
45
|
|
|
44
|
-
export { isInvalidRequestError2, isUnauthorizedError2, isLocationNotFoundError2, isServiceUnavailableError2, isAgentNotFoundError2, isPluginNotFoundError2, isInvalidCursorError2, isSessionNotFoundError2, isMessageNotFoundError2, isConflictError2, isCommandNotFoundError2, isCommandExecutionError2, isSessionBusyError2, isUnknownError2, isFormNotFoundError2, isFormInvalidAnswerError2, isFormAlreadySettledError2, isSkillNotFoundError2, isInstructionEntryValueTooLargeError2, isProviderNotFoundError2, isModelNotFoundError2, isUnsupportedModelError2, isProviderRequestError2, isIntegrationNotFoundError2, isIntegrationAttemptNotFoundError2, isIntegrationMethodNotFoundError2, isMcpServerNotFoundError2,
|
|
46
|
+
export { isInvalidRequestError2, isUnauthorizedError2, isLocationNotFoundError2, isServiceUnavailableError2, isAgentNotFoundError2, isPluginNotFoundError2, isInvalidCursorError2, isSessionNotFoundError2, isMessageNotFoundError2, isConflictError2, isCommandNotFoundError2, isCommandExecutionError2, isSessionBusyError2, isUnknownError2, isFormNotFoundError2, isFormInvalidAnswerError2, isFormAlreadySettledError2, isSkillNotFoundError2, isInstructionEntryValueTooLargeError2, isProviderNotFoundError2, isModelNotFoundError2, isUnsupportedModelError2, isProviderRequestError2, isForbiddenError2, isVideoNotFoundError2, isIntegrationNotFoundError2, isIntegrationAttemptNotFoundError2, isIntegrationMethodNotFoundError2, isMcpServerNotFoundError2, isProjectNotFoundError2, isPermissionSavedNotFoundError2, isPermissionNotFoundError2, isFileNotFoundError2, isRpcError2, isRpcInternalError2, isPtyNotFoundError2, isPtyFeatureUnsupportedError2, isBlobNotFoundError2, isAutomationNotFoundError2, isArtifactNotFoundError2, isShellNotFoundError2, isWorktreeError2, isVcsInitNotSupportedError2 };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// src/effect/generated/client-error.ts
|
|
2
2
|
import { Schema } from "effect";
|
|
3
3
|
|
|
4
|
-
class
|
|
4
|
+
class ClientError3 extends Schema.TaggedError()("ClientError", {
|
|
5
5
|
cause: Schema.Defect()
|
|
6
6
|
}) {
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export {
|
|
9
|
+
export { ClientError3 };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defaultEnsureTiming2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./service-xgnj2w4v.js";
|
|
4
4
|
import {
|
|
5
5
|
matchesVersion2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./service-sxt88q69.js";
|
|
7
7
|
|
|
8
8
|
// src/service-probe.ts
|
|
9
9
|
import { homedir } from "node:os";
|
|
@@ -3,20 +3,20 @@ import {
|
|
|
3
3
|
readError2,
|
|
4
4
|
event2,
|
|
5
5
|
eventType2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./service-ryy6kscr.js";
|
|
7
7
|
import {
|
|
8
8
|
__export
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./service-9rqn6x4v.js";
|
|
10
10
|
|
|
11
11
|
// src/effect/rpc.ts
|
|
12
12
|
var exports_rpc = {};
|
|
13
13
|
__export(exports_rpc, {
|
|
14
14
|
RpcClientRuntime: () => exports_rpc,
|
|
15
15
|
aborted: () => aborted2,
|
|
16
|
-
make: () =>
|
|
16
|
+
make: () => make5
|
|
17
17
|
});
|
|
18
18
|
import { Effect, Stream } from "effect";
|
|
19
|
-
function
|
|
19
|
+
function make5(call, subscribe) {
|
|
20
20
|
return (definition) => {
|
|
21
21
|
const methods = Object.fromEntries(Object.entries(definition.methods).map(([name, method]) => [
|
|
22
22
|
name,
|
|
@@ -59,4 +59,4 @@ function aborted2(signal) {
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
export {
|
|
62
|
+
export { make5, aborted2, exports_rpc };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
make7
|
|
3
|
+
} from "./service-gecjxyvt.js";
|
|
4
|
+
import {
|
|
5
|
+
make3
|
|
6
|
+
} from "./service-nmmc7qpz.js";
|
|
7
|
+
import {
|
|
8
|
+
makeRpc2
|
|
9
|
+
} from "./service-xafd70ys.js";
|
|
10
|
+
import {
|
|
11
|
+
__export
|
|
12
|
+
} from "./service-9rqn6x4v.js";
|
|
13
|
+
|
|
14
|
+
// src/promise/client.ts
|
|
15
|
+
var exports_client = {};
|
|
16
|
+
__export(exports_client, {
|
|
17
|
+
OpenCode: () => exports_client,
|
|
18
|
+
make: () => make2
|
|
19
|
+
});
|
|
20
|
+
function make2(options) {
|
|
21
|
+
const raw = make3(options);
|
|
22
|
+
const events = make7((signal, onActivity) => raw.event.subscribe(undefined, { signal, onActivity }));
|
|
23
|
+
return {
|
|
24
|
+
...raw,
|
|
25
|
+
rpc: Object.assign(makeRpc2(raw, events), raw.rpc),
|
|
26
|
+
event: events
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { make2, exports_client };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/promise/generated/client-error.ts
|
|
2
|
-
class
|
|
2
|
+
class ClientError2 extends Error {
|
|
3
3
|
reason;
|
|
4
4
|
name = "ClientError";
|
|
5
5
|
constructor(reason, options) {
|
|
@@ -9,4 +9,4 @@ class ClientError3 extends Error {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export {
|
|
12
|
+
export { ClientError2 };
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
isFormNotFoundError2,
|
|
5
5
|
isFormAlreadySettledError2,
|
|
6
6
|
isPermissionNotFoundError2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./service-6hqrj29e.js";
|
|
8
8
|
|
|
9
9
|
// src/solid/data.ts
|
|
10
10
|
import { Worktree } from "@opencode/schema/worktree";
|
|
@@ -50,8 +50,11 @@ function omitFileData(content) {
|
|
|
50
50
|
const omit = (item) => item.type === "file" && item.uri.startsWith("data:") ? { ...item, uri: `data:${item.mime};base64,` } : item;
|
|
51
51
|
return [omit(content[0]), ...content.slice(1).map(omit)];
|
|
52
52
|
}
|
|
53
|
+
var hasFileData = (part) => part.type === "tool" && ("content" in part.state) && !!part.state.content?.some((item) => item.type === "file" && item.uri.startsWith("data:"));
|
|
54
|
+
var isDroppedFile = (item) => item.type === "file" && item.uri === `data:${item.mime};base64,`;
|
|
55
|
+
var hasDroppedFileData = (message) => message.type === "assistant" && message.content.some((part) => part.type === "tool" && ("content" in part.state) && !!part.state.content?.some(isDroppedFile));
|
|
53
56
|
function omitMessageFileData(message) {
|
|
54
|
-
if (message.type !== "assistant")
|
|
57
|
+
if (message.type !== "assistant" || !message.content.some(hasFileData))
|
|
55
58
|
return message;
|
|
56
59
|
return {
|
|
57
60
|
...message,
|
|
@@ -137,20 +140,36 @@ function createData2(config) {
|
|
|
137
140
|
function refresh(load) {
|
|
138
141
|
if (disposed || config.connection && config.connection.status() !== "connected")
|
|
139
142
|
return;
|
|
140
|
-
load().catch(
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
if (isMessageNotFoundError2(error))
|
|
143
|
+
load().catch(refreshFailed);
|
|
144
|
+
}
|
|
145
|
+
function restoreMessageFiles(sessionID, messageID) {
|
|
146
|
+
return api().session.message.get({ sessionID, messageID }).then((item) => {
|
|
147
|
+
if (item.type !== "assistant" || omitFiles())
|
|
148
148
|
return;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
message.editAssistant(sessionID, item.id, (assistant) => {
|
|
150
|
+
assistant.content.forEach((part) => {
|
|
151
|
+
if (part.type !== "tool" || !("content" in part.state) || !part.state.content?.some(isDroppedFile))
|
|
152
|
+
return;
|
|
153
|
+
const fetched = item.content.findLast((other) => other.type === "tool" && other.id === part.id);
|
|
154
|
+
if (fetched?.type === "tool" && "content" in fetched.state && fetched.state.content)
|
|
155
|
+
part.state.content = fetched.state.content;
|
|
156
|
+
});
|
|
157
|
+
});
|
|
152
158
|
});
|
|
153
159
|
}
|
|
160
|
+
function refreshFailed(error) {
|
|
161
|
+
if (disposed || config.connection && config.connection.status() !== "connected")
|
|
162
|
+
return;
|
|
163
|
+
if (isSessionNotFoundError2(error)) {
|
|
164
|
+
markDeleted(error.sessionID);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (isMessageNotFoundError2(error))
|
|
168
|
+
return;
|
|
169
|
+
if (config.onError)
|
|
170
|
+
return config.onError(error);
|
|
171
|
+
console.error("Failed to refresh client data", error);
|
|
172
|
+
}
|
|
154
173
|
const settling = new Map;
|
|
155
174
|
onCleanup(() => settling.forEach((timer) => clearTimeout(timer)));
|
|
156
175
|
function settle(key, load) {
|
|
@@ -182,7 +201,8 @@ function createData2(config) {
|
|
|
182
201
|
const [defaultLocation, setDefaultLocation] = createSignal({ directory: config.directory });
|
|
183
202
|
const sessions = createMemo(() => Object.values(store.session.info).toSorted((a, b) => b.time.updated - a.time.updated));
|
|
184
203
|
const messageIndex = new Map;
|
|
185
|
-
const
|
|
204
|
+
const omitFiles = () => typeof config.omitToolFileData === "function" ? config.omitToolFileData() : config.omitToolFileData === true;
|
|
205
|
+
const stored = (message) => omitFiles() ? omitMessageFileData(message) : message;
|
|
186
206
|
const sync = createSync();
|
|
187
207
|
let activeUpdates;
|
|
188
208
|
const pendingUpdates = new Map;
|
|
@@ -755,6 +775,7 @@ function createData2(config) {
|
|
|
755
775
|
existing.rawFinish = undefined;
|
|
756
776
|
existing.native = undefined;
|
|
757
777
|
existing.time.created = event.data.started;
|
|
778
|
+
existing.time.firstToken = undefined;
|
|
758
779
|
existing.time.streamed = undefined;
|
|
759
780
|
existing.time.completed = undefined;
|
|
760
781
|
if (event.data.snapshot)
|
|
@@ -783,6 +804,11 @@ function createData2(config) {
|
|
|
783
804
|
assistant.time.streamed = event.created;
|
|
784
805
|
});
|
|
785
806
|
return;
|
|
807
|
+
case "session.step.first-token":
|
|
808
|
+
message.editAssistant(event.data.sessionID, event.data.assistantMessageID, (assistant) => {
|
|
809
|
+
assistant.time.firstToken = event.created;
|
|
810
|
+
});
|
|
811
|
+
return;
|
|
786
812
|
case "session.step.ended": {
|
|
787
813
|
message.editAssistant(event.data.sessionID, event.data.assistantMessageID, (assistant) => {
|
|
788
814
|
assistant.time.completed = event.created;
|
|
@@ -872,7 +898,7 @@ function createData2(config) {
|
|
|
872
898
|
status: "completed",
|
|
873
899
|
input: tool.state.input,
|
|
874
900
|
metadata: event.data.metadata,
|
|
875
|
-
content:
|
|
901
|
+
content: omitFiles() ? omitFileData(event.data.content) : [...event.data.content]
|
|
876
902
|
};
|
|
877
903
|
tool.executed = event.data.executed || tool.executed === true;
|
|
878
904
|
if (event.data.native)
|
|
@@ -889,7 +915,7 @@ function createData2(config) {
|
|
|
889
915
|
error: event.data.error,
|
|
890
916
|
input: typeof tool.state.input === "string" ? {} : tool.state.input,
|
|
891
917
|
metadata: event.data.metadata,
|
|
892
|
-
content:
|
|
918
|
+
content: omitFiles() && event.data.content ? omitFileData(event.data.content) : event.data.content
|
|
893
919
|
};
|
|
894
920
|
tool.executed = event.data.executed || tool.executed === true;
|
|
895
921
|
if (event.data.native)
|
|
@@ -1505,6 +1531,13 @@ function createData2(config) {
|
|
|
1505
1531
|
const position = messageIndex.get(sessionID)?.get(messageID);
|
|
1506
1532
|
return position === undefined ? undefined : messages?.[position];
|
|
1507
1533
|
},
|
|
1534
|
+
restoreFiles() {
|
|
1535
|
+
const sessions = Object.entries(store.session.message).flatMap(([sessionID, messages]) => {
|
|
1536
|
+
const ids = (messages ?? []).filter(hasDroppedFileData).map((item) => item.id);
|
|
1537
|
+
return ids.length === 0 ? [] : [{ sessionID, ids }];
|
|
1538
|
+
});
|
|
1539
|
+
return Promise.all(sessions.map((session) => session.ids.reduce((previous, messageID) => previous.then(() => restoreMessageFiles(session.sessionID, messageID).catch(refreshFailed)), Promise.resolve())));
|
|
1540
|
+
},
|
|
1508
1541
|
sync(sessionID) {
|
|
1509
1542
|
return sync.run(`session.message:${sessionID}`, async () => {
|
|
1510
1543
|
const started = deletionEpoch;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
make7
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./service-gecjxyvt.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./
|
|
5
|
+
ClientError3
|
|
6
|
+
} from "./service-7f0py9js.js";
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
} from "./
|
|
8
|
+
make6
|
|
9
|
+
} from "./service-3v8v7cjx.js";
|
|
10
10
|
import {
|
|
11
|
-
|
|
11
|
+
make5,
|
|
12
12
|
aborted2
|
|
13
|
-
} from "./
|
|
13
|
+
} from "./service-anregfhs.js";
|
|
14
14
|
import {
|
|
15
15
|
__export
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./service-9rqn6x4v.js";
|
|
17
17
|
|
|
18
18
|
// src/effect/client.ts
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
OpenCode: () =>
|
|
22
|
-
make: () =>
|
|
19
|
+
var exports_client3 = {};
|
|
20
|
+
__export(exports_client3, {
|
|
21
|
+
OpenCode: () => exports_client3,
|
|
22
|
+
make: () => make4
|
|
23
23
|
});
|
|
24
24
|
import { Cause, Context, Effect, Stream } from "effect";
|
|
25
25
|
import { HttpClient, HttpClientRequest } from "effect/http";
|
|
@@ -28,9 +28,9 @@ var CurrentHeaders = Context.Reference("@opencode/client/effect/rpc/headers", {
|
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
var
|
|
31
|
+
var make4 = Effect.fn("OpenCode.make")(function* (options) {
|
|
32
32
|
const httpClient = yield* HttpClient.HttpClient;
|
|
33
|
-
const raw = yield*
|
|
33
|
+
const raw = yield* make6(options).pipe(Effect.provideService(HttpClient.HttpClient, HttpClient.mapRequestEffect(httpClient, (request) => Effect.map(CurrentHeaders, (headers) => headers ? HttpClientRequest.setHeaders(request, new Headers(headers)) : request))));
|
|
34
34
|
const context = yield* Effect.context();
|
|
35
35
|
const native = raw.event.subscribe();
|
|
36
36
|
|
|
@@ -41,12 +41,12 @@ var make2 = Effect.fn("OpenCode.make")(function* (options) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
const shared = make7((signal) => Stream.toAsyncIterableWith(native.pipe(Stream.interruptWhen(aborted2(signal)), Stream.catchCause((cause) => Stream.fail(new EventFailure(cause)))), context));
|
|
44
|
-
const subscribe = (input) => Stream.fromAsyncIterable(shared.subscribe({ types: input?.types }), (error) => error).pipe(Stream.catch((error) => Stream.failCause(error instanceof EventFailure ? error.cause : Cause.fail(new
|
|
44
|
+
const subscribe = (input) => Stream.fromAsyncIterable(shared.subscribe({ types: input?.types }), (error) => error).pipe(Stream.catch((error) => Stream.failCause(error instanceof EventFailure ? error.cause : Cause.fail(new ClientError3({ cause: error })))));
|
|
45
45
|
return {
|
|
46
46
|
...raw,
|
|
47
47
|
event: { ...raw.event, subscribe },
|
|
48
|
-
rpc: Object.assign(
|
|
48
|
+
rpc: Object.assign(make5((input, options) => raw.rpc.call(input).pipe(Effect.provideService(CurrentHeaders, options?.headers)), subscribe), raw.rpc)
|
|
49
49
|
};
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
export {
|
|
52
|
+
export { make4, exports_client3 };
|