@intentic/sandbox-contract 1.253.0 → 1.254.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/contracts/prepush.contract.d.ts +22 -16
  2. package/dist/contracts/prepush.contract.d.ts.map +1 -1
  3. package/dist/contracts/prepush.contract.js +12 -1
  4. package/dist/contracts/prepush.contract.js.map +1 -1
  5. package/dist/contracts/settings.contract.d.ts +38 -0
  6. package/dist/contracts/settings.contract.d.ts.map +1 -1
  7. package/dist/contracts/settings.contract.js +18 -0
  8. package/dist/contracts/settings.contract.js.map +1 -1
  9. package/dist/contracts/system.contract.d.ts +30 -30
  10. package/dist/index.d.ts +72 -31
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +1 -0
  13. package/dist/index.js.map +1 -1
  14. package/dist/schemas/devices.d.ts +14 -0
  15. package/dist/schemas/devices.d.ts.map +1 -1
  16. package/dist/schemas/devices.js +7 -0
  17. package/dist/schemas/devices.js.map +1 -1
  18. package/dist/schemas/repo-checks.d.ts +74 -0
  19. package/dist/schemas/repo-checks.d.ts.map +1 -0
  20. package/dist/schemas/repo-checks.js +36 -0
  21. package/dist/schemas/repo-checks.js.map +1 -0
  22. package/dist/schemas/settings.d.ts +31 -0
  23. package/dist/schemas/settings.d.ts.map +1 -1
  24. package/dist/schemas/settings.js +17 -0
  25. package/dist/schemas/settings.js.map +1 -1
  26. package/dist/state/definition.d.ts +4 -0
  27. package/dist/state/definition.d.ts.map +1 -1
  28. package/package.json +4 -4
  29. package/src/contracts/prepush.contract.ts +18 -1
  30. package/src/contracts/settings.contract.ts +22 -0
  31. package/src/index.ts +1 -0
  32. package/src/schemas/devices.ts +24 -3
  33. package/src/schemas/repo-checks.ts +64 -0
  34. package/src/schemas/settings.ts +28 -1
@@ -0,0 +1,64 @@
1
+ // repo-checks: what a REPOSITORY says should be run on its own code, declared in the repository, at
2
+ // `<repo>/.intentic/checks.json`.
3
+ //
4
+ // The line between this file and the sandbox's own settings is authority, not subject matter: a repository may declare
5
+ // WHAT to run, because the command belongs beside the scripts it names and travels with the checkout; only the sandbox
6
+ // owner decides what happens when it fails (whether work lands, whether a push goes), and that stays in settings.json.
7
+ // Nothing declared here runs until the owner adopts it for that repository (settings `adoptedChecks`), the same rule
8
+ // git keeps for hooks, which are never cloned.
9
+ import { z } from "zod";
10
+
11
+ // Named for the occasion as a repository would say it, not for the daemon's wire moment: `turn` is `turn.ending` and
12
+ // `push` is `push.starting` (rules/repo-checks.ts maps them). Two, because these are the two occasions whose command a
13
+ // repository actually owns; a verdict moment has nothing here to express.
14
+ export const RepoCheckMomentSchema = z.enum(["turn", "push"]);
15
+ export type RepoCheckMoment = z.infer<typeof RepoCheckMomentSchema>;
16
+
17
+ export const RepoCheckSchema = z.object({
18
+ when: RepoCheckMomentSchema.describe("When to run it: `turn` before the assistant finishes, `push` before code leaves the machine."),
19
+ run: z.string().min(1).max(500).describe("The command, run in this repository's own directory, so it reads as it would in a terminal there."),
20
+ label: z.string().min(1).max(80).optional().describe("What to call it on screen. Absent names it after the command."),
21
+ // Same ceiling as a rule's own command; past it the process group is killed and the run is a failure, never a
22
+ // silent pass.
23
+ timeoutMs: z.number().min(60_000).max(3_600_000).optional().describe("How long it may take before it is killed and counted as failed."),
24
+ // Repo-relative, as anybody reading this file would write them; the daemon prefixes the repo id before matching,
25
+ // since a rule's globs are workspace-relative.
26
+ paths: z
27
+ .array(z.string().min(1))
28
+ .max(20)
29
+ .optional()
30
+ .describe("Only run it when the change touches these paths, written relative to this repository. Absent runs it on every change here."),
31
+ });
32
+ export type RepoCheck = z.infer<typeof RepoCheckSchema>;
33
+
34
+ // The file itself. One key, so a second concern can be added later without breaking a file anyone has written.
35
+ export const RepoChecksFileSchema = z.object({ checks: z.array(RepoCheckSchema).max(10).default([]) });
36
+ export type RepoChecksFile = z.infer<typeof RepoChecksFileSchema>;
37
+
38
+ // One repository, as a screen reads it: what it declares, and where that stands with the owner.
39
+ export const RepoChecksSummarySchema = z.object({
40
+ repo: z.string().describe('Which repository, by its workspace id ("root" is the workspace itself).'),
41
+ path: z.string().describe("Where the declaration lives, relative to the workspace, whether or not the file exists yet."),
42
+ checks: z.array(RepoCheckSchema).describe("What it declares, in the order the file lists them."),
43
+ adopted: z
44
+ .boolean()
45
+ .describe("Whether these are running. False means declared and inert: nothing a repository writes runs until the owner switches it on."),
46
+ changed: z
47
+ .boolean()
48
+ .describe(
49
+ "Whether the declaration changed since it was adopted, which holds it until the owner looks again. True only for a repository that was adopted before.",
50
+ ),
51
+ error: z.string().optional().describe("Why the file could not be read, when it exists but does not parse. The checks list is empty in that case."),
52
+ });
53
+ export type RepoChecksSummary = z.infer<typeof RepoChecksSummarySchema>;
54
+ export const RepoChecksListSchema = z.object({
55
+ repos: z.array(RepoChecksSummarySchema).describe("Every repository that declares checks, plus any the owner has adopted before, sorted by id."),
56
+ });
57
+ export type RepoChecksList = z.infer<typeof RepoChecksListSchema>;
58
+ export const RepoChecksAdoptSchema = z.object({
59
+ repo: z.string().min(1).describe("Which repository's declaration to switch."),
60
+ on: z
61
+ .boolean()
62
+ .describe("On adopts what it declares as it stands now; off stops running it. Adopting again is how a changed declaration is accepted."),
63
+ });
64
+ export type RepoChecksAdopt = z.infer<typeof RepoChecksAdoptSchema>;
@@ -369,8 +369,18 @@ export const SandboxSettingsSchema = z.object({
369
369
  .describe(
370
370
  "Whether a turn killed by the sandbox restarting is re-run once it comes back. Off to begin with, for the same reason: it would spend your allowance on work you are not watching and edit files while you are still waiting for the sandbox to return. Either way the interruption is recorded rather than silently lost.",
371
371
  ),
372
+ // Which repositories' own declarations (`<repo>/.intentic/checks.json`) the owner has switched on, each against the
373
+ // fingerprint of what was declared when they did. A declaration that has since changed no longer matches its
374
+ // fingerprint and is held rather than run, which is what makes adoption a decision about a command rather than a
375
+ // permanent permission on a folder. Keyed by repo id, so `/` in the key is ordinary.
376
+ adoptedChecks: z
377
+ .record(z.string(), z.string())
378
+ .default({})
379
+ .describe(
380
+ "Which repositories may run the checks they declare for themselves, and exactly which version of those checks you agreed to. A repository's declaration does nothing until it appears here, the same rule git keeps for hooks, which are never cloned; and a declaration that changes afterwards is held until you look at it again.",
381
+ ),
372
382
  // Lives in the owner's own settings, not the workspace: a rule can hold work and gate a push, so it answers to the
373
- // sandbox owner alone. Repo- or extension-contributed rules aren't supported yet.
383
+ // sandbox owner alone. A repository may declare a COMMAND of its own (see `adoptedChecks`), never a verdict.
374
384
  rules: z
375
385
  .array(RuleSchema)
376
386
  .max(50)
@@ -511,6 +521,22 @@ export const TierReportSchema = z.object({
511
521
  denied: z.number(),
512
522
  });
513
523
  export type TierReport = z.infer<typeof TierReportSchema>;
524
+ // One dependency version or library improvement suggested or pinned.
525
+ export const DependencyImprovementSchema = z.object({
526
+ prevented: z.string(),
527
+ chosen: z.string(),
528
+ reason: z.string(),
529
+ at: z.number().optional(),
530
+ });
531
+ export type DependencyImprovement = z.infer<typeof DependencyImprovementSchema>;
532
+ // Rollup of registry freshness interventions over the queried day window.
533
+ export const DependencySavingsSchema = z.object({
534
+ checked: z.number(),
535
+ improved: z.number(),
536
+ recent: z.array(DependencyImprovementSchema),
537
+ updatedAt: z.number().optional(),
538
+ });
539
+ export type DependencySavings = z.infer<typeof DependencySavingsSchema>;
514
540
  export const SavingsReportSchema = z.object({
515
541
  input: InputSavingsSchema,
516
542
  search: TurnExperimentSchema.optional(),
@@ -518,5 +544,6 @@ export const SavingsReportSchema = z.object({
518
544
  map: TurnExperimentSchema.optional(),
519
545
  // Automatic tier selection's readout, see TierReportSchema. Absent ⇒ nothing was judged in the window.
520
546
  tier: TierReportSchema.optional(),
547
+ dependencies: DependencySavingsSchema.optional(),
521
548
  });
522
549
  export type SavingsReport = z.infer<typeof SavingsReportSchema>;