@intentic/sandbox-contract 1.309.0 → 1.311.0

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 (200) hide show
  1. package/README.md +38 -159
  2. package/dist/contracts/accounts.contract.d.ts +3 -0
  3. package/dist/contracts/accounts.contract.d.ts.map +1 -1
  4. package/dist/contracts/agent.contract.d.ts +15 -0
  5. package/dist/contracts/agent.contract.d.ts.map +1 -1
  6. package/dist/contracts/agents.contract.d.ts +596 -1
  7. package/dist/contracts/agents.contract.d.ts.map +1 -1
  8. package/dist/contracts/agents.contract.js +13 -2
  9. package/dist/contracts/agents.contract.js.map +1 -1
  10. package/dist/contracts/capabilities.contract.d.ts +2 -0
  11. package/dist/contracts/capabilities.contract.d.ts.map +1 -1
  12. package/dist/contracts/device.contract.d.ts +1 -0
  13. package/dist/contracts/device.contract.d.ts.map +1 -1
  14. package/dist/contracts/runner.contract.d.ts +45 -0
  15. package/dist/contracts/runner.contract.d.ts.map +1 -1
  16. package/dist/contracts/settings.contract.d.ts +11 -15
  17. package/dist/contracts/settings.contract.d.ts.map +1 -1
  18. package/dist/contracts/system.contract.d.ts +59 -0
  19. package/dist/contracts/system.contract.d.ts.map +1 -1
  20. package/dist/events/agent-events.d.ts +20 -0
  21. package/dist/events/agent-events.d.ts.map +1 -1
  22. package/dist/events/agent-events.js +6 -1
  23. package/dist/events/agent-events.js.map +1 -1
  24. package/dist/events/system-events.d.ts +48 -0
  25. package/dist/events/system-events.d.ts.map +1 -1
  26. package/dist/events/transcript.d.ts +5 -0
  27. package/dist/events/transcript.d.ts.map +1 -1
  28. package/dist/events/transcript.js +9 -1
  29. package/dist/events/transcript.js.map +1 -1
  30. package/dist/front/generated/wire.d.ts +74 -0
  31. package/dist/front/generated/wire.d.ts.map +1 -0
  32. package/dist/front/generated/wire.js +2 -0
  33. package/dist/front/generated/wire.js.map +1 -0
  34. package/dist/index.d.ts +717 -74
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +1 -3
  37. package/dist/index.js.map +1 -1
  38. package/dist/policy/command-run.d.ts +1 -1
  39. package/dist/policy/command-run.d.ts.map +1 -1
  40. package/dist/policy/command-run.js +7 -4
  41. package/dist/policy/command-run.js.map +1 -1
  42. package/dist/protocol/ingress-protocol.d.ts.map +1 -1
  43. package/dist/protocol/ingress-protocol.js +15 -0
  44. package/dist/protocol/ingress-protocol.js.map +1 -1
  45. package/dist/protocol/upgrade-relay.d.ts +4 -0
  46. package/dist/protocol/upgrade-relay.d.ts.map +1 -0
  47. package/dist/protocol/upgrade-relay.js +25 -0
  48. package/dist/protocol/upgrade-relay.js.map +1 -0
  49. package/dist/schemas/agents.d.ts +72 -3
  50. package/dist/schemas/agents.d.ts.map +1 -1
  51. package/dist/schemas/agents.js +10 -7
  52. package/dist/schemas/agents.js.map +1 -1
  53. package/dist/schemas/automations.d.ts +24 -0
  54. package/dist/schemas/automations.d.ts.map +1 -1
  55. package/dist/schemas/capabilities.d.ts +3 -0
  56. package/dist/schemas/capabilities.d.ts.map +1 -1
  57. package/dist/schemas/capabilities.js +4 -0
  58. package/dist/schemas/capabilities.js.map +1 -1
  59. package/dist/schemas/ci.d.ts.map +1 -1
  60. package/dist/schemas/ci.js.map +1 -1
  61. package/dist/schemas/devices.d.ts +32 -6
  62. package/dist/schemas/devices.d.ts.map +1 -1
  63. package/dist/schemas/devices.js +8 -6
  64. package/dist/schemas/devices.js.map +1 -1
  65. package/dist/schemas/keep-warm.d.ts +68 -0
  66. package/dist/schemas/keep-warm.d.ts.map +1 -0
  67. package/dist/schemas/keep-warm.js +74 -0
  68. package/dist/schemas/keep-warm.js.map +1 -0
  69. package/dist/schemas/metrics.d.ts +24 -25
  70. package/dist/schemas/metrics.d.ts.map +1 -1
  71. package/dist/schemas/metrics.js +6 -31
  72. package/dist/schemas/metrics.js.map +1 -1
  73. package/dist/schemas/providers/provider-oauth.d.ts +3 -0
  74. package/dist/schemas/providers/provider-oauth.d.ts.map +1 -1
  75. package/dist/schemas/providers/provider-oauth.js +4 -0
  76. package/dist/schemas/providers/provider-oauth.js.map +1 -1
  77. package/dist/schemas/providers/usage.d.ts +6 -0
  78. package/dist/schemas/providers/usage.d.ts.map +1 -1
  79. package/dist/schemas/providers/usage.js +4 -0
  80. package/dist/schemas/providers/usage.js.map +1 -1
  81. package/dist/schemas/settings.d.ts +13 -29
  82. package/dist/schemas/settings.d.ts.map +1 -1
  83. package/dist/schemas/settings.js +48 -11
  84. package/dist/schemas/settings.js.map +1 -1
  85. package/dist/state/definition.d.ts +24 -20
  86. package/dist/state/definition.d.ts.map +1 -1
  87. package/dist/state/fix-stance.d.ts.map +1 -1
  88. package/dist/state/fix-stance.js +1 -0
  89. package/dist/state/fix-stance.js.map +1 -1
  90. package/dist/state/runtime-state.d.ts +3 -0
  91. package/dist/state/runtime-state.d.ts.map +1 -1
  92. package/dist/state/runtime-state.js +1 -0
  93. package/dist/state/runtime-state.js.map +1 -1
  94. package/dist/state/workspace-state.d.ts +0 -7
  95. package/dist/state/workspace-state.d.ts.map +1 -1
  96. package/dist/state/workspace-state.js +0 -8
  97. package/dist/state/workspace-state.js.map +1 -1
  98. package/dist/text/transcript-fold.d.ts +2 -0
  99. package/dist/text/transcript-fold.d.ts.map +1 -1
  100. package/dist/text/transcript-fold.js +20 -7
  101. package/dist/text/transcript-fold.js.map +1 -1
  102. package/dist/time/zone.d.ts +1 -0
  103. package/dist/time/zone.d.ts.map +1 -1
  104. package/dist/time/zone.js +5 -0
  105. package/dist/time/zone.js.map +1 -1
  106. package/package.json +27 -5
  107. package/src/chores/chores.test.ts +0 -1
  108. package/src/chores/digest.test.ts +0 -1
  109. package/src/chores/probes.test.ts +0 -1
  110. package/src/chores/stack.test.ts +0 -1
  111. package/src/chores/verdict.test.ts +0 -1
  112. package/src/contracts/agents.contract.ts +14 -2
  113. package/src/events/agent-events.ts +9 -1
  114. package/src/events/agent-words.test.ts +0 -1
  115. package/src/events/resume.test.ts +0 -1
  116. package/src/events/transcript.ts +14 -3
  117. package/src/events/watch-wake.test.ts +0 -1
  118. package/src/front/generated/wire.ts +73 -0
  119. package/src/ids/conversation-ids.test.ts +1 -2
  120. package/src/ids/hostnames.fixture.json +20 -0
  121. package/src/ids/hostnames.test.ts +20 -1
  122. package/src/ids/share-paths.test.ts +0 -1
  123. package/src/ids/tunnel-ids.test.ts +0 -1
  124. package/src/index.ts +1 -3
  125. package/src/models/agent-catalog.test.ts +0 -1
  126. package/src/models/capability-ledger.test.ts +0 -1
  127. package/src/models/model-label.test.ts +0 -1
  128. package/src/models/model-offer.test.ts +0 -1
  129. package/src/models/model-order.test.ts +0 -1
  130. package/src/models/model-pins.test.ts +0 -1
  131. package/src/models/model-roles.test.ts +0 -1
  132. package/src/models/plan-pools.test.ts +0 -1
  133. package/src/models/provider-specs.test.ts +0 -1
  134. package/src/policy/batch-runs.test.ts +0 -1
  135. package/src/policy/command-classes.test.ts +0 -1
  136. package/src/policy/command-run.test.ts +35 -0
  137. package/src/policy/command-run.ts +10 -5
  138. package/src/policy/credential-material.test.ts +0 -1
  139. package/src/policy/fence-paths.test.ts +0 -1
  140. package/src/policy/overlay-lint.test.ts +0 -1
  141. package/src/policy/owner-ticket.test.ts +0 -1
  142. package/src/policy/persona-home.test.ts +0 -1
  143. package/src/policy/reserved-servers.test.ts +0 -1
  144. package/src/policy/safety-policy.test.ts +0 -1
  145. package/src/policy/search-globs.test.ts +0 -1
  146. package/src/protocol/container-requirements.test.ts +0 -1
  147. package/src/protocol/ingress-contract.test.ts +0 -1
  148. package/src/protocol/ingress-protocol.test.ts +45 -2
  149. package/src/protocol/ingress-protocol.ts +25 -4
  150. package/src/protocol/peer-dial.test.ts +1 -2
  151. package/src/protocol/peer-mcp-server.test.ts +0 -1
  152. package/src/protocol/routes.test.ts +6 -3
  153. package/src/protocol/tunnel-heartbeat.test.ts +2 -3
  154. package/src/protocol/upgrade-relay.ts +28 -0
  155. package/src/schemas/agent.test.ts +0 -1
  156. package/src/schemas/agents.ts +14 -7
  157. package/src/schemas/areas.test.ts +1 -2
  158. package/src/schemas/capabilities.ts +6 -0
  159. package/src/schemas/ci.ts +3 -9
  160. package/src/schemas/context-trim.test.ts +0 -1
  161. package/src/schemas/dev-rebuild-log.test.ts +0 -1
  162. package/src/schemas/devices.ts +16 -9
  163. package/src/schemas/git/git.test.ts +0 -1
  164. package/src/schemas/keep-warm.test.ts +68 -0
  165. package/src/schemas/keep-warm.ts +124 -0
  166. package/src/schemas/metrics.ts +33 -64
  167. package/src/schemas/providers/provider-oauth.ts +6 -0
  168. package/src/schemas/providers/usage.ts +7 -0
  169. package/src/schemas/settings.test.ts +41 -7
  170. package/src/schemas/settings.ts +78 -44
  171. package/src/schemas/version-seam.test.ts +0 -1
  172. package/src/state/contract-lock.test.ts +0 -1
  173. package/src/state/fix-attempt-plan.test.ts +0 -1
  174. package/src/state/fix-stance.test.ts +14 -1
  175. package/src/state/fix-stance.ts +2 -0
  176. package/src/state/landed-commit.test.ts +0 -1
  177. package/src/state/runtime-state.test.ts +0 -1
  178. package/src/state/runtime-state.ts +4 -0
  179. package/src/state/versions.test.ts +0 -1
  180. package/src/state/workspace-state.test.ts +0 -3
  181. package/src/state/workspace-state.ts +0 -14
  182. package/src/text/archives.test.ts +0 -1
  183. package/src/text/documents.test.ts +0 -1
  184. package/src/text/embed.test.ts +2 -3
  185. package/src/text/emoji.test.ts +0 -1
  186. package/src/text/mentions.test.ts +0 -1
  187. package/src/text/path-refs.test.ts +0 -1
  188. package/src/text/title.test.ts +0 -1
  189. package/src/text/transcript-fold.test.ts +32 -4
  190. package/src/text/transcript-fold.ts +39 -9
  191. package/src/text/whisper.test.ts +0 -1
  192. package/src/text/workflow-faults.test.ts +0 -1
  193. package/src/time/zone.test.ts +0 -1
  194. package/src/time/zone.ts +7 -0
  195. package/src/webext/index.ts +1 -1
  196. package/dist/contracts/prepush.contract.d.ts +0 -32
  197. package/dist/contracts/prepush.contract.d.ts.map +0 -1
  198. package/dist/contracts/prepush.contract.js +0 -41
  199. package/dist/contracts/prepush.contract.js.map +0 -1
  200. package/src/contracts/prepush.contract.ts +0 -58
package/src/time/zone.ts CHANGED
@@ -108,6 +108,13 @@ const offsetMinutes = (at: number, zone: Zone): number => {
108
108
  return (match[1] === "-" ? -1 : 1) * (Number(match[2]) * 60 + Number(match[3]));
109
109
  };
110
110
 
111
+ /** The instant the calendar day after the one `at` falls on begins, in a named zone: where `civilDayIn` next changes. */
112
+ export const nextDayStartIn = (at: number, zone: Zone): number => {
113
+ const [year = 0, month = 1, day = 1] = civilDayIn(at, zone).split("-").map(Number);
114
+ const midnightUtc = Date.UTC(year, month - 1, day + 1);
115
+ return midnightUtc - offsetMinutes(midnightUtc, zone) * 60_000;
116
+ };
117
+
111
118
  /** Whether two zones are showing the same wall clock right now — which is when naming one on screen would be noise. */
112
119
  export const sameClock = (a: Zone, b: Zone, at: number = Date.now()): boolean => a === b || offsetMinutes(at, a) === offsetMinutes(at, b);
113
120
 
@@ -2,7 +2,7 @@
2
2
  // `src/index.ts` reaches every schema and contract in the repo, and the extension's bundle is uploaded to a store,
3
3
  // where ~400 kB of the daemon's unrelated wire surface is both dead weight and something a reviewer has to account for.
4
4
  // Nothing here may import that barrel, or the saving is silently undone — `pnpm --filter @intentic/webext build`
5
- // prints the bundle size, and _devices/webext/README.md records what it should be.
5
+ // checks the bundle against the ceiling in _devices/webext/scripts/size-budget.mjs.
6
6
  export { webextContract } from "../contracts/webext.contract.js";
7
7
  export * from "../protocol/webext-links.js";
8
8
  export * from "../protocol/webext-protocol.js";
@@ -1,32 +0,0 @@
1
- import { z } from "zod";
2
- export declare const PrepushRunSchema: z.ZodPrefault<z.ZodObject<{
3
- repos: z.ZodDefault<z.ZodArray<z.ZodString>>;
4
- }, z.core.$strip>>;
5
- export declare const prepushContract: {
6
- state: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
7
- status: z.ZodEnum<{
8
- cancelled: "cancelled";
9
- error: "error";
10
- failed: "failed";
11
- idle: "idle";
12
- passed: "passed";
13
- running: "running";
14
- }>;
15
- command: z.ZodString;
16
- startedAt: z.ZodOptional<z.ZodNumber>;
17
- finishedAt: z.ZodOptional<z.ZodNumber>;
18
- exitCode: z.ZodOptional<z.ZodNumber>;
19
- timedOut: z.ZodOptional<z.ZodBoolean>;
20
- session: z.ZodOptional<z.ZodString>;
21
- output: z.ZodString;
22
- }, z.core.$strip>, Record<never, never>, import("../protocol/route-meta.js").RouteMeta & Record<never, never>>;
23
- run: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodPrefault<z.ZodObject<{
24
- repos: z.ZodDefault<z.ZodArray<z.ZodString>>;
25
- }, z.core.$strip>>, z.ZodObject<{
26
- ok: z.ZodLiteral<true>;
27
- }, z.core.$strip>, Record<never, never>, import("../protocol/route-meta.js").RouteMeta & Record<never, never>>;
28
- cancel: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
29
- ok: z.ZodLiteral<true>;
30
- }, z.core.$strip>, Record<never, never>, import("../protocol/route-meta.js").RouteMeta & Record<never, never>>;
31
- };
32
- //# sourceMappingURL=prepush.contract.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prepush.contract.d.ts","sourceRoot":"","sources":["../../src/contracts/prepush.contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,gBAAgB;;kBAQZ,CAAC;AAWlB,eAAO,MAAM,eAAe;IACxB,KAAK;;;;;;;;;;;;;;;;;IASL,GAAG;;;;;IAUH,MAAM;;;CAQT,CAAC"}
@@ -1,41 +0,0 @@
1
- import { procedure } from "../protocol/route-meta.js";
2
- import { z } from "zod";
3
- import { CommandRunSchema } from "../schemas/ci.js";
4
- import { OkSchema } from "../schemas/shared.js";
5
- export const PrepushRunSchema = z
6
- .object({
7
- repos: z
8
- .array(z.string().min(1))
9
- .max(100)
10
- .default([])
11
- .describe("The repositories going out, by workspace id. Empty runs only what stands for every push, whichever repository it is."),
12
- })
13
- .prefault({});
14
- export const prepushContract = {
15
- state: procedure
16
- .route({
17
- method: "GET",
18
- path: "/prepush/state",
19
- summary: "How the pre-push check is going",
20
- description: "The verdict, or the progress so far. Nothing is addressed by id here, because there is one working tree and so exactly one check.",
21
- })
22
- .output(CommandRunSchema),
23
- run: procedure
24
- .route({
25
- method: "POST",
26
- path: "/prepush/run",
27
- summary: "Run the checks before pushing",
28
- description: "Starts the suite the workspace runs before anything leaves the machine, and answers immediately. A suite takes minutes, and a request held open that long dies at the first proxy. It runs in a real terminal, so watch it there and poll for the verdict. Name the repositories going out, and each one's own checks run in its own directory.",
29
- })
30
- .input(PrepushRunSchema)
31
- .output(OkSchema),
32
- cancel: procedure
33
- .route({
34
- method: "POST",
35
- path: "/prepush/cancel",
36
- summary: "Stop the pre-push check",
37
- description: "Kills the run. It settles as cancelled and the push it was gating does not go.",
38
- })
39
- .output(OkSchema),
40
- };
41
- //# sourceMappingURL=prepush.contract.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prepush.contract.js","sourceRoot":"","sources":["../../src/contracts/prepush.contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAOhD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC5B,MAAM,CAAC;IACJ,KAAK,EAAE,CAAC;SACH,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACxB,GAAG,CAAC,GAAG,CAAC;SACR,OAAO,CAAC,EAAE,CAAC;SACX,QAAQ,CAAC,sHAAsH,CAAC;CACxI,CAAC;KACD,QAAQ,CAAC,EAAE,CAAC,CAAC;AAWlB,MAAM,CAAC,MAAM,eAAe,GAAG;IAC3B,KAAK,EAAE,SAAS;SACX,KAAK,CAAC;QACH,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE,iCAAiC;QAC1C,WAAW,EACP,mIAAmI;KAC1I,CAAC;SACD,MAAM,CAAC,gBAAgB,CAAC;IAC7B,GAAG,EAAE,SAAS;SACT,KAAK,CAAC;QACH,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,+BAA+B;QACxC,WAAW,EACP,iVAAiV;KACxV,CAAC;SACD,KAAK,CAAC,gBAAgB,CAAC;SACvB,MAAM,CAAC,QAAQ,CAAC;IACrB,MAAM,EAAE,SAAS;SACZ,KAAK,CAAC;QACH,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,yBAAyB;QAClC,WAAW,EAAE,gFAAgF;KAChG,CAAC;SACD,MAAM,CAAC,QAAQ,CAAC;CACxB,CAAC"}
@@ -1,58 +0,0 @@
1
- import { procedure } from "../protocol/route-meta.js";
2
- import { z } from "zod";
3
- import { CommandRunSchema } from "../schemas/ci.js";
4
- import { OkSchema } from "../schemas/shared.js";
5
-
6
- // Which repositories are about to be pushed. The check is one run over one working tree, but what stands in it is not
7
- // the same for every push: a repository's own checks (repo-checks.ts) run only when that repository is going out, and a
8
- // rule the owner aimed at one repository does the same.
9
- // `prefault`, so a caller that sends no body at all still starts the check: a browser tab open since before this input
10
- // existed is the ordinary case, and refusing its push over a missing field would be the worst possible way to say so.
11
- export const PrepushRunSchema = z
12
- .object({
13
- repos: z
14
- .array(z.string().min(1))
15
- .max(100)
16
- .default([])
17
- .describe("The repositories going out, by workspace id. Empty runs only what stands for every push, whichever repository it is."),
18
- })
19
- .prefault({});
20
-
21
- // The pre-push check, the command the workspace runs when the user pushes, before anything leaves the machine
22
- // (see CommandRunSchema for where this sits and why). Three verbs about ONE run: the check answers about the
23
- // main working tree, of which there is exactly one, so nothing here is addressed by id.
24
- //
25
- // `run` starts the check and returns immediately, a suite takes minutes, and an oRPC call held open for one
26
- // would die on the first proxy timeout with the work still going. The dialog that started it polls `state` for
27
- // the verdict, and opens the terminals panel on the `session` the first answer names: the suite runs in a real
28
- // tmux window, so watching it is the terminal's job. `cancel` kills that window; the run settles as `cancelled`
29
- // and the push it was gating does not go.
30
- export const prepushContract = {
31
- state: procedure
32
- .route({
33
- method: "GET",
34
- path: "/prepush/state",
35
- summary: "How the pre-push check is going",
36
- description:
37
- "The verdict, or the progress so far. Nothing is addressed by id here, because there is one working tree and so exactly one check.",
38
- })
39
- .output(CommandRunSchema),
40
- run: procedure
41
- .route({
42
- method: "POST",
43
- path: "/prepush/run",
44
- summary: "Run the checks before pushing",
45
- description:
46
- "Starts the suite the workspace runs before anything leaves the machine, and answers immediately. A suite takes minutes, and a request held open that long dies at the first proxy. It runs in a real terminal, so watch it there and poll for the verdict. Name the repositories going out, and each one's own checks run in its own directory.",
47
- })
48
- .input(PrepushRunSchema)
49
- .output(OkSchema),
50
- cancel: procedure
51
- .route({
52
- method: "POST",
53
- path: "/prepush/cancel",
54
- summary: "Stop the pre-push check",
55
- description: "Kills the run. It settles as cancelled and the push it was gating does not go.",
56
- })
57
- .output(OkSchema),
58
- };