@aigile/engine 0.0.0-stage → 0.2.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.
- package/dist/agents/code-reviewer.d.ts +37 -0
- package/dist/agents/code-reviewer.d.ts.map +1 -0
- package/dist/agents/code-reviewer.js +192 -0
- package/dist/agents/code-reviewer.js.map +1 -0
- package/dist/agents/engineer.d.ts +118 -0
- package/dist/agents/engineer.d.ts.map +1 -0
- package/dist/agents/engineer.js +528 -0
- package/dist/agents/engineer.js.map +1 -0
- package/dist/agents/monitor.d.ts +66 -0
- package/dist/agents/monitor.d.ts.map +1 -0
- package/dist/agents/monitor.js +281 -0
- package/dist/agents/monitor.js.map +1 -0
- package/dist/agents/orchestrator.d.ts +49 -0
- package/dist/agents/orchestrator.d.ts.map +1 -0
- package/dist/agents/orchestrator.js +204 -0
- package/dist/agents/orchestrator.js.map +1 -0
- package/dist/agents/release-manager.d.ts +76 -0
- package/dist/agents/release-manager.d.ts.map +1 -0
- package/dist/agents/release-manager.js +312 -0
- package/dist/agents/release-manager.js.map +1 -0
- package/dist/agents/spec-analyst.d.ts +102 -0
- package/dist/agents/spec-analyst.d.ts.map +1 -0
- package/dist/agents/spec-analyst.js +406 -0
- package/dist/agents/spec-analyst.js.map +1 -0
- package/dist/agents/verifier.d.ts +41 -0
- package/dist/agents/verifier.d.ts.map +1 -0
- package/dist/agents/verifier.js +173 -0
- package/dist/agents/verifier.js.map +1 -0
- package/dist/ai-service.d.ts +52 -0
- package/dist/ai-service.d.ts.map +1 -0
- package/dist/ai-service.js +164 -0
- package/dist/ai-service.js.map +1 -0
- package/dist/build-service.d.ts +65 -0
- package/dist/build-service.d.ts.map +1 -0
- package/dist/build-service.js +140 -0
- package/dist/build-service.js.map +1 -0
- package/dist/checkout.d.ts +57 -0
- package/dist/checkout.d.ts.map +1 -0
- package/dist/checkout.js +187 -0
- package/dist/checkout.js.map +1 -0
- package/dist/command-runner.d.ts +67 -0
- package/dist/command-runner.d.ts.map +1 -0
- package/dist/command-runner.js +149 -0
- package/dist/command-runner.js.map +1 -0
- package/dist/conversations.d.ts +18 -0
- package/dist/conversations.d.ts.map +1 -0
- package/dist/conversations.js +34 -0
- package/dist/conversations.js.map +1 -0
- package/dist/data-access.d.ts +34 -0
- package/dist/data-access.d.ts.map +1 -0
- package/dist/data-access.js +85 -0
- package/dist/data-access.js.map +1 -0
- package/dist/git-host.d.ts +43 -0
- package/dist/git-host.d.ts.map +1 -0
- package/dist/git-host.js +83 -0
- package/dist/git-host.js.map +1 -0
- package/dist/in-memory-store.d.ts +25 -0
- package/dist/in-memory-store.d.ts.map +1 -0
- package/dist/in-memory-store.js +52 -0
- package/dist/in-memory-store.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/milestones.d.ts +36 -0
- package/dist/milestones.d.ts.map +1 -0
- package/dist/milestones.js +50 -0
- package/dist/milestones.js.map +1 -0
- package/dist/pull-request-sync.d.ts +29 -0
- package/dist/pull-request-sync.d.ts.map +1 -0
- package/dist/pull-request-sync.js +79 -0
- package/dist/pull-request-sync.js.map +1 -0
- package/dist/questions.d.ts +37 -0
- package/dist/questions.d.ts.map +1 -0
- package/dist/questions.js +79 -0
- package/dist/questions.js.map +1 -0
- package/dist/queue.d.ts +51 -0
- package/dist/queue.d.ts.map +1 -0
- package/dist/queue.js +108 -0
- package/dist/queue.js.map +1 -0
- package/dist/reviews.d.ts +17 -0
- package/dist/reviews.d.ts.map +1 -0
- package/dist/reviews.js +42 -0
- package/dist/reviews.js.map +1 -0
- package/dist/router.d.ts +13 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.js +22 -0
- package/dist/router.js.map +1 -0
- package/dist/scheduler.d.ts +57 -0
- package/dist/scheduler.d.ts.map +1 -0
- package/dist/scheduler.js +134 -0
- package/dist/scheduler.js.map +1 -0
- package/dist/services.d.ts +359 -0
- package/dist/services.d.ts.map +1 -0
- package/dist/services.js +674 -0
- package/dist/services.js.map +1 -0
- package/dist/spec-resolver.d.ts +69 -0
- package/dist/spec-resolver.d.ts.map +1 -0
- package/dist/spec-resolver.js +200 -0
- package/dist/spec-resolver.js.map +1 -0
- package/dist/text-diff.d.ts +16 -0
- package/dist/text-diff.d.ts.map +1 -0
- package/dist/text-diff.js +51 -0
- package/dist/text-diff.js.map +1 -0
- package/dist/tool-sandbox.d.ts +47 -0
- package/dist/tool-sandbox.d.ts.map +1 -0
- package/dist/tool-sandbox.js +245 -0
- package/dist/tool-sandbox.js.map +1 -0
- package/dist/tracks.d.ts +58 -0
- package/dist/tracks.d.ts.map +1 -0
- package/dist/tracks.js +149 -0
- package/dist/tracks.js.map +1 -0
- package/dist/verifier.d.ts +27 -0
- package/dist/verifier.d.ts.map +1 -0
- package/dist/verifier.js +99 -0
- package/dist/verifier.js.map +1 -0
- package/package.json +31 -4
- package/README.md +0 -3
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { BuildService } from './build-service.js';
|
|
2
|
+
import { DataAccess } from './data-access.js';
|
|
3
|
+
import { MilestoneService } from './milestones.js';
|
|
4
|
+
import { ORCHESTRATOR_KEY } from './agents/orchestrator.js';
|
|
5
|
+
import { SpecResolver } from './spec-resolver.js';
|
|
6
|
+
/**
|
|
7
|
+
* The Orchestrator's clock (documentation/agents.md §3.5 step 3): every tick
|
|
8
|
+
* runs the merge sync and, with `engineer.autoBuild` on, starts a build for
|
|
9
|
+
* each project with a repository, no build in flight, and resolved spec
|
|
10
|
+
* revisions that differ from its latest build's, once the newest of those
|
|
11
|
+
* revisions is older than the quiet period. A rejected or failed last build
|
|
12
|
+
* is not retried until a spec changes again. One process ticks on an
|
|
13
|
+
* interval; `aigile tick` runs one tick for cron.
|
|
14
|
+
*/
|
|
15
|
+
export class Scheduler {
|
|
16
|
+
config;
|
|
17
|
+
deps;
|
|
18
|
+
data;
|
|
19
|
+
builds;
|
|
20
|
+
resolver;
|
|
21
|
+
milestones;
|
|
22
|
+
timer = null;
|
|
23
|
+
running = null;
|
|
24
|
+
lastTick = null;
|
|
25
|
+
constructor(store, config, deps) {
|
|
26
|
+
this.config = config;
|
|
27
|
+
this.deps = deps;
|
|
28
|
+
this.data = new DataAccess(store);
|
|
29
|
+
this.builds = new BuildService(this.data, store);
|
|
30
|
+
this.resolver = new SpecResolver(this.data);
|
|
31
|
+
this.milestones = new MilestoneService(store);
|
|
32
|
+
}
|
|
33
|
+
get enabled() {
|
|
34
|
+
return this.config.agents.schedule.enabled;
|
|
35
|
+
}
|
|
36
|
+
/** Tick on the configured interval; the timer never keeps the process alive. */
|
|
37
|
+
start() {
|
|
38
|
+
if (this.timer || !this.enabled)
|
|
39
|
+
return;
|
|
40
|
+
this.timer = setInterval(() => void this.tick().catch((err) => console.warn(`[aigile] tick: ${err instanceof Error ? err.message : String(err)}`)), this.config.agents.schedule.tickSeconds * 1000);
|
|
41
|
+
this.timer.unref();
|
|
42
|
+
}
|
|
43
|
+
stop() {
|
|
44
|
+
if (this.timer)
|
|
45
|
+
clearInterval(this.timer);
|
|
46
|
+
this.timer = null;
|
|
47
|
+
}
|
|
48
|
+
nextTickAt() {
|
|
49
|
+
if (!this.timer)
|
|
50
|
+
return null;
|
|
51
|
+
const base = this.lastTick ? Date.parse(this.lastTick.at) : (this.deps.now ?? Date.now)();
|
|
52
|
+
return new Date(base + this.config.agents.schedule.tickSeconds * 1000).toISOString();
|
|
53
|
+
}
|
|
54
|
+
async tick() {
|
|
55
|
+
if (this.running)
|
|
56
|
+
return this.running;
|
|
57
|
+
this.running = this.run().finally(() => {
|
|
58
|
+
this.running = null;
|
|
59
|
+
});
|
|
60
|
+
return this.running;
|
|
61
|
+
}
|
|
62
|
+
async run() {
|
|
63
|
+
const now = (this.deps.now ?? Date.now)();
|
|
64
|
+
const report = { at: new Date(now).toISOString(), synced: 0, swept: 0, auditsScheduled: 0, started: [], settling: [] };
|
|
65
|
+
try {
|
|
66
|
+
report.synced = await this.deps.sync.now();
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
console.warn(`[aigile] tick: sync failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
70
|
+
}
|
|
71
|
+
if (this.deps.monitor && this.deps.installRoot) {
|
|
72
|
+
try {
|
|
73
|
+
for (const buildId of this.deps.sync.lastMerged)
|
|
74
|
+
report.auditsScheduled += (await this.deps.monitor.scheduleAudits(buildId, now)).length;
|
|
75
|
+
report.swept += (await this.deps.monitor.runDueAudits(this.deps.installRoot, now)).length;
|
|
76
|
+
const last = await this.deps.monitor.lastSweep();
|
|
77
|
+
const cadenceMs = this.config.agents.monitor.cadenceMinutes * 60_000;
|
|
78
|
+
if (this.config.agents.monitor.probes.length > 0 && (!last || now - Date.parse(last.at) >= cadenceMs)) {
|
|
79
|
+
await this.deps.monitor.sweep({ installRoot: this.deps.installRoot, reason: 'cadence', at: new Date(now).toISOString() });
|
|
80
|
+
report.swept++;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
console.warn(`[aigile] tick: monitor failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (this.config.agents.engineer.autoBuild) {
|
|
88
|
+
const actor = { userId: `agent:${ORCHESTRATOR_KEY}`, author: { name: 'Orchestrator', email: `${ORCHESTRATOR_KEY}@aigile.local` } };
|
|
89
|
+
for (const project of await this.data.projects()) {
|
|
90
|
+
const why = await this.pending(project, now);
|
|
91
|
+
if (why === 'settling')
|
|
92
|
+
report.settling.push(project.id);
|
|
93
|
+
if (why !== 'build')
|
|
94
|
+
continue;
|
|
95
|
+
try {
|
|
96
|
+
const build = await this.deps.startBuild(project.id, actor);
|
|
97
|
+
report.started.push({ projectId: project.id, buildId: build.id });
|
|
98
|
+
await this.milestones.post({ kind: 'claimed', agentKey: ORCHESTRATOR_KEY, about: { kind: 'build', id: build.id }, projectIds: [project.id], summary: `Started a build of ${project.name} on the clock: its specs changed and settled` }, actor);
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
console.warn(`[aigile] tick: build of ${project.name} not started: ${err instanceof Error ? err.message : String(err)}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
this.lastTick = report;
|
|
106
|
+
return report;
|
|
107
|
+
}
|
|
108
|
+
/** Whether a project wants a build now: 'build', 'settling' (changes too fresh), or null. */
|
|
109
|
+
async pending(project, now) {
|
|
110
|
+
if (!project.gitUrl)
|
|
111
|
+
return null;
|
|
112
|
+
const builds = await this.builds.forProject(project.id);
|
|
113
|
+
if (builds.some((b) => b.status === 'building' || b.status === 'proposed'))
|
|
114
|
+
return null;
|
|
115
|
+
const resolution = await this.resolver.resolveProject(project.id);
|
|
116
|
+
if (resolution.resolved.length === 0)
|
|
117
|
+
return null;
|
|
118
|
+
const current = new Set(resolution.resolved.map((r) => `${r.specId}@${r.revision}`));
|
|
119
|
+
const last = builds[0] ?? null;
|
|
120
|
+
if (last) {
|
|
121
|
+
const previous = new Set(last.specRevisions.map((r) => `${r.specId}@${r.revision}`));
|
|
122
|
+
const same = current.size === previous.size && [...current].every((k) => previous.has(k));
|
|
123
|
+
// The same revisions: nothing new, whatever became of the last build.
|
|
124
|
+
if (same)
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
const specs = await this.data.specs();
|
|
128
|
+
const newest = Math.max(...resolution.resolved.map((r) => Date.parse(specs.find((s) => s.id === r.specId)?.updatedAt ?? '0')));
|
|
129
|
+
if (now - newest < this.config.agents.schedule.quietSeconds * 1000)
|
|
130
|
+
return 'settling';
|
|
131
|
+
return 'build';
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=scheduler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler.js","sourceRoot":"","sources":["../src/scheduler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,o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AAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;QAC/H,IAAI,GAAG,GAAG,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,GAAG,IAAI;YAAE,OAAO,UAAU,CAAC;QACtF,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import type { Conflict, DataStore, Message, Organization, Project, RevisionMeta, Role, RoleAssignment, Spec, User, WriteAuthor } from '@aigile/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { type DiffLine } from './text-diff.js';
|
|
4
|
+
/**
|
|
5
|
+
* The write side of the domain: validated create / update / delete for
|
|
6
|
+
* Organizations, Projects and Specs, plus Spec revisions. The web API, the CLI
|
|
7
|
+
* and the agents all go through these, so there is one write path.
|
|
8
|
+
*
|
|
9
|
+
* Every write names the person it is made for (`Actor`); the datastore commits
|
|
10
|
+
* under its service identity and records the actor as an `Authored-by:` trailer.
|
|
11
|
+
*/
|
|
12
|
+
export interface Actor {
|
|
13
|
+
userId: string;
|
|
14
|
+
/** How to record the actor on the write; omitted for system writes. */
|
|
15
|
+
author?: WriteAuthor;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* What to do with the children of a deleted organization or project:
|
|
19
|
+
* refuse while any exist (the default), move them to the deleted item's
|
|
20
|
+
* parent, or delete them too. Specs are never deleted by a cascade; they lose
|
|
21
|
+
* the mapping (or have it moved). A role assignment that would be left with
|
|
22
|
+
* no scope at all is removed rather than silently widened to everywhere.
|
|
23
|
+
*/
|
|
24
|
+
export type ChildrenPolicy = 'refuse' | 'reparent' | 'delete';
|
|
25
|
+
export declare const CHILDREN_POLICIES: readonly ChildrenPolicy[];
|
|
26
|
+
/** An error the API can map to a status code. */
|
|
27
|
+
export declare class ServiceError extends Error {
|
|
28
|
+
readonly status: 400 | 403 | 404 | 409;
|
|
29
|
+
constructor(status: 400 | 403 | 404 | 409, message: string);
|
|
30
|
+
}
|
|
31
|
+
export declare const organizationInputSchema: z.ZodObject<Omit<{
|
|
32
|
+
id: z.ZodString;
|
|
33
|
+
createdAt: z.ZodString;
|
|
34
|
+
updatedAt: z.ZodString;
|
|
35
|
+
} & {
|
|
36
|
+
name: z.ZodString;
|
|
37
|
+
parentId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
38
|
+
}, "id" | "createdAt" | "updatedAt">, "strip", z.ZodTypeAny, {
|
|
39
|
+
name: string;
|
|
40
|
+
parentId: string | null;
|
|
41
|
+
}, {
|
|
42
|
+
name: string;
|
|
43
|
+
parentId?: string | null | undefined;
|
|
44
|
+
}>;
|
|
45
|
+
/** What a person may change about themselves. */
|
|
46
|
+
export declare const profileInputSchema: z.ZodObject<{
|
|
47
|
+
email: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
|
|
48
|
+
firstName: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
49
|
+
lastName: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
50
|
+
organizationId: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
|
|
51
|
+
jobTitle: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
email?: string | null | undefined;
|
|
54
|
+
firstName?: string | undefined;
|
|
55
|
+
lastName?: string | undefined;
|
|
56
|
+
organizationId?: string | null | undefined;
|
|
57
|
+
jobTitle?: string | undefined;
|
|
58
|
+
}, {
|
|
59
|
+
email?: string | null | undefined;
|
|
60
|
+
firstName?: string | undefined;
|
|
61
|
+
lastName?: string | undefined;
|
|
62
|
+
organizationId?: string | null | undefined;
|
|
63
|
+
jobTitle?: string | undefined;
|
|
64
|
+
}>;
|
|
65
|
+
export type ProfileInput = z.infer<typeof profileInputSchema>;
|
|
66
|
+
/** What an admin may change about a user: the profile fields plus `disabled`. */
|
|
67
|
+
export declare const userAdminInputSchema: z.ZodObject<{
|
|
68
|
+
email: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
|
|
69
|
+
firstName: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
70
|
+
lastName: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
71
|
+
organizationId: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
|
|
72
|
+
managerId: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
|
|
73
|
+
jobTitle: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
74
|
+
disabled: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
email?: string | null | undefined;
|
|
77
|
+
firstName?: string | undefined;
|
|
78
|
+
lastName?: string | undefined;
|
|
79
|
+
organizationId?: string | null | undefined;
|
|
80
|
+
managerId?: string | null | undefined;
|
|
81
|
+
jobTitle?: string | undefined;
|
|
82
|
+
disabled?: boolean | undefined;
|
|
83
|
+
}, {
|
|
84
|
+
email?: string | null | undefined;
|
|
85
|
+
firstName?: string | undefined;
|
|
86
|
+
lastName?: string | undefined;
|
|
87
|
+
organizationId?: string | null | undefined;
|
|
88
|
+
managerId?: string | null | undefined;
|
|
89
|
+
jobTitle?: string | undefined;
|
|
90
|
+
disabled?: boolean | undefined;
|
|
91
|
+
}>;
|
|
92
|
+
/** The ranking is not typed in: it comes from the order of the roles (RoleService.reorder). */
|
|
93
|
+
export declare const roleInputSchema: z.ZodObject<Omit<Omit<{
|
|
94
|
+
id: z.ZodString;
|
|
95
|
+
createdAt: z.ZodString;
|
|
96
|
+
updatedAt: z.ZodString;
|
|
97
|
+
} & {
|
|
98
|
+
name: z.ZodString;
|
|
99
|
+
ranking: z.ZodNumber;
|
|
100
|
+
description: z.ZodDefault<z.ZodString>;
|
|
101
|
+
appRole: z.ZodDefault<z.ZodEnum<["owner", "admin", "maintainer", "contributor", "viewer"]>>;
|
|
102
|
+
kind: z.ZodDefault<z.ZodEnum<["human", "agent"]>>;
|
|
103
|
+
agentKey: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
104
|
+
}, "id" | "createdAt" | "updatedAt">, "ranking">, "strip", z.ZodTypeAny, {
|
|
105
|
+
name: string;
|
|
106
|
+
description: string;
|
|
107
|
+
appRole: "owner" | "admin" | "maintainer" | "contributor" | "viewer";
|
|
108
|
+
kind: "human" | "agent";
|
|
109
|
+
agentKey: string | null;
|
|
110
|
+
}, {
|
|
111
|
+
name: string;
|
|
112
|
+
description?: string | undefined;
|
|
113
|
+
appRole?: "owner" | "admin" | "maintainer" | "contributor" | "viewer" | undefined;
|
|
114
|
+
kind?: "human" | "agent" | undefined;
|
|
115
|
+
agentKey?: string | null | undefined;
|
|
116
|
+
}>;
|
|
117
|
+
export declare const RANKING_STEP = 10;
|
|
118
|
+
export declare const roleAssignmentInputSchema: z.ZodObject<Omit<{
|
|
119
|
+
id: z.ZodString;
|
|
120
|
+
createdAt: z.ZodString;
|
|
121
|
+
updatedAt: z.ZodString;
|
|
122
|
+
} & {
|
|
123
|
+
userId: z.ZodString;
|
|
124
|
+
roleId: z.ZodString;
|
|
125
|
+
organizationIds: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
126
|
+
projectIds: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
127
|
+
rankingOverride: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
|
128
|
+
}, "id" | "createdAt" | "updatedAt">, "strip", z.ZodTypeAny, {
|
|
129
|
+
roleId: string;
|
|
130
|
+
userId: string;
|
|
131
|
+
organizationIds: string[];
|
|
132
|
+
projectIds: string[];
|
|
133
|
+
rankingOverride: number | null;
|
|
134
|
+
}, {
|
|
135
|
+
roleId: string;
|
|
136
|
+
userId: string;
|
|
137
|
+
organizationIds?: string[] | undefined;
|
|
138
|
+
projectIds?: string[] | undefined;
|
|
139
|
+
rankingOverride?: number | null | undefined;
|
|
140
|
+
}>;
|
|
141
|
+
export type RoleInput = z.infer<typeof roleInputSchema>;
|
|
142
|
+
export type RoleAssignmentInput = z.infer<typeof roleAssignmentInputSchema>;
|
|
143
|
+
/** Kept for callers that still read it; administration follows the application role now. */
|
|
144
|
+
export declare const ADMIN_RANKING = 80;
|
|
145
|
+
export declare const projectInputSchema: z.ZodObject<Omit<{
|
|
146
|
+
id: z.ZodString;
|
|
147
|
+
createdAt: z.ZodString;
|
|
148
|
+
updatedAt: z.ZodString;
|
|
149
|
+
} & {
|
|
150
|
+
name: z.ZodString;
|
|
151
|
+
gitUrl: z.ZodDefault<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
|
|
152
|
+
gitBranch: z.ZodDefault<z.ZodString>;
|
|
153
|
+
organizationId: z.ZodString;
|
|
154
|
+
parentProjectId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
155
|
+
}, "id" | "createdAt" | "updatedAt">, "strip", z.ZodTypeAny, {
|
|
156
|
+
name: string;
|
|
157
|
+
organizationId: string;
|
|
158
|
+
gitUrl: string | null;
|
|
159
|
+
gitBranch: string;
|
|
160
|
+
parentProjectId: string | null;
|
|
161
|
+
}, {
|
|
162
|
+
name: string;
|
|
163
|
+
organizationId: string;
|
|
164
|
+
gitUrl?: string | null | undefined;
|
|
165
|
+
gitBranch?: string | undefined;
|
|
166
|
+
parentProjectId?: string | null | undefined;
|
|
167
|
+
}>;
|
|
168
|
+
export declare const specInputSchema: z.ZodObject<Omit<Omit<{
|
|
169
|
+
id: z.ZodString;
|
|
170
|
+
createdAt: z.ZodString;
|
|
171
|
+
updatedAt: z.ZodString;
|
|
172
|
+
} & {
|
|
173
|
+
title: z.ZodString;
|
|
174
|
+
authorUserId: z.ZodString;
|
|
175
|
+
organizationIds: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
176
|
+
projectIds: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
177
|
+
roleIds: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
178
|
+
userIds: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
179
|
+
content: z.ZodDefault<z.ZodString>;
|
|
180
|
+
seed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
181
|
+
}, "id" | "createdAt" | "updatedAt">, "authorUserId">, "strip", z.ZodTypeAny, {
|
|
182
|
+
content: string;
|
|
183
|
+
organizationIds: string[];
|
|
184
|
+
projectIds: string[];
|
|
185
|
+
title: string;
|
|
186
|
+
roleIds: string[];
|
|
187
|
+
userIds: string[];
|
|
188
|
+
seed: string | null;
|
|
189
|
+
}, {
|
|
190
|
+
title: string;
|
|
191
|
+
content?: string | undefined;
|
|
192
|
+
organizationIds?: string[] | undefined;
|
|
193
|
+
projectIds?: string[] | undefined;
|
|
194
|
+
roleIds?: string[] | undefined;
|
|
195
|
+
userIds?: string[] | undefined;
|
|
196
|
+
seed?: string | null | undefined;
|
|
197
|
+
}>;
|
|
198
|
+
export type OrganizationInput = z.infer<typeof organizationInputSchema>;
|
|
199
|
+
export type ProjectInput = z.infer<typeof projectInputSchema>;
|
|
200
|
+
export type SpecInput = z.infer<typeof specInputSchema>;
|
|
201
|
+
export declare class OrganizationService {
|
|
202
|
+
private readonly store;
|
|
203
|
+
private readonly data;
|
|
204
|
+
constructor(store: DataStore);
|
|
205
|
+
list(): Promise<Organization[]>;
|
|
206
|
+
get(id: string): Promise<Organization>;
|
|
207
|
+
create(input: unknown, actor: Actor): Promise<Organization>;
|
|
208
|
+
update(id: string, input: unknown, actor: Actor): Promise<Organization>;
|
|
209
|
+
delete(id: string, actor: Actor, children?: ChildrenPolicy): Promise<void>;
|
|
210
|
+
/** Refuse a parent that is the organization itself or one of its descendants (a cycle). */
|
|
211
|
+
private assertNotDescendant;
|
|
212
|
+
}
|
|
213
|
+
export declare class ProjectService {
|
|
214
|
+
private readonly store;
|
|
215
|
+
private readonly data;
|
|
216
|
+
constructor(store: DataStore);
|
|
217
|
+
list(): Promise<Project[]>;
|
|
218
|
+
get(id: string): Promise<Project>;
|
|
219
|
+
create(input: unknown, actor: Actor): Promise<Project>;
|
|
220
|
+
update(id: string, input: unknown, actor: Actor): Promise<Project>;
|
|
221
|
+
/**
|
|
222
|
+
* With `reparent`, child projects move to this project's parent (or become
|
|
223
|
+
* top-level projects of the organization); specs and role scopes move to the
|
|
224
|
+
* parent project, or are dropped when there is none, since moving them to the
|
|
225
|
+
* organization would widen what they apply to.
|
|
226
|
+
*/
|
|
227
|
+
delete(id: string, actor: Actor, children?: ChildrenPolicy): Promise<void>;
|
|
228
|
+
private assertReferences;
|
|
229
|
+
}
|
|
230
|
+
export interface SpecRevision extends RevisionMeta {
|
|
231
|
+
/** True for the revision the spec currently sits at. */
|
|
232
|
+
current: boolean;
|
|
233
|
+
}
|
|
234
|
+
export declare class SpecService {
|
|
235
|
+
private readonly store;
|
|
236
|
+
private readonly data;
|
|
237
|
+
constructor(store: DataStore);
|
|
238
|
+
list(): Promise<Spec[]>;
|
|
239
|
+
get(id: string): Promise<Spec>;
|
|
240
|
+
create(input: unknown, actor: Actor): Promise<Spec>;
|
|
241
|
+
/** Create, and say which revision the datastore gave it (what the Spec Analyst reviews). */
|
|
242
|
+
createRevision(input: unknown, actor: Actor): Promise<{
|
|
243
|
+
spec: Spec;
|
|
244
|
+
revision: RevisionMeta;
|
|
245
|
+
}>;
|
|
246
|
+
/** Every update is a new revision; the author of the spec stays its creator. */
|
|
247
|
+
update(id: string, input: unknown, actor: Actor): Promise<Spec>;
|
|
248
|
+
/** Update, and say which revision the datastore gave it. */
|
|
249
|
+
revise(id: string, input: unknown, actor: Actor): Promise<{
|
|
250
|
+
spec: Spec;
|
|
251
|
+
revision: RevisionMeta;
|
|
252
|
+
}>;
|
|
253
|
+
delete(id: string, actor: Actor): Promise<void>;
|
|
254
|
+
/** Revisions newest first, the first one marked current. */
|
|
255
|
+
revisions(id: string): Promise<SpecRevision[]>;
|
|
256
|
+
atRevision(id: string, revision: string): Promise<Spec>;
|
|
257
|
+
/** Line diff of the content from one revision to another (`to` defaults to the current spec). */
|
|
258
|
+
diff(id: string, from: string, to?: string): Promise<DiffLine[]>;
|
|
259
|
+
private assertMappings;
|
|
260
|
+
}
|
|
261
|
+
export declare class UserService {
|
|
262
|
+
private readonly store;
|
|
263
|
+
constructor(store: DataStore);
|
|
264
|
+
list(): Promise<User[]>;
|
|
265
|
+
get(id: string): Promise<User>;
|
|
266
|
+
/** A person's own profile fields; credentials and roles are not touched here. */
|
|
267
|
+
updateProfile(id: string, input: unknown, actor: Actor): Promise<User>;
|
|
268
|
+
/** An admin's edit of a user: the profile fields and `disabled`. */
|
|
269
|
+
adminUpdate(id: string, input: unknown, actor: Actor): Promise<User>;
|
|
270
|
+
/** A manager must exist, must not be the person, and must not report back to them, however far up. */
|
|
271
|
+
private assertManager;
|
|
272
|
+
private apply;
|
|
273
|
+
}
|
|
274
|
+
export declare class RoleService {
|
|
275
|
+
private readonly store;
|
|
276
|
+
constructor(store: DataStore);
|
|
277
|
+
list(): Promise<Role[]>;
|
|
278
|
+
get(id: string): Promise<Role>;
|
|
279
|
+
/** A new role joins at the bottom of the order: one step below the lowest. */
|
|
280
|
+
create(input: unknown, actor: Actor): Promise<Role>;
|
|
281
|
+
update(id: string, input: unknown, actor: Actor): Promise<Role>;
|
|
282
|
+
/**
|
|
283
|
+
* Set the precedence from an ordering of every role, strongest first; the
|
|
284
|
+
* rankings become multiples of RANKING_STEP from the top. Every role must
|
|
285
|
+
* appear exactly once.
|
|
286
|
+
*/
|
|
287
|
+
reorder(ids: string[], actor: Actor): Promise<Role[]>;
|
|
288
|
+
/** Only a role nobody holds can go; the package's agents stay (install would seed them again). */
|
|
289
|
+
delete(id: string, actor: Actor): Promise<void>;
|
|
290
|
+
private assertNameFree;
|
|
291
|
+
}
|
|
292
|
+
export declare class RoleAssignmentService {
|
|
293
|
+
private readonly store;
|
|
294
|
+
constructor(store: DataStore);
|
|
295
|
+
list(): Promise<RoleAssignment[]>;
|
|
296
|
+
get(id: string): Promise<RoleAssignment>;
|
|
297
|
+
create(input: unknown, actor: Actor): Promise<RoleAssignment>;
|
|
298
|
+
update(id: string, input: unknown, actor: Actor): Promise<RoleAssignment>;
|
|
299
|
+
delete(id: string, actor: Actor): Promise<void>;
|
|
300
|
+
private assertReferences;
|
|
301
|
+
}
|
|
302
|
+
export interface ConflictInput {
|
|
303
|
+
left: {
|
|
304
|
+
specId: string;
|
|
305
|
+
revision: string;
|
|
306
|
+
};
|
|
307
|
+
right: {
|
|
308
|
+
specId: string;
|
|
309
|
+
revision: string;
|
|
310
|
+
};
|
|
311
|
+
detectedBy?: 'agent' | 'user';
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Conflicts between spec revisions: opened by the Spec Analyst (or a person),
|
|
315
|
+
* discussed in messages, and resolved or deferred by a person. While one is
|
|
316
|
+
* active the resolver skips the revisions it names.
|
|
317
|
+
*/
|
|
318
|
+
export declare class ConflictService {
|
|
319
|
+
private readonly store;
|
|
320
|
+
private readonly data;
|
|
321
|
+
constructor(store: DataStore);
|
|
322
|
+
list(): Promise<Conflict[]>;
|
|
323
|
+
get(id: string): Promise<Conflict>;
|
|
324
|
+
/** The active conflict between two specs, whichever side each is on, if any. */
|
|
325
|
+
activeBetween(specA: string, specB: string): Promise<Conflict | null>;
|
|
326
|
+
open(input: ConflictInput, actor: Actor): Promise<Conflict>;
|
|
327
|
+
setStatus(id: string, status: unknown, actor: Actor): Promise<Conflict>;
|
|
328
|
+
}
|
|
329
|
+
/** The discussion on a conflict; people and agents both post. */
|
|
330
|
+
export declare class MessageService {
|
|
331
|
+
private readonly store;
|
|
332
|
+
private readonly data;
|
|
333
|
+
constructor(store: DataStore);
|
|
334
|
+
forConflict(conflictId: string): Promise<Message[]>;
|
|
335
|
+
post(conflictId: string, body: unknown, author: Message['author'], actor: Actor): Promise<Message>;
|
|
336
|
+
}
|
|
337
|
+
/** Who administers the installation. */
|
|
338
|
+
export declare class AuthzService {
|
|
339
|
+
private readonly store;
|
|
340
|
+
constructor(store: DataStore);
|
|
341
|
+
/**
|
|
342
|
+
* An admin holds a role whose application role is owner or admin; the
|
|
343
|
+
* ranking (spec precedence) and a ranking override play no part. While
|
|
344
|
+
* nobody holds such a role, everyone is: a fresh installation has to be set
|
|
345
|
+
* up by somebody, and losing the last admin must not lock everyone out.
|
|
346
|
+
*/
|
|
347
|
+
isAdmin(userId: string): Promise<boolean>;
|
|
348
|
+
/** True while the bootstrap rule is in force: nobody holds an owner or admin application role. */
|
|
349
|
+
isBootstrap(): Promise<boolean>;
|
|
350
|
+
/**
|
|
351
|
+
* Who decides for the agents (approve, reject, start a build, go or roll
|
|
352
|
+
* back a release): an owner, admin or maintainer. Under the bootstrap rule
|
|
353
|
+
* everyone decides, as everyone administers.
|
|
354
|
+
*/
|
|
355
|
+
canDecide(userId: string): Promise<boolean>;
|
|
356
|
+
private adminUserIds;
|
|
357
|
+
private userIdsWith;
|
|
358
|
+
}
|
|
359
|
+
//# sourceMappingURL=services.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../src/services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,QAAQ,EAER,SAAS,EACT,OAAO,EACP,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,IAAI,EACJ,cAAc,EACd,IAAI,EACJ,IAAI,EACJ,WAAW,EACZ,MAAM,cAAc,CAAC;AAoBtB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,QAAQ,EAAa,MAAM,gBAAgB,CAAC;AAE1D;;;;;;;GAOG;AAEH,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;;;GAMG;A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