@cat-factory/server 0.311.3 → 0.313.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.
@@ -84,27 +84,90 @@ export declare class ContainerRepoBootstrapper implements RepoBootstrapper {
84
84
  * Pre-flight the target repo and dispatch the bootstrap container as a
85
85
  * background job (returns once accepted, like `/run`). Throws on a pre-flight
86
86
  * failure so the run fails fast before a board frame is created.
87
+ *
88
+ * THREE dispatch shapes, chosen by the target and the run's delivery. A new repository
89
+ * delivered by `direct_push` is the original one (adapt a clone, reinitialise, force-push);
90
+ * everything else is the ordinary coding shape (clone the writable target, template beside it
91
+ * read-only, work branch, pull request), because the target already holds a history nobody may
92
+ * reset: the monorepo's, or the initial commit a pull request has to be opened against.
87
93
  */
88
94
  startBootstrap(request: BootstrapRepoRequest): Promise<BootstrapJobHandle>;
95
+ /**
96
+ * Pre-flight the pre-created target repository of a NEW-REPO run: it exists, the App can
97
+ * write to it, and it holds no real content.
98
+ *
99
+ * The target repo is created up front: by the user via the host's new-repo page, or, for
100
+ * privileged-tier orgs (ADR 0005), programmatically via the create-repo endpoint behind the
101
+ * modal's "Create repository" button.
102
+ *
103
+ * The emptiness rule binds under both deliveries, because both WRITE a whole service into the
104
+ * repository: a force-push would clobber real content and a pull request would propose
105
+ * deleting it. What differs is the FLOOR: a pull request needs an initial commit to branch
106
+ * from, so that delivery also refuses a repository with none.
107
+ */
108
+ private preflightNewRepoTarget;
109
+ /**
110
+ * Dispatch a NEW-REPO run delivered as a pull request: the ordinary coding shape against the
111
+ * (already-initialised) target repository, with the reference template beside it as a
112
+ * READ-ONLY sibling checkout.
113
+ *
114
+ * Deliberately NOT the `bootstrap` spec, which is the whole reason this path exists
115
+ * separately: that spec reinitialises history and force-pushes, and a branch whose history
116
+ * shares no ancestor with the default branch is not something a pull request can be opened
117
+ * from. Here the target's own initial commit is the base, so the diff a reviewer reads is the
118
+ * service being added.
119
+ */
120
+ private startNewRepoPullRequest;
89
121
  /**
90
122
  * Dispatch a monorepo bootstrap's APPLY phase: an ordinary coding job on the monorepo, with
91
123
  * the reference template alongside it as a READ-ONLY sibling checkout.
92
124
  *
93
125
  * Deliberately the plain coding shape rather than a `bootstrap` spec, and that is the design:
94
- * the harness already knows how to clone a writable primary at a work branch, clone
95
- * `referenceRepos` beside it without ever branching or pushing them, and open one pull request
96
- * for the primary. A bespoke bootstrap mode here would be a second implementation of that with
97
- * one extra way to get the push wrong, against a repository that holds other people's code.
126
+ * the harness already knows how to clone a writable primary (at a work branch, or at the
127
+ * default branch it commits onto, per the run's delivery), clone `referenceRepos` beside it
128
+ * without ever branching or pushing them, and open one pull request for the primary when it
129
+ * was given one to open. A bespoke bootstrap mode here would be a second implementation of
130
+ * that with one extra way to get the push wrong, against a repository that holds other
131
+ * people's code.
98
132
  *
99
133
  * `repo.serviceDirectory` is what scopes the agent to the new subdirectory: the same field
100
134
  * every monorepo-service run rides, so the working-directory rule is stated in one place.
101
135
  *
102
136
  * Two pre-flights, both about the monorepo rather than about a new repo: the App must be able
103
137
  * to WRITE to it (a read-only grant reads fine and 403s on the push, after a board frame
104
- * exists), and the target directory must still be absent at dispatch time, because the orchestration
105
- * pre-flighted it before the survey, and a review can be settled days later.
138
+ * exists), and the target directory must still be absent at dispatch time, because the
139
+ * orchestration pre-flighted it before the survey and a review can be settled days later.
106
140
  */
107
141
  private startMonorepoBootstrap;
142
+ /**
143
+ * The dispatch both non-force-push shapes share: clone the writable target, fetch the
144
+ * reference template beside it read-only, and either open a work branch plus a pull request
145
+ * or commit onto the target's own default branch.
146
+ *
147
+ * ONE builder rather than one per target, because the delivery rule is the interesting part
148
+ * and a second copy of it is a second place for `newBranch` and `pr` to disagree: a body
149
+ * carrying a branch but no PR pushes work onto a branch nobody is told about.
150
+ */
151
+ private dispatchCodingShape;
152
+ /**
153
+ * Resolve the reference template a run reads from: its clone spec, plus the numeric id the
154
+ * run's installation token has to be scoped to.
155
+ *
156
+ * ONE resolution for both dispatch shapes, because both CLONE the template and both mint the
157
+ * token that clone runs on. Two copies is what left the force-push path granting only its push
158
+ * target while cloning the template with that same token, so a PRIVATE reference architecture
159
+ * 404s on clone under one delivery and works under the other, and what left it assuming the
160
+ * template's base branch was `main`.
161
+ *
162
+ * A template the installation cannot read resolves to no id and the conventional branch rather
163
+ * than refusing the run: the clone then fails inside the harness naming the repository, which
164
+ * is a better report than a pre-flight throw here, and the warning says which read failed.
165
+ */
166
+ private resolveReferenceTemplate;
167
+ /** The model-locked LLM-proxy session token a bootstrap container runs under. */
168
+ private mintSessionToken;
169
+ /** The host's web base, trailing slashes stripped, for building clone URLs. */
170
+ private webBase;
108
171
  /** Poll a dispatched bootstrap job, mapping the runner job view into an update. */
109
172
  pollBootstrap(handle: BootstrapJobHandle): Promise<BootstrapJobUpdate>;
110
173
  /**
@@ -125,7 +188,20 @@ export declare class ContainerRepoBootstrapper implements RepoBootstrapper {
125
188
  installationId: number;
126
189
  githubId: number;
127
190
  }>;
128
- /** Construct the success outcome from the installation + the recorded job's repo name. */
191
+ /**
192
+ * Construct the success outcome from the installation + the recorded job's repo name.
193
+ *
194
+ * `resultDefaultBranch` is what the HARNESS reported, and only the `bootstrap` spec reports one
195
+ * (it echoes back the branch it force-pushed, which it also created). The plain coding shape a
196
+ * `pull_request` run takes reports none, so the branch is READ off the target repository rather
197
+ * than defaulted to `main`: this field states which branch the work lands on, and a repository
198
+ * whose default is `master`, `trunk` or an org-wide choice would otherwise be recorded as a ref
199
+ * that does not exist. One read, on the terminal poll only. A failed read keeps the
200
+ * conventional fallback and says so in a warning, rather than failing a delivered run over the
201
+ * one field nothing reads back.
202
+ */
129
203
  private buildOutcome;
204
+ /** The run's stored row, which a poll addresses only by id. */
205
+ private requireRecord;
130
206
  }
131
207
  //# sourceMappingURL=ContainerRepoBootstrapper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ContainerRepoBootstrapper.d.ts","sourceRoot":"","sources":["../../src/agents/ContainerRepoBootstrapper.ts"],"names":[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