@looply/core 0.5.8 → 0.5.10
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/delivery-settings.d.ts +122 -0
- package/dist/delivery-settings.d.ts.map +1 -0
- package/dist/delivery-settings.js +184 -0
- package/dist/delivery-settings.js.map +1 -0
- package/dist/goal.d.ts +25 -0
- package/dist/goal.d.ts.map +1 -1
- package/dist/goal.js +13 -0
- package/dist/goal.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/machine-settings.d.ts +91 -0
- package/dist/machine-settings.d.ts.map +1 -0
- package/dist/machine-settings.js +134 -0
- package/dist/machine-settings.js.map +1 -0
- package/dist/provider-accounts.d.ts +228 -0
- package/dist/provider-accounts.d.ts.map +1 -0
- package/dist/provider-accounts.js +453 -0
- package/dist/provider-accounts.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHAT HAPPENS TO A FINISHED GOAL'S BRANCH — the shape the server stores and the
|
|
3
|
+
* machine obeys.
|
|
4
|
+
*
|
|
5
|
+
* One declaration, shared, so a value AutoRyn or the console can save is exactly
|
|
6
|
+
* a value the machine will act on, and a value the machine would refuse cannot be
|
|
7
|
+
* saved in the first place.
|
|
8
|
+
*
|
|
9
|
+
* pr — push the goal's own `looply/run-*` branch to `origin` and open a pull
|
|
10
|
+
* request into the project's base branch. A person merges. THE DEFAULT.
|
|
11
|
+
* merge — as `pr`, then merge that pull request once the project's required CI
|
|
12
|
+
* checks are green. Never before; never on a red or a missing check.
|
|
13
|
+
* deploy — as `merge`, then run the project's OWN declared release step
|
|
14
|
+
* (`deliver.release` in `.looply/config.yaml`). A remote setting can
|
|
15
|
+
* choose this mode, but it can never name the command: the command is
|
|
16
|
+
* only ever what the project's own file declares.
|
|
17
|
+
* off — keep the branch on this machine (the behaviour before delivery existed).
|
|
18
|
+
*
|
|
19
|
+
* 🔴 THE HARD RULES ARE NOT SETTINGS. Whatever is chosen here, the machine never
|
|
20
|
+
* pushes the base branch, `main`/`master` or a protected branch, never pushes to a
|
|
21
|
+
* remote other than `origin`, and never force-pushes. Those live in the CLI's
|
|
22
|
+
* `branch-delivery.ts` and nothing here can loosen them.
|
|
23
|
+
*/
|
|
24
|
+
export declare const DELIVER_MODES: readonly ["pr", "merge", "deploy", "off"];
|
|
25
|
+
export type DeliverMode = (typeof DELIVER_MODES)[number];
|
|
26
|
+
/** Push and open a pull request; a person merges. */
|
|
27
|
+
export declare const DEFAULT_DELIVER_MODE: DeliverMode;
|
|
28
|
+
export declare function isDeliverMode(x: unknown): x is DeliverMode;
|
|
29
|
+
/** A project's remote delivery choice. */
|
|
30
|
+
/**
|
|
31
|
+
* HOW A MERGED CHANGE IS DEPLOYED — configured explicitly per project, never guessed.
|
|
32
|
+
*
|
|
33
|
+
* none — nothing is deployed; the merge is the end
|
|
34
|
+
* merge-deploys — merging into the base branch IS the deploy (Heroku / Netlify auto-deploy on main)
|
|
35
|
+
* push — push the merged base commit to `branch` on the named `remote` (e.g. heroku-qa main).
|
|
36
|
+
* The ONE exception to "origin only", and only for the remote named here, never forced.
|
|
37
|
+
* run — run the release step the project's OWN .looply/config.yaml declares (`deliver.release`).
|
|
38
|
+
* A remote setting chooses this kind; it can never carry the command.
|
|
39
|
+
*/
|
|
40
|
+
export declare const DEPLOY_KINDS: readonly ["none", "merge-deploys", "push", "run"];
|
|
41
|
+
export type DeployKind = (typeof DEPLOY_KINDS)[number];
|
|
42
|
+
export type DeployConfig = {
|
|
43
|
+
kind: 'none';
|
|
44
|
+
} | {
|
|
45
|
+
kind: 'merge-deploys';
|
|
46
|
+
} | {
|
|
47
|
+
kind: 'push';
|
|
48
|
+
remote: string;
|
|
49
|
+
branch: string;
|
|
50
|
+
} | {
|
|
51
|
+
kind: 'run';
|
|
52
|
+
};
|
|
53
|
+
export declare function validateDeployConfig(x: unknown): {
|
|
54
|
+
ok: true;
|
|
55
|
+
deploy: DeployConfig;
|
|
56
|
+
} | {
|
|
57
|
+
ok: false;
|
|
58
|
+
because: string;
|
|
59
|
+
};
|
|
60
|
+
export declare function describeDeploy(d: DeployConfig | null | undefined): string;
|
|
61
|
+
export interface DeliverySettings {
|
|
62
|
+
deliver: DeliverMode;
|
|
63
|
+
/** Absent: none (or, under `deploy`, the config.yaml release step when one is declared). */
|
|
64
|
+
deploy?: DeployConfig;
|
|
65
|
+
}
|
|
66
|
+
export type DeliverySettingsValidation = {
|
|
67
|
+
ok: true;
|
|
68
|
+
settings: DeliverySettings;
|
|
69
|
+
} | {
|
|
70
|
+
ok: false;
|
|
71
|
+
key: string;
|
|
72
|
+
because: string;
|
|
73
|
+
};
|
|
74
|
+
/** The one rule the server applies on write and the machine on read. */
|
|
75
|
+
export declare function validateDeliverySettings(x: unknown): DeliverySettingsValidation;
|
|
76
|
+
/**
|
|
77
|
+
* WHERE A FINISHED GOAL'S BRANCH GOT TO — recorded on the goal so a person (and
|
|
78
|
+
* AutoRyn's "Done — please review" comment) can open the code.
|
|
79
|
+
*
|
|
80
|
+
* pushed — the branch is on origin; no pull request could be opened (`note` says why)
|
|
81
|
+
* pr-open — a pull request is open; a person reviews and merges (`deliver: pr`)
|
|
82
|
+
* waiting-checks — `merge`/`deploy`: waiting for the required CI checks
|
|
83
|
+
* checks-failed — `merge`/`deploy`: a required check failed; it stays open for a person
|
|
84
|
+
* merged — merged into the base branch (by Looply under `merge`, or by a person)
|
|
85
|
+
* deployed — merged, and the project's declared release step finished
|
|
86
|
+
* deploy-failed — merged, and the release step failed
|
|
87
|
+
* not-pushed — nothing left this machine (`note` says why)
|
|
88
|
+
*/
|
|
89
|
+
export declare const BRANCH_DELIVERY_STATES: readonly ["pushed", "pr-open", "waiting-checks", "checks-failed", "merged", "deployed", "deploy-failed", "not-pushed"];
|
|
90
|
+
export type BranchDeliveryState = (typeof BRANCH_DELIVERY_STATES)[number];
|
|
91
|
+
export interface BranchDeliveryReport {
|
|
92
|
+
state: BranchDeliveryState;
|
|
93
|
+
/** The run branch, e.g. `looply/run-20261016122247-39ekd8kc`. */
|
|
94
|
+
branch: string;
|
|
95
|
+
/** What the pull request targets: the base branch, or the branch this one stacks on. */
|
|
96
|
+
base: string | null;
|
|
97
|
+
/** The pull request's web address, or null when none was opened. */
|
|
98
|
+
pullRequestUrl: string | null;
|
|
99
|
+
/** The mode it was delivered under. */
|
|
100
|
+
mode: DeliverMode;
|
|
101
|
+
/** A plain sentence when something did not happen, or happened differently. */
|
|
102
|
+
note: string | null;
|
|
103
|
+
/** The other unmerged run branch this one is built on, when it is. */
|
|
104
|
+
dependsOn: string | null;
|
|
105
|
+
/** The commit the merge made on the base branch, once merged. */
|
|
106
|
+
mergeSha?: string | null;
|
|
107
|
+
/** The deploy step's outcome, once one ran (or was the merge itself). */
|
|
108
|
+
deploy?: {
|
|
109
|
+
kind: DeployKind;
|
|
110
|
+
ok: boolean;
|
|
111
|
+
detail: string;
|
|
112
|
+
} | null;
|
|
113
|
+
}
|
|
114
|
+
/** A report a machine sent, checked once, the same way on both sides. */
|
|
115
|
+
export declare function validateBranchDeliveryReport(x: unknown): {
|
|
116
|
+
ok: true;
|
|
117
|
+
report: BranchDeliveryReport;
|
|
118
|
+
} | {
|
|
119
|
+
ok: false;
|
|
120
|
+
because: string;
|
|
121
|
+
};
|
|
122
|
+
//# sourceMappingURL=delivery-settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delivery-settings.d.ts","sourceRoot":"","sources":["../src/delivery-settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,eAAO,MAAM,aAAa,2CAA4C,CAAC;AACvE,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,qDAAqD;AACrD,eAAO,MAAM,oBAAoB,EAAE,WAAkB,C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AsB,wHASzB,CAAC;AACX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1E,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,mBAAmB,CAAC;IAC3B,iEAAiE;IACjE,MAAM,EAAE,MAAM,CAAC;IACf,wFAAwF;IACxF,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,oEAAoE;IACpE,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,uCAAuC;IACvC,IAAI,EAAE,WAAW,CAAC;IAClB,+EAA+E;IAC/E,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,sEAAsE;IACtE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,iEAAiE;IACjE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,yEAAyE;IACzE,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,EAAE,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACnE;AAKD,yEAAyE;AACzE,wBAAgB,4BAA4B,CAC1C,CAAC,EAAE,OAAO,GACT;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,oBAAoB,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CA0C7E"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* WHAT HAPPENS TO A FINISHED GOAL'S BRANCH — the shape the server stores and the
|
|
4
|
+
* machine obeys.
|
|
5
|
+
*
|
|
6
|
+
* One declaration, shared, so a value AutoRyn or the console can save is exactly
|
|
7
|
+
* a value the machine will act on, and a value the machine would refuse cannot be
|
|
8
|
+
* saved in the first place.
|
|
9
|
+
*
|
|
10
|
+
* pr — push the goal's own `looply/run-*` branch to `origin` and open a pull
|
|
11
|
+
* request into the project's base branch. A person merges. THE DEFAULT.
|
|
12
|
+
* merge — as `pr`, then merge that pull request once the project's required CI
|
|
13
|
+
* checks are green. Never before; never on a red or a missing check.
|
|
14
|
+
* deploy — as `merge`, then run the project's OWN declared release step
|
|
15
|
+
* (`deliver.release` in `.looply/config.yaml`). A remote setting can
|
|
16
|
+
* choose this mode, but it can never name the command: the command is
|
|
17
|
+
* only ever what the project's own file declares.
|
|
18
|
+
* off — keep the branch on this machine (the behaviour before delivery existed).
|
|
19
|
+
*
|
|
20
|
+
* 🔴 THE HARD RULES ARE NOT SETTINGS. Whatever is chosen here, the machine never
|
|
21
|
+
* pushes the base branch, `main`/`master` or a protected branch, never pushes to a
|
|
22
|
+
* remote other than `origin`, and never force-pushes. Those live in the CLI's
|
|
23
|
+
* `branch-delivery.ts` and nothing here can loosen them.
|
|
24
|
+
*/
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.BRANCH_DELIVERY_STATES = exports.DEPLOY_KINDS = exports.DEFAULT_DELIVER_MODE = exports.DELIVER_MODES = void 0;
|
|
27
|
+
exports.isDeliverMode = isDeliverMode;
|
|
28
|
+
exports.validateDeployConfig = validateDeployConfig;
|
|
29
|
+
exports.describeDeploy = describeDeploy;
|
|
30
|
+
exports.validateDeliverySettings = validateDeliverySettings;
|
|
31
|
+
exports.validateBranchDeliveryReport = validateBranchDeliveryReport;
|
|
32
|
+
exports.DELIVER_MODES = ['pr', 'merge', 'deploy', 'off'];
|
|
33
|
+
/** Push and open a pull request; a person merges. */
|
|
34
|
+
exports.DEFAULT_DELIVER_MODE = 'pr';
|
|
35
|
+
function isDeliverMode(x) {
|
|
36
|
+
return typeof x === 'string' && exports.DELIVER_MODES.includes(x);
|
|
37
|
+
}
|
|
38
|
+
/** A project's remote delivery choice. */
|
|
39
|
+
/**
|
|
40
|
+
* HOW A MERGED CHANGE IS DEPLOYED — configured explicitly per project, never guessed.
|
|
41
|
+
*
|
|
42
|
+
* none — nothing is deployed; the merge is the end
|
|
43
|
+
* merge-deploys — merging into the base branch IS the deploy (Heroku / Netlify auto-deploy on main)
|
|
44
|
+
* push — push the merged base commit to `branch` on the named `remote` (e.g. heroku-qa main).
|
|
45
|
+
* The ONE exception to "origin only", and only for the remote named here, never forced.
|
|
46
|
+
* run — run the release step the project's OWN .looply/config.yaml declares (`deliver.release`).
|
|
47
|
+
* A remote setting chooses this kind; it can never carry the command.
|
|
48
|
+
*/
|
|
49
|
+
exports.DEPLOY_KINDS = ['none', 'merge-deploys', 'push', 'run'];
|
|
50
|
+
const NAME = /^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/;
|
|
51
|
+
const BRANCH = /^[A-Za-z0-9][A-Za-z0-9._/-]{0,199}$/;
|
|
52
|
+
function validateDeployConfig(x) {
|
|
53
|
+
if (typeof x !== 'object' || x === null || Array.isArray(x))
|
|
54
|
+
return { ok: false, because: 'must be an object like { "kind": "none" }' };
|
|
55
|
+
const o = x;
|
|
56
|
+
const kind = o['kind'];
|
|
57
|
+
if (typeof kind !== 'string' || !exports.DEPLOY_KINDS.includes(kind)) {
|
|
58
|
+
return { ok: false, because: `kind must be one of: ${exports.DEPLOY_KINDS.join(', ')}` };
|
|
59
|
+
}
|
|
60
|
+
const allowed = kind === 'push' ? ['kind', 'remote', 'branch'] : ['kind'];
|
|
61
|
+
for (const k of Object.keys(o))
|
|
62
|
+
if (!allowed.includes(k))
|
|
63
|
+
return { ok: false, because: `"${k}" is not part of a ${kind} deploy` };
|
|
64
|
+
if (kind !== 'push')
|
|
65
|
+
return { ok: true, deploy: { kind } };
|
|
66
|
+
const remote = o['remote'];
|
|
67
|
+
const branch = o['branch'];
|
|
68
|
+
if (typeof remote !== 'string' || !NAME.test(remote))
|
|
69
|
+
return { ok: false, because: 'remote must be a remote name, e.g. heroku-qa' };
|
|
70
|
+
if (typeof branch !== 'string' || !BRANCH.test(branch) || branch.includes('..') || branch.endsWith('/') || branch.endsWith('.lock')) {
|
|
71
|
+
return { ok: false, because: 'branch must be a branch name, e.g. main' };
|
|
72
|
+
}
|
|
73
|
+
return { ok: true, deploy: { kind: 'push', remote, branch } };
|
|
74
|
+
}
|
|
75
|
+
function describeDeploy(d) {
|
|
76
|
+
if (!d || d.kind === 'none')
|
|
77
|
+
return 'nothing is deployed';
|
|
78
|
+
if (d.kind === 'merge-deploys')
|
|
79
|
+
return 'merging into the base branch deploys';
|
|
80
|
+
if (d.kind === 'push')
|
|
81
|
+
return `push the merged commit to ${d.branch} on ${d.remote}`;
|
|
82
|
+
return "run the release step the project's .looply/config.yaml declares";
|
|
83
|
+
}
|
|
84
|
+
/** The one rule the server applies on write and the machine on read. */
|
|
85
|
+
function validateDeliverySettings(x) {
|
|
86
|
+
if (typeof x !== 'object' || x === null || Array.isArray(x)) {
|
|
87
|
+
return { ok: false, key: '<root>', because: 'must be an object like { "deliver": "pr" }' };
|
|
88
|
+
}
|
|
89
|
+
const o = x;
|
|
90
|
+
for (const k of Object.keys(o)) {
|
|
91
|
+
if (k !== 'deliver' && k !== 'deploy')
|
|
92
|
+
return { ok: false, key: k, because: 'is not a delivery setting (only "deliver" and "deploy" are)' };
|
|
93
|
+
}
|
|
94
|
+
if (!isDeliverMode(o['deliver'])) {
|
|
95
|
+
return { ok: false, key: 'deliver', because: `must be one of: ${exports.DELIVER_MODES.join(', ')}` };
|
|
96
|
+
}
|
|
97
|
+
if (o['deploy'] === undefined || o['deploy'] === null)
|
|
98
|
+
return { ok: true, settings: { deliver: o['deliver'] } };
|
|
99
|
+
const d = validateDeployConfig(o['deploy']);
|
|
100
|
+
if (!d.ok)
|
|
101
|
+
return { ok: false, key: 'deploy', because: d.because };
|
|
102
|
+
return { ok: true, settings: { deliver: o['deliver'], deploy: d.deploy } };
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* WHERE A FINISHED GOAL'S BRANCH GOT TO — recorded on the goal so a person (and
|
|
106
|
+
* AutoRyn's "Done — please review" comment) can open the code.
|
|
107
|
+
*
|
|
108
|
+
* pushed — the branch is on origin; no pull request could be opened (`note` says why)
|
|
109
|
+
* pr-open — a pull request is open; a person reviews and merges (`deliver: pr`)
|
|
110
|
+
* waiting-checks — `merge`/`deploy`: waiting for the required CI checks
|
|
111
|
+
* checks-failed — `merge`/`deploy`: a required check failed; it stays open for a person
|
|
112
|
+
* merged — merged into the base branch (by Looply under `merge`, or by a person)
|
|
113
|
+
* deployed — merged, and the project's declared release step finished
|
|
114
|
+
* deploy-failed — merged, and the release step failed
|
|
115
|
+
* not-pushed — nothing left this machine (`note` says why)
|
|
116
|
+
*/
|
|
117
|
+
exports.BRANCH_DELIVERY_STATES = [
|
|
118
|
+
'pushed',
|
|
119
|
+
'pr-open',
|
|
120
|
+
'waiting-checks',
|
|
121
|
+
'checks-failed',
|
|
122
|
+
'merged',
|
|
123
|
+
'deployed',
|
|
124
|
+
'deploy-failed',
|
|
125
|
+
'not-pushed',
|
|
126
|
+
];
|
|
127
|
+
const MAX_NOTE = 600;
|
|
128
|
+
const MAX_URL = 400;
|
|
129
|
+
/** A report a machine sent, checked once, the same way on both sides. */
|
|
130
|
+
function validateBranchDeliveryReport(x) {
|
|
131
|
+
if (typeof x !== 'object' || x === null || Array.isArray(x))
|
|
132
|
+
return { ok: false, because: 'must be an object' };
|
|
133
|
+
const o = x;
|
|
134
|
+
const state = o['state'];
|
|
135
|
+
if (typeof state !== 'string' || !exports.BRANCH_DELIVERY_STATES.includes(state)) {
|
|
136
|
+
return { ok: false, because: `state must be one of: ${exports.BRANCH_DELIVERY_STATES.join(', ')}` };
|
|
137
|
+
}
|
|
138
|
+
const branch = o['branch'];
|
|
139
|
+
if (typeof branch !== 'string' || branch.length === 0 || branch.length > 200)
|
|
140
|
+
return { ok: false, because: 'branch' };
|
|
141
|
+
const optStr = (k, max) => {
|
|
142
|
+
const v = o[k];
|
|
143
|
+
if (v === null || v === undefined)
|
|
144
|
+
return null;
|
|
145
|
+
if (typeof v !== 'string' || v.length > max)
|
|
146
|
+
return false;
|
|
147
|
+
return v;
|
|
148
|
+
};
|
|
149
|
+
const base = optStr('base', 200);
|
|
150
|
+
if (base === false)
|
|
151
|
+
return { ok: false, because: 'base' };
|
|
152
|
+
const url = optStr('pullRequestUrl', MAX_URL);
|
|
153
|
+
if (url === false)
|
|
154
|
+
return { ok: false, because: 'pullRequestUrl' };
|
|
155
|
+
if (url !== null && !/^https:\/\/[^\s]+$/.test(url))
|
|
156
|
+
return { ok: false, because: 'pullRequestUrl must be an https address' };
|
|
157
|
+
const note = optStr('note', MAX_NOTE);
|
|
158
|
+
if (note === false)
|
|
159
|
+
return { ok: false, because: `note must be a string of at most ${MAX_NOTE} characters` };
|
|
160
|
+
const dependsOn = optStr('dependsOn', 200);
|
|
161
|
+
if (dependsOn === false)
|
|
162
|
+
return { ok: false, because: 'dependsOn' };
|
|
163
|
+
const mode = o['mode'];
|
|
164
|
+
if (!isDeliverMode(mode))
|
|
165
|
+
return { ok: false, because: `mode must be one of: ${exports.DELIVER_MODES.join(', ')}` };
|
|
166
|
+
const mergeSha = optStr('mergeSha', 64);
|
|
167
|
+
if (mergeSha === false || (mergeSha !== null && !/^[0-9a-f]{7,64}$/.test(mergeSha)))
|
|
168
|
+
return { ok: false, because: 'mergeSha must be a hex commit id' };
|
|
169
|
+
let deploy = null;
|
|
170
|
+
const dep = o['deploy'];
|
|
171
|
+
if (dep !== undefined && dep !== null) {
|
|
172
|
+
const r = dep;
|
|
173
|
+
if (typeof dep !== 'object' || Array.isArray(dep) || typeof r['kind'] !== 'string' || !exports.DEPLOY_KINDS.includes(r['kind'])
|
|
174
|
+
|| typeof r['ok'] !== 'boolean' || typeof r['detail'] !== 'string' || r['detail'].length > MAX_NOTE) {
|
|
175
|
+
return { ok: false, because: 'deploy must be { kind, ok, detail }' };
|
|
176
|
+
}
|
|
177
|
+
deploy = { kind: r['kind'], ok: r['ok'], detail: r['detail'] };
|
|
178
|
+
}
|
|
179
|
+
return {
|
|
180
|
+
ok: true,
|
|
181
|
+
report: { state: state, branch, base, pullRequestUrl: url, mode, note, dependsOn, mergeSha, deploy },
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=delivery-settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delivery-settings.js","sourceRoot":"","sources":["../src/delivery-settings.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;AAQH,sCAEC;AAwBD,oDAiBC;AAED,wCAKC;AAaD,4DAeC;AAmDD,oEA4CC;AAnLY,QAAA,aAAa,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAU,CAAC;AAGvE,qDAAqD;AACxC,QAAA,oBAAoB,GAAgB,IAAI,CAAC;AAEtD,SAAgB,aAAa,CAAC,CAAU;IACtC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAK,qBAAmC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACnF,CAAC;AAED,0CAA0C;AAC1C;;;;;;;;;GASG;AACU,QAAA,YAAY,GAAG,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,CAAU,CAAC;AAQ9E,MAAM,IAAI,GAAG,mCAAmC,CAAC;AACjD,MAAM,MAAM,GAAG,qCAAqC,CAAC;AAErD,SAAgB,oBAAoB,CAAC,CAAU;IAC7C,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,2CAA2C,EAAE,CAAC;IACxI,MAAM,CAAC,GAAG,CAA4B,CAAC;IACvC,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;IACvB,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAE,oBAAkC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;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AAC,CAAC,IAAI,CAAC,KAAK,SAAS,IAAI,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,QAAQ,IAAK,CAAC,CAAC,QAAQ,CAAY,CAAC,MAAM,GAAG,QAAQ,EAAE,CAAC;YAClH,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,qCAAqC,EAAE,CAAC;QACvE,CAAC;QACD,MAAM,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAe,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAY,EAAE,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAW,EAAE,CAAC;IACpG,CAAC;IACD,OAAO;QACL,EAAE,EAAE,IAAI;QACR,MAAM,EAAE,EAAE,KAAK,EAAE,KAA4B,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE;KAC5H,CAAC;AACJ,CAAC"}
|
package/dist/goal.d.ts
CHANGED
|
@@ -118,6 +118,17 @@ export interface Goal {
|
|
|
118
118
|
* run the same wrong declaration again.
|
|
119
119
|
*/
|
|
120
120
|
surfaces?: readonly string[];
|
|
121
|
+
/**
|
|
122
|
+
* The pull request this goal's finished branch was delivered as — the address
|
|
123
|
+
* a person opens to see the code. Present only once the machine recorded one.
|
|
124
|
+
*/
|
|
125
|
+
pullRequestUrl?: string;
|
|
126
|
+
/**
|
|
127
|
+
* A person approved shipping this goal's pull request ("Approve and ship"): the
|
|
128
|
+
* machine merges it once its checks allow, then runs the project's deploy step.
|
|
129
|
+
* Present only once approved.
|
|
130
|
+
*/
|
|
131
|
+
shipRequestedAt?: string;
|
|
121
132
|
/**
|
|
122
133
|
* Which requirements and constraints of a stored source this goal serves
|
|
123
134
|
* (M2-2): pairs a person set, versioned with the goal. What the goal has
|
|
@@ -172,7 +183,21 @@ export interface Goal {
|
|
|
172
183
|
* server always answers it, `[]` when none.
|
|
173
184
|
*/
|
|
174
185
|
siblings?: readonly GoalSibling[];
|
|
186
|
+
/**
|
|
187
|
+
* The person the work is for, as the caller names them (AutoRyn: the user
|
|
188
|
+
* who sent the ticket). An opaque reference and a display label — not who
|
|
189
|
+
* authenticated, which stays `createdBy`. The machine reads `ref` to apply
|
|
190
|
+
* an AI account's "only its owner" setting (`provider-accounts.ts`). Null or
|
|
191
|
+
* absent when nobody was named.
|
|
192
|
+
*/
|
|
193
|
+
requestedBy?: GoalRequester | null;
|
|
194
|
+
}
|
|
195
|
+
export interface GoalRequester {
|
|
196
|
+
ref: string;
|
|
197
|
+
label: string | null;
|
|
175
198
|
}
|
|
199
|
+
/** A goal's `requestedBy`, checked: ref 1..128 characters, label up to 120; null when not one. */
|
|
200
|
+
export declare function goalRequesterOf(raw: unknown): GoalRequester | null;
|
|
176
201
|
/**
|
|
177
202
|
* The transitions a human may make.
|
|
178
203
|
*
|
package/dist/goal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"goal.d.ts","sourceRoot":"","sources":["../src/goal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEzD,eAAO,MAAM,WAAW,2CAA2E,CAAC;AAEpG,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,SAAS,CAEtD;AAED,8GAA8G;AAC9G,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,IAAI;IACnB,EAAE,EA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AC/E,2BAA2B;AAC7B,sEAAsE;GACpE,iBAAiB;AACnB,6BAA6B;GAC3B,gBAAgB;AAClB;;;;;GAKG;GACD,8BAA8B;AAChC;;;;;;;;;;;;;GAaG;GACD,qBAAqB;AACvB;;;;;GAKG;GACD,aAAa,CAAC;AAElB,eAAO,MAAM,iBAAiB,uLASgB,CAAC;AAE/C,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,cAAc,CAEhE;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAEnE"}
|
package/dist/goal.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RUN_REFUSAL_CODES = exports.MAX_AUTONOMY_LIFETIME_MS = exports.MAX_AUTONOMOUS_STARTS = exports.GOAL_AUTONOMY_STATES = exports.MACHINE_SETTLABLE_STATES = exports.GOAL_STATES = void 0;
|
|
4
4
|
exports.isGoalState = isGoalState;
|
|
5
|
+
exports.goalRequesterOf = goalRequesterOf;
|
|
5
6
|
exports.canGoalTransition = canGoalTransition;
|
|
6
7
|
exports.isMachineSettlableState = isMachineSettlableState;
|
|
7
8
|
exports.isGoalAutonomyState = isGoalAutonomyState;
|
|
@@ -12,6 +13,18 @@ exports.GOAL_STATES = ['draft', 'active', 'abandoned'];
|
|
|
12
13
|
function isGoalState(x) {
|
|
13
14
|
return typeof x === 'string' && exports.GOAL_STATES.includes(x);
|
|
14
15
|
}
|
|
16
|
+
/** A goal's `requestedBy`, checked: ref 1..128 characters, label up to 120; null when not one. */
|
|
17
|
+
function goalRequesterOf(raw) {
|
|
18
|
+
if (typeof raw !== 'object' || raw === null || Array.isArray(raw))
|
|
19
|
+
return null;
|
|
20
|
+
const r = raw;
|
|
21
|
+
const ref = r['ref'];
|
|
22
|
+
// eslint-disable-next-line no-control-regex
|
|
23
|
+
if (typeof ref !== 'string' || ref.length < 1 || ref.length > 128 || /[\u0000-\u001f\u007f]/.test(ref))
|
|
24
|
+
return null;
|
|
25
|
+
const label = typeof r['label'] === 'string' && r['label'].trim() !== '' ? r['label'].slice(0, 120) : null;
|
|
26
|
+
return { ref, label };
|
|
27
|
+
}
|
|
15
28
|
/**
|
|
16
29
|
* The transitions a human may make.
|
|
17
30
|
*
|
package/dist/goal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"goal.js","sourceRoot":"","sources":["../src/goal.ts"],"names":[],"mappings":";;;AAoCA,kCAEC;
|
|
1
|
+
{"version":3,"file":"goal.js","sourceRoot":"","sources":["../src/goal.ts"],"names":[],"mappings":";;;AAoCA,kCAEC;AA2KD,0CAQC;AASD,8CAKC;AA6CD,0DAEC;AA4BD,kDAEC;AAaD,gDAEC;AAgHD,4CAEC;AAUD,oDAEC;AA/ZY,QAAA,WAAW,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,WAAW,CAAyC,CAAC;AAEpG,SAAgB,WAAW,CAAC,CAAU;IACpC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAK,mBAAiC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACjF,CAAC;AA0KD,kGAAkG;AAClG,SAAgB,eAAe,CAAC,GAAY;IAC1C,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAC/E,MAAM,CAAC,GAAG,GAA8B,CAAC;IACzC,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IACrB,4CAA4C;IAC5C,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,IAAI,uBAAuB,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACpH,MAAM,KA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AAwB;IACzD,OAAO,KAAK,KAAK,YAAY,CAAC;AAChC,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACU,QAAA,qBAAqB,GAAG,CAAC,CAAC;AAEvC;;;;;;;;;;GAUG;AACU,QAAA,wBAAwB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAqE/C,QAAA,iBAAiB,GAAG;IAC/B,gBAAgB;IAChB,qBAAqB;IACrB,gBAAgB;IAChB,2BAA2B;IAC3B,iBAAiB;IACjB,gBAAgB;IAChB,8BAA8B;IAC9B,aAAa;CAC+B,CAAC;AAE/C,SAAgB,gBAAgB,CAAC,CAAU;IACzC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAK,yBAAuC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACvF,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,oBAAoB,CAAC,KAAqB;IACxD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -54,6 +54,9 @@ export * from './ledger';
|
|
|
54
54
|
export * from './trailer';
|
|
55
55
|
export * from './settings';
|
|
56
56
|
export * from './agent-settings';
|
|
57
|
+
export * from './machine-settings';
|
|
58
|
+
export * from './delivery-settings';
|
|
59
|
+
export * from './provider-accounts';
|
|
57
60
|
export * from './action-canonical';
|
|
58
61
|
export * from './action';
|
|
59
62
|
export * from './approval';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc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AAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -70,6 +70,9 @@ __exportStar(require("./ledger"), exports);
|
|
|
70
70
|
__exportStar(require("./trailer"), exports);
|
|
71
71
|
__exportStar(require("./settings"), exports);
|
|
72
72
|
__exportStar(require("./agent-settings"), exports);
|
|
73
|
+
__exportStar(require("./machine-settings"), exports);
|
|
74
|
+
__exportStar(require("./delivery-settings"), exports);
|
|
75
|
+
__exportStar(require("./provider-accounts"), exports);
|
|
73
76
|
__exportStar(require("./action-canonical"), exports);
|
|
74
77
|
__exportStar(require("./action"), exports);
|
|
75
78
|
__exportStar(require("./approval"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,oDAAkC;AAClC,2CAAyB;AACzB,8CAA4B;AAC5B,0CAAwB;AACxB,yCAAuB;AACvB,yCAAuB;AACvB,+CAA6B;AAC7B,kDAAgC;AAChC,kDAAgC;AAChC,uDAAqC;AACrC,wDAAsC;AACtC,2DAAyC;AACzC,uDAAqC;AACrC,+CAA6B;AAC7B,uDAAqC;AACrC,uDAAqC;AACrC,qDAAmC;AACnC,qDAAmC;AACnC,oDAAkC;AAClC,qDAAmC;AACnC,uDAAqC;AACrC,oDAAkC;AAClC,sDAAoC;AACpC,oDAAkC;AAClC,kDAAgC;AAChC,gDAA8B;AAC9B,uDAAqC;AACrC,8CAA4B;AAC5B,gDAA8B;AAC9B,gDAA8B;AAC9B,iDAA+B;AAC/B,mDAAiC;AACjC,qDAAmC;AACnC,kDAAgC;AAChC,oDAAkC;AAClC,kDAAgC;AAChC,qDAAmC;AACnC,gDAA8B;AAC9B,oDAAkC;AAClC,iDAA+B;AAC/B,oDAAkC;AAClC,8CAA4B;AAC5B,oDAAkC;AAClC,0DAAwC;AACxC,qDAAmC;AACnC,mDAAiC;AACjC,kDAAgC;AAChC,wDAAsC;AACtC,2CAAyB;AACzB,2CAAyB;AACzB,gDAA8B;AAC9B,2CAAyB;AACzB,4CAA0B;AAC1B,6CAA2B;AAC3B,mDAAiC;AACjC,qDAAmC;AACnC,2CAAyB;AACzB,6CAA2B;AAC3B,kDAAgC;AAChC,uDAAqC;AACrC,sDAAoC;AACpC,wDAAsC;AACtC,6CAA2B;AAC3B,gDAA8B;AAC9B,4CAA0B;AAC1B,6CAA2B;AAC3B,mDAAiC;AACjC,oDAAkC;AAClC,+CAA6B;AAC7B,6CAA2B;AAC3B,gDAA8B;AAC9B,mDAAiC;AACjC,kDAAgC;AAChC,mDAAiC;AACjC,mDAAiC;AACjC,kDAAgC;AAChC,kDAAgC;AAChC,kDAAgC;AAChC,6CAA2B;AAC3B,gDAA8B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,oDAAkC;AAClC,2CAAyB;AACzB,8CAA4B;AAC5B,0CAAwB;AACxB,yCAAuB;AACvB,yCAAuB;AACvB,+CAA6B;AAC7B,kDAAgC;AAChC,kDAAgC;AAChC,uDAAqC;AACrC,wDAAsC;AACtC,2DAAyC;AACzC,uDAAqC;AACrC,+CAA6B;AAC7B,uDAAqC;AACrC,uDAAqC;AACrC,qDAAmC;AACnC,qDAAmC;AACnC,oDAAkC;AAClC,qDAAmC;AACnC,uDAAqC;AACrC,oDAAkC;AAClC,sDAAoC;AACpC,oDAAkC;AAClC,kDAAgC;AAChC,gDAA8B;AAC9B,uDAAqC;AACrC,8CAA4B;AAC5B,gDAA8B;AAC9B,gDAA8B;AAC9B,iDAA+B;AAC/B,mDAAiC;AACjC,qDAAmC;AACnC,kDAAgC;AAChC,oDAAkC;AAClC,kDAAgC;AAChC,qDAAmC;AACnC,gDAA8B;AAC9B,oDAAkC;AAClC,iDAA+B;AAC/B,oDAAkC;AAClC,8CAA4B;AAC5B,oDAAkC;AAClC,0DAAwC;AACxC,qDAAmC;AACnC,mDAAiC;AACjC,kDAAgC;AAChC,wDAAsC;AACtC,2CAAyB;AACzB,2CAAyB;AACzB,gDAA8B;AAC9B,2CAAyB;AACzB,4CAA0B;AAC1B,6CAA2B;AAC3B,mDAAiC;AACjC,qDAAmC;AACnC,sDAAoC;AACpC,sDAAoC;AACpC,qDAAmC;AACnC,2CAAyB;AACzB,6CAA2B;AAC3B,kDAAgC;AAChC,uDAAqC;AACrC,sDAAoC;AACpC,wDAAsC;AACtC,6CAA2B;AAC3B,gDAA8B;AAC9B,4CAA0B;AAC1B,6CAA2B;AAC3B,mDAAiC;AACjC,oDAAkC;AAClC,+CAA6B;AAC7B,6CAA2B;AAC3B,gDAA8B;AAC9B,mDAAiC;AACjC,kDAAgC;AAChC,mDAAiC;AACjC,mDAAiC;AACjC,kDAAgC;AAChC,kDAAgC;AAChC,kDAAgC;AAChC,6CAA2B;AAC3B,gDAA8B"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHERE A MACHINE'S CHECKOUTS GO, AND HOW MUCH DISK THEY MAY TAKE — the shape
|
|
3
|
+
* the server stores and the machine obeys.
|
|
4
|
+
*
|
|
5
|
+
* 🔴 ON 2026-10-16 CHECKOUTS FILLED THE OWNER'S C: (about 100 GB). These are
|
|
6
|
+
* the three knobs a person gets for that, per machine, from the console or
|
|
7
|
+
* AutoRyn:
|
|
8
|
+
*
|
|
9
|
+
* workspacesRoot the folder new checkouts go in. Null: `~/.looply/workspaces`.
|
|
10
|
+
* checkoutsCapGb GB all checkouts together may use. Null: no cap.
|
|
11
|
+
* minFreeGb GB that must stay free on the checkout drive. Null: 20.
|
|
12
|
+
*
|
|
13
|
+
* One declaration, shared, so a value the server accepts is a value the machine
|
|
14
|
+
* can at least read. The server can only check a folder's SHAPE; whether it is
|
|
15
|
+
* on a local fixed drive, writable, outside every served repository and outside
|
|
16
|
+
* `~/.looply` is a fact about the machine, so the machine checks that itself
|
|
17
|
+
* before using it (`packages/cli/src/machine-settings.ts`) and refuses in words.
|
|
18
|
+
*
|
|
19
|
+
* ⚠️ THE MACHINE'S OWN SAY STILL WINS: `LOOPLY_WORKSPACES_ROOT` and
|
|
20
|
+
* `~/.looply/machine-settings.json` override whatever is set here.
|
|
21
|
+
*/
|
|
22
|
+
export declare const MACHINE_SETTING_KEYS: readonly ["workspacesRoot", "checkoutsCapGb", "minFreeGb"];
|
|
23
|
+
export type MachineSettingKey = (typeof MACHINE_SETTING_KEYS)[number];
|
|
24
|
+
export interface MachineSettings {
|
|
25
|
+
workspacesRoot: string | null;
|
|
26
|
+
checkoutsCapGb: number | null;
|
|
27
|
+
minFreeGb: number | null;
|
|
28
|
+
}
|
|
29
|
+
/** No new checkout is made when its drive has less free space than this (GB). */
|
|
30
|
+
export declare const DEFAULT_MIN_FREE_GB = 20;
|
|
31
|
+
/** What null means for each field, for a client to render "default" honestly. */
|
|
32
|
+
export declare const DEFAULT_MACHINE_SETTINGS: MachineSettings;
|
|
33
|
+
/** Longest folder accepted: leaves room under Windows' 260 for a checkout's own paths. */
|
|
34
|
+
export declare const WORKSPACES_ROOT_MAX = 240;
|
|
35
|
+
/**
|
|
36
|
+
* Why `path` cannot be a checkout folder on ANY machine, or null when its shape
|
|
37
|
+
* is fine. Absolute (`X:\…` or `/…`), not a network path, no `..` segment, no
|
|
38
|
+
* control characters, not too long. Platform-free on purpose: the server runs
|
|
39
|
+
* on Linux and judges a Windows path, so `path.isAbsolute` would answer wrong.
|
|
40
|
+
*/
|
|
41
|
+
export declare function folderShapeProblem(path: string): string | null;
|
|
42
|
+
export type MachineSettingsPatch = Partial<MachineSettings>;
|
|
43
|
+
export type MachineSettingsPatchCheck = {
|
|
44
|
+
ok: true;
|
|
45
|
+
patch: MachineSettingsPatch;
|
|
46
|
+
} | {
|
|
47
|
+
ok: false;
|
|
48
|
+
key: string;
|
|
49
|
+
because: string;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* A partial update: a key left out is unchanged, `null` puts it back to the
|
|
53
|
+
* machine default. Unknown keys are refused rather than dropped, so a typo is
|
|
54
|
+
* a 400 and not a setting that silently never applies.
|
|
55
|
+
*/
|
|
56
|
+
export declare function validateMachineSettingsPatch(raw: unknown): MachineSettingsPatchCheck;
|
|
57
|
+
/**
|
|
58
|
+
* A whole stored or fetched value: every key, missing ones read as null. A
|
|
59
|
+
* value that does not validate is refused whole — a machine must not act on
|
|
60
|
+
* half of a setting it could not read.
|
|
61
|
+
*/
|
|
62
|
+
export declare function validateMachineSettings(raw: unknown): {
|
|
63
|
+
ok: true;
|
|
64
|
+
settings: MachineSettings;
|
|
65
|
+
} | {
|
|
66
|
+
ok: false;
|
|
67
|
+
key: string;
|
|
68
|
+
because: string;
|
|
69
|
+
};
|
|
70
|
+
/** Where the folder a machine is using came from. */
|
|
71
|
+
export declare const WORKSPACES_SOURCES: readonly ["local", "remote", "default"];
|
|
72
|
+
export type WorkspacesSource = (typeof WORKSPACES_SOURCES)[number];
|
|
73
|
+
/**
|
|
74
|
+
* What a machine says about its checkouts on every heartbeat. Plain sentences
|
|
75
|
+
* in `refused` and `blocked`, because they are what a ticket and the console
|
|
76
|
+
* show a person.
|
|
77
|
+
*/
|
|
78
|
+
export interface WorkspacesReport {
|
|
79
|
+
/** The folder new checkouts go in right now. */
|
|
80
|
+
root: string;
|
|
81
|
+
source: WorkspacesSource;
|
|
82
|
+
/** Free GB on that folder's drive; null when it could not be measured. */
|
|
83
|
+
freeGb: number | null;
|
|
84
|
+
/** GB used by this machine's checkouts; null when not measured yet. */
|
|
85
|
+
usedGb: number | null;
|
|
86
|
+
/** Why the remote folder was not applied, or null. */
|
|
87
|
+
refused: string | null;
|
|
88
|
+
/** Why no new checkout can be made right now (space, cap), or null. */
|
|
89
|
+
blocked: string | null;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=machine-settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"machine-settings.d.ts","sourceRoot":"","sources":["../src/machine-settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,eAAO,MAAM,oBAAoB,4DAA6D,CAAC;AAC/F,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,iFAAiF;AACjF,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,iFAAiF;AACjF,eAAO,MAAM,wBAAwB,EAAE,eAItC,CAAC;AAEF,0FAA0F;AAC1F,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAIvC;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW9D;AAQD,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAE5D,MAAM,MAAM,yBAAyB,GACjC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,oBAAoB,CAAA;CAAE,GACzC;IAAE,EAAE,EAAE,KAAK,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