@dual-os/sdk 0.8.0-next.0 → 0.8.0-next.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/README.md +5 -17
- package/dist/Action.d.ts +0 -1
- package/dist/Action.js +1 -2
- package/dist/AgentChannel.d.ts +11 -3
- package/dist/AgentChannel.d.ts.map +1 -1
- package/dist/AgentChannel.js +31 -5
- package/dist/AgentChannel.js.map +1 -1
- package/dist/AgentChannelConformance.d.ts +0 -1
- package/dist/AgentChannelConformance.js +1 -2
- package/dist/AgentChannelRuntime.d.ts +0 -1
- package/dist/AgentChannelRuntime.d.ts.map +1 -1
- package/dist/AgentChannelRuntime.js +3 -4
- package/dist/AgentChannelRuntime.js.map +1 -1
- package/dist/AiProvider.d.ts +0 -1
- package/dist/AiProvider.js +1 -2
- package/dist/AuthMethod.d.ts +0 -1
- package/dist/AuthMethod.js +1 -2
- package/dist/AuthMethodBinding.d.ts +0 -1
- package/dist/AuthMethodBinding.js +1 -2
- package/dist/AuthMethodExecution.d.ts +0 -1
- package/dist/AuthMethodExecution.js +1 -2
- package/dist/ConnectionResolver.d.ts +0 -1
- package/dist/ConnectionResolver.js +1 -2
- package/dist/DefinitionError.d.ts +0 -1
- package/dist/DefinitionError.js +1 -2
- package/dist/DualRegistry.d.ts +0 -1
- package/dist/DualRegistry.js +1 -2
- package/dist/DualRuntime.d.ts +0 -1
- package/dist/DualRuntime.js +1 -2
- package/dist/Files.d.ts +0 -1
- package/dist/Files.js +1 -2
- package/dist/Group.d.ts +0 -1
- package/dist/Group.js +1 -2
- package/dist/Http.d.ts +0 -1
- package/dist/Http.d.ts.map +1 -1
- package/dist/Http.js +4 -5
- package/dist/Http.js.map +1 -1
- package/dist/Mcp.d.ts +0 -1
- package/dist/Mcp.js +1 -2
- package/dist/OAuth2TokenRefresher.d.ts +0 -1
- package/dist/OAuth2TokenRefresher.js +1 -2
- package/dist/OAuthFlow.d.ts +0 -1
- package/dist/OAuthFlow.js +1 -2
- package/dist/Plugin.d.ts +0 -1
- package/dist/Plugin.js +1 -2
- package/dist/PluginRuntime.d.ts +0 -1
- package/dist/PluginRuntime.js +1 -2
- package/dist/Runner.js +3 -4
- package/dist/Runner.js.map +1 -1
- package/dist/ToolFile.d.ts +0 -1
- package/dist/ToolFile.js +1 -2
- package/dist/Trigger.d.ts +0 -1
- package/dist/Trigger.js +1 -2
- package/dist/_virtual/_rolldown/runtime.js +1 -2
- package/dist/internal/auth-context.d.ts +0 -2
- package/dist/internal/auth-context.d.ts.map +1 -1
- package/dist/internal/auth-execution.d.ts +0 -2
- package/dist/internal/auth-execution.d.ts.map +1 -1
- package/dist/internal/auth-execution.js +1 -2
- package/dist/internal/auth-runtime.d.ts +0 -2
- package/dist/internal/auth-runtime.d.ts.map +1 -1
- package/dist/internal/auth-runtime.js +1 -2
- package/dist/internal/capabilities.d.ts +0 -2
- package/dist/internal/capabilities.d.ts.map +1 -1
- package/dist/internal/capabilities.js +1 -2
- package/dist/internal/children.d.ts +0 -2
- package/dist/internal/children.d.ts.map +1 -1
- package/dist/internal/children.js +1 -2
- package/dist/internal/collection-utils.d.ts +0 -2
- package/dist/internal/collection-utils.d.ts.map +1 -1
- package/dist/internal/collection-utils.js +1 -2
- package/dist/internal/dual/actions.d.ts +0 -2
- package/dist/internal/dual/actions.d.ts.map +1 -1
- package/dist/internal/dual/actions.js +1 -2
- package/dist/internal/dual/invoke.d.ts +0 -2
- package/dist/internal/dual/invoke.d.ts.map +1 -1
- package/dist/internal/dual/invoke.js +1 -2
- package/dist/internal/dual/registry.d.ts +0 -2
- package/dist/internal/dual/registry.d.ts.map +1 -1
- package/dist/internal/dual/registry.js +1 -2
- package/dist/internal/dual/triggers.d.ts +0 -2
- package/dist/internal/dual/triggers.d.ts.map +1 -1
- package/dist/internal/dual/triggers.js +1 -2
- package/dist/internal/handler-context.d.ts +0 -2
- package/dist/internal/handler-context.d.ts.map +1 -1
- package/dist/internal/handler-context.js +1 -2
- package/dist/internal/identifier.d.ts +0 -2
- package/dist/internal/identifier.d.ts.map +1 -1
- package/dist/internal/identifier.js +1 -2
- package/dist/internal/plugin-handlers.d.ts +0 -2
- package/dist/internal/plugin-handlers.d.ts.map +1 -1
- package/dist/internal/plugin-handlers.js +1 -2
- package/dist/internal/proto.d.ts +0 -2
- package/dist/internal/proto.d.ts.map +1 -1
- package/dist/internal/proto.js +1 -2
- package/dist/internal/schema-runtime.d.ts +0 -2
- package/dist/internal/schema-runtime.d.ts.map +1 -1
- package/dist/internal/schema-runtime.js +1 -2
- package/dist/internal/trigger-runtime-shared.d.ts +0 -2
- package/dist/internal/trigger-runtime-shared.d.ts.map +1 -1
- package/dist/internal/trigger-runtime-shared.js +1 -2
- package/dist/internal/trigger-runtime.d.ts +0 -2
- package/dist/internal/trigger-runtime.d.ts.map +1 -1
- package/dist/internal/trigger-runtime.js +1 -2
- package/dist/internal/types.d.ts +0 -2
- package/dist/internal/types.d.ts.map +1 -1
- package/dist/remote-runtime.d.ts +0 -1
- package/dist/remote-runtime.js +1 -2
- package/package.json +6 -7
- package/src/AgentChannel.ts +30 -2
- package/src/AgentChannelRuntime.ts +2 -1
- package/src/Http.ts +21 -4
- package/src/Runner.ts +5 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/internal/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/internal/types.ts"],"mappings":";YAGY,MAAM,uBAAuB;YAE7B,eAAe,oDAAoD;YAInE,WAAW,uBAAuB,6BAA6B,oBACvE,gBACG,gBAAgB,qBAAqB"}
|
package/dist/remote-runtime.d.ts
CHANGED
|
@@ -580,6 +580,5 @@ export declare const execute: (request: {
|
|
|
580
580
|
readonly pluginVersion: string;
|
|
581
581
|
};
|
|
582
582
|
}, never, Service$1>;
|
|
583
|
-
//#endregion
|
|
584
583
|
export { remote_runtime_d_exports as RemoteRuntime, remote_runtime_d_exports };
|
|
585
584
|
//# sourceMappingURL=remote-runtime.d.ts.map
|
package/dist/remote-runtime.js
CHANGED
|
@@ -9,7 +9,7 @@ import { File, FileError, Service as Service$2 } from "./Files.js";
|
|
|
9
9
|
import "./remote-runtime.js";
|
|
10
10
|
import { Array, Cause, Effect, Layer, Match, Option, Predicate, Redacted, Schema, flow, pipe } from "effect";
|
|
11
11
|
import { HttpClient, HttpClientRequest } from "effect/http";
|
|
12
|
-
|
|
12
|
+
// src/remote-runtime.ts
|
|
13
13
|
/**
|
|
14
14
|
* Data-only SDK lifecycle requests for an installed, isolated integration plugin.
|
|
15
15
|
*
|
|
@@ -361,7 +361,6 @@ const execute = Effect.fn("RemoteRuntime.execute")(function* (request) {
|
|
|
361
361
|
identity: request.identity
|
|
362
362
|
})));
|
|
363
363
|
});
|
|
364
|
-
//#endregion
|
|
365
364
|
export { Failure, FileAccess, Identity, Operation, remote_runtime_exports as RemoteRuntime, Request, Response, connectionLayer, execute, failure, filesUnavailable, remote_runtime_exports };
|
|
366
365
|
|
|
367
366
|
//# sourceMappingURL=remote-runtime.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dual-os/sdk",
|
|
3
|
-
"version": "0.8.0-next.
|
|
3
|
+
"version": "0.8.0-next.1",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**/*.js",
|
|
@@ -42,16 +42,15 @@
|
|
|
42
42
|
"./Runner": "./dist/Runner.js"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
|
-
"prepack": "vp run build"
|
|
45
|
+
"prepack": "vp run build",
|
|
46
|
+
"typecheck": "tsrs --build tsconfig.json --force --pretty false"
|
|
46
47
|
},
|
|
47
48
|
"dependencies": {
|
|
48
|
-
"@effect/platform-node": "4.
|
|
49
|
-
"effect": "4.
|
|
49
|
+
"@effect/platform-node": "4.1.2",
|
|
50
|
+
"effect": "4.1.2"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
|
-
"@deslop/coding-standards": "0.1.1193",
|
|
53
53
|
"@types/node": "^22.15.3",
|
|
54
|
-
"bun-types": "^1.3.11"
|
|
55
|
-
"typescript": "7.0.2"
|
|
54
|
+
"bun-types": "^1.3.11"
|
|
56
55
|
}
|
|
57
56
|
}
|
package/src/AgentChannel.ts
CHANGED
|
@@ -116,7 +116,10 @@ const ResponseHeaders = Schema.Record(
|
|
|
116
116
|
Object.keys(headers).every(name => name === "content-type" || name === "cache-control"),
|
|
117
117
|
),
|
|
118
118
|
);
|
|
119
|
-
/**
|
|
119
|
+
/**
|
|
120
|
+
* Bounded provider-required webhook response, returned only after request verification. A 204 or
|
|
121
|
+
* 205 response has an empty body.
|
|
122
|
+
*/
|
|
120
123
|
export const WebhookResponse = Schema.Struct({
|
|
121
124
|
body: Schema.String.check(
|
|
122
125
|
Schema.isMaxLength(65_536),
|
|
@@ -124,7 +127,11 @@ export const WebhookResponse = Schema.Struct({
|
|
|
124
127
|
),
|
|
125
128
|
headers: Schema.optionalKey(ResponseHeaders),
|
|
126
129
|
status: Schema.Int.check(Schema.isBetween({ maximum: 299, minimum: 200 })),
|
|
127
|
-
})
|
|
130
|
+
}).check(
|
|
131
|
+
Schema.makeFilter(
|
|
132
|
+
response => (response.status !== 204 && response.status !== 205) || response.body === "",
|
|
133
|
+
),
|
|
134
|
+
);
|
|
128
135
|
export type WebhookResponse = typeof WebhookResponse.Type;
|
|
129
136
|
export const Timestamp = Schema.String.check(
|
|
130
137
|
Schema.isMaxLength(64),
|
|
@@ -544,6 +551,27 @@ export type CommandV2<State extends Schema.Top = Schema.Unknown> = ReturnType<
|
|
|
544
551
|
export type ResultV2<State extends Schema.Top = Schema.Unknown> = ReturnType<
|
|
545
552
|
typeof resultSchemaV2<State>
|
|
546
553
|
>["Type"];
|
|
554
|
+
/** Maximum UTF-8 bytes in an ordinary Channel command or result, including its JSON envelope. */
|
|
555
|
+
export const resultByteLimit = 2_097_152;
|
|
556
|
+
/** Keep the newest context messages within the checked result budget, oldest first. */
|
|
557
|
+
export function contextResult(
|
|
558
|
+
operationKey: string,
|
|
559
|
+
context: readonly ContextMessage[],
|
|
560
|
+
): Extract<ResultV2, { readonly kind: "read_context" }> {
|
|
561
|
+
const messages: ContextMessage[] = [];
|
|
562
|
+
const result = { kind: "read_context" as const, messages, operationKey };
|
|
563
|
+
const encoder = new TextEncoder();
|
|
564
|
+
let bytes = encoder.encode(JSON.stringify(result)).byteLength;
|
|
565
|
+
for (let index = context.length - 1; index >= 0; index--) {
|
|
566
|
+
const message = context[index];
|
|
567
|
+
if (message === undefined) continue;
|
|
568
|
+
const size = encoder.encode(JSON.stringify(message)).byteLength + 1;
|
|
569
|
+
if (bytes + size > resultByteLimit) break;
|
|
570
|
+
bytes += size;
|
|
571
|
+
messages.unshift(message);
|
|
572
|
+
}
|
|
573
|
+
return result;
|
|
574
|
+
}
|
|
547
575
|
/** The command and result schemas of a Channel's protocol. */
|
|
548
576
|
export const schemasFor = (definition: Pick<Definition, "protocol" | "state">) =>
|
|
549
577
|
definition.protocol === "v2"
|
|
@@ -105,7 +105,8 @@ const AssetResultJson = Schema.Json.check(
|
|
|
105
105
|
);
|
|
106
106
|
const Json = Schema.Json.check(
|
|
107
107
|
Schema.makeFilter(
|
|
108
|
-
value =>
|
|
108
|
+
value =>
|
|
109
|
+
new TextEncoder().encode(JSON.stringify(value)).byteLength <= AgentChannel.resultByteLimit,
|
|
109
110
|
),
|
|
110
111
|
);
|
|
111
112
|
const strict = { onExcessProperty: "error" } as const;
|
package/src/Http.ts
CHANGED
|
@@ -32,6 +32,8 @@ import {
|
|
|
32
32
|
HttpClient,
|
|
33
33
|
HttpClientError,
|
|
34
34
|
HttpClientRequest,
|
|
35
|
+
Headers,
|
|
36
|
+
UrlParams,
|
|
35
37
|
} from "effect/http";
|
|
36
38
|
import type { HttpClientResponse } from "effect/http";
|
|
37
39
|
|
|
@@ -661,9 +663,14 @@ export function continuation(request: HttpClientRequest.HttpClientRequest, nextL
|
|
|
661
663
|
return refused("A continuation URL must be an HTTPS link to the same operation path");
|
|
662
664
|
}
|
|
663
665
|
return Effect.succeed(
|
|
664
|
-
HttpClientRequest.
|
|
665
|
-
|
|
666
|
-
|
|
666
|
+
HttpClientRequest.makeWith(
|
|
667
|
+
request.method,
|
|
668
|
+
`${declared.origin}${next.pathname}${next.search}`,
|
|
669
|
+
UrlParams.empty,
|
|
670
|
+
Option.none(),
|
|
671
|
+
request.headers,
|
|
672
|
+
HttpBody.empty,
|
|
673
|
+
),
|
|
667
674
|
);
|
|
668
675
|
}
|
|
669
676
|
|
|
@@ -707,7 +714,17 @@ function redirect(response: HttpClientResponse.HttpClientResponse) {
|
|
|
707
714
|
: sent;
|
|
708
715
|
return url.origin === new URL(sent.url).origin
|
|
709
716
|
? HttpClientRequest.setUrl(request, url)
|
|
710
|
-
: HttpClientRequest.
|
|
717
|
+
: HttpClientRequest.setUrl(
|
|
718
|
+
HttpClientRequest.makeWith(
|
|
719
|
+
request.method,
|
|
720
|
+
"",
|
|
721
|
+
UrlParams.empty,
|
|
722
|
+
Option.none(),
|
|
723
|
+
Headers.empty,
|
|
724
|
+
request.body,
|
|
725
|
+
),
|
|
726
|
+
url,
|
|
727
|
+
);
|
|
711
728
|
}
|
|
712
729
|
|
|
713
730
|
function follow(
|
package/src/Runner.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NodeRuntime, NodeServices } from "@effect/platform-node";
|
|
1
|
+
import { NodeCrypto, NodeRuntime, NodeServices } from "@effect/platform-node";
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
Array,
|
|
@@ -60,7 +60,9 @@ function initializationError(cause: unknown) {
|
|
|
60
60
|
// This executable runs only in the plugin's process, using its own SDK and Effect.
|
|
61
61
|
pipe(
|
|
62
62
|
Effect.gen(function* () {
|
|
63
|
-
const guestServices = yield* Effect.context<
|
|
63
|
+
const guestServices = yield* Effect.context<
|
|
64
|
+
NodeServices.NodeServices | Layer.Success<typeof NodeCrypto.layer>
|
|
65
|
+
>();
|
|
64
66
|
const scope = yield* Scope.Scope;
|
|
65
67
|
const runtimeScope = yield* Scope.fork(scope, "sequential");
|
|
66
68
|
const failed = yield* Deferred.make<never, PluginRuntime.PluginExecutionError>();
|
|
@@ -242,7 +244,6 @@ pipe(
|
|
|
242
244
|
);
|
|
243
245
|
}),
|
|
244
246
|
Effect.scoped,
|
|
245
|
-
|
|
246
|
-
Effect.provide(NodeServices.layer),
|
|
247
|
+
Effect.provide([NodeServices.layer, NodeCrypto.layer]),
|
|
247
248
|
NodeRuntime.runMain({ disableErrorReporting: process.argv[4] !== "inspect" }),
|
|
248
249
|
);
|