@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/session.d.mts ADDED
@@ -0,0 +1,59 @@
1
+ import { Schema } from "effect";
2
+ declare namespace session_d_exports {
3
+ export { Delivery, Failure, InterruptReason, PromptConflictError, RelinkError, RelinkReason, SessionLinkedSpaceNotFoundError, SessionNotFoundError, session_d_exports as SessionSchema };
4
+ }
5
+ /**
6
+ * Why an execution stopped. Supplied by whoever asked for the interruption --
7
+ * a stop the user asked for and a stop the process imposed on shutdown are
8
+ * different facts, and inspecting the cause cannot tell them apart. `crash` is
9
+ * the startup sweep's: the process that ran the execution died without ending it.
10
+ */
11
+ export declare const InterruptReason: Schema.Literals<readonly ["user", "shutdown", "crash"]>;
12
+ export type InterruptReason = typeof InterruptReason.Type;
13
+ /**
14
+ * The public description of a failed execution.
15
+ *
16
+ * Open by design: `type` is a kebab-case category ending in `-error`, not a closed union.
17
+ * A client older than the server degrades to the message instead of failing to
18
+ * decode, and a new category is an additive change. The typed cause stays
19
+ * server-side -- this is what crosses the wire.
20
+ */
21
+ export declare const Failure: Schema.Struct<{
22
+ readonly type: Schema.String;
23
+ readonly message: Schema.String;
24
+ /** Provider HTTP status, when the failure came from one. */
25
+ readonly status: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
26
+ }>;
27
+ export type Failure = typeof Failure.Type;
28
+ /** How a prompt sent while the agent works joins the turn: folded into it, or queued after it. */
29
+ export declare const Delivery: Schema.Literals<readonly ["steer", "followUp"]>;
30
+ export type Delivery = typeof Delivery.Type;
31
+ declare const SessionNotFoundError_base: Schema.Class<SessionNotFoundError, Schema.TaggedStruct<"SessionNotFoundError", {
32
+ readonly sessionId: Schema.String;
33
+ }>, import("effect/Cause").YieldableError>;
34
+ export declare class SessionNotFoundError extends SessionNotFoundError_base {}
35
+ declare const SessionLinkedSpaceNotFoundError_base: Schema.Class<SessionLinkedSpaceNotFoundError, Schema.TaggedStruct<"SessionLinkedSpaceNotFoundError", {
36
+ readonly sessionId: Schema.String;
37
+ readonly threadId: Schema.optional<Schema.String>;
38
+ }>, import("effect/Cause").YieldableError>;
39
+ export declare class SessionLinkedSpaceNotFoundError extends SessionLinkedSpaceNotFoundError_base {}
40
+ declare const RelinkError_base: Schema.Class<RelinkError, Schema.TaggedStruct<"RelinkError", {
41
+ readonly sessionId: Schema.String;
42
+ readonly spaceId: Schema.String;
43
+ readonly reason: Schema.Literals<readonly ["space_not_found", "space_is_archived", "project_scope_mismatch", "directory_outside_space"]>;
44
+ }>, import("effect/Cause").YieldableError>;
45
+ export declare class RelinkError extends RelinkError_base {}
46
+ export type RelinkReason = RelinkError["reason"];
47
+ declare const PromptConflictError_base: Schema.Class<PromptConflictError, Schema.TaggedStruct<"PromptConflictError", {
48
+ readonly threadId: Schema.String;
49
+ readonly messageId: Schema.String;
50
+ }>, import("effect/Cause").YieldableError>;
51
+ /**
52
+ * The prompt could not be admitted under the id it was given: either that id
53
+ * already carries different content, or it has already left the inbox. Typed
54
+ * rather than a defect — a client that retried with a reused id can act on it.
55
+ */
56
+ export declare class PromptConflictError extends PromptConflictError_base {}
57
+ //#endregion
58
+ export { session_d_exports as SessionSchema };
59
+ //# sourceMappingURL=session.d.mts.map
package/session.mjs ADDED
@@ -0,0 +1,69 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { optional } from "./common.mjs";
3
+ import { Schema } from "effect";
4
+ //#region src/session.ts
5
+ var session_exports = /* @__PURE__ */ __exportAll({
6
+ Delivery: () => Delivery,
7
+ Failure: () => Failure,
8
+ InterruptReason: () => InterruptReason,
9
+ PromptConflictError: () => PromptConflictError,
10
+ RelinkError: () => RelinkError,
11
+ SessionLinkedSpaceNotFoundError: () => SessionLinkedSpaceNotFoundError,
12
+ SessionNotFoundError: () => SessionNotFoundError,
13
+ SessionSchema: () => session_exports
14
+ });
15
+ /**
16
+ * Why an execution stopped. Supplied by whoever asked for the interruption --
17
+ * a stop the user asked for and a stop the process imposed on shutdown are
18
+ * different facts, and inspecting the cause cannot tell them apart. `crash` is
19
+ * the startup sweep's: the process that ran the execution died without ending it.
20
+ */
21
+ const InterruptReason = Schema.Literals([
22
+ "user",
23
+ "shutdown",
24
+ "crash"
25
+ ]);
26
+ /**
27
+ * The public description of a failed execution.
28
+ *
29
+ * Open by design: `type` is a kebab-case category ending in `-error`, not a closed union.
30
+ * A client older than the server degrades to the message instead of failing to
31
+ * decode, and a new category is an additive change. The typed cause stays
32
+ * server-side -- this is what crosses the wire.
33
+ */
34
+ const Failure = Schema.Struct({
35
+ type: Schema.String,
36
+ message: Schema.String,
37
+ /** Provider HTTP status, when the failure came from one. */
38
+ status: optional(Schema.Int)
39
+ });
40
+ /** How a prompt sent while the agent works joins the turn: folded into it, or queued after it. */
41
+ const Delivery = Schema.Literals(["steer", "followUp"]);
42
+ var SessionNotFoundError = class extends Schema.TaggedError()("SessionNotFoundError", { sessionId: Schema.String }) {};
43
+ var SessionLinkedSpaceNotFoundError = class extends Schema.TaggedError()("SessionLinkedSpaceNotFoundError", {
44
+ sessionId: Schema.String,
45
+ threadId: Schema.optional(Schema.String)
46
+ }) {};
47
+ var RelinkError = class extends Schema.TaggedError()("RelinkError", {
48
+ sessionId: Schema.String,
49
+ spaceId: Schema.String,
50
+ reason: Schema.Literals([
51
+ "space_not_found",
52
+ "space_is_archived",
53
+ "project_scope_mismatch",
54
+ "directory_outside_space"
55
+ ])
56
+ }) {};
57
+ /**
58
+ * The prompt could not be admitted under the id it was given: either that id
59
+ * already carries different content, or it has already left the inbox. Typed
60
+ * rather than a defect — a client that retried with a reused id can act on it.
61
+ */
62
+ var PromptConflictError = class extends Schema.TaggedError()("PromptConflictError", {
63
+ threadId: Schema.String,
64
+ messageId: Schema.String
65
+ }) {};
66
+ //#endregion
67
+ export { Delivery, Failure, InterruptReason, PromptConflictError, RelinkError, SessionLinkedSpaceNotFoundError, SessionNotFoundError, session_exports as SessionSchema };
68
+
69
+ //# sourceMappingURL=session.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.mjs","names":[],"sources":["../../src/session.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport { optional } from \"./common.ts\";\n\n/**\n * Why an execution stopped. Supplied by whoever asked for the interruption --\n * a stop the user asked for and a stop the process imposed on shutdown are\n * different facts, and inspecting the cause cannot tell them apart. `crash` is\n * the startup sweep's: the process that ran the execution died without ending it.\n */\nexport const InterruptReason = Schema.Literals([\"user\", \"shutdown\", \"crash\"]);\nexport type InterruptReason = typeof InterruptReason.Type;\n\n/**\n * The public description of a failed execution.\n *\n * Open by design: `type` is a kebab-case category ending in `-error`, not a closed union.\n * A client older than the server degrades to the message instead of failing to\n * decode, and a new category is an additive change. The typed cause stays\n * server-side -- this is what crosses the wire.\n */\nexport const Failure = Schema.Struct({\n\ttype: Schema.String,\n\tmessage: Schema.String,\n\t/** Provider HTTP status, when the failure came from one. */\n\tstatus: optional(Schema.Int),\n});\nexport type Failure = typeof Failure.Type;\n\n/** How a prompt sent while the agent works joins the turn: folded into it, or queued after it. */\nexport const Delivery = Schema.Literals([\"steer\", \"followUp\"]);\nexport type Delivery = typeof Delivery.Type;\n\nexport class SessionNotFoundError extends Schema.TaggedError<SessionNotFoundError>()(\"SessionNotFoundError\", {\n\tsessionId: Schema.String,\n}) {}\n\n// The space a run is placed in is gone — unreachable for a session's own while the FK holds, but a\n// thread placement names its space in a document, which no FK guards. Typed so a UI can offer\n// `relink` (with `--thread` for a placement) as the repair.\nexport class SessionLinkedSpaceNotFoundError extends Schema.TaggedError<SessionLinkedSpaceNotFoundError>()(\n\t\"SessionLinkedSpaceNotFoundError\",\n\t{ sessionId: Schema.String, threadId: Schema.optional(Schema.String) },\n) {}\n\n// Relink rejections: the target is not a live space, the session would cross\n// projects, or an explicit directory would break the containment invariant.\nexport class RelinkError extends Schema.TaggedError<RelinkError>()(\"RelinkError\", {\n\tsessionId: Schema.String,\n\tspaceId: Schema.String,\n\treason: Schema.Literals([\n\t\t\"space_not_found\",\n\t\t\"space_is_archived\",\n\t\t\"project_scope_mismatch\",\n\t\t\"directory_outside_space\",\n\t]),\n}) {}\nexport type RelinkReason = RelinkError[\"reason\"];\n\n/**\n * The prompt could not be admitted under the id it was given: either that id\n * already carries different content, or it has already left the inbox. Typed\n * rather than a defect — a client that retried with a reused id can act on it.\n */\nexport class PromptConflictError extends Schema.TaggedError<PromptConflictError>()(\"PromptConflictError\", {\n\tthreadId: Schema.String,\n\tmessageId: Schema.String,\n}) {}\n\nexport * as SessionSchema from \"./session.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AASA,MAAa,kBAAkB,OAAO,SAAS;CAAC;CAAQ;CAAY;AAAO,CAAC;;;;;;;;;AAW5E,MAAa,UAAU,OAAO,OAAO;CACpC,MAAM,OAAO;CACb,SAAS,OAAO;;CAEhB,QAAQ,SAAS,OAAO,GAAG;AAC5B,CAAC;;AAID,MAAa,WAAW,OAAO,SAAS,CAAC,SAAS,UAAU,CAAC;AAG7D,IAAa,uBAAb,cAA0C,OAAO,YAAkC,CAAC,CAAC,wBAAwB,EAC5G,WAAW,OAAO,OACnB,CAAC,CAAC,CAAC,CAAC;AAKJ,IAAa,kCAAb,cAAqD,OAAO,YAA6C,CAAC,CACzG,mCACA;CAAE,WAAW,OAAO;CAAQ,UAAU,OAAO,SAAS,OAAO,MAAM;AAAE,CACtE,CAAC,CAAC,CAAC;AAIH,IAAa,cAAb,cAAiC,OAAO,YAAyB,CAAC,CAAC,eAAe;CACjF,WAAW,OAAO;CAClB,SAAS,OAAO;CAChB,QAAQ,OAAO,SAAS;EACvB;EACA;EACA;EACA;CACD,CAAC;AACF,CAAC,CAAC,CAAC,CAAC;;;;;;AAQJ,IAAa,sBAAb,cAAyC,OAAO,YAAiC,CAAC,CAAC,uBAAuB;CACzG,UAAU,OAAO;CACjB,WAAW,OAAO;AACnB,CAAC,CAAC,CAAC,CAAC"}
package/settings.d.mts ADDED
@@ -0,0 +1,22 @@
1
+ import { Schema } from "effect";
2
+ declare namespace settings_d_exports {
3
+ export { SettingsConflictError, SettingsError, settings_d_exports as SettingsSchema };
4
+ }
5
+ declare const SettingsError_base: Schema.Class<SettingsError, Schema.TaggedStruct<"SettingsError", {
6
+ readonly path: Schema.String;
7
+ readonly reason: Schema.Literals<readonly ["read", "write", "parse", "decode"]>;
8
+ readonly detail: Schema.String;
9
+ }>, import("effect/Cause").YieldableError>;
10
+ export declare class SettingsError extends SettingsError_base {
11
+ get message(): string;
12
+ }
13
+ declare const SettingsConflictError_base: Schema.Class<SettingsConflictError, Schema.TaggedStruct<"SettingsConflictError", {
14
+ readonly path: Schema.String;
15
+ }>, import("effect/Cause").YieldableError>;
16
+ /** The file changed since the caller read it. */
17
+ export declare class SettingsConflictError extends SettingsConflictError_base {
18
+ get message(): string;
19
+ }
20
+ //#endregion
21
+ export { settings_d_exports as SettingsSchema };
22
+ //# sourceMappingURL=settings.d.mts.map
package/settings.mjs ADDED
@@ -0,0 +1,32 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { Schema } from "effect";
3
+ //#region src/settings.ts
4
+ var settings_exports = /* @__PURE__ */ __exportAll({
5
+ SettingsConflictError: () => SettingsConflictError,
6
+ SettingsError: () => SettingsError,
7
+ SettingsSchema: () => settings_exports
8
+ });
9
+ var SettingsError = class extends Schema.TaggedError()("SettingsError", {
10
+ path: Schema.String,
11
+ reason: Schema.Literals([
12
+ "read",
13
+ "write",
14
+ "parse",
15
+ "decode"
16
+ ]),
17
+ detail: Schema.String
18
+ }) {
19
+ get message() {
20
+ return `${this.path}: ${this.reason}: ${this.detail}`;
21
+ }
22
+ };
23
+ /** The file changed since the caller read it. */
24
+ var SettingsConflictError = class extends Schema.TaggedError()("SettingsConflictError", { path: Schema.String }) {
25
+ get message() {
26
+ return `${this.path} changed since it was read`;
27
+ }
28
+ };
29
+ //#endregion
30
+ export { SettingsConflictError, SettingsError, settings_exports as SettingsSchema };
31
+
32
+ //# sourceMappingURL=settings.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.mjs","names":[],"sources":["../../src/settings.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nexport class SettingsError extends Schema.TaggedError<SettingsError>()(\"SettingsError\", {\n\tpath: Schema.String,\n\treason: Schema.Literals([\"read\", \"write\", \"parse\", \"decode\"]),\n\tdetail: Schema.String,\n}) {\n\toverride get message(): string {\n\t\treturn `${this.path}: ${this.reason}: ${this.detail}`;\n\t}\n}\n\n/** The file changed since the caller read it. */\nexport class SettingsConflictError extends Schema.TaggedError<SettingsConflictError>()(\"SettingsConflictError\", {\n\tpath: Schema.String,\n}) {\n\toverride get message(): string {\n\t\treturn `${this.path} changed since it was read`;\n\t}\n}\n\nexport * as SettingsSchema from \"./settings.ts\";\n"],"mappings":";;;;;;;;AAEA,IAAa,gBAAb,cAAmC,OAAO,YAA2B,CAAC,CAAC,iBAAiB;CACvF,MAAM,OAAO;CACb,QAAQ,OAAO,SAAS;EAAC;EAAQ;EAAS;EAAS;CAAQ,CAAC;CAC5D,QAAQ,OAAO;AAChB,CAAC,CAAC,CAAC;CACF,IAAa,UAAkB;EAC9B,OAAO,GAAG,KAAK,KAAK,IAAI,KAAK,OAAO,IAAI,KAAK;CAC9C;AACD;;AAGA,IAAa,wBAAb,cAA2C,OAAO,YAAmC,CAAC,CAAC,yBAAyB,EAC/G,MAAM,OAAO,OACd,CAAC,CAAC,CAAC;CACF,IAAa,UAAkB;EAC9B,OAAO,GAAG,KAAK,KAAK;CACrB;AACD"}
package/shell.d.mts ADDED
@@ -0,0 +1,5 @@
1
+ //#region src/shell.d.ts
2
+ /** A path as one shell word: as is when it needs no quoting, else single-quoted. */
3
+ export declare const shellQuoted: (path: string) => string;
4
+ //#endregion
5
+ //# sourceMappingURL=shell.d.mts.map
package/shell.mjs ADDED
@@ -0,0 +1,7 @@
1
+ //#region src/shell.ts
2
+ /** A path as one shell word: as is when it needs no quoting, else single-quoted. */
3
+ const shellQuoted = (path) => /^[\w./~-]+$/.test(path) ? path : `'${path.replaceAll("'", "'\\''")}'`;
4
+ //#endregion
5
+ export { shellQuoted };
6
+
7
+ //# sourceMappingURL=shell.mjs.map
package/shell.mjs.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell.mjs","names":[],"sources":["../../src/shell.ts"],"sourcesContent":["/** A path as one shell word: as is when it needs no quoting, else single-quoted. */\nexport const shellQuoted = (path: string) => (/^[\\w./~-]+$/.test(path) ? path : `'${path.replaceAll(\"'\", \"'\\\\''\")}'`);\n"],"mappings":";;AACA,MAAa,eAAe,SAAkB,cAAc,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,WAAW,KAAK,OAAO,EAAE"}
@@ -0,0 +1,25 @@
1
+ import { Schema } from "effect";
2
+ declare namespace space_d_exports {
3
+ export { ID, Info, Kind, space_d_exports as SpaceSchema, Status };
4
+ }
5
+ declare const ID: Schema.brand<Schema.String, "Space.ID">;
6
+ type ID = typeof ID.Type;
7
+ declare const Kind: Schema.Literals<readonly ["primary", "linked", "copy", "plain"]>;
8
+ type Kind = typeof Kind.Type;
9
+ declare const Status: Schema.Literals<readonly ["active", "archived"]>;
10
+ type Status = typeof Status.Type;
11
+ declare const Info_base: Schema.Class<Info, Schema.Struct<{
12
+ readonly id: Schema.brand<Schema.String, "Space.ID">;
13
+ readonly projectId: Schema.brand<Schema.String, "Project.ID">;
14
+ readonly location: Schema.brand<Schema.String, "AbsolutePath">;
15
+ readonly kind: Schema.Literals<readonly ["primary", "linked", "copy", "plain"]>;
16
+ readonly env: Schema.brand<Schema.String, "SandboxInstance.ID"> & {
17
+ local: string & import("effect/Brand").Brand<"SandboxInstance.ID">;
18
+ create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
19
+ };
20
+ readonly status: Schema.Literals<readonly ["active", "archived"]>;
21
+ }>, {}>;
22
+ declare class Info extends Info_base {}
23
+ //#endregion
24
+ export { space_d_exports as a, Status as i, Info as n, Kind as r, ID as t };
25
+ //# sourceMappingURL=space-CR-9UxdT.d.mts.map
package/space.d.mts ADDED
@@ -0,0 +1,2 @@
1
+ import { a as space_d_exports, i as Status, n as Info, r as Kind, t as ID } from "./space-CR-9UxdT.mjs";
2
+ export { ID, Info, Kind, space_d_exports as SpaceSchema, Status };
package/space.mjs ADDED
@@ -0,0 +1,33 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { AbsolutePath } from "./common.mjs";
3
+ import { ID as ID$1 } from "./sandbox/instance.mjs";
4
+ import { ID as ID$2 } from "./project.mjs";
5
+ import { Schema } from "effect";
6
+ //#region src/space.ts
7
+ var space_exports = /* @__PURE__ */ __exportAll({
8
+ ID: () => ID,
9
+ Info: () => Info,
10
+ Kind: () => Kind,
11
+ SpaceSchema: () => space_exports,
12
+ Status: () => Status
13
+ });
14
+ const ID = Schema.String.pipe(Schema.brand("Space.ID"));
15
+ const Kind = Schema.Literals([
16
+ "primary",
17
+ "linked",
18
+ "copy",
19
+ "plain"
20
+ ]);
21
+ const Status = Schema.Literals(["active", "archived"]);
22
+ var Info = class extends Schema.Class("Space.Info")({
23
+ id: ID,
24
+ projectId: ID$2,
25
+ location: AbsolutePath,
26
+ kind: Kind,
27
+ env: ID$1,
28
+ status: Status
29
+ }) {};
30
+ //#endregion
31
+ export { ID, Info, Kind, space_exports as SpaceSchema, Status };
32
+
33
+ //# sourceMappingURL=space.mjs.map
package/space.mjs.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"space.mjs","names":["ProjectSchema.ID","SandboxInstance.ID"],"sources":["../../src/space.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport { ProjectSchema } from \"./project.ts\";\nimport { SandboxInstance } from \"./sandbox/instance.ts\";\nimport { AbsolutePath } from \"./common.ts\";\n\n// hash(env, location) — no project component, so re-pointing a space to\n// another project never rewrites the key sessions reference.\nexport const ID = Schema.String.pipe(Schema.brand(\"Space.ID\"));\nexport type ID = typeof ID.Type;\n\n// primary: the main checkout (one per project+env); linked: a git worktree\n// sharing the primary's store; copy: another clone; plain: a non-git directory.\nexport const Kind = Schema.Literals([\"primary\", \"linked\", \"copy\", \"plain\"]);\nexport type Kind = typeof Kind.Type;\n\nexport const Status = Schema.Literals([\"active\", \"archived\"]);\nexport type Status = typeof Status.Type;\n\n// One directory in one env that belongs to a project; the unit sessions attach to.\nexport class Info extends Schema.Class<Info>(\"Space.Info\")({\n\tid: ID,\n\tprojectId: ProjectSchema.ID,\n\tlocation: AbsolutePath,\n\tkind: Kind,\n\tenv: SandboxInstance.ID,\n\tstatus: Status,\n}) {}\n\nexport * as SpaceSchema from \"./space.ts\";\n"],"mappings":";;;;;;;;;;;;;AAOA,MAAa,KAAK,OAAO,OAAO,KAAK,OAAO,MAAM,UAAU,CAAC;AAK7D,MAAa,OAAO,OAAO,SAAS;CAAC;CAAW;CAAU;CAAQ;AAAO,CAAC;AAG1E,MAAa,SAAS,OAAO,SAAS,CAAC,UAAU,UAAU,CAAC;AAI5D,IAAa,OAAb,cAA0B,OAAO,MAAY,YAAY,CAAC,CAAC;CAC1D,IAAI;CACJ,WAAWA;CACX,UAAU;CACV,MAAM;CACN,KAAKC;CACL,QAAQ;AACT,CAAC,CAAC,CAAC,CAAC"}
package/thread.d.mts ADDED
@@ -0,0 +1,50 @@
1
+ import { Schema } from "effect";
2
+ declare namespace thread_d_exports {
3
+ export { ForkError, RunError, RunFailedReason, RunOutcome, RunState, ThreadNotFoundError, thread_d_exports as ThreadSchema };
4
+ }
5
+ /**
6
+ * Where the thread's run is, projected from its lifecycle events: `starting` from
7
+ * `execution.started` until the first `llm.started`, `running` after it, `idle` once it ended.
8
+ */
9
+ export declare const RunState: Schema.Literals<readonly ["idle", "starting", "running"]>;
10
+ export type RunState = typeof RunState.Type;
11
+ export declare const RunOutcome: Schema.Literals<readonly ["succeeded", "failed", "interrupted"]>;
12
+ export type RunOutcome = typeof RunOutcome.Type;
13
+ /** Why a run ended without its answer and is not resumed; see `session.run.failed`. */
14
+ export declare const RunFailedReason: Schema.Literals<readonly ["crashloop", "interrupted", "truncated"]>;
15
+ export type RunFailedReason = typeof RunFailedReason.Type;
16
+ /**
17
+ * Why the last run did not succeed; stored as `thread.run_error` JSON. On a run still open it holds the
18
+ * user stop that run was asked for, until its terminal lands.
19
+ */
20
+ export declare const RunError: Schema.Union<readonly [Schema.TaggedStruct<"failed", {
21
+ readonly error: Schema.Struct<{
22
+ readonly type: Schema.String;
23
+ readonly message: Schema.String;
24
+ readonly status: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
25
+ }>;
26
+ }>, Schema.TaggedStruct<"runFailed", {
27
+ readonly reason: Schema.Literals<readonly ["crashloop", "interrupted", "truncated"]>;
28
+ readonly message: Schema.String;
29
+ }>, Schema.TaggedStruct<"interrupted", {
30
+ readonly reason: Schema.Literals<readonly ["user", "shutdown", "crash"]>;
31
+ }>]>;
32
+ export type RunError = typeof RunError.Type;
33
+ declare const ThreadNotFoundError_base: Schema.Class<ThreadNotFoundError, Schema.TaggedStruct<"ThreadNotFoundError", {
34
+ readonly threadId: Schema.String;
35
+ }>, import("effect/Cause").YieldableError>;
36
+ export declare class ThreadNotFoundError extends ThreadNotFoundError_base {
37
+ get message(): string;
38
+ }
39
+ declare const ForkError_base: Schema.Class<ForkError, Schema.TaggedStruct<"ForkError", {
40
+ readonly threadId: Schema.String;
41
+ readonly entryId: Schema.String;
42
+ readonly reason: Schema.Literals<readonly ["entry_not_found", "entry_not_committed", "not_a_user_entry", "nothing_before_entry"]>;
43
+ }>, import("effect/Cause").YieldableError>;
44
+ /** A fork point the thread's line cannot be cut at. */
45
+ export declare class ForkError extends ForkError_base {
46
+ get message(): string;
47
+ }
48
+ //#endregion
49
+ export { thread_d_exports as ThreadSchema };
50
+ //# sourceMappingURL=thread.d.mts.map
package/thread.mjs ADDED
@@ -0,0 +1,69 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { Failure, InterruptReason } from "./session.mjs";
3
+ import { Schema } from "effect";
4
+ //#region src/thread.ts
5
+ var thread_exports = /* @__PURE__ */ __exportAll({
6
+ ForkError: () => ForkError,
7
+ RunError: () => RunError,
8
+ RunFailedReason: () => RunFailedReason,
9
+ RunOutcome: () => RunOutcome,
10
+ RunState: () => RunState,
11
+ ThreadNotFoundError: () => ThreadNotFoundError,
12
+ ThreadSchema: () => thread_exports
13
+ });
14
+ /**
15
+ * Where the thread's run is, projected from its lifecycle events: `starting` from
16
+ * `execution.started` until the first `llm.started`, `running` after it, `idle` once it ended.
17
+ */
18
+ const RunState = Schema.Literals([
19
+ "idle",
20
+ "starting",
21
+ "running"
22
+ ]);
23
+ const RunOutcome = Schema.Literals([
24
+ "succeeded",
25
+ "failed",
26
+ "interrupted"
27
+ ]);
28
+ /** Why a run ended without its answer and is not resumed; see `session.run.failed`. */
29
+ const RunFailedReason = Schema.Literals([
30
+ "crashloop",
31
+ "interrupted",
32
+ "truncated"
33
+ ]);
34
+ /**
35
+ * Why the last run did not succeed; stored as `thread.run_error` JSON. On a run still open it holds the
36
+ * user stop that run was asked for, until its terminal lands.
37
+ */
38
+ const RunError = Schema.Union([
39
+ Schema.TaggedStruct("failed", { error: Failure }),
40
+ Schema.TaggedStruct("runFailed", {
41
+ reason: RunFailedReason,
42
+ message: Schema.String
43
+ }),
44
+ Schema.TaggedStruct("interrupted", { reason: InterruptReason })
45
+ ]);
46
+ var ThreadNotFoundError = class extends Schema.TaggedError()("ThreadNotFoundError", { threadId: Schema.String }) {
47
+ get message() {
48
+ return `thread ${this.threadId} not found`;
49
+ }
50
+ };
51
+ /** A fork point the thread's line cannot be cut at. */
52
+ var ForkError = class extends Schema.TaggedError()("ForkError", {
53
+ threadId: Schema.String,
54
+ entryId: Schema.String,
55
+ reason: Schema.Literals([
56
+ "entry_not_found",
57
+ "entry_not_committed",
58
+ "not_a_user_entry",
59
+ "nothing_before_entry"
60
+ ])
61
+ }) {
62
+ get message() {
63
+ return `cannot fork ${this.threadId} at ${this.entryId}: ${this.reason.replaceAll("_", " ")}`;
64
+ }
65
+ };
66
+ //#endregion
67
+ export { ForkError, RunError, RunFailedReason, RunOutcome, RunState, ThreadNotFoundError, thread_exports as ThreadSchema };
68
+
69
+ //# sourceMappingURL=thread.mjs.map
package/thread.mjs.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thread.mjs","names":[],"sources":["../../src/thread.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport { Failure, InterruptReason } from \"./session.ts\";\n\n/**\n * Where the thread's run is, projected from its lifecycle events: `starting` from\n * `execution.started` until the first `llm.started`, `running` after it, `idle` once it ended.\n */\nexport const RunState = Schema.Literals([\"idle\", \"starting\", \"running\"]);\nexport type RunState = typeof RunState.Type;\n\nexport const RunOutcome = Schema.Literals([\"succeeded\", \"failed\", \"interrupted\"]);\nexport type RunOutcome = typeof RunOutcome.Type;\n\n/** Why a run ended without its answer and is not resumed; see `session.run.failed`. */\nexport const RunFailedReason = Schema.Literals([\"crashloop\", \"interrupted\", \"truncated\"]);\nexport type RunFailedReason = typeof RunFailedReason.Type;\n\n/**\n * Why the last run did not succeed; stored as `thread.run_error` JSON. On a run still open it holds the\n * user stop that run was asked for, until its terminal lands.\n */\nexport const RunError = Schema.Union([\n\tSchema.TaggedStruct(\"failed\", { error: Failure }),\n\tSchema.TaggedStruct(\"runFailed\", { reason: RunFailedReason, message: Schema.String }),\n\tSchema.TaggedStruct(\"interrupted\", { reason: InterruptReason }),\n]);\nexport type RunError = typeof RunError.Type;\n\nexport class ThreadNotFoundError extends Schema.TaggedError<ThreadNotFoundError>()(\"ThreadNotFoundError\", {\n\tthreadId: Schema.String,\n}) {\n\toverride get message(): string {\n\t\treturn `thread ${this.threadId} not found`;\n\t}\n}\n\n/** A fork point the thread's line cannot be cut at. */\nexport class ForkError extends Schema.TaggedError<ForkError>()(\"ForkError\", {\n\tthreadId: Schema.String,\n\tentryId: Schema.String,\n\treason: Schema.Literals([\n\t\t// not in the thread's line\n\t\t\"entry_not_found\",\n\t\t// a draft is still changing, an aborted entry is not part of the context\n\t\t\"entry_not_committed\",\n\t\t// `before` refills the editor, so it needs a user entry\n\t\t\"not_a_user_entry\",\n\t\t// `before` the first entry of main: an empty start is a new session or a reset\n\t\t\"nothing_before_entry\",\n\t]),\n}) {\n\toverride get message(): string {\n\t\treturn `cannot fork ${this.threadId} at ${this.entryId}: ${this.reason.replaceAll(\"_\", \" \")}`;\n\t}\n}\n\nexport * as ThreadSchema from \"./thread.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAOA,MAAa,WAAW,OAAO,SAAS;CAAC;CAAQ;CAAY;AAAS,CAAC;AAGvE,MAAa,aAAa,OAAO,SAAS;CAAC;CAAa;CAAU;AAAa,CAAC;;AAIhF,MAAa,kBAAkB,OAAO,SAAS;CAAC;CAAa;CAAe;AAAW,CAAC;;;;;AAOxF,MAAa,WAAW,OAAO,MAAM;CACpC,OAAO,aAAa,UAAU,EAAE,OAAO,QAAQ,CAAC;CAChD,OAAO,aAAa,aAAa;EAAE,QAAQ;EAAiB,SAAS,OAAO;CAAO,CAAC;CACpF,OAAO,aAAa,eAAe,EAAE,QAAQ,gBAAgB,CAAC;AAC/D,CAAC;AAGD,IAAa,sBAAb,cAAyC,OAAO,YAAiC,CAAC,CAAC,uBAAuB,EACzG,UAAU,OAAO,OAClB,CAAC,CAAC,CAAC;CACF,IAAa,UAAkB;EAC9B,OAAO,UAAU,KAAK,SAAS;CAChC;AACD;;AAGA,IAAa,YAAb,cAA+B,OAAO,YAAuB,CAAC,CAAC,aAAa;CAC3E,UAAU,OAAO;CACjB,SAAS,OAAO;CAChB,QAAQ,OAAO,SAAS;EAEvB;EAEA;EAEA;EAEA;CACD,CAAC;AACF,CAAC,CAAC,CAAC;CACF,IAAa,UAAkB;EAC9B,OAAO,eAAe,KAAK,SAAS,MAAM,KAAK,QAAQ,IAAI,KAAK,OAAO,WAAW,KAAK,GAAG;CAC3F;AACD"}
@@ -0,0 +1,15 @@
1
+ declare namespace usage_d_exports {
2
+ export { TallyKind, usage_d_exports as UsageSchema, edges, tallyKinds };
3
+ }
4
+ /**
5
+ * Upper bounds in ms of the request duration histogram, log-spaced from 250 ms to 30 min: bucket `i`
6
+ * counts durations below `edges[i]` and at or above `edges[i - 1]`; one more bucket past the last edge
7
+ * is open-ended. Medians and percentiles read from it are accurate to a bucket. Persisted counts are
8
+ * positional, so the edges are frozen.
9
+ */
10
+ declare const edges: readonly [250, 374, 561, 839, 1257, 1882, 2818, 4220, 6318, 9461, 14167, 21213, 31764, 47563, 71221, 106645, 159688, 239115, 358046, 536133, 802797, 1202096, 1800000];
11
+ declare const tallyKinds: readonly ["prompt", "tool"];
12
+ type TallyKind = (typeof tallyKinds)[number];
13
+ //#endregion
14
+ export { usage_d_exports as i, edges as n, tallyKinds as r, TallyKind as t };
15
+ //# sourceMappingURL=usage-B_TDmpKC.d.mts.map
package/usage.d.mts ADDED
@@ -0,0 +1,2 @@
1
+ import { i as usage_d_exports, n as edges, r as tallyKinds, t as TallyKind } from "./usage-B_TDmpKC.mjs";
2
+ export { TallyKind, usage_d_exports as UsageSchema, edges, tallyKinds };
package/usage.mjs ADDED
@@ -0,0 +1,43 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ //#region src/usage.ts
3
+ var usage_exports = /* @__PURE__ */ __exportAll({
4
+ UsageSchema: () => usage_exports,
5
+ edges: () => edges,
6
+ tallyKinds: () => tallyKinds
7
+ });
8
+ /**
9
+ * Upper bounds in ms of the request duration histogram, log-spaced from 250 ms to 30 min: bucket `i`
10
+ * counts durations below `edges[i]` and at or above `edges[i - 1]`; one more bucket past the last edge
11
+ * is open-ended. Medians and percentiles read from it are accurate to a bucket. Persisted counts are
12
+ * positional, so the edges are frozen.
13
+ */
14
+ const edges = [
15
+ 250,
16
+ 374,
17
+ 561,
18
+ 839,
19
+ 1257,
20
+ 1882,
21
+ 2818,
22
+ 4220,
23
+ 6318,
24
+ 9461,
25
+ 14167,
26
+ 21213,
27
+ 31764,
28
+ 47563,
29
+ 71221,
30
+ 106645,
31
+ 159688,
32
+ 239115,
33
+ 358046,
34
+ 536133,
35
+ 802797,
36
+ 1202096,
37
+ 18e5
38
+ ];
39
+ const tallyKinds = ["prompt", "tool"];
40
+ //#endregion
41
+ export { usage_exports as UsageSchema, edges, tallyKinds };
42
+
43
+ //# sourceMappingURL=usage.mjs.map
package/usage.mjs.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage.mjs","names":[],"sources":["../../src/usage.ts"],"sourcesContent":["/**\n * Upper bounds in ms of the request duration histogram, log-spaced from 250 ms to 30 min: bucket `i`\n * counts durations below `edges[i]` and at or above `edges[i - 1]`; one more bucket past the last edge\n * is open-ended. Medians and percentiles read from it are accurate to a bucket. Persisted counts are\n * positional, so the edges are frozen.\n */\nexport const edges = [\n\t250, 374, 561, 839, 1257, 1882, 2818, 4220, 6318, 9461, 14167, 21213, 31764, 47563, 71221, 106645, 159688, 239115,\n\t358046, 536133, 802797, 1202096, 1800000,\n] as const;\n\nexport const tallyKinds = [\"prompt\", \"tool\"] as const;\nexport type TallyKind = (typeof tallyKinds)[number];\n\nexport * as UsageSchema from \"./usage.ts\";\n"],"mappings":";;;;;;;;;;;;;AAMA,MAAa,QAAQ;CACpB;CAAK;CAAK;CAAK;CAAK;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAO;CAAO;CAAO;CAAO;CAAO;CAAQ;CAAQ;CAC3G;CAAQ;CAAQ;CAAQ;CAAS;AAClC;AAEA,MAAa,aAAa,CAAC,UAAU,MAAM"}