@codeworksh/schema 0.0.0-stage → 0.1.0-canary.165.2.g336229f9
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/LICENSE +21 -0
- package/README.md +47 -2
- package/common.d.mts +86 -0
- package/common.mjs +88 -0
- package/common.mjs.map +1 -0
- package/daemon.d.mts +12 -0
- package/daemon.mjs +22 -0
- package/daemon.mjs.map +1 -0
- package/door.d.mts +33 -0
- package/door.mjs +52 -0
- package/door.mjs.map +1 -0
- package/event.d.mts +79 -0
- package/event.mjs +35 -0
- package/event.mjs.map +1 -0
- package/forwarded.d.mts +13 -0
- package/forwarded.mjs +25 -0
- package/forwarded.mjs.map +1 -0
- package/host/envelope.d.mts +36 -0
- package/host/envelope.mjs +35 -0
- package/host/envelope.mjs.map +1 -0
- package/host/part.d.mts +2 -0
- package/host/part.mjs +60 -0
- package/host/part.mjs.map +1 -0
- package/host/principal.d.mts +36 -0
- package/host/principal.mjs +24 -0
- package/host/principal.mjs.map +1 -0
- package/host/records.d.mts +1051 -0
- package/host/records.mjs +494 -0
- package/host/records.mjs.map +1 -0
- package/host.d.mts +2224 -0
- package/host.mjs +812 -0
- package/host.mjs.map +1 -0
- package/ids.d.mts +53 -0
- package/ids.mjs +60 -0
- package/ids.mjs.map +1 -0
- package/jws.d.mts +84 -0
- package/jws.mjs +119 -0
- package/jws.mjs.map +1 -0
- package/location.d.mts +55 -0
- package/location.mjs +51 -0
- package/location.mjs.map +1 -0
- package/machine.d.mts +77 -0
- package/machine.mjs +48 -0
- package/machine.mjs.map +1 -0
- package/mcp.d.mts +24 -0
- package/mcp.mjs +36 -0
- package/mcp.mjs.map +1 -0
- package/model.d.mts +18 -0
- package/model.mjs +35 -0
- package/model.mjs.map +1 -0
- package/package.json +182 -5
- package/pairing.d.mts +67 -0
- package/pairing.mjs +67 -0
- package/pairing.mjs.map +1 -0
- package/part-Bzm-yNax.d.mts +69 -0
- package/project.d.mts +30 -0
- package/project.mjs +27 -0
- package/project.mjs.map +1 -0
- package/records-316ZUpKX.mjs +127 -0
- package/records-316ZUpKX.mjs.map +1 -0
- package/relay.d.mts +285 -0
- package/relay.mjs +115 -0
- package/relay.mjs.map +1 -0
- package/repo.d.mts +42 -0
- package/repo.mjs +46 -0
- package/repo.mjs.map +1 -0
- package/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/sandbox/driver.d.mts +10 -0
- package/sandbox/driver.mjs +13 -0
- package/sandbox/driver.mjs.map +1 -0
- package/sandbox/errors.d.mts +130 -0
- package/sandbox/errors.mjs +112 -0
- package/sandbox/errors.mjs.map +1 -0
- package/sandbox/instance.d.mts +152 -0
- package/sandbox/instance.mjs +150 -0
- package/sandbox/instance.mjs.map +1 -0
- package/session.d.mts +59 -0
- package/session.mjs +69 -0
- package/session.mjs.map +1 -0
- package/settings.d.mts +22 -0
- package/settings.mjs +32 -0
- package/settings.mjs.map +1 -0
- package/shell.d.mts +5 -0
- package/shell.mjs +7 -0
- package/shell.mjs.map +1 -0
- package/space-CR-9UxdT.d.mts +25 -0
- package/space.d.mts +2 -0
- package/space.mjs +33 -0
- package/space.mjs.map +1 -0
- package/thread.d.mts +50 -0
- package/thread.mjs +69 -0
- package/thread.mjs.map +1 -0
- package/usage-B_TDmpKC.d.mts +15 -0
- package/usage.d.mts +2 -0
- package/usage.mjs +43 -0
- package/usage.mjs.map +1 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { optional } from "../common.mjs";
|
|
3
|
+
import { ID } from "../event.mjs";
|
|
4
|
+
import { Schema } from "effect";
|
|
5
|
+
//#region src/host/envelope.ts
|
|
6
|
+
var envelope_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
+
EncodingError: () => EncodingError,
|
|
8
|
+
EventEnvelope: () => EventEnvelope,
|
|
9
|
+
HostEnvelope: () => envelope_exports
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* The wire form of an event payload. `data` is carried in its encoded form — decoded payloads are
|
|
13
|
+
* not wire-safe (`Schema.Duration`, aikit class transforms) — so clients decode it lazily through
|
|
14
|
+
* their own copy of the registry and can skip types they do not know.
|
|
15
|
+
*/
|
|
16
|
+
const EventEnvelope = Schema.Struct({
|
|
17
|
+
id: ID,
|
|
18
|
+
type: Schema.String,
|
|
19
|
+
durable: optional(Schema.Struct({
|
|
20
|
+
aggregateId: Schema.String,
|
|
21
|
+
seq: Schema.Int,
|
|
22
|
+
version: Schema.Int
|
|
23
|
+
})),
|
|
24
|
+
metadata: optional(Schema.Record(Schema.String, Schema.String)),
|
|
25
|
+
data: Schema.Unknown
|
|
26
|
+
});
|
|
27
|
+
/** The server could not encode an event for the wire; it disconnects every live subscriber. */
|
|
28
|
+
var EncodingError = class extends Schema.TaggedError()("EventEncodingError", {
|
|
29
|
+
type: Schema.String,
|
|
30
|
+
cause: Schema.Defect()
|
|
31
|
+
}) {};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { EncodingError, EventEnvelope, envelope_exports as HostEnvelope };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=envelope.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"envelope.mjs","names":[],"sources":["../../../src/host/envelope.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport { optional } from \"../common.ts\";\nimport { ID } from \"../event.ts\";\n\n/**\n * The wire form of an event payload. `data` is carried in its encoded form — decoded payloads are\n * not wire-safe (`Schema.Duration`, aikit class transforms) — so clients decode it lazily through\n * their own copy of the registry and can skip types they do not know.\n */\nexport const EventEnvelope = Schema.Struct({\n\tid: ID,\n\ttype: Schema.String,\n\tdurable: optional(Schema.Struct({ aggregateId: Schema.String, seq: Schema.Int, version: Schema.Int })),\n\tmetadata: optional(Schema.Record(Schema.String, Schema.String)),\n\tdata: Schema.Unknown,\n});\nexport type EventEnvelope = typeof EventEnvelope.Type;\n\n/** The server could not encode an event for the wire; it disconnects every live subscriber. */\nexport class EncodingError extends Schema.TaggedError<EncodingError>()(\"EventEncodingError\", {\n\ttype: Schema.String,\n\tcause: Schema.Defect(),\n}) {}\n\nexport * as HostEnvelope from \"./envelope.ts\";\n"],"mappings":";;;;;;;;;;;;;;;AASA,MAAa,gBAAgB,OAAO,OAAO;CAC1C,IAAI;CACJ,MAAM,OAAO;CACb,SAAS,SAAS,OAAO,OAAO;EAAE,aAAa,OAAO;EAAQ,KAAK,OAAO;EAAK,SAAS,OAAO;CAAI,CAAC,CAAC;CACrG,UAAU,SAAS,OAAO,OAAO,OAAO,QAAQ,OAAO,MAAM,CAAC;CAC9D,MAAM,OAAO;AACd,CAAC;;AAID,IAAa,gBAAb,cAAmC,OAAO,YAA2B,CAAC,CAAC,sBAAsB;CAC5F,MAAM,OAAO;CACb,OAAO,OAAO,OAAO;AACtB,CAAC,CAAC,CAAC,CAAC"}
|
package/host/part.d.mts
ADDED
package/host/part.mjs
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
//#region src/host/part.ts
|
|
4
|
+
var part_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
HostPart: () => part_exports,
|
|
6
|
+
Part: () => Part,
|
|
7
|
+
ToolCall: () => ToolCall
|
|
8
|
+
});
|
|
9
|
+
const TextContent = Schema.Struct({
|
|
10
|
+
type: Schema.Literal("text"),
|
|
11
|
+
text: Schema.String
|
|
12
|
+
});
|
|
13
|
+
const ImageContent = Schema.Struct({
|
|
14
|
+
type: Schema.Literal("image"),
|
|
15
|
+
data: Schema.String,
|
|
16
|
+
mimeType: Schema.String
|
|
17
|
+
});
|
|
18
|
+
const ThinkingContent = Schema.Struct({
|
|
19
|
+
type: Schema.Literal("thinking"),
|
|
20
|
+
thinking: Schema.String,
|
|
21
|
+
/** The provider withheld the reasoning; `thinking` is then empty. */
|
|
22
|
+
redacted: Schema.optionalKey(Schema.Boolean)
|
|
23
|
+
});
|
|
24
|
+
/** aikit's ToolStatusEnum. */
|
|
25
|
+
const ToolStatus = Schema.Literals([
|
|
26
|
+
"pending",
|
|
27
|
+
"running",
|
|
28
|
+
"completed",
|
|
29
|
+
"error",
|
|
30
|
+
"skipped",
|
|
31
|
+
"aborted"
|
|
32
|
+
]);
|
|
33
|
+
const ToolResult = Schema.Struct({
|
|
34
|
+
content: Schema.Array(Schema.Union([TextContent, ImageContent])),
|
|
35
|
+
isError: Schema.Boolean
|
|
36
|
+
});
|
|
37
|
+
const ToolCall = Schema.Struct({
|
|
38
|
+
type: Schema.Literal("toolCall"),
|
|
39
|
+
callID: Schema.String,
|
|
40
|
+
name: Schema.String,
|
|
41
|
+
arguments: Schema.Record(Schema.String, Schema.Json),
|
|
42
|
+
status: ToolStatus,
|
|
43
|
+
/** Present once the call settled (completed, error, skipped, aborted). */
|
|
44
|
+
result: Schema.optionalKey(ToolResult),
|
|
45
|
+
/** Epoch milliseconds: started, and last lifecycle update. */
|
|
46
|
+
time: Schema.optionalKey(Schema.Struct({
|
|
47
|
+
start: Schema.Finite,
|
|
48
|
+
end: Schema.Finite
|
|
49
|
+
}))
|
|
50
|
+
});
|
|
51
|
+
const Part = Schema.Union([
|
|
52
|
+
TextContent,
|
|
53
|
+
ImageContent,
|
|
54
|
+
ThinkingContent,
|
|
55
|
+
ToolCall
|
|
56
|
+
]);
|
|
57
|
+
//#endregion
|
|
58
|
+
export { part_exports as HostPart, Part, ToolCall };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=part.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"part.mjs","names":[],"sources":["../../../src/host/part.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\n/*\n * A stored message part as clients see it: aikit's part JSON (persisted verbatim by the harness),\n * narrowed to what a client renders. Provider replay data (signatures, namespaces) and tool\n * `details` are left out, so decoding a stored part drops them.\n */\n\nconst TextContent = Schema.Struct({ type: Schema.Literal(\"text\"), text: Schema.String });\nconst ImageContent = Schema.Struct({\n\ttype: Schema.Literal(\"image\"),\n\tdata: Schema.String,\n\tmimeType: Schema.String,\n});\nconst ThinkingContent = Schema.Struct({\n\ttype: Schema.Literal(\"thinking\"),\n\tthinking: Schema.String,\n\t/** The provider withheld the reasoning; `thinking` is then empty. */\n\tredacted: Schema.optionalKey(Schema.Boolean),\n});\n\n/** aikit's ToolStatusEnum. */\nconst ToolStatus = Schema.Literals([\"pending\", \"running\", \"completed\", \"error\", \"skipped\", \"aborted\"]);\n\nconst ToolResult = Schema.Struct({\n\tcontent: Schema.Array(Schema.Union([TextContent, ImageContent])),\n\tisError: Schema.Boolean,\n});\n\nexport const ToolCall = Schema.Struct({\n\ttype: Schema.Literal(\"toolCall\"),\n\tcallID: Schema.String,\n\tname: Schema.String,\n\targuments: Schema.Record(Schema.String, Schema.Json),\n\tstatus: ToolStatus,\n\t/** Present once the call settled (completed, error, skipped, aborted). */\n\tresult: Schema.optionalKey(ToolResult),\n\t/** Epoch milliseconds: started, and last lifecycle update. */\n\ttime: Schema.optionalKey(Schema.Struct({ start: Schema.Finite, end: Schema.Finite })),\n});\nexport type ToolCall = typeof ToolCall.Type;\n\nexport const Part = Schema.Union([TextContent, ImageContent, ThinkingContent, ToolCall]);\nexport type Part = typeof Part.Type;\n\nexport * as HostPart from \"./part.ts\";\n"],"mappings":";;;;;;;;AAQA,MAAM,cAAc,OAAO,OAAO;CAAE,MAAM,OAAO,QAAQ,MAAM;CAAG,MAAM,OAAO;AAAO,CAAC;AACvF,MAAM,eAAe,OAAO,OAAO;CAClC,MAAM,OAAO,QAAQ,OAAO;CAC5B,MAAM,OAAO;CACb,UAAU,OAAO;AAClB,CAAC;AACD,MAAM,kBAAkB,OAAO,OAAO;CACrC,MAAM,OAAO,QAAQ,UAAU;CAC/B,UAAU,OAAO;;CAEjB,UAAU,OAAO,YAAY,OAAO,OAAO;AAC5C,CAAC;;AAGD,MAAM,aAAa,OAAO,SAAS;CAAC;CAAW;CAAW;CAAa;CAAS;CAAW;AAAS,CAAC;AAErG,MAAM,aAAa,OAAO,OAAO;CAChC,SAAS,OAAO,MAAM,OAAO,MAAM,CAAC,aAAa,YAAY,CAAC,CAAC;CAC/D,SAAS,OAAO;AACjB,CAAC;AAED,MAAa,WAAW,OAAO,OAAO;CACrC,MAAM,OAAO,QAAQ,UAAU;CAC/B,QAAQ,OAAO;CACf,MAAM,OAAO;CACb,WAAW,OAAO,OAAO,OAAO,QAAQ,OAAO,IAAI;CACnD,QAAQ;;CAER,QAAQ,OAAO,YAAY,UAAU;;CAErC,MAAM,OAAO,YAAY,OAAO,OAAO;EAAE,OAAO,OAAO;EAAQ,KAAK,OAAO;CAAO,CAAC,CAAC;AACrF,CAAC;AAGD,MAAa,OAAO,OAAO,MAAM;CAAC;CAAa;CAAc;CAAiB;AAAQ,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Context, Schema } from "effect";
|
|
2
|
+
import { RpcMiddleware } from "effect/rpc";
|
|
3
|
+
declare namespace principal_d_exports {
|
|
4
|
+
export { Current, Door, Forbidden, principal_d_exports as HostPrincipal, Principal, Unauthorized };
|
|
5
|
+
}
|
|
6
|
+
/** Who is calling, decided once per connection by the listener's door. */
|
|
7
|
+
export type Principal =
|
|
8
|
+
/** Holds the home's token, from this computer: nothing stored about who. */
|
|
9
|
+
{
|
|
10
|
+
readonly kind: "local";
|
|
11
|
+
} |
|
|
12
|
+
/** A paired device, by the id `codework service devices` lists. */
|
|
13
|
+
{
|
|
14
|
+
readonly kind: "device";
|
|
15
|
+
readonly id: string;
|
|
16
|
+
};
|
|
17
|
+
declare const Current_base: Context.ServiceClass<Current, "@codeworksh/cli/server/principal/Current", Principal>;
|
|
18
|
+
export declare class Current extends Current_base {}
|
|
19
|
+
declare const Unauthorized_base: Schema.Class<Unauthorized, Schema.TaggedStruct<"Server.Unauthorized", {
|
|
20
|
+
readonly message: Schema.String;
|
|
21
|
+
}>, import("effect/Cause").YieldableError>;
|
|
22
|
+
export declare class Unauthorized extends Unauthorized_base {}
|
|
23
|
+
declare const Forbidden_base: Schema.Class<Forbidden, Schema.TaggedStruct<"Server.Forbidden", {
|
|
24
|
+
readonly message: Schema.String;
|
|
25
|
+
}>, import("effect/Cause").YieldableError>;
|
|
26
|
+
/** A call this caller may not make: only this computer manages who is paired, and only a device leaves. */
|
|
27
|
+
export declare class Forbidden extends Forbidden_base {}
|
|
28
|
+
declare const Door_base: RpcMiddleware.ServiceClass<Door, "@codeworksh/cli/server/principal/Door", Current, typeof Unauthorized, never, never, false>;
|
|
29
|
+
/**
|
|
30
|
+
* Decides the caller of every RPC from the connection it comes on. The contract carries the tag; each
|
|
31
|
+
* listener provides its own implementation where it is built.
|
|
32
|
+
*/
|
|
33
|
+
export declare class Door extends Door_base {}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { principal_d_exports as HostPrincipal };
|
|
36
|
+
//# sourceMappingURL=principal.d.mts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { Context, Schema } from "effect";
|
|
3
|
+
import { RpcMiddleware } from "effect/rpc";
|
|
4
|
+
//#region src/host/principal.ts
|
|
5
|
+
var principal_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
+
Current: () => Current,
|
|
7
|
+
Door: () => Door,
|
|
8
|
+
Forbidden: () => Forbidden,
|
|
9
|
+
HostPrincipal: () => principal_exports,
|
|
10
|
+
Unauthorized: () => Unauthorized
|
|
11
|
+
});
|
|
12
|
+
var Current = class extends Context.Service()("@codeworksh/cli/server/principal/Current") {};
|
|
13
|
+
var Unauthorized = class extends Schema.TaggedError()("Server.Unauthorized", { message: Schema.String }) {};
|
|
14
|
+
/** A call this caller may not make: only this computer manages who is paired, and only a device leaves. */
|
|
15
|
+
var Forbidden = class extends Schema.TaggedError()("Server.Forbidden", { message: Schema.String }) {};
|
|
16
|
+
/**
|
|
17
|
+
* Decides the caller of every RPC from the connection it comes on. The contract carries the tag; each
|
|
18
|
+
* listener provides its own implementation where it is built.
|
|
19
|
+
*/
|
|
20
|
+
var Door = class extends RpcMiddleware.Service()("@codeworksh/cli/server/principal/Door", { error: Unauthorized }) {};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Current, Door, Forbidden, principal_exports as HostPrincipal, Unauthorized };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=principal.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"principal.mjs","names":[],"sources":["../../../src/host/principal.ts"],"sourcesContent":["import { Context, Schema } from \"effect\";\nimport { RpcMiddleware } from \"effect/rpc\";\n\n/** Who is calling, decided once per connection by the listener's door. */\nexport type Principal =\n\t/** Holds the home's token, from this computer: nothing stored about who. */\n\t| { readonly kind: \"local\" }\n\t/** A paired device, by the id `codework service devices` lists. */\n\t| { readonly kind: \"device\"; readonly id: string };\n\nexport class Current extends Context.Service<Current, Principal>()(\"@codeworksh/cli/server/principal/Current\") {}\n\nexport class Unauthorized extends Schema.TaggedError<Unauthorized>()(\"Server.Unauthorized\", {\n\tmessage: Schema.String,\n}) {}\n\n/** A call this caller may not make: only this computer manages who is paired, and only a device leaves. */\nexport class Forbidden extends Schema.TaggedError<Forbidden>()(\"Server.Forbidden\", {\n\tmessage: Schema.String,\n}) {}\n\n/**\n * Decides the caller of every RPC from the connection it comes on. The contract carries the tag; each\n * listener provides its own implementation where it is built.\n */\nexport class Door extends RpcMiddleware.Service<Door, { provides: Current }>()(\n\t\"@codeworksh/cli/server/principal/Door\",\n\t{ error: Unauthorized },\n) {}\n\nexport * as HostPrincipal from \"./principal.ts\";\n"],"mappings":";;;;;;;;;;;AAUA,IAAa,UAAb,cAA6B,QAAQ,QAA4B,CAAC,CAAC,0CAA0C,CAAC,CAAC,CAAC;AAEhH,IAAa,eAAb,cAAkC,OAAO,YAA0B,CAAC,CAAC,uBAAuB,EAC3F,SAAS,OAAO,OACjB,CAAC,CAAC,CAAC,CAAC;;AAGJ,IAAa,YAAb,cAA+B,OAAO,YAAuB,CAAC,CAAC,oBAAoB,EAClF,SAAS,OAAO,OACjB,CAAC,CAAC,CAAC,CAAC;;;;;AAMJ,IAAa,OAAb,cAA0B,cAAc,QAAqC,CAAC,CAC7E,yCACA,EAAE,OAAO,aAAa,CACvB,CAAC,CAAC,CAAC"}
|