@maycombhq/sdk 2.0.0-beta.21 → 2.0.0-beta.23

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.
@@ -1,7 +1,8 @@
1
1
  /**
2
- * roles.yaml version 1 → 2 (ADR 0140). Version 2 adds `teams`; a file without them names no
3
- * team, as version 1 did, so the step writes the new number only and keeps the file's comments,
4
- * order and line layout (`atticus upgrade`'s roles-v2).
2
+ * roles.yaml version 1 → 2 (ADR 0140) → 3 (ADR 0191). Version 2 adds `teams`, version 3 who
3
+ * takes each role (`defaults`, a team's `roles`); a file without them names none, as before, so
4
+ * the step writes the new number only and keeps the file's comments, order and line layout
5
+ * (`atticus upgrade`'s roles-v2, which writes the current version).
5
6
  */
6
7
  export declare function migrateRolesText(text: string): {
7
8
  text: string;
@@ -0,0 +1,165 @@
1
+ /**
2
+ * ADR 0187: what a command run outside the app prints, for the app's Console. A long command
3
+ * (`atticus map`, `verify`, `scan`, `workspace sync`, a task run, ...) run in a terminal, by an
4
+ * editor or by a Copilot session keeps:
5
+ *
6
+ * - `.atticus/logs/runs/<runId>.log`: the lines it printed, each redacted as the local log is
7
+ * (ADR 0050's redactText: no secrets, tokens, credentials in URLs or home folder), with no
8
+ * colour codes; bounded (its last lines are kept past RUN_LOG_MAX_BYTES).
9
+ * - `.atticus/logs/running/<runId>.json`: who and what — the command words, the ids it was given
10
+ * (repo, change, run and task ids: words that look like an id and nothing else), the names of
11
+ * its flags (never their values), the process and a hash of the machine's name, when it
12
+ * started, and how it ended (its exit code), written again when it ends. While it runs it is
13
+ * written again every RUN_HEARTBEAT_MS (`beatAt`), and on Linux it keeps when its process
14
+ * started (`procStart`, from /proc): a process id used again by another process, or a run
15
+ * silent past RUN_SILENT_MS, is a run that ended without saying.
16
+ *
17
+ * Only the last RUN_LOG_KEEP runs are kept. `.atticus/logs/` is this machine's own (never
18
+ * committed). The names have no `:` (Windows). Nothing here loads a schema: the command line
19
+ * starts a run before it knows anything else. Writing never throws: a run log that can't be
20
+ * written is skipped, never failing the command it describes.
21
+ */
22
+ export declare const RUN_LOG_KEEP = 50;
23
+ export declare const RUN_LOG_MAX_BYTES: number;
24
+ /** A line longer than this is cut (a minified file printed whole). */
25
+ export declare const RUN_LOG_LINE_MAX = 4000;
26
+ /** The lines a read gives at most. */
27
+ export declare const RUN_LOG_READ_MAX = 5000;
28
+ /** A running command writes its record again this often. */
29
+ export declare const RUN_HEARTBEAT_MS = 30000;
30
+ /** A running record that beats, silent (record and log) for longer than this, has ended. */
31
+ export declare const RUN_SILENT_MS: number;
32
+ /** `20261109-101530-4242-ab12`: when (UTC), the process, and a little randomness. */
33
+ export declare const TERMINAL_RUN_ID: RegExp;
34
+ export declare const runLogsDirOf: (root: string) => string;
35
+ export declare const runningDirOf: (root: string) => string;
36
+ export type StartedBy = "terminal" | "vscode" | "intellij" | "copilot";
37
+ export type TerminalRunState = "running" | "done" | "failed" | "cancelled";
38
+ export interface TerminalRunRecord {
39
+ schemaVersion: 1;
40
+ runId: string;
41
+ pid: number;
42
+ /** A hash of the machine's name: whether the process can be looked for here. */
43
+ host: string;
44
+ title: string;
45
+ command: string[];
46
+ flags: string[];
47
+ startedBy: StartedBy;
48
+ startedAt: string;
49
+ state: TerminalRunState;
50
+ finishedAt?: string;
51
+ exitCode?: number;
52
+ /** Lines printed so far (as of the last write of the record; the log has them all). */
53
+ lines: number;
54
+ /** Lines no longer in the log (the log keeps its last lines). */
55
+ dropped: number;
56
+ /** When the process started, as the system says (Linux: /proc), to tell a reused pid. */
57
+ procStart?: string;
58
+ /** When a running command last wrote its record (every RUN_HEARTBEAT_MS). */
59
+ beatAt?: string;
60
+ }
61
+ /** A record as read: `stale` when its process is gone though it never said it ended. */
62
+ export type TerminalRunView = TerminalRunRecord & {
63
+ stale?: true;
64
+ };
65
+ export declare function recordedCommand(positionals: readonly string[], flags: readonly string[]): boolean;
66
+ /** The command words, ids and flag names of a run, and its title. */
67
+ export declare function runTitle(positionals: readonly string[], flags: readonly string[]): {
68
+ command: string[];
69
+ title: string;
70
+ };
71
+ /** Where the run was started, as its environment says. */
72
+ export declare function startedByOf(env?: NodeJS.ProcessEnv): StartedBy;
73
+ /**
74
+ * When a process started, as Linux keeps it (/proc/<pid>/stat's starttime, in ticks since boot):
75
+ * one file read, no command run. Undefined elsewhere, or when it can't be read.
76
+ */
77
+ export declare function procStartOf(pid: number): string | undefined;
78
+ /** A printed text as the lines the log keeps: no colour codes, no \r, each redacted and cut. */
79
+ export declare function runLogLines(text: string, o?: {
80
+ home?: string;
81
+ user?: string;
82
+ }): string[];
83
+ export interface TerminalRunRecorder {
84
+ readonly runId: string;
85
+ /** Print a line (or several, split at newlines) to the run's log. */
86
+ line(text: string): void;
87
+ /** Record how it ended: 0 done, 130 or 143 (Ctrl+C, a stop) cancelled, else failed. */
88
+ end(code: number, how?: "crash"): void;
89
+ }
90
+ export interface StartRunOptions {
91
+ positionals: readonly string[];
92
+ flags: readonly string[];
93
+ env?: NodeJS.ProcessEnv;
94
+ now?: () => Date;
95
+ pid?: number;
96
+ keep?: number;
97
+ maxBytes?: number;
98
+ redact?: {
99
+ home?: string;
100
+ user?: string;
101
+ };
102
+ /**
103
+ * Record the end on the process's exit, Ctrl+C and SIGTERM too, when nothing else did (the
104
+ * command line passes true; a test doesn't).
105
+ */
106
+ hookProcess?: boolean;
107
+ /** Write the record again this often while it runs. Default RUN_HEARTBEAT_MS with hookProcess. */
108
+ heartbeatMs?: number;
109
+ /** When this process started (procStartOf, for its own pid only). */
110
+ procStart?: () => string | undefined;
111
+ /** Whether a process is there (pidAlive), for the runs pruned as this one starts. */
112
+ alive?: (pid: number) => boolean;
113
+ }
114
+ /**
115
+ * Start a run's files. Undefined when they can't be written (the run goes on without them).
116
+ * The caller checks `recordedCommand` first.
117
+ */
118
+ export declare function startTerminalRun(root: string, o: StartRunOptions): TerminalRunRecorder | undefined;
119
+ /** Whether a process is there: signal 0 asks without sending anything. */
120
+ export declare function pidAlive(pid: number): boolean;
121
+ /**
122
+ * The runs kept, newest first. A run still `running` whose process is gone on this machine (or
123
+ * that started days ago elsewhere) is `stale`: it ended without saying (closed terminal, a crash).
124
+ */
125
+ export declare function readTerminalRuns(root: string, o?: {
126
+ alive?: (pid: number) => boolean;
127
+ now?: () => Date;
128
+ /** When a process started (procStartOf). */
129
+ startOf?: (pid: number) => string | undefined;
130
+ }): TerminalRunView[];
131
+ /** One run as read now, or undefined. */
132
+ export declare const readTerminalRun: (root: string, runId: string, o?: {
133
+ alive?: (pid: number) => boolean;
134
+ now?: () => Date;
135
+ startOf?: (pid: number) => string | undefined;
136
+ }) => TerminalRunView | undefined;
137
+ /**
138
+ * A run's lines from a line on (`from`, counted from its first line ever), at most `max`; without
139
+ * `from`, its last `max`. `total` is how many it has printed. Undefined for no such run.
140
+ */
141
+ export declare function readTerminalRunLines(root: string, runId: string, from?: number, max?: number): {
142
+ from: number;
143
+ lines: string[];
144
+ total: number;
145
+ } | undefined;
146
+ /** Where a tail of a run's log has read to: the next line's number and its byte in the file. */
147
+ export interface RunLogTail {
148
+ line: number;
149
+ bytes: number;
150
+ /** The record's dropped count and the file (its inode) when read: either changing is a cut. */
151
+ dropped: number;
152
+ ino: number;
153
+ }
154
+ /**
155
+ * A run's new lines since `at` (where the last tail read to), at most `max`: only the bytes
156
+ * added are read. Without `at`, or when the log was cut meanwhile, the whole log is read once:
157
+ * its last `max` lines without `at`, else from `at.line` (or the first line kept, when those were
158
+ * dropped). `more` says lines past `max` wait for the next read. Undefined for no such run.
159
+ */
160
+ export declare function tailTerminalRunLines(root: string, runId: string, at: RunLogTail | undefined, max?: number): {
161
+ from: number;
162
+ lines: string[];
163
+ at: RunLogTail;
164
+ more: boolean;
165
+ } | undefined;
@@ -128,22 +128,36 @@ type CallLike = {
128
128
  value: string;
129
129
  };
130
130
  };
131
+ /**
132
+ * Review round 2 (beta.23): a person's newest edit of where a call goes (an `edit` setting `to`,
133
+ * not the AI's), or none.
134
+ */
135
+ export declare function personEditOfTo(f: CallLike, corrections: readonly FactCorrection[]): FactCorrection | undefined;
131
136
  /**
132
137
  * G1 (ADR 0174): every pairing (`link`) that meets a call, newest first: on its cited line by its
133
138
  * id or by what it cites, or by its id where an edit of the same fact moved it to the line it is
134
139
  * on now. One matcher for the verifier and the join.
135
140
  */
136
141
  export declare function linksFor(f: CallLike, corrections: readonly FactCorrection[]): FactCorrection[];
137
- /** A pairing as the join reads it: what the call reaches, who said so, and (ADR 0181) the AI run. */
142
+ /**
143
+ * A pairing as the join reads it: what the call reaches, who said so, and (ADR 0181) the AI run.
144
+ * Review round 48: `none` when a person's `unlink` is the newest (asked for with `declined`): the
145
+ * call reaches nothing a person knows of, so an AI answer never joins it (the path is the call's).
146
+ */
138
147
  export type PairOnFile = CorrectionLink & {
139
148
  by: string;
140
149
  ai?: CorrectionAi;
150
+ none?: true;
141
151
  };
142
152
  /**
143
153
  * G1 (ADR 0174): a repo's pairings, call fact id → what the person paired it with, from its
144
154
  * corrections file: the newest link per call (a repo's or an outside system's), met as linksFor
145
155
  * meets it. A link that meets no call is left out (the verifier says so). ADR 0181: an AI
146
- * pairing keeps its run (`ai`); a newer `unlink` withdraws any pairing.
156
+ * pairing keeps its run (`ai`); a newer `unlink` withdraws any pairing. With `declined` (the
157
+ * join's read, round 48), a person's newest `unlink` is kept as `none`, so the join knows a
158
+ * person said "none" and an AI answer doesn't join the call.
147
159
  */
148
- export declare function pairsFromCorrections(facts: readonly CallLike[], corrections: readonly FactCorrection[]): Record<string, PairOnFile>;
160
+ export declare function pairsFromCorrections(facts: readonly CallLike[], corrections: readonly FactCorrection[], o?: {
161
+ declined?: boolean;
162
+ }): Record<string, PairOnFile>;
149
163
  export {};
@@ -77,20 +77,30 @@ export declare const Approver: z.ZodObject<{
77
77
  * Words, not permissions: nothing is allowed or refused by team. The rest of the file stays
78
78
  * deprecated (ADR 0073). A version-1 file is read as it is; `teams` needs version 2.
79
79
  */
80
- export declare const ROLES_SCHEMA_VERSION: 2;
80
+ /**
81
+ * Version 3 (ADR 0191) adds who takes each role on a change, so a new change's owners are
82
+ * suggested: a team's `roles` (each built-in or custom role id with the team's people who take
83
+ * it, for the changes on that team's repos) and the file's `defaults` (the organisation's person
84
+ * for a role when no team owning the change's repos names one). Both optional; a person accepts a
85
+ * suggestion, nothing is written by itself. A version-1 or version-2 file reads as it is.
86
+ */
87
+ export declare const ROLES_SCHEMA_VERSION: 3;
81
88
  export declare const Team: z.ZodObject<{
82
89
  id: z.ZodString;
83
90
  name: z.ZodOptional<z.ZodString>;
84
91
  people: z.ZodDefault<z.ZodArray<z.ZodString>>;
92
+ roles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
85
93
  }, z.core.$strict>;
86
94
  export type Team = z.infer<typeof Team>;
87
95
  export declare const Roles: z.ZodObject<{
88
- schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
96
+ schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>;
89
97
  teams: z.ZodDefault<z.ZodArray<z.ZodObject<{
90
98
  id: z.ZodString;
91
99
  name: z.ZodOptional<z.ZodString>;
92
100
  people: z.ZodDefault<z.ZodArray<z.ZodString>>;
101
+ roles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
93
102
  }, z.core.$strict>>>;
103
+ defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
94
104
  custom: z.ZodDefault<z.ZodArray<z.ZodObject<{
95
105
  id: z.ZodString;
96
106
  name: z.ZodString;
@@ -432,6 +442,13 @@ export declare const IntegrationPattern: z.ZodObject<{
432
442
  }>;
433
443
  }, z.core.$strict>;
434
444
  export type IntegrationPattern = z.infer<typeof IntegrationPattern>;
445
+ /**
446
+ * Review round 49: why git wouldn't take a wiki's `ref` as a branch or tag name, or undefined
447
+ * when it would. Git's own rules (git check-ref-format), and never a leading `-`, so the name
448
+ * can't be read as an option. Beta.18 took any name; round 13 narrowed it to letters, digits and
449
+ * `._/-`, which refused names git takes (`v2.1+hotfix`, `feature@x`); this takes them again.
450
+ */
451
+ export declare function gitRefProblem(ref: string): string | undefined;
435
452
  /** Suggested source kinds (ADR 0083). Tags are free text: an organisation adds its own. */
436
453
  export declare const SOURCE_KIND_SUGGESTIONS: readonly ["enterprise-architecture", "integration-patterns", "platform-runbook", "security-standard", "change-process", "framework"];
437
454
  /**
@@ -855,20 +872,26 @@ export declare const Runtime: z.ZodObject<{
855
872
  "text-only": "text-only";
856
873
  off: "off";
857
874
  }>>;
858
- modes: z.ZodDefault<z.ZodObject<{
875
+ modes: z.ZodDefault<z.ZodPipe<z.ZodObject<{
859
876
  allowed: z.ZodArray<z.ZodEnum<{
860
877
  model: "model";
861
878
  "hand-off": "hand-off";
862
879
  "headless-claude-code": "headless-claude-code";
863
880
  "copilot-acp": "copilot-acp";
864
881
  }>>;
865
- default: z.ZodEnum<{
882
+ default: z.ZodOptional<z.ZodEnum<{
866
883
  model: "model";
867
884
  "hand-off": "hand-off";
868
885
  "headless-claude-code": "headless-claude-code";
869
886
  "copilot-acp": "copilot-acp";
870
- }>;
871
- }, z.core.$strict>>;
887
+ }>>;
888
+ }, z.core.$strict>, z.ZodTransform<{
889
+ allowed: ("model" | "hand-off" | "headless-claude-code" | "copilot-acp")[];
890
+ default: "model" | "hand-off" | "headless-claude-code" | "copilot-acp";
891
+ }, {
892
+ allowed: ("model" | "hand-off" | "headless-claude-code" | "copilot-acp")[];
893
+ default?: "model" | "hand-off" | "headless-claude-code" | "copilot-acp" | undefined;
894
+ }>>>;
872
895
  models: z.ZodDefault<z.ZodObject<{
873
896
  allowed: z.ZodDefault<z.ZodArray<z.ZodString>>;
874
897
  recommended: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
@@ -930,42 +953,72 @@ export declare const Runtime: z.ZodObject<{
930
953
  enabled: z.ZodDefault<z.ZodBoolean>;
931
954
  }, z.core.$strict>>;
932
955
  adapters: z.ZodDefault<z.ZodObject<{
933
- workTracker: z.ZodOptional<z.ZodObject<{
956
+ workTracker: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodEnum<{
957
+ [x: string]: string;
958
+ }>, z.ZodTransform<{
959
+ type: string;
960
+ settings: Record<string, string | number | boolean | string[]>;
961
+ }, string>>, z.ZodObject<{
934
962
  type: z.ZodEnum<{
935
963
  [x: string]: string;
936
964
  }>;
937
965
  settings: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>>;
938
- }, z.core.$strict>>;
939
- serviceDesk: z.ZodOptional<z.ZodObject<{
966
+ }, z.core.$strict>]>>;
967
+ serviceDesk: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodEnum<{
968
+ [x: string]: string;
969
+ }>, z.ZodTransform<{
970
+ type: string;
971
+ settings: Record<string, string | number | boolean | string[]>;
972
+ }, string>>, z.ZodObject<{
940
973
  type: z.ZodEnum<{
941
974
  [x: string]: string;
942
975
  }>;
943
976
  settings: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>>;
944
- }, z.core.$strict>>;
945
- gitHost: z.ZodOptional<z.ZodObject<{
977
+ }, z.core.$strict>]>>;
978
+ gitHost: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodEnum<{
979
+ [x: string]: string;
980
+ }>, z.ZodTransform<{
981
+ type: string;
982
+ settings: Record<string, string | number | boolean | string[]>;
983
+ }, string>>, z.ZodObject<{
946
984
  type: z.ZodEnum<{
947
985
  [x: string]: string;
948
986
  }>;
949
987
  settings: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>>;
950
- }, z.core.$strict>>;
951
- wiki: z.ZodOptional<z.ZodObject<{
988
+ }, z.core.$strict>]>>;
989
+ wiki: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodEnum<{
990
+ [x: string]: string;
991
+ }>, z.ZodTransform<{
992
+ type: string;
993
+ settings: Record<string, string | number | boolean | string[]>;
994
+ }, string>>, z.ZodObject<{
952
995
  type: z.ZodEnum<{
953
996
  [x: string]: string;
954
997
  }>;
955
998
  settings: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>>;
956
- }, z.core.$strict>>;
957
- notify: z.ZodOptional<z.ZodObject<{
999
+ }, z.core.$strict>]>>;
1000
+ notify: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodEnum<{
1001
+ [x: string]: string;
1002
+ }>, z.ZodTransform<{
1003
+ type: string;
1004
+ settings: Record<string, string | number | boolean | string[]>;
1005
+ }, string>>, z.ZodObject<{
958
1006
  type: z.ZodEnum<{
959
1007
  [x: string]: string;
960
1008
  }>;
961
1009
  settings: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>>;
962
- }, z.core.$strict>>;
963
- design: z.ZodOptional<z.ZodObject<{
1010
+ }, z.core.$strict>]>>;
1011
+ design: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodEnum<{
1012
+ [x: string]: string;
1013
+ }>, z.ZodTransform<{
1014
+ type: string;
1015
+ settings: Record<string, string | number | boolean | string[]>;
1016
+ }, string>>, z.ZodObject<{
964
1017
  type: z.ZodEnum<{
965
1018
  [x: string]: string;
966
1019
  }>;
967
1020
  settings: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>>;
968
- }, z.core.$strict>>;
1021
+ }, z.core.$strict>]>>;
969
1022
  model: z.ZodOptional<z.ZodObject<{
970
1023
  type: z.ZodUnion<readonly [z.ZodEnum<{
971
1024
  mock: "mock";
@@ -33,7 +33,15 @@ import { z } from "zod";
33
33
  * question: `askedOf` (the team or person a person's Ask routed it to) and `finding` (the gap it
34
34
  * asks about, by change, gate, round and id). Both optional.
35
35
  */
36
- export declare const QUESTION_SCHEMA_VERSION: 5;
36
+ /**
37
+ * Version 6 (ADR 0191, routing by what a question asks) adds two optional fields: `asks`, what the
38
+ * question asks (business, design or delivery), which the AI tags when it raises it and which
39
+ * decides the role that owns it (business → the product owner, or the business analyst from the
40
+ * stories on; design → the architect; delivery → the tech lead); and `routed`, a person's
41
+ * re-routing of it to another role (from which, by whom, when), with `role` holding the new one.
42
+ * Version-1 to version-5 files read as before and come back as version 6 in memory.
43
+ */
44
+ export declare const QUESTION_SCHEMA_VERSION: 6;
37
45
  /**
38
46
  * ADR 0181 part 4: who owns a question on a change, by the phase that raised it. The product owner
39
47
  * (Define), the architect (Design), the business analyst (Plan's stories) and the tech lead (Plan's
@@ -47,6 +55,31 @@ export declare const QuestionRole: z.ZodEnum<{
47
55
  analysis: "analysis";
48
56
  }>;
49
57
  export type QuestionRole = z.infer<typeof QuestionRole>;
58
+ /**
59
+ * ADR 0191: what a question asks, by its level. `business`: what the change must do for whom (a
60
+ * rule, a limit, what happens when money is short); `design`: how the estate does it (a call, a
61
+ * timeout, a topic, a circuit breaker); `delivery`: how and when it is built and shipped (a repo, a
62
+ * migration's order, a test). The AI tags each question it raises; a person can re-route it.
63
+ */
64
+ export declare const QUESTION_ASKS: readonly ["business", "design", "delivery"];
65
+ export declare const QuestionAsks: z.ZodEnum<{
66
+ business: "business";
67
+ delivery: "delivery";
68
+ design: "design";
69
+ }>;
70
+ export type QuestionAsks = z.infer<typeof QuestionAsks>;
71
+ /** ADR 0191: a person moved a question to another role: from which, by whom, when. */
72
+ export declare const QuestionRouted: z.ZodObject<{
73
+ from: z.ZodOptional<z.ZodEnum<{
74
+ product: "product";
75
+ architecture: "architecture";
76
+ delivery: "delivery";
77
+ analysis: "analysis";
78
+ }>>;
79
+ by: z.ZodString;
80
+ at: z.ZodISODateTime;
81
+ }, z.core.$strict>;
82
+ export type QuestionRouted = z.infer<typeof QuestionRouted>;
50
83
  /**
51
84
  * ADR 0181: the runtimes whose runs Atticus records, so a decision can name its run: a Copilot
52
85
  * session Atticus started (`copilot-acp`), or a hand-off run Atticus prepared for the person's
@@ -187,7 +220,7 @@ export declare const QuestionAnswer: z.ZodObject<{
187
220
  }, z.core.$strict>;
188
221
  export type QuestionAnswer = z.infer<typeof QuestionAnswer>;
189
222
  export declare const Question: z.ZodObject<{
190
- schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
223
+ schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>]>;
191
224
  id: z.ZodString;
192
225
  askedBy: z.ZodObject<{
193
226
  step: z.ZodString;
@@ -223,6 +256,21 @@ export declare const Question: z.ZodObject<{
223
256
  delivery: "delivery";
224
257
  analysis: "analysis";
225
258
  }>>;
259
+ asks: z.ZodOptional<z.ZodEnum<{
260
+ business: "business";
261
+ delivery: "delivery";
262
+ design: "design";
263
+ }>>;
264
+ routed: z.ZodOptional<z.ZodObject<{
265
+ from: z.ZodOptional<z.ZodEnum<{
266
+ product: "product";
267
+ architecture: "architecture";
268
+ delivery: "delivery";
269
+ analysis: "analysis";
270
+ }>>;
271
+ by: z.ZodString;
272
+ at: z.ZodISODateTime;
273
+ }, z.core.$strict>>;
226
274
  askedOf: z.ZodOptional<z.ZodString>;
227
275
  finding: z.ZodOptional<z.ZodObject<{
228
276
  change: z.ZodString;
@@ -362,6 +410,11 @@ export declare const QuestionDraft: z.ZodObject<{
362
410
  delivery: "delivery";
363
411
  analysis: "analysis";
364
412
  }>>;
413
+ asks: z.ZodOptional<z.ZodEnum<{
414
+ business: "business";
415
+ delivery: "delivery";
416
+ design: "design";
417
+ }>>;
365
418
  sameAs: z.ZodOptional<z.ZodObject<{
366
419
  id: z.ZodString;
367
420
  verdict: z.ZodEnum<{
@@ -85,6 +85,11 @@ export declare const VerifyFix: z.ZodUnion<readonly [z.ZodObject<{
85
85
  delivery: "delivery";
86
86
  analysis: "analysis";
87
87
  }>>;
88
+ asks: z.ZodOptional<z.ZodEnum<{
89
+ business: "business";
90
+ delivery: "delivery";
91
+ design: "design";
92
+ }>>;
88
93
  sameAs: z.ZodOptional<z.ZodObject<{
89
94
  id: z.ZodString;
90
95
  verdict: z.ZodEnum<{
@@ -147,6 +152,11 @@ export declare const VerifyMissed: z.ZodObject<{
147
152
  delivery: "delivery";
148
153
  analysis: "analysis";
149
154
  }>>;
155
+ asks: z.ZodOptional<z.ZodEnum<{
156
+ business: "business";
157
+ delivery: "delivery";
158
+ design: "design";
159
+ }>>;
150
160
  sameAs: z.ZodOptional<z.ZodObject<{
151
161
  id: z.ZodString;
152
162
  verdict: z.ZodEnum<{
@@ -219,6 +229,11 @@ export declare const VerifyWrong: z.ZodObject<{
219
229
  delivery: "delivery";
220
230
  analysis: "analysis";
221
231
  }>>;
232
+ asks: z.ZodOptional<z.ZodEnum<{
233
+ business: "business";
234
+ delivery: "delivery";
235
+ design: "design";
236
+ }>>;
222
237
  sameAs: z.ZodOptional<z.ZodObject<{
223
238
  id: z.ZodString;
224
239
  verdict: z.ZodEnum<{
@@ -294,6 +309,11 @@ export declare const VerifyAnswer: z.ZodObject<{
294
309
  delivery: "delivery";
295
310
  analysis: "analysis";
296
311
  }>>;
312
+ asks: z.ZodOptional<z.ZodEnum<{
313
+ business: "business";
314
+ delivery: "delivery";
315
+ design: "design";
316
+ }>>;
297
317
  sameAs: z.ZodOptional<z.ZodObject<{
298
318
  id: z.ZodString;
299
319
  verdict: z.ZodEnum<{
@@ -364,6 +384,11 @@ export declare const VerifyAnswer: z.ZodObject<{
364
384
  delivery: "delivery";
365
385
  analysis: "analysis";
366
386
  }>>;
387
+ asks: z.ZodOptional<z.ZodEnum<{
388
+ business: "business";
389
+ delivery: "delivery";
390
+ design: "design";
391
+ }>>;
367
392
  sameAs: z.ZodOptional<z.ZodObject<{
368
393
  id: z.ZodString;
369
394
  verdict: z.ZodEnum<{
@@ -468,6 +493,11 @@ export declare const ScanVerifyProposal: z.ZodObject<{
468
493
  delivery: "delivery";
469
494
  analysis: "analysis";
470
495
  }>>;
496
+ asks: z.ZodOptional<z.ZodEnum<{
497
+ business: "business";
498
+ delivery: "delivery";
499
+ design: "design";
500
+ }>>;
471
501
  sameAs: z.ZodOptional<z.ZodObject<{
472
502
  id: z.ZodString;
473
503
  verdict: z.ZodEnum<{
@@ -538,6 +568,11 @@ export declare const ScanVerifyProposal: z.ZodObject<{
538
568
  delivery: "delivery";
539
569
  analysis: "analysis";
540
570
  }>>;
571
+ asks: z.ZodOptional<z.ZodEnum<{
572
+ business: "business";
573
+ delivery: "delivery";
574
+ design: "design";
575
+ }>>;
541
576
  sameAs: z.ZodOptional<z.ZodObject<{
542
577
  id: z.ZodString;
543
578
  verdict: z.ZodEnum<{
@@ -0,0 +1,107 @@
1
+ import type { z } from "zod";
2
+ import { type LineChange } from "./manifest-edit.js";
3
+ /**
4
+ * ADR 0190: settings and setup are done in the app, "Edit, then Propose". Each edit writes one
5
+ * file of the org pack through its schema, keeping the file's comments, order and line endings,
6
+ * and shows the lines it changes before it writes (`preview`); Propose for review then opens the
7
+ * PR. Nothing here reaches a shared system, and no edit takes a secret: a setting whose name
8
+ * looks like one is refused by the runtime.yaml schema itself.
9
+ */
10
+ /** runtime.yaml's outside systems the app sets up, in the order the Adapters panel shows them. */
11
+ export declare const ADAPTER_KINDS: readonly ["gitHost", "workTracker", "serviceDesk", "notify", "wiki", "design"];
12
+ export type AdapterKind = (typeof ADAPTER_KINDS)[number];
13
+ /**
14
+ * The types runtime.yaml's schema takes for each, read from it so the two never drift (manual
15
+ * first: a person does the step and records the result, ADR 0032). `mock` is for tests and isn't
16
+ * offered; a file that has it shows it.
17
+ */
18
+ export declare const ADAPTER_TYPES: Record<AdapterKind, readonly string[]>;
19
+ /**
20
+ * The settings Atticus itself reads for each kind (the manual adapters and the steps that name a
21
+ * repo on the Git host), each a value or a list. A live adapter's plugin may read more: those
22
+ * are written as further settings, checked by the same schema (never a secret's value).
23
+ */
24
+ export declare const ADAPTER_FIELDS: Record<AdapterKind, readonly {
25
+ name: string;
26
+ list?: boolean;
27
+ }[]>;
28
+ export declare class SetupEditError extends Error {
29
+ readonly code: "invalid" | "not-found" | "exists";
30
+ constructor(code: "invalid" | "not-found" | "exists", message: string);
31
+ }
32
+ /** What an edit changed (or would change, with preview), file by file name. */
33
+ export interface FileEdit {
34
+ /** The file, relative to the metarepo ("/"-separated). */
35
+ path: string;
36
+ changes: LineChange[];
37
+ written: boolean;
38
+ }
39
+ /** An adapter as the app sends it: its type and settings, or null to take it out. */
40
+ export interface AdapterValue {
41
+ type: string;
42
+ settings?: Record<string, string | number | boolean | string[]>;
43
+ }
44
+ /** The flow style a file uses (`[a]` or `[ a ]`), so a write keeps it and changes only its lines. */
45
+ export declare const flowPaddingOf: (text: string) => boolean;
46
+ /**
47
+ * Set (or with null, take out) one outside system in runtime.yaml: `adapters.<kind>`, written as
48
+ * the type alone when it has no settings (`gitHost: manual`). The entry is edited in place: a
49
+ * setting sent as it is stays as it is (its comments, its style), one changed is that line, one
50
+ * left out is taken out. The whole file is checked with the Runtime schema first, so a type it
51
+ * doesn't take, or a setting named like a secret, is refused. With `baseSha256` (the file's
52
+ * sha256 as the form read it), a file changed since is refused (`exists`), never overwritten.
53
+ */
54
+ export declare function setRuntimeAdapter(root: string, kind: AdapterKind, value: AdapterValue | null, o?: {
55
+ preview?: boolean;
56
+ baseSha256?: string;
57
+ }): Promise<FileEdit>;
58
+ /**
59
+ * The schema an org-pack file is read with, by its path in the org pack; none for other files.
60
+ * Matched in any case: on a disk that doesn't tell case apart (Windows, macOS) `Runtime.yaml` is
61
+ * runtime.yaml, and is checked as it.
62
+ */
63
+ export declare function orgPackFileSchema(rel: string): z.ZodTypeAny | undefined;
64
+ /** A path in the org pack the raw editor may open: relative, inside it, a text file. */
65
+ export declare function orgPackFileRel(rel: string): string;
66
+ export declare const sha256Of: (text: string) => string;
67
+ /** An org-pack file as the raw editor shows it, with the schema it is checked with. */
68
+ export declare function readOrgPackFile(root: string, rel: string): Promise<{
69
+ path: string;
70
+ rel: string;
71
+ content: string;
72
+ sha256: string;
73
+ exists: boolean;
74
+ checked: boolean;
75
+ }>;
76
+ /** The problems Atticus would have reading this text as that org-pack file (empty when none). */
77
+ export declare function orgPackFileProblems(rel: string, content: string): string[];
78
+ /**
79
+ * The raw editor's write (the fallback for anything without a form): the file's whole text,
80
+ * checked with its schema, written onto the file as the person opened it (`baseSha256`, from
81
+ * readOrgPackFile; an edit meanwhile is refused), in the file's own line endings.
82
+ */
83
+ export declare function writeOrgPackFile(root: string, rel: string, content: string, o: {
84
+ baseSha256: string;
85
+ preview?: boolean;
86
+ }): Promise<FileEdit>;
87
+ /** An integration pattern as the app's form gives it (patterns/<code>.yaml). */
88
+ export interface PatternInput {
89
+ code: string;
90
+ name: string;
91
+ definition: string;
92
+ interaction: string;
93
+ route: string;
94
+ targetType: string;
95
+ controls?: string[];
96
+ source: string;
97
+ version?: string;
98
+ status?: string;
99
+ }
100
+ /**
101
+ * A new integration pattern from the form, as its own file `patterns/<code>.yaml` (the shape the
102
+ * starter pack's patterns have), checked with the pattern schema. A code already there is refused:
103
+ * an existing pattern is edited in the raw editor.
104
+ */
105
+ export declare function addPattern(root: string, p: PatternInput, o?: {
106
+ preview?: boolean;
107
+ }): Promise<FileEdit>;