@codeworksh/schema 0.0.0 → 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.
Files changed (96) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +48 -0
  3. package/common.d.mts +86 -0
  4. package/common.mjs +88 -0
  5. package/common.mjs.map +1 -0
  6. package/daemon.d.mts +12 -0
  7. package/daemon.mjs +22 -0
  8. package/daemon.mjs.map +1 -0
  9. package/door.d.mts +33 -0
  10. package/door.mjs +52 -0
  11. package/door.mjs.map +1 -0
  12. package/event.d.mts +79 -0
  13. package/event.mjs +35 -0
  14. package/event.mjs.map +1 -0
  15. package/forwarded.d.mts +13 -0
  16. package/forwarded.mjs +25 -0
  17. package/forwarded.mjs.map +1 -0
  18. package/host/envelope.d.mts +36 -0
  19. package/host/envelope.mjs +35 -0
  20. package/host/envelope.mjs.map +1 -0
  21. package/host/part.d.mts +2 -0
  22. package/host/part.mjs +60 -0
  23. package/host/part.mjs.map +1 -0
  24. package/host/principal.d.mts +36 -0
  25. package/host/principal.mjs +24 -0
  26. package/host/principal.mjs.map +1 -0
  27. package/host/records.d.mts +1051 -0
  28. package/host/records.mjs +494 -0
  29. package/host/records.mjs.map +1 -0
  30. package/host.d.mts +2224 -0
  31. package/host.mjs +812 -0
  32. package/host.mjs.map +1 -0
  33. package/ids.d.mts +53 -0
  34. package/ids.mjs +60 -0
  35. package/ids.mjs.map +1 -0
  36. package/jws.d.mts +84 -0
  37. package/jws.mjs +119 -0
  38. package/jws.mjs.map +1 -0
  39. package/location.d.mts +55 -0
  40. package/location.mjs +51 -0
  41. package/location.mjs.map +1 -0
  42. package/machine.d.mts +77 -0
  43. package/machine.mjs +48 -0
  44. package/machine.mjs.map +1 -0
  45. package/mcp.d.mts +24 -0
  46. package/mcp.mjs +36 -0
  47. package/mcp.mjs.map +1 -0
  48. package/model.d.mts +18 -0
  49. package/model.mjs +35 -0
  50. package/model.mjs.map +1 -0
  51. package/package.json +181 -4
  52. package/pairing.d.mts +67 -0
  53. package/pairing.mjs +67 -0
  54. package/pairing.mjs.map +1 -0
  55. package/part-Bzm-yNax.d.mts +69 -0
  56. package/project.d.mts +30 -0
  57. package/project.mjs +27 -0
  58. package/project.mjs.map +1 -0
  59. package/records-316ZUpKX.mjs +127 -0
  60. package/records-316ZUpKX.mjs.map +1 -0
  61. package/relay.d.mts +285 -0
  62. package/relay.mjs +115 -0
  63. package/relay.mjs.map +1 -0
  64. package/repo.d.mts +42 -0
  65. package/repo.mjs +46 -0
  66. package/repo.mjs.map +1 -0
  67. package/rolldown-runtime-D7D4PA-g.mjs +13 -0
  68. package/sandbox/driver.d.mts +10 -0
  69. package/sandbox/driver.mjs +13 -0
  70. package/sandbox/driver.mjs.map +1 -0
  71. package/sandbox/errors.d.mts +130 -0
  72. package/sandbox/errors.mjs +112 -0
  73. package/sandbox/errors.mjs.map +1 -0
  74. package/sandbox/instance.d.mts +152 -0
  75. package/sandbox/instance.mjs +150 -0
  76. package/sandbox/instance.mjs.map +1 -0
  77. package/session.d.mts +59 -0
  78. package/session.mjs +69 -0
  79. package/session.mjs.map +1 -0
  80. package/settings.d.mts +22 -0
  81. package/settings.mjs +32 -0
  82. package/settings.mjs.map +1 -0
  83. package/shell.d.mts +5 -0
  84. package/shell.mjs +7 -0
  85. package/shell.mjs.map +1 -0
  86. package/space-CR-9UxdT.d.mts +25 -0
  87. package/space.d.mts +2 -0
  88. package/space.mjs +33 -0
  89. package/space.mjs.map +1 -0
  90. package/thread.d.mts +50 -0
  91. package/thread.mjs +69 -0
  92. package/thread.mjs.map +1 -0
  93. package/usage-B_TDmpKC.d.mts +15 -0
  94. package/usage.d.mts +2 -0
  95. package/usage.mjs +43 -0
  96. package/usage.mjs.map +1 -0
package/machine.mjs ADDED
@@ -0,0 +1,48 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { n as Connected } from "./records-316ZUpKX.mjs";
3
+ import { Schema } from "effect";
4
+ //#region src/machine.ts
5
+ var machine_exports = /* @__PURE__ */ __exportAll({
6
+ ConnectError: () => ConnectError,
7
+ ConnectEvent: () => ConnectEvent,
8
+ Disconnect: () => Disconnect,
9
+ Disconnected: () => Disconnected,
10
+ Machine: () => machine_exports,
11
+ Status: () => Status
12
+ });
13
+ /** This machine and the workspaces it is connected to, from its `machine.json`. */
14
+ const Status = Schema.Struct({
15
+ /** None before the machine's first connect gives it an identity. */
16
+ id: Schema.NullOr(Schema.String),
17
+ /** The OS's name for the host, read fresh. */
18
+ localHostName: Schema.String,
19
+ /** The user's own name for it, shown in place of `localHostName` when set. */
20
+ givenName: Schema.NullOr(Schema.String),
21
+ /**
22
+ * Each link with the thumbprint of its key: a relay row under another key is not this machine's. A
23
+ * leaving link was ended here while the relay couldn't be reached; it is revoked once it can. Older
24
+ * machines don't report it.
25
+ */
26
+ workspaces: Schema.Array(Schema.Struct({
27
+ id: Schema.String,
28
+ name: Schema.String,
29
+ keyId: Schema.String,
30
+ leaving: Schema.optionalKey(Schema.Boolean)
31
+ }))
32
+ });
33
+ const Disconnect = Schema.Struct({
34
+ workspaceId: Schema.String,
35
+ keyId: Schema.String
36
+ });
37
+ /** A disconnect: this machine afterwards, and whether the relay confirmed; if not, the link is left leaving. */
38
+ const Disconnected = Schema.Struct({
39
+ status: Status,
40
+ revoked: Schema.Boolean
41
+ });
42
+ /** A connect's progress: the code to approve, then the link once a member approved it. */
43
+ const ConnectEvent = Schema.Union([Schema.TaggedStruct("Code", { userCode: Schema.String }), Schema.TaggedStruct("Connected", { connected: Connected })]);
44
+ var ConnectError = class extends Schema.TaggedError()("Machine.ConnectError", { message: Schema.String }) {};
45
+ //#endregion
46
+ export { ConnectError, ConnectEvent, Disconnect, Disconnected, machine_exports as Machine, Status };
47
+
48
+ //# sourceMappingURL=machine.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"machine.mjs","names":[],"sources":["../../src/machine.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport { Connected } from \"./records.ts\";\n\n// A CodeWork server as a machine: what its clients (the desktop app) see over the CodeWork RPC.\n\n/** This machine and the workspaces it is connected to, from its `machine.json`. */\nexport const Status = Schema.Struct({\n\t/** None before the machine's first connect gives it an identity. */\n\tid: Schema.NullOr(Schema.String),\n\t/** The OS's name for the host, read fresh. */\n\tlocalHostName: Schema.String,\n\t/** The user's own name for it, shown in place of `localHostName` when set. */\n\tgivenName: Schema.NullOr(Schema.String),\n\t/**\n\t * Each link with the thumbprint of its key: a relay row under another key is not this machine's. A\n\t * leaving link was ended here while the relay couldn't be reached; it is revoked once it can. Older\n\t * machines don't report it.\n\t */\n\tworkspaces: Schema.Array(\n\t\tSchema.Struct({\n\t\t\tid: Schema.String,\n\t\t\tname: Schema.String,\n\t\t\tkeyId: Schema.String,\n\t\t\tleaving: Schema.optionalKey(Schema.Boolean),\n\t\t}),\n\t),\n});\nexport type Status = typeof Status.Type;\n\nexport const Disconnect = Schema.Struct({ workspaceId: Schema.String, keyId: Schema.String });\n\n/** A disconnect: this machine afterwards, and whether the relay confirmed; if not, the link is left leaving. */\nexport const Disconnected = Schema.Struct({ status: Status, revoked: Schema.Boolean });\nexport type Disconnected = typeof Disconnected.Type;\n\n/** A connect's progress: the code to approve, then the link once a member approved it. */\nexport const ConnectEvent = Schema.Union([\n\tSchema.TaggedStruct(\"Code\", { userCode: Schema.String }),\n\tSchema.TaggedStruct(\"Connected\", { connected: Connected }),\n]);\nexport type ConnectEvent = typeof ConnectEvent.Type;\n\nexport class ConnectError extends Schema.TaggedError<ConnectError>()(\"Machine.ConnectError\", {\n\tmessage: Schema.String,\n}) {}\n\nexport * as Machine from \"./machine.ts\";\n"],"mappings":";;;;;;;;;;;;;AAMA,MAAa,SAAS,OAAO,OAAO;;CAEnC,IAAI,OAAO,OAAO,OAAO,MAAM;;CAE/B,eAAe,OAAO;;CAEtB,WAAW,OAAO,OAAO,OAAO,MAAM;;;;;;CAMtC,YAAY,OAAO,MAClB,OAAO,OAAO;EACb,IAAI,OAAO;EACX,MAAM,OAAO;EACb,OAAO,OAAO;EACd,SAAS,OAAO,YAAY,OAAO,OAAO;CAC3C,CAAC,CACF;AACD,CAAC;AAGD,MAAa,aAAa,OAAO,OAAO;CAAE,aAAa,OAAO;CAAQ,OAAO,OAAO;AAAO,CAAC;;AAG5F,MAAa,eAAe,OAAO,OAAO;CAAE,QAAQ;CAAQ,SAAS,OAAO;AAAQ,CAAC;;AAIrF,MAAa,eAAe,OAAO,MAAM,CACxC,OAAO,aAAa,QAAQ,EAAE,UAAU,OAAO,OAAO,CAAC,GACvD,OAAO,aAAa,aAAa,EAAE,WAAW,UAAU,CAAC,CAC1D,CAAC;AAGD,IAAa,eAAb,cAAkC,OAAO,YAA0B,CAAC,CAAC,wBAAwB,EAC5F,SAAS,OAAO,OACjB,CAAC,CAAC,CAAC,CAAC"}
package/mcp.d.mts ADDED
@@ -0,0 +1,24 @@
1
+ import { Schema } from "effect";
2
+ declare namespace mcp_d_exports {
3
+ export { mcp_d_exports as McpSchema, McpSkipped, McpState, UnknownServerError };
4
+ }
5
+ /** Every state an MCP server can be in. */
6
+ export declare const McpState: Schema.Literals<readonly ["connecting", "connected", "failed", "authenticate", "disconnected", "disabled"]>;
7
+ /**
8
+ * The tools a server listed that were left out because the MCP SDK rejects them: their names, and how
9
+ * many had no usable name.
10
+ */
11
+ export declare const McpSkipped: Schema.Struct<{
12
+ readonly names: Schema.$Array<Schema.String>;
13
+ readonly unnamed: Schema.Int;
14
+ }>;
15
+ export type McpSkipped = typeof McpSkipped.Type;
16
+ declare const UnknownServerError_base: Schema.Class<UnknownServerError, Schema.TaggedStruct<"Mcp.UnknownServerError", {
17
+ readonly server: Schema.String;
18
+ readonly message: Schema.String;
19
+ }>, import("effect/Cause").YieldableError>;
20
+ /** The thread has no MCP server of this name, a turn replaced it meanwhile, or no turn started its servers yet. */
21
+ export declare class UnknownServerError extends UnknownServerError_base {}
22
+ //#endregion
23
+ export { mcp_d_exports as McpSchema };
24
+ //# sourceMappingURL=mcp.d.mts.map
package/mcp.mjs ADDED
@@ -0,0 +1,36 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { NonNegativeInt } from "./common.mjs";
3
+ import { Schema } from "effect";
4
+ //#region src/mcp.ts
5
+ var mcp_exports = /* @__PURE__ */ __exportAll({
6
+ McpSchema: () => mcp_exports,
7
+ McpSkipped: () => McpSkipped,
8
+ McpState: () => McpState,
9
+ UnknownServerError: () => UnknownServerError
10
+ });
11
+ /** Every state an MCP server can be in. */
12
+ const McpState = Schema.Literals([
13
+ "connecting",
14
+ "connected",
15
+ "failed",
16
+ "authenticate",
17
+ "disconnected",
18
+ "disabled"
19
+ ]);
20
+ /**
21
+ * The tools a server listed that were left out because the MCP SDK rejects them: their names, and how
22
+ * many had no usable name.
23
+ */
24
+ const McpSkipped = Schema.Struct({
25
+ names: Schema.Array(Schema.String),
26
+ unnamed: NonNegativeInt
27
+ });
28
+ /** The thread has no MCP server of this name, a turn replaced it meanwhile, or no turn started its servers yet. */
29
+ var UnknownServerError = class extends Schema.TaggedError()("Mcp.UnknownServerError", {
30
+ server: Schema.String,
31
+ message: Schema.String
32
+ }) {};
33
+ //#endregion
34
+ export { mcp_exports as McpSchema, McpSkipped, McpState, UnknownServerError };
35
+
36
+ //# sourceMappingURL=mcp.mjs.map
package/mcp.mjs.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.mjs","names":[],"sources":["../../src/mcp.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport { NonNegativeInt } from \"./common.ts\";\n\n/** Every state an MCP server can be in. */\nexport const McpState = Schema.Literals([\n\t\"connecting\",\n\t\"connected\",\n\t\"failed\",\n\t\"authenticate\",\n\t\"disconnected\",\n\t\"disabled\",\n]);\n\n/**\n * The tools a server listed that were left out because the MCP SDK rejects them: their names, and how\n * many had no usable name.\n */\nexport const McpSkipped = Schema.Struct({ names: Schema.Array(Schema.String), unnamed: NonNegativeInt });\nexport type McpSkipped = typeof McpSkipped.Type;\n\n/** The thread has no MCP server of this name, a turn replaced it meanwhile, or no turn started its servers yet. */\nexport class UnknownServerError extends Schema.TaggedError<UnknownServerError>()(\"Mcp.UnknownServerError\", {\n\tserver: Schema.String,\n\tmessage: Schema.String,\n}) {}\n\nexport * as McpSchema from \"./mcp.ts\";\n"],"mappings":";;;;;;;;;;;AAIA,MAAa,WAAW,OAAO,SAAS;CACvC;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;;;;;AAMD,MAAa,aAAa,OAAO,OAAO;CAAE,OAAO,OAAO,MAAM,OAAO,MAAM;CAAG,SAAS;AAAe,CAAC;;AAIvG,IAAa,qBAAb,cAAwC,OAAO,YAAgC,CAAC,CAAC,0BAA0B;CAC1G,QAAQ,OAAO;CACf,SAAS,OAAO;AACjB,CAAC,CAAC,CAAC,CAAC"}
package/model.d.mts ADDED
@@ -0,0 +1,18 @@
1
+ import { Schema } from "effect";
2
+ declare namespace model_d_exports {
3
+ export { ModelCatalogError, model_d_exports as ModelSchema, ThinkingLevel };
4
+ }
5
+ /** How hard a model reasons, ascending: aikit's `ThinkingLevel`, which the harness holds this to. */
6
+ export declare const ThinkingLevel: Schema.Literals<readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max"]>;
7
+ export type ThinkingLevel = typeof ThinkingLevel.Type;
8
+ declare const ModelCatalogError_base: Schema.Class<ModelCatalogError, Schema.TaggedStruct<"Runner.ModelCatalogError", {
9
+ readonly path: Schema.String;
10
+ readonly reason: Schema.Literals<readonly ["unreadable", "empty", "invalid"]>;
11
+ readonly detail: Schema.String;
12
+ }>, import("effect/Cause").YieldableError>;
13
+ export declare class ModelCatalogError extends ModelCatalogError_base {
14
+ get message(): string;
15
+ }
16
+ //#endregion
17
+ export { model_d_exports as ModelSchema };
18
+ //# sourceMappingURL=model.d.mts.map
package/model.mjs ADDED
@@ -0,0 +1,35 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { Schema } from "effect";
3
+ //#region src/model.ts
4
+ var model_exports = /* @__PURE__ */ __exportAll({
5
+ ModelCatalogError: () => ModelCatalogError,
6
+ ModelSchema: () => model_exports,
7
+ ThinkingLevel: () => ThinkingLevel
8
+ });
9
+ /** How hard a model reasons, ascending: aikit's `ThinkingLevel`, which the harness holds this to. */
10
+ const ThinkingLevel = Schema.Literals([
11
+ "off",
12
+ "minimal",
13
+ "low",
14
+ "medium",
15
+ "high",
16
+ "xhigh",
17
+ "max"
18
+ ]);
19
+ var ModelCatalogError = class extends Schema.TaggedError()("Runner.ModelCatalogError", {
20
+ path: Schema.String,
21
+ reason: Schema.Literals([
22
+ "unreadable",
23
+ "empty",
24
+ "invalid"
25
+ ]),
26
+ detail: Schema.String
27
+ }) {
28
+ get message() {
29
+ return this.detail;
30
+ }
31
+ };
32
+ //#endregion
33
+ export { ModelCatalogError, model_exports as ModelSchema, ThinkingLevel };
34
+
35
+ //# sourceMappingURL=model.mjs.map
package/model.mjs.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.mjs","names":[],"sources":["../../src/model.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\n/** How hard a model reasons, ascending: aikit's `ThinkingLevel`, which the harness holds this to. */\nexport const ThinkingLevel = Schema.Literals([\"off\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"]);\nexport type ThinkingLevel = typeof ThinkingLevel.Type;\n\nexport class ModelCatalogError extends Schema.TaggedError<ModelCatalogError>()(\"Runner.ModelCatalogError\", {\n\tpath: Schema.String,\n\treason: Schema.Literals([\"unreadable\", \"empty\", \"invalid\"]),\n\tdetail: Schema.String,\n}) {\n\toverride get message(): string {\n\t\treturn this.detail;\n\t}\n}\n\nexport * as ModelSchema from \"./model.ts\";\n"],"mappings":";;;;;;;;;AAGA,MAAa,gBAAgB,OAAO,SAAS;CAAC;CAAO;CAAW;CAAO;CAAU;CAAQ;CAAS;AAAK,CAAC;AAGxG,IAAa,oBAAb,cAAuC,OAAO,YAA+B,CAAC,CAAC,4BAA4B;CAC1G,MAAM,OAAO;CACb,QAAQ,OAAO,SAAS;EAAC;EAAc;EAAS;CAAS,CAAC;CAC1D,QAAQ,OAAO;AAChB,CAAC,CAAC,CAAC;CACF,IAAa,UAAkB;EAC9B,OAAO,KAAK;CACb;AACD"}
package/package.json CHANGED
@@ -1,6 +1,183 @@
1
1
  {
2
- "name": "@codeworksh/schema",
3
- "version": "0.0.0",
4
- "license": "MIT",
5
- "description": "Shared schemas for CodeWork."
2
+ "name": "@codeworksh/schema",
3
+ "version": "0.1.0-canary.165.2.g336229f9",
4
+ "description": "Schemas shared across CodeWork: ids, projects, spaces, locations, sessions, threads, events and sandboxes, the CodeWork RPC server's contract, the Relay API, signed machine requests, pairing and the server's WebSocket door.",
5
+ "keywords": [
6
+ "codework",
7
+ "effect",
8
+ "schema"
9
+ ],
10
+ "homepage": "https://www.codework.sh",
11
+ "bugs": {
12
+ "url": "https://github.com/codeworksh/codework/issues"
13
+ },
14
+ "license": "MIT",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/codeworksh/codework.git",
18
+ "directory": "packages/schema"
19
+ },
20
+ "type": "module",
21
+ "exports": {
22
+ "./common": {
23
+ "types": "./common.d.mts",
24
+ "import": "./common.mjs",
25
+ "default": "./common.mjs"
26
+ },
27
+ "./daemon": {
28
+ "types": "./daemon.d.mts",
29
+ "import": "./daemon.mjs",
30
+ "default": "./daemon.mjs"
31
+ },
32
+ "./door": {
33
+ "types": "./door.d.mts",
34
+ "import": "./door.mjs",
35
+ "default": "./door.mjs"
36
+ },
37
+ "./event": {
38
+ "types": "./event.d.mts",
39
+ "import": "./event.mjs",
40
+ "default": "./event.mjs"
41
+ },
42
+ "./forwarded": {
43
+ "types": "./forwarded.d.mts",
44
+ "import": "./forwarded.mjs",
45
+ "default": "./forwarded.mjs"
46
+ },
47
+ "./host": {
48
+ "types": "./host.d.mts",
49
+ "import": "./host.mjs",
50
+ "default": "./host.mjs"
51
+ },
52
+ "./host/envelope": {
53
+ "types": "./host/envelope.d.mts",
54
+ "import": "./host/envelope.mjs",
55
+ "default": "./host/envelope.mjs"
56
+ },
57
+ "./host/part": {
58
+ "types": "./host/part.d.mts",
59
+ "import": "./host/part.mjs",
60
+ "default": "./host/part.mjs"
61
+ },
62
+ "./host/principal": {
63
+ "types": "./host/principal.d.mts",
64
+ "import": "./host/principal.mjs",
65
+ "default": "./host/principal.mjs"
66
+ },
67
+ "./host/records": {
68
+ "types": "./host/records.d.mts",
69
+ "import": "./host/records.mjs",
70
+ "default": "./host/records.mjs"
71
+ },
72
+ "./ids": {
73
+ "types": "./ids.d.mts",
74
+ "import": "./ids.mjs",
75
+ "default": "./ids.mjs"
76
+ },
77
+ "./jws": {
78
+ "types": "./jws.d.mts",
79
+ "import": "./jws.mjs",
80
+ "default": "./jws.mjs"
81
+ },
82
+ "./location": {
83
+ "types": "./location.d.mts",
84
+ "import": "./location.mjs",
85
+ "default": "./location.mjs"
86
+ },
87
+ "./machine": {
88
+ "types": "./machine.d.mts",
89
+ "import": "./machine.mjs",
90
+ "default": "./machine.mjs"
91
+ },
92
+ "./mcp": {
93
+ "types": "./mcp.d.mts",
94
+ "import": "./mcp.mjs",
95
+ "default": "./mcp.mjs"
96
+ },
97
+ "./model": {
98
+ "types": "./model.d.mts",
99
+ "import": "./model.mjs",
100
+ "default": "./model.mjs"
101
+ },
102
+ "./pairing": {
103
+ "types": "./pairing.d.mts",
104
+ "import": "./pairing.mjs",
105
+ "default": "./pairing.mjs"
106
+ },
107
+ "./project": {
108
+ "types": "./project.d.mts",
109
+ "import": "./project.mjs",
110
+ "default": "./project.mjs"
111
+ },
112
+ "./relay": {
113
+ "types": "./relay.d.mts",
114
+ "import": "./relay.mjs",
115
+ "default": "./relay.mjs"
116
+ },
117
+ "./repo": {
118
+ "types": "./repo.d.mts",
119
+ "import": "./repo.mjs",
120
+ "default": "./repo.mjs"
121
+ },
122
+ "./sandbox/driver": {
123
+ "types": "./sandbox/driver.d.mts",
124
+ "import": "./sandbox/driver.mjs",
125
+ "default": "./sandbox/driver.mjs"
126
+ },
127
+ "./sandbox/errors": {
128
+ "types": "./sandbox/errors.d.mts",
129
+ "import": "./sandbox/errors.mjs",
130
+ "default": "./sandbox/errors.mjs"
131
+ },
132
+ "./sandbox/instance": {
133
+ "types": "./sandbox/instance.d.mts",
134
+ "import": "./sandbox/instance.mjs",
135
+ "default": "./sandbox/instance.mjs"
136
+ },
137
+ "./session": {
138
+ "types": "./session.d.mts",
139
+ "import": "./session.mjs",
140
+ "default": "./session.mjs"
141
+ },
142
+ "./settings": {
143
+ "types": "./settings.d.mts",
144
+ "import": "./settings.mjs",
145
+ "default": "./settings.mjs"
146
+ },
147
+ "./shell": {
148
+ "types": "./shell.d.mts",
149
+ "import": "./shell.mjs",
150
+ "default": "./shell.mjs"
151
+ },
152
+ "./space": {
153
+ "types": "./space.d.mts",
154
+ "import": "./space.mjs",
155
+ "default": "./space.mjs"
156
+ },
157
+ "./thread": {
158
+ "types": "./thread.d.mts",
159
+ "import": "./thread.mjs",
160
+ "default": "./thread.mjs"
161
+ },
162
+ "./usage": {
163
+ "types": "./usage.d.mts",
164
+ "import": "./usage.mjs",
165
+ "default": "./usage.mjs"
166
+ },
167
+ "./package.json": "./package.json"
168
+ },
169
+ "files": [
170
+ "**/*",
171
+ "README.md",
172
+ "LICENSE"
173
+ ],
174
+ "publishConfig": {
175
+ "access": "public"
176
+ },
177
+ "dependencies": {
178
+ "uuidv7": "^1.2.1"
179
+ },
180
+ "peerDependencies": {
181
+ "effect": "4.0.5"
182
+ }
6
183
  }
package/pairing.d.mts ADDED
@@ -0,0 +1,67 @@
1
+ import { Schema } from "effect";
2
+ declare namespace pairing_d_exports {
3
+ export { Device, Exchange, Grant, pairing_d_exports as Pairing, Proof, Refusal, Signed, devicesPath, proofWindow, ticketsPath };
4
+ }
5
+ /** `POST` with {@link Exchange} creates a device: answers 201 with {@link Device}. */
6
+ export declare const devicesPath = "/api/v1/devices";
7
+ /**
8
+ * `POST` with a {@link Signed} {@link Proof} creates a ticket: answers 201 with a {@link Signed} {@link Grant},
9
+ * or 401 with a {@link Signed} {@link Refusal} (empty when the body names no nonce).
10
+ */
11
+ export declare const ticketsPath = "/api/v1/tickets";
12
+ /** What `POST /api/v1/devices` takes: the code a person read, a name for the computer offering it, and its key. */
13
+ export declare const Exchange: Schema.Struct<{
14
+ readonly code: Schema.String;
15
+ readonly label: Schema.String;
16
+ readonly key: Schema.Struct<{
17
+ readonly kty: Schema.Literal<"OKP">;
18
+ readonly crv: Schema.Literal<"Ed25519">;
19
+ readonly x: Schema.String;
20
+ }>;
21
+ }>;
22
+ /** A new device: its id, and the machine's identity key, which signs every {@link Grant}. */
23
+ export declare const Device: Schema.Struct<{
24
+ readonly id: Schema.String;
25
+ readonly machine: Schema.Struct<{
26
+ readonly kty: Schema.Literal<"OKP">;
27
+ readonly crv: Schema.Literal<"Ed25519">;
28
+ readonly x: Schema.String;
29
+ }>;
30
+ }>;
31
+ /** A compact JWS, as both ticket routes carry one. */
32
+ export declare const Signed: Schema.Struct<{
33
+ readonly jws: Schema.String;
34
+ }>;
35
+ /** How long a {@link Proof} is good for, either side of the machine's clock; its nonce is held as long. */
36
+ export declare const proofWindow: number;
37
+ /** A device asking for a ticket, signed with its key and named by the key's thumbprint; each nonce is taken once. */
38
+ export declare const Proof: Schema.Struct<{
39
+ readonly op: Schema.Literal<"ticket.create">;
40
+ /** The thumbprint of the machine key it is for: one device key is paired with every machine. */
41
+ readonly aud: Schema.String;
42
+ readonly device: Schema.String;
43
+ /** Epoch milliseconds. */
44
+ readonly iat: Schema.Finite;
45
+ readonly nonce: Schema.String;
46
+ }>;
47
+ export type Proof = typeof Proof.Type;
48
+ /** A ticket for one socket, signed with the machine's identity key, echoing the {@link Proof}'s nonce. */
49
+ export declare const Grant: Schema.Struct<{
50
+ readonly op: Schema.Literal<"ticket.grant">;
51
+ readonly ticket: Schema.String;
52
+ readonly nonce: Schema.String;
53
+ }>;
54
+ export type Grant = typeof Grant.Type;
55
+ /**
56
+ * A refused {@link Proof}, signed with the machine's identity key, echoing the nonce it named, so a refusal
57
+ * is told from another machine's. `at` is the machine's clock, epoch milliseconds. It never says why.
58
+ */
59
+ export declare const Refusal: Schema.Struct<{
60
+ readonly op: Schema.Literal<"ticket.refuse">;
61
+ readonly nonce: Schema.String;
62
+ readonly at: Schema.Finite;
63
+ }>;
64
+ export type Refusal = typeof Refusal.Type;
65
+ //#endregion
66
+ export { pairing_d_exports as Pairing };
67
+ //# sourceMappingURL=pairing.d.mts.map
package/pairing.mjs ADDED
@@ -0,0 +1,67 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { PublicKey } from "./jws.mjs";
3
+ import { Schema } from "effect";
4
+ //#region src/pairing.ts
5
+ var pairing_exports = /* @__PURE__ */ __exportAll({
6
+ Device: () => Device,
7
+ Exchange: () => Exchange,
8
+ Grant: () => Grant,
9
+ Pairing: () => pairing_exports,
10
+ Proof: () => Proof,
11
+ Refusal: () => Refusal,
12
+ Signed: () => Signed,
13
+ devicesPath: () => devicesPath,
14
+ proofWindow: () => proofWindow,
15
+ ticketsPath: () => ticketsPath
16
+ });
17
+ /** `POST` with {@link Exchange} creates a device: answers 201 with {@link Device}. */
18
+ const devicesPath = "/api/v1/devices";
19
+ /**
20
+ * `POST` with a {@link Signed} {@link Proof} creates a ticket: answers 201 with a {@link Signed} {@link Grant},
21
+ * or 401 with a {@link Signed} {@link Refusal} (empty when the body names no nonce).
22
+ */
23
+ const ticketsPath = "/api/v1/tickets";
24
+ /** What `POST /api/v1/devices` takes: the code a person read, a name for the computer offering it, and its key. */
25
+ const Exchange = Schema.Struct({
26
+ code: Schema.String,
27
+ label: Schema.String.check(Schema.isNonEmpty(), Schema.isMaxLength(100), Schema.isPattern(/^[^\p{Cc}]*$/u)),
28
+ key: PublicKey
29
+ });
30
+ /** A new device: its id, and the machine's identity key, which signs every {@link Grant}. */
31
+ const Device = Schema.Struct({
32
+ id: Schema.String,
33
+ machine: PublicKey
34
+ });
35
+ /** A compact JWS, as both ticket routes carry one. */
36
+ const Signed = Schema.Struct({ jws: Schema.String });
37
+ /** How long a {@link Proof} is good for, either side of the machine's clock; its nonce is held as long. */
38
+ const proofWindow = 3e5;
39
+ /** A device asking for a ticket, signed with its key and named by the key's thumbprint; each nonce is taken once. */
40
+ const Proof = Schema.Struct({
41
+ op: Schema.Literal("ticket.create"),
42
+ /** The thumbprint of the machine key it is for: one device key is paired with every machine. */
43
+ aud: Schema.String,
44
+ device: Schema.String,
45
+ /** Epoch milliseconds. */
46
+ iat: Schema.Finite,
47
+ nonce: Schema.String
48
+ });
49
+ /** A ticket for one socket, signed with the machine's identity key, echoing the {@link Proof}'s nonce. */
50
+ const Grant = Schema.Struct({
51
+ op: Schema.Literal("ticket.grant"),
52
+ ticket: Schema.String,
53
+ nonce: Schema.String
54
+ });
55
+ /**
56
+ * A refused {@link Proof}, signed with the machine's identity key, echoing the nonce it named, so a refusal
57
+ * is told from another machine's. `at` is the machine's clock, epoch milliseconds. It never says why.
58
+ */
59
+ const Refusal = Schema.Struct({
60
+ op: Schema.Literal("ticket.refuse"),
61
+ nonce: Schema.String,
62
+ at: Schema.Finite
63
+ });
64
+ //#endregion
65
+ export { Device, Exchange, Grant, pairing_exports as Pairing, Proof, Refusal, Signed, devicesPath, proofWindow, ticketsPath };
66
+
67
+ //# sourceMappingURL=pairing.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pairing.mjs","names":[],"sources":["../../src/pairing.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport { PublicKey } from \"./jws.ts\";\n\n// How another computer pairs with a CodeWork server over plain HTTP, beside its socket. As with SSH,\n// each side holds a key and keeps the other's public half; only signatures cross the wire. A refused\n// credential gets 401, never why.\n\n/** `POST` with {@link Exchange} creates a device: answers 201 with {@link Device}. */\nexport const devicesPath = \"/api/v1/devices\";\n/**\n * `POST` with a {@link Signed} {@link Proof} creates a ticket: answers 201 with a {@link Signed} {@link Grant},\n * or 401 with a {@link Signed} {@link Refusal} (empty when the body names no nonce).\n */\nexport const ticketsPath = \"/api/v1/tickets\";\n\n/** What `POST /api/v1/devices` takes: the code a person read, a name for the computer offering it, and its key. */\nexport const Exchange = Schema.Struct({\n\tcode: Schema.String,\n\tlabel: Schema.String.check(Schema.isNonEmpty(), Schema.isMaxLength(100), Schema.isPattern(/^[^\\p{Cc}]*$/u)),\n\tkey: PublicKey,\n});\n\n/** A new device: its id, and the machine's identity key, which signs every {@link Grant}. */\nexport const Device = Schema.Struct({ id: Schema.String, machine: PublicKey });\n\n/** A compact JWS, as both ticket routes carry one. */\nexport const Signed = Schema.Struct({ jws: Schema.String });\n\n/** How long a {@link Proof} is good for, either side of the machine's clock; its nonce is held as long. */\nexport const proofWindow = 5 * 60 * 1000;\n\n/** A device asking for a ticket, signed with its key and named by the key's thumbprint; each nonce is taken once. */\nexport const Proof = Schema.Struct({\n\top: Schema.Literal(\"ticket.create\"),\n\t/** The thumbprint of the machine key it is for: one device key is paired with every machine. */\n\taud: Schema.String,\n\tdevice: Schema.String,\n\t/** Epoch milliseconds. */\n\tiat: Schema.Finite,\n\tnonce: Schema.String,\n});\nexport type Proof = typeof Proof.Type;\n\n/** A ticket for one socket, signed with the machine's identity key, echoing the {@link Proof}'s nonce. */\nexport const Grant = Schema.Struct({\n\top: Schema.Literal(\"ticket.grant\"),\n\tticket: Schema.String,\n\tnonce: Schema.String,\n});\nexport type Grant = typeof Grant.Type;\n\n/**\n * A refused {@link Proof}, signed with the machine's identity key, echoing the nonce it named, so a refusal\n * is told from another machine's. `at` is the machine's clock, epoch milliseconds. It never says why.\n */\nexport const Refusal = Schema.Struct({\n\top: Schema.Literal(\"ticket.refuse\"),\n\tnonce: Schema.String,\n\tat: Schema.Finite,\n});\nexport type Refusal = typeof Refusal.Type;\n\nexport * as Pairing from \"./pairing.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAQA,MAAa,cAAc;;;;;AAK3B,MAAa,cAAc;;AAG3B,MAAa,WAAW,OAAO,OAAO;CACrC,MAAM,OAAO;CACb,OAAO,OAAO,OAAO,MAAM,OAAO,WAAW,GAAG,OAAO,YAAY,GAAG,GAAG,OAAO,UAAU,eAAe,CAAC;CAC1G,KAAK;AACN,CAAC;;AAGD,MAAa,SAAS,OAAO,OAAO;CAAE,IAAI,OAAO;CAAQ,SAAS;AAAU,CAAC;;AAG7E,MAAa,SAAS,OAAO,OAAO,EAAE,KAAK,OAAO,OAAO,CAAC;;AAG1D,MAAa,cAAc;;AAG3B,MAAa,QAAQ,OAAO,OAAO;CAClC,IAAI,OAAO,QAAQ,eAAe;;CAElC,KAAK,OAAO;CACZ,QAAQ,OAAO;;CAEf,KAAK,OAAO;CACZ,OAAO,OAAO;AACf,CAAC;;AAID,MAAa,QAAQ,OAAO,OAAO;CAClC,IAAI,OAAO,QAAQ,cAAc;CACjC,QAAQ,OAAO;CACf,OAAO,OAAO;AACf,CAAC;;;;;AAOD,MAAa,UAAU,OAAO,OAAO;CACpC,IAAI,OAAO,QAAQ,eAAe;CAClC,OAAO,OAAO;CACd,IAAI,OAAO;AACZ,CAAC"}
@@ -0,0 +1,69 @@
1
+ import { Schema } from "effect";
2
+ declare namespace part_d_exports {
3
+ export { part_d_exports as HostPart, Part, ToolCall };
4
+ }
5
+ declare const ToolCall: Schema.Struct<{
6
+ readonly type: Schema.Literal<"toolCall">;
7
+ readonly callID: Schema.String;
8
+ readonly name: Schema.String;
9
+ readonly arguments: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
10
+ readonly status: Schema.Literals<readonly ["pending", "running", "completed", "error", "skipped", "aborted"]>;
11
+ /** Present once the call settled (completed, error, skipped, aborted). */
12
+ readonly result: Schema.optionalKey<Schema.Struct<{
13
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
14
+ readonly type: Schema.Literal<"text">;
15
+ readonly text: Schema.String;
16
+ }>, Schema.Struct<{
17
+ readonly type: Schema.Literal<"image">;
18
+ readonly data: Schema.String;
19
+ readonly mimeType: Schema.String;
20
+ }>]>>;
21
+ readonly isError: Schema.Boolean;
22
+ }>>;
23
+ /** Epoch milliseconds: started, and last lifecycle update. */
24
+ readonly time: Schema.optionalKey<Schema.Struct<{
25
+ readonly start: Schema.Finite;
26
+ readonly end: Schema.Finite;
27
+ }>>;
28
+ }>;
29
+ type ToolCall = typeof ToolCall.Type;
30
+ declare const Part: Schema.Union<readonly [Schema.Struct<{
31
+ readonly type: Schema.Literal<"text">;
32
+ readonly text: Schema.String;
33
+ }>, Schema.Struct<{
34
+ readonly type: Schema.Literal<"image">;
35
+ readonly data: Schema.String;
36
+ readonly mimeType: Schema.String;
37
+ }>, Schema.Struct<{
38
+ readonly type: Schema.Literal<"thinking">;
39
+ readonly thinking: Schema.String;
40
+ /** The provider withheld the reasoning; `thinking` is then empty. */
41
+ readonly redacted: Schema.optionalKey<Schema.Boolean>;
42
+ }>, Schema.Struct<{
43
+ readonly type: Schema.Literal<"toolCall">;
44
+ readonly callID: Schema.String;
45
+ readonly name: Schema.String;
46
+ readonly arguments: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
47
+ readonly status: Schema.Literals<readonly ["pending", "running", "completed", "error", "skipped", "aborted"]>;
48
+ /** Present once the call settled (completed, error, skipped, aborted). */
49
+ readonly result: Schema.optionalKey<Schema.Struct<{
50
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
51
+ readonly type: Schema.Literal<"text">;
52
+ readonly text: Schema.String;
53
+ }>, Schema.Struct<{
54
+ readonly type: Schema.Literal<"image">;
55
+ readonly data: Schema.String;
56
+ readonly mimeType: Schema.String;
57
+ }>]>>;
58
+ readonly isError: Schema.Boolean;
59
+ }>>;
60
+ /** Epoch milliseconds: started, and last lifecycle update. */
61
+ readonly time: Schema.optionalKey<Schema.Struct<{
62
+ readonly start: Schema.Finite;
63
+ readonly end: Schema.Finite;
64
+ }>>;
65
+ }>]>;
66
+ type Part = typeof Part.Type;
67
+ //#endregion
68
+ export { ToolCall as n, part_d_exports as r, Part as t };
69
+ //# sourceMappingURL=part-Bzm-yNax.d.mts.map
package/project.d.mts ADDED
@@ -0,0 +1,30 @@
1
+ import { Schema } from "effect";
2
+ declare namespace project_d_exports {
3
+ export { ID, Info, ProjectCheckoutError, ProjectNotFoundError, project_d_exports as ProjectSchema, Status };
4
+ }
5
+ export declare const ID: Schema.brand<Schema.String, "Project.ID">;
6
+ export type ID = typeof ID.Type;
7
+ export declare const Status: Schema.Literals<readonly ["active", "archived"]>;
8
+ export type Status = typeof Status.Type;
9
+ declare const Info_base: Schema.Class<Info, Schema.Struct<{
10
+ readonly id: Schema.brand<Schema.String, "Project.ID">;
11
+ readonly name: Schema.String;
12
+ readonly status: Schema.Literals<readonly ["active", "archived"]>;
13
+ readonly vcs: Schema.optional<Schema.Union<readonly [Schema.Struct<{
14
+ readonly type: Schema.Literal<"git">;
15
+ readonly store: Schema.brand<Schema.String, "AbsolutePath">;
16
+ }>]>>;
17
+ }>, {}>;
18
+ export declare class Info extends Info_base {}
19
+ declare const ProjectNotFoundError_base: Schema.Class<ProjectNotFoundError, Schema.TaggedStruct<"ProjectNotFoundError", {
20
+ readonly projectId: Schema.String;
21
+ }>, import("effect/Cause").YieldableError>;
22
+ export declare class ProjectNotFoundError extends ProjectNotFoundError_base {}
23
+ declare const ProjectCheckoutError_base: Schema.Class<ProjectCheckoutError, Schema.TaggedStruct<"ProjectCheckoutError", {
24
+ readonly projectId: Schema.String;
25
+ }>, import("effect/Cause").YieldableError>;
26
+ /** The project has no main checkout on this host, so no host file of its own. */
27
+ export declare class ProjectCheckoutError extends ProjectCheckoutError_base {}
28
+ //#endregion
29
+ export { project_d_exports as ProjectSchema };
30
+ //# sourceMappingURL=project.d.mts.map
package/project.mjs ADDED
@@ -0,0 +1,27 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { Vcs } from "./repo.mjs";
3
+ import { Schema } from "effect";
4
+ //#region src/project.ts
5
+ var project_exports = /* @__PURE__ */ __exportAll({
6
+ ID: () => ID,
7
+ Info: () => Info,
8
+ ProjectCheckoutError: () => ProjectCheckoutError,
9
+ ProjectNotFoundError: () => ProjectNotFoundError,
10
+ ProjectSchema: () => project_exports,
11
+ Status: () => Status
12
+ });
13
+ const ID = Schema.String.pipe(Schema.brand("Project.ID"));
14
+ const Status = Schema.Literals(["active", "archived"]);
15
+ var Info = class extends Schema.Class("Project.Info")({
16
+ id: ID,
17
+ name: Schema.String,
18
+ status: Status,
19
+ vcs: Schema.optional(Vcs)
20
+ }) {};
21
+ var ProjectNotFoundError = class extends Schema.TaggedError()("ProjectNotFoundError", { projectId: Schema.String }) {};
22
+ /** The project has no main checkout on this host, so no host file of its own. */
23
+ var ProjectCheckoutError = class extends Schema.TaggedError()("ProjectCheckoutError", { projectId: Schema.String }) {};
24
+ //#endregion
25
+ export { ID, Info, ProjectCheckoutError, ProjectNotFoundError, project_exports as ProjectSchema, Status };
26
+
27
+ //# sourceMappingURL=project.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.mjs","names":["RepoSchema.Vcs"],"sources":["../../src/project.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport { RepoSchema } from \"./repo.ts\";\n\n// Env-independent project id: marker ?? remoteHash ?? rootCommit ?? provisional.\nexport const ID = Schema.String.pipe(Schema.brand(\"Project.ID\"));\nexport type ID = typeof ID.Type;\n\n// A project is archived, never deleted, once it has no active space anywhere.\nexport const Status = Schema.Literals([\"active\", \"archived\"]);\nexport type Status = typeof Status.Type;\n\nexport class Info extends Schema.Class<Info>(\"Project.Info\")({\n\tid: ID,\n\tname: Schema.String,\n\tstatus: Status,\n\tvcs: Schema.optional(RepoSchema.Vcs),\n}) {}\n\nexport class ProjectNotFoundError extends Schema.TaggedError<ProjectNotFoundError>()(\"ProjectNotFoundError\", {\n\tprojectId: Schema.String,\n}) {}\n\n/** The project has no main checkout on this host, so no host file of its own. */\nexport class ProjectCheckoutError extends Schema.TaggedError<ProjectCheckoutError>()(\"ProjectCheckoutError\", {\n\tprojectId: Schema.String,\n}) {}\n\nexport * as ProjectSchema from \"./project.ts\";\n"],"mappings":";;;;;;;;;;;;AAIA,MAAa,KAAK,OAAO,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAI/D,MAAa,SAAS,OAAO,SAAS,CAAC,UAAU,UAAU,CAAC;AAG5D,IAAa,OAAb,cAA0B,OAAO,MAAY,cAAc,CAAC,CAAC;CAC5D,IAAI;CACJ,MAAM,OAAO;CACb,QAAQ;CACR,KAAK,OAAO,SAASA,GAAc;AACpC,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,uBAAb,cAA0C,OAAO,YAAkC,CAAC,CAAC,wBAAwB,EAC5G,WAAW,OAAO,OACnB,CAAC,CAAC,CAAC,CAAC;;AAGJ,IAAa,uBAAb,cAA0C,OAAO,YAAkC,CAAC,CAAC,wBAAwB,EAC5G,WAAW,OAAO,OACnB,CAAC,CAAC,CAAC,CAAC"}