@agent-relay/factory 0.1.79 → 0.1.81
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.
- package/README.md +39 -5
- package/dist/cli/fleet.d.ts +8 -2
- package/dist/cli/fleet.d.ts.map +1 -1
- package/dist/cli/fleet.js +40 -4
- package/dist/cli/fleet.js.map +1 -1
- package/dist/config/schema.d.ts +9 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +14 -3
- package/dist/config/schema.js.map +1 -1
- package/dist/fleet/relay-fleet-client.d.ts +5 -0
- package/dist/fleet/relay-fleet-client.d.ts.map +1 -1
- package/dist/fleet/relay-fleet-client.js +57 -12
- package/dist/fleet/relay-fleet-client.js.map +1 -1
- package/dist/github/gh-identity.d.ts +44 -0
- package/dist/github/gh-identity.d.ts.map +1 -0
- package/dist/github/gh-identity.js +31 -0
- package/dist/github/gh-identity.js.map +1 -0
- package/dist/github/index.d.ts +3 -1
- package/dist/github/index.d.ts.map +1 -1
- package/dist/github/index.js +2 -1
- package/dist/github/index.js.map +1 -1
- package/dist/github/merge-gate.d.ts +22 -1
- package/dist/github/merge-gate.d.ts.map +1 -1
- package/dist/github/merge-gate.js +103 -24
- package/dist/github/merge-gate.js.map +1 -1
- package/dist/github/probe-closer.d.ts +4 -3
- package/dist/github/probe-closer.d.ts.map +1 -1
- package/dist/github/probe-closer.js +37 -28
- package/dist/github/probe-closer.js.map +1 -1
- package/dist/github/standalone-babysitter.d.ts +7 -3
- package/dist/github/standalone-babysitter.d.ts.map +1 -1
- package/dist/github/standalone-babysitter.js +16 -46
- package/dist/github/standalone-babysitter.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/intake/notion.d.ts +36 -6
- package/dist/intake/notion.d.ts.map +1 -1
- package/dist/intake/notion.js +74 -16
- package/dist/intake/notion.js.map +1 -1
- package/dist/orchestrator/factory.d.ts +32 -5
- package/dist/orchestrator/factory.d.ts.map +1 -1
- package/dist/orchestrator/factory.js +424 -243
- package/dist/orchestrator/factory.js.map +1 -1
- package/dist/ports/fleet.d.ts +6 -0
- package/dist/ports/fleet.d.ts.map +1 -1
- package/dist/ports/mount.d.ts +1 -0
- package/dist/ports/mount.d.ts.map +1 -1
- package/dist/ports/state.d.ts +17 -0
- package/dist/ports/state.d.ts.map +1 -1
- package/dist/state/file-state-store.d.ts +1 -0
- package/dist/state/file-state-store.d.ts.map +1 -1
- package/dist/state/file-state-store.js +22 -1
- package/dist/state/file-state-store.js.map +1 -1
- package/dist/state/in-memory-state-store.d.ts +1 -0
- package/dist/state/in-memory-state-store.d.ts.map +1 -1
- package/dist/state/in-memory-state-store.js +15 -1
- package/dist/state/in-memory-state-store.js.map +1 -1
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -782,9 +782,10 @@ Factory GitHub write attribution is controlled explicitly with `github.identity`
|
|
|
782
782
|
- `"user"` publishes pull requests and performs issue lifecycle writes with the
|
|
783
783
|
account authenticated by the local `gh` CLI, even when the app path is
|
|
784
784
|
available.
|
|
785
|
-
- `"auto"` is the default and
|
|
786
|
-
App
|
|
787
|
-
|
|
785
|
+
- `"auto"` is the default. Pull requests and issue lifecycle writes prefer the
|
|
786
|
+
connected App when their complete capability is available. A non-cloud host
|
|
787
|
+
can fall back to its local `gh` user; the gh-less cloud container instead
|
|
788
|
+
fails loudly when the connected lifecycle capability is incomplete.
|
|
788
789
|
|
|
789
790
|
Each successful publication log includes `identity` (`app` or `user`) and the
|
|
790
791
|
confirmed `author`. App writes are not reported complete until the connected
|
|
@@ -792,8 +793,41 @@ mount acknowledges the provider mutation. Provider-authoritative issue reads
|
|
|
792
793
|
remain optional on the writeback interface; when unavailable, their existing
|
|
793
794
|
call sites keep their conservative fallback behavior.
|
|
794
795
|
|
|
795
|
-
|
|
796
|
-
|
|
796
|
+
#### Writes that still shell out to `gh`
|
|
797
|
+
|
|
798
|
+
Two Factory GitHub mutations are not represented on the connected App surface
|
|
799
|
+
and therefore cannot be performed as the app today. Under `"app"` they refuse
|
|
800
|
+
rather than writing as the operator, so an explicit app identity never produces
|
|
801
|
+
a human-attributed write:
|
|
802
|
+
|
|
803
|
+
| Write | Built-in CLI identity gate | Missing connected capability |
|
|
804
|
+
|---|---|---|
|
|
805
|
+
| Guarded squash merge (`mergePolicy: "on-green-with-review"`) | `"app"` declines and logs; nothing is merged | `mergePullRequest` |
|
|
806
|
+
| Notion intake issue create | only exact `"user"`; `"auto"` and `"app"` block before any durable claim | `createIssue` |
|
|
807
|
+
| Notion intake issue edit | only exact `"user"`; `"auto"` and `"app"` block before any CLI access | `updateIssue` |
|
|
808
|
+
|
|
809
|
+
The merge refusal names `"user"` or `"auto"` as its local-user recovery path.
|
|
810
|
+
The built-in Notion publisher is stricter: its local-host opt-in is exact
|
|
811
|
+
`github.identity: "user"`, because the production Factory container contains
|
|
812
|
+
no `gh` binary and the App surface has no issue-create or source-marker query.
|
|
813
|
+
|
|
814
|
+
Notion intake is a separate surface from the Factory lifecycle writeback and
|
|
815
|
+
still requires local `gh` authentication when enabled. Its CLI entry point
|
|
816
|
+
resolves `github.identity` from the selected contract — including a split
|
|
817
|
+
`workspaceConfig`/`nodeConfig` contract, where the node half wins. Only exact
|
|
818
|
+
`"user"` enables the built-in CLI publisher. An absent contract resolves to
|
|
819
|
+
`"auto"` and therefore blocks repository intake explicitly; a contract that
|
|
820
|
+
exists but cannot be parsed is an error rather than a silent downgrade.
|
|
821
|
+
|
|
822
|
+
The gate covers the built-in publisher's visibility, label, reconciliation,
|
|
823
|
+
create, and edit operations. `"auto"` and `"app"` fail before spawning `gh` and
|
|
824
|
+
before reserving a durable claim. Project-only intake and injected custom
|
|
825
|
+
publishers do not use this adapter and remain available.
|
|
826
|
+
|
|
827
|
+
The standalone babysitter reads complete PR metadata from the authenticated
|
|
828
|
+
mounted projection and reports `source: 'mount'`; it does not fall back to
|
|
829
|
+
local `gh`. Review replies and pushes on a babysat PR are performed by the
|
|
830
|
+
dispatched agent under the agent's own credential, not by the Factory process.
|
|
797
831
|
|
|
798
832
|
Authenticated Factory progress reporting is enabled by default for real CLI
|
|
799
833
|
sessions. Factory sends privacy-bounded lifecycle events, worker ownership,
|
package/dist/cli/fleet.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { ensureCloudSession, type CloudSession } from '@agent-relay/cloud';
|
|
2
2
|
import { type LocalClonePathOptions } from '../config/local-clone-paths.js';
|
|
3
|
+
import type { GithubWriteIdentity } from '../github/index.js';
|
|
3
4
|
import { createFactory, createFleet, ensureRelayBroker, reapFactoryEnvironmentsOnce, type Capability, type Factory, type FactoryEventReporter, type FactoryConfig, type FleetBackend, type FleetClient, type GhRunner, type FactoryStateResolution, type Logger, type LocalMountOptions, type MountClient, type ProbeCloser, type RelayfileCloudMountClientConfig, type ResolvedFactoryWorkspace } from '../index.js';
|
|
4
5
|
import { type CheckFeatureMapOptions, type FeatureMapCheckReport } from '../featuremap/index.js';
|
|
5
6
|
import type { FactoryIntegrationProvider } from '../ports/index.js';
|
|
6
7
|
import type { StateStore } from '../ports/state.js';
|
|
7
8
|
import type { RelayClientFactoryOptions, RelayClientLike } from '../fleet/relay-fleet-client.js';
|
|
8
9
|
import { type FactoryVersionInfo, type FactoryVersionInfoOptions } from '../version-info.js';
|
|
9
|
-
import { type FactoryTasksNotionClient, type NotionIntakeClaimStore, type NotionContractPublisher } from '../intake/index.js';
|
|
10
|
+
import { type GithubIssuePublisher, type FactoryTasksNotionClient, type NotionIntakeClaimStore, type NotionContractPublisher } from '../intake/index.js';
|
|
10
11
|
export type CliStateStore = StateStore & {
|
|
11
12
|
/** Host readiness gate. The CLI invokes it before constructing Factory. */
|
|
12
13
|
assertReady(): Promise<void>;
|
|
@@ -33,7 +34,6 @@ export interface FleetCliDeps {
|
|
|
33
34
|
stderr?: Pick<NodeJS.WriteStream, 'write'>;
|
|
34
35
|
probeCloser?: ProbeCloser;
|
|
35
36
|
probePrGhRunner?: GhRunner;
|
|
36
|
-
babysitPrGhRunner?: GhRunner;
|
|
37
37
|
now?: () => number;
|
|
38
38
|
stopSignalProcessLike?: Pick<NodeJS.Process, 'once' | 'off'>;
|
|
39
39
|
daemonExit?: (code: number) => void;
|
|
@@ -64,6 +64,12 @@ export interface FleetCliDeps {
|
|
|
64
64
|
notionContracts?: NotionContractPublisher;
|
|
65
65
|
/** Hermetic workspace-global Notion claim store for tests and alternate runtimes. */
|
|
66
66
|
notionClaims?: NotionIntakeClaimStore;
|
|
67
|
+
/**
|
|
68
|
+
* Hermetic GitHub issue publisher for intake tests and alternate runtimes.
|
|
69
|
+
* Receives the identity resolved from the selected contract, so a test can
|
|
70
|
+
* assert the CLI honours `github.identity` without reaching the gh binary.
|
|
71
|
+
*/
|
|
72
|
+
notionGithub?: (identity: GithubWriteIdentity) => GithubIssuePublisher;
|
|
67
73
|
/** Hermetic Factory Tasks reader for manifest-generation tests and alternate runtimes. */
|
|
68
74
|
notionFactoryTasks?: FactoryTasksNotionClient;
|
|
69
75
|
/** Hermetic verification-environment sweep for CLI tests and alternate runtimes. */
|
package/dist/cli/fleet.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fleet.d.ts","sourceRoot":"","sources":["../../src/cli/fleet.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAG1E,OAAO,EAA6B,KAAK,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"fleet.d.ts","sourceRoot":"","sources":["../../src/cli/fleet.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAG1E,OAAO,EAA6B,KAAK,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AA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AC,CAAA;CAC9C,GACL,MAAM,IAAI,CA4BZ;AA8ED,wBAAsB,IAAI,CAAC,IAAI,WAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAQtE"}
|
package/dist/cli/fleet.js
CHANGED
|
@@ -6,10 +6,11 @@ import readline from 'node:readline/promises';
|
|
|
6
6
|
import { ensureCloudSession } from '@agent-relay/cloud';
|
|
7
7
|
import { stringifyLogValue } from '../logging.js';
|
|
8
8
|
import { resolveLocalFactoryConfig } from '../config/local-clone-paths.js';
|
|
9
|
+
import { loadFactoryConfig } from '../config/schema.js';
|
|
9
10
|
import { initializeFactory } from './init.js';
|
|
10
11
|
import { diagnoseDeployedFactory, renderDeployedDiagnosis } from './diagnose.js';
|
|
11
12
|
import { FACTORY_EXIT, exitCodeForDispatchResult, exitCodeForError, exitCodeForIterationReport, exitCodeForLoopReports, exitCodeForRelayDispatch, } from './exit-codes.js';
|
|
12
|
-
import { FileStateStore, RelayfileCloudMountClient, checkFactoryLoopLiveness, closeProbePr, createFactory, createFleet, createFactoryCloudEventV1, ensureRelayBroker, FactoryCloudReporter, FileFactoryCloudEventOutbox,
|
|
13
|
+
import { FileStateStore, RelayfileCloudMountClient, checkFactoryLoopLiveness, closeProbePr, createFactory, createFleet, createFactoryCloudEventV1, ensureRelayBroker, FactoryCloudReporter, FileFactoryCloudEventOutbox, explicitLinkedIssueKey, githubIssuePathParts, githubWatchStatePath, isAllowedFactoryGithubDraft, isAllowedFactoryGithubArtifactDraft, isInFactoryScope, parseGithubFactoryIssue, publishFactoryMountHealth, heldAgentsFromRegistry, parseOwnedBrokerAgentExitTimeoutMs, parseStandaloneBabysitTarget, readStandalonePullRequest, readLinearIssueWithCanonicalFallback, reapFactoryOrphansOnce, reapFactoryEnvironmentsOnce, readFactoryInFlightRegistry, readFactoryLoopHeartbeat, resolveFactoryStates, stateResolutionFromIds, standaloneBabysitterAgentName, renderAgentTask, resolveFactoryWorkspace, } from '../index.js';
|
|
13
14
|
import { resolveTestGuidance } from '../dispatch/test-guidance.js';
|
|
14
15
|
import { FakeFleetClient, FakeMountClient } from '../testing/index.js';
|
|
15
16
|
import { GitAgentWorktreeManager } from '../git/agent-worktree.js';
|
|
@@ -157,7 +158,14 @@ export async function runFleetCli(argv, deps = {}) {
|
|
|
157
158
|
manifest,
|
|
158
159
|
dispatch: !globals.dryRun,
|
|
159
160
|
...(!globals.dryRun ? {
|
|
160
|
-
|
|
161
|
+
// Notion intake has no app-authored issue-create route, so under an
|
|
162
|
+
// explicit `github.identity: "app"` it refuses rather than writing
|
|
163
|
+
// as the operator. Hardcoding `'user'` here would make that gate
|
|
164
|
+
// unreachable from the only production caller.
|
|
165
|
+
github: await (async () => {
|
|
166
|
+
const identity = await resolveNotionIntakeIdentity(globals.config);
|
|
167
|
+
return deps.notionGithub?.(identity) ?? new GhCliIssuePublisher(identity);
|
|
168
|
+
})(),
|
|
161
169
|
workspace,
|
|
162
170
|
...(notionClaims ? { claims: notionClaims } : {}),
|
|
163
171
|
...(notionContracts ? { contracts: notionContracts } : {}),
|
|
@@ -183,6 +191,7 @@ export async function runFleetCli(argv, deps = {}) {
|
|
|
183
191
|
prNumber: command.prNumber,
|
|
184
192
|
expectedIssueKey: command.issue,
|
|
185
193
|
...(githubWrite ? { githubWrite } : {}),
|
|
194
|
+
...(mount ? { mount } : {}),
|
|
186
195
|
...(deps.probePrGhRunner ? { runner: deps.probePrGhRunner } : {}),
|
|
187
196
|
});
|
|
188
197
|
writeJson(out, result);
|
|
@@ -345,7 +354,6 @@ export async function runFleetCli(argv, deps = {}) {
|
|
|
345
354
|
fleet,
|
|
346
355
|
stateStore,
|
|
347
356
|
stateResolution,
|
|
348
|
-
probePrGhRunner: deps.probePrGhRunner ?? defaultGhRunner,
|
|
349
357
|
logger,
|
|
350
358
|
reporter,
|
|
351
359
|
worktrees: globals.backend === 'internal' ? new GitAgentWorktreeManager() : undefined,
|
|
@@ -756,7 +764,7 @@ async function runStandaloneBabysitCommand(command, mount, fleet, config, global
|
|
|
756
764
|
const clonePath = standaloneBabysitClonePath(repo, config);
|
|
757
765
|
const mountFn = resolveLocalMountFn(deps, mount);
|
|
758
766
|
await ensureWorkspaceMount(mount, mountFn, workspaceId, acceptableMountIds, deps.stderr);
|
|
759
|
-
const pr = await readStandalonePullRequest(mount, { repo, prNumber: command.prNumber, url: command.url }
|
|
767
|
+
const pr = await readStandalonePullRequest(mount, { repo, prNumber: command.prNumber, url: command.url });
|
|
760
768
|
const state = pr.state?.trim().toUpperCase();
|
|
761
769
|
if (pr.merged || state === 'MERGED') {
|
|
762
770
|
throw new Error(`factory babysit requires an open PR; ${repo} PR #${pr.number} is merged`);
|
|
@@ -1275,6 +1283,34 @@ function parseFactoryStartFlags(args) {
|
|
|
1275
1283
|
}
|
|
1276
1284
|
return { mode };
|
|
1277
1285
|
}
|
|
1286
|
+
/**
|
|
1287
|
+
* The GitHub write identity Notion intake must honour.
|
|
1288
|
+
*
|
|
1289
|
+
* Notion intake does not otherwise require a Factory contract on disk, so an
|
|
1290
|
+
* absent one is not an error — it is the same as an unset `github` block,
|
|
1291
|
+
* which the schema synthesises to `auto`. A file that exists but cannot be
|
|
1292
|
+
* read or parsed IS an error: silently degrading it to `auto` would resolve a
|
|
1293
|
+
* deliberate `app` selection into the permissive value and reintroduce the
|
|
1294
|
+
* silent local-user write this gate exists to prevent.
|
|
1295
|
+
*
|
|
1296
|
+
* Use the canonical config loader for both contract shapes. In particular,
|
|
1297
|
+
* split config is a shallow top-level merge: a present `nodeConfig.github`
|
|
1298
|
+
* replaces `workspaceConfig.github` even when the node block is empty, after
|
|
1299
|
+
* which the GitHub schema supplies its `auto` default.
|
|
1300
|
+
*/
|
|
1301
|
+
async function resolveNotionIntakeIdentity(path) {
|
|
1302
|
+
const configPath = path ?? resolve(process.cwd(), 'factory.config.json');
|
|
1303
|
+
let raw;
|
|
1304
|
+
try {
|
|
1305
|
+
raw = await readFile(configPath, 'utf8');
|
|
1306
|
+
}
|
|
1307
|
+
catch (error) {
|
|
1308
|
+
if (error.code === 'ENOENT')
|
|
1309
|
+
return 'auto';
|
|
1310
|
+
throw error;
|
|
1311
|
+
}
|
|
1312
|
+
return loadFactoryConfig(JSON.parse(raw)).factoryConfig.github.identity;
|
|
1313
|
+
}
|
|
1278
1314
|
async function loadConfig(path, options = {}) {
|
|
1279
1315
|
const configPath = path ?? resolve(process.cwd(), 'factory.config.json');
|
|
1280
1316
|
const raw = JSON.parse(await readFile(configPath, 'utf8'));
|