@jini-ai/devops 0.6.20 → 0.6.22
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# @jini-ai/devops
|
|
2
2
|
|
|
3
|
+
## 0.6.22
|
|
4
|
+
|
|
5
|
+
- Static publish runs as a background job with progress (`deploy/publish-jobs`); a failed provider build is reported as failed and timeouts report what is known.
|
|
6
|
+
|
|
3
7
|
## 0.6.20
|
|
4
8
|
|
|
5
9
|
- `electron` is a classified opt-in peer (`jini.optionalPeers`): only `@jini-ai/devops/local-dev`'s `selectNodeRuntime` loads it. A host that packages a server importing `local-dev` (listen/retirement helpers) no longer fails its staged-closure audit on that dev-only runtime picker (Tovu desktop 0.1.27).
|
|
@@ -53,8 +53,23 @@ export interface DeployPublishInput {
|
|
|
53
53
|
files: DeployFile[];
|
|
54
54
|
projectName: string;
|
|
55
55
|
}
|
|
56
|
+
/** Confirmed provider facts only: unknown creation/remote file counts stay explicit.
|
|
57
|
+
* Uploaded/reused counts refer to distinct content hashes, not duplicate paths.
|
|
58
|
+
*/
|
|
59
|
+
export interface DeployPublishProgress {
|
|
60
|
+
readonly phase: 'exporting' | 'uploading' | 'creating' | 'polling' | 'checking';
|
|
61
|
+
readonly deploymentCreated?: boolean | 'unknown';
|
|
62
|
+
readonly totalFiles?: number;
|
|
63
|
+
readonly uploadedFiles?: number;
|
|
64
|
+
readonly reusedFiles?: number;
|
|
65
|
+
readonly deploymentId?: string;
|
|
66
|
+
readonly url?: string;
|
|
67
|
+
readonly providerStatus?: string;
|
|
68
|
+
}
|
|
56
69
|
/** Optional publish settings, passed separately from the file set and project name. */
|
|
57
70
|
export interface DeployPublishOptions {
|
|
71
|
+
/** Synchronous credential-free snapshots; the caller owns storage/transport frequency. */
|
|
72
|
+
onProgress?: (progress: DeployPublishProgress) => void;
|
|
58
73
|
metadata?: UnknownRecord;
|
|
59
74
|
responseHeaders?: ResponseHeaderSet;
|
|
60
75
|
}
|
package/dist/deploy/index.d.ts
CHANGED
package/dist/deploy/index.js
CHANGED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/** @file Process-local snapshot storage extracted from a host's existing background publish path.
|
|
2
|
+
* The host owns execution and persistence; this module owns bounded retention and scoped lookup.
|
|
3
|
+
*/
|
|
4
|
+
import type { DeployPublishProgress } from '../core/deploy-types.js';
|
|
5
|
+
/** A credential-free publish snapshot. Hosts authorize scopeId before reading it.
|
|
6
|
+
* Results survive subsequent publishes, within the configured process-local retention bound.
|
|
7
|
+
*/
|
|
8
|
+
export interface PublishJobSnapshot<T> {
|
|
9
|
+
readonly jobId: string;
|
|
10
|
+
/** Host correlation for recovery after a response was lost; never a credential. */
|
|
11
|
+
readonly requestId?: string;
|
|
12
|
+
readonly status: 'running' | 'completed' | 'errored';
|
|
13
|
+
readonly startedAtIso: string;
|
|
14
|
+
readonly finishedAtIso: string | null;
|
|
15
|
+
readonly target: string;
|
|
16
|
+
readonly progress: DeployPublishProgress;
|
|
17
|
+
readonly result?: T;
|
|
18
|
+
readonly error?: string;
|
|
19
|
+
}
|
|
20
|
+
type BeginJob = {
|
|
21
|
+
requestId?: string;
|
|
22
|
+
jobId: string;
|
|
23
|
+
scopeId: string;
|
|
24
|
+
target: string;
|
|
25
|
+
startedAtIso: string;
|
|
26
|
+
};
|
|
27
|
+
type SettleJob<T> = {
|
|
28
|
+
jobId: string;
|
|
29
|
+
status: 'completed' | 'errored';
|
|
30
|
+
finishedAtIso: string;
|
|
31
|
+
result?: T;
|
|
32
|
+
error?: string;
|
|
33
|
+
};
|
|
34
|
+
/** Storage behind an existing host background-publish workflow; no timers, I/O or credentials. */
|
|
35
|
+
export interface PublishJobStore<T> {
|
|
36
|
+
begin(required: BeginJob, optional?: Record<string, never>): PublishJobSnapshot<T>;
|
|
37
|
+
get(required: {
|
|
38
|
+
scopeId: string;
|
|
39
|
+
jobId?: string;
|
|
40
|
+
requestId?: string;
|
|
41
|
+
}, optional?: Record<string, never>): PublishJobSnapshot<T> | undefined;
|
|
42
|
+
/** Internal single-flight guard; never expose this unscoped read at a transport boundary. */
|
|
43
|
+
latest(required?: Record<string, never>, optional?: Record<string, never>): PublishJobSnapshot<T> | undefined;
|
|
44
|
+
progress(required: {
|
|
45
|
+
jobId: string;
|
|
46
|
+
progress: Partial<DeployPublishProgress>;
|
|
47
|
+
}, optional?: Record<string, never>): void;
|
|
48
|
+
settle(required: SettleJob<T>, optional?: Record<string, never>): void;
|
|
49
|
+
}
|
|
50
|
+
/** Extracted publish-run snapshot owner: one running publish plus bounded terminal results.
|
|
51
|
+
* @param _required - No dependencies: IDs and timestamps are supplied by the host.
|
|
52
|
+
* @param optional.maxCompleted - Retained terminal jobs (default 20, range 1–1000).
|
|
53
|
+
* @returns An isolated store. Snapshot envelopes and progress are frozen; hosts must treat their own result as immutable.
|
|
54
|
+
* @throws RangeError for an invalid retention bound; begin throws while work is running or ID is reused.
|
|
55
|
+
* @complexity O(1) ID reads/progress; O(maxCompleted) latest-scope reads and settlement eviction.
|
|
56
|
+
* @example const jobs = createPublishJobStore<PublishOutcome>({}, { maxCompleted: 20 });
|
|
57
|
+
*/
|
|
58
|
+
export declare function createPublishJobStore<T>(_required: Record<string, never>, { maxCompleted }?: {
|
|
59
|
+
maxCompleted?: number;
|
|
60
|
+
}): PublishJobStore<T>;
|
|
61
|
+
/** Human-readable recovery from a lost delegated response, based only on confirmed job facts.
|
|
62
|
+
* @param required.job - Scoped snapshot for this request; omit when a matching job could not be confirmed.
|
|
63
|
+
* @param required.statusToolId - Host tool to retrieve progress/final result; no provider polling here.
|
|
64
|
+
* @returns Pasteable ID, upload count, URL/status and next step. Unknown stays explicit.
|
|
65
|
+
* @complexity O(1), no I/O; output is independent of file count/export size.
|
|
66
|
+
*/
|
|
67
|
+
export declare function publishJobRecoveryMessage<T>({ job, statusToolId }: {
|
|
68
|
+
job?: PublishJobSnapshot<T> | undefined;
|
|
69
|
+
statusToolId: string;
|
|
70
|
+
}, _options?: {}): string;
|
|
71
|
+
export {};
|
|
72
|
+
//# sourceMappingURL=publish-jobs.d.ts.map
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/** Extracted publish-run snapshot owner: one running publish plus bounded terminal results.
|
|
2
|
+
* @param _required - No dependencies: IDs and timestamps are supplied by the host.
|
|
3
|
+
* @param optional.maxCompleted - Retained terminal jobs (default 20, range 1–1000).
|
|
4
|
+
* @returns An isolated store. Snapshot envelopes and progress are frozen; hosts must treat their own result as immutable.
|
|
5
|
+
* @throws RangeError for an invalid retention bound; begin throws while work is running or ID is reused.
|
|
6
|
+
* @complexity O(1) ID reads/progress; O(maxCompleted) latest-scope reads and settlement eviction.
|
|
7
|
+
* @example const jobs = createPublishJobStore<PublishOutcome>({}, { maxCompleted: 20 });
|
|
8
|
+
*/
|
|
9
|
+
export function createPublishJobStore(_required, { maxCompleted = 20 } = {}) {
|
|
10
|
+
if (!Number.isInteger(maxCompleted) || maxCompleted < 1 || maxCompleted > 1000)
|
|
11
|
+
throw new RangeError('Publish retention must be 1–1000 jobs.');
|
|
12
|
+
const jobs = new Map();
|
|
13
|
+
let latestId;
|
|
14
|
+
const latest = () => latestId === undefined ? undefined : jobs.get(latestId)?.snapshot;
|
|
15
|
+
return {
|
|
16
|
+
latest,
|
|
17
|
+
begin({ jobId, scopeId, target, startedAtIso, requestId }) {
|
|
18
|
+
if (latest()?.status === 'running')
|
|
19
|
+
throw new Error('A publish is already running. Read its status before starting another.');
|
|
20
|
+
if (jobs.has(jobId))
|
|
21
|
+
throw new Error('Publish job ID is already in use. Generate a new ID.');
|
|
22
|
+
const snapshot = Object.freeze({ jobId, target, startedAtIso, ...(requestId ? { requestId } : {}), finishedAtIso: null, status: 'running',
|
|
23
|
+
progress: Object.freeze({ phase: 'exporting', deploymentCreated: false, uploadedFiles: 0 }) });
|
|
24
|
+
jobs.set(jobId, { scopeId, snapshot });
|
|
25
|
+
latestId = jobId;
|
|
26
|
+
return snapshot;
|
|
27
|
+
},
|
|
28
|
+
get({ scopeId, jobId, requestId }) {
|
|
29
|
+
if (jobId !== undefined) {
|
|
30
|
+
const record = jobs.get(jobId);
|
|
31
|
+
return record?.scopeId === scopeId && (requestId === undefined || record.snapshot.requestId === requestId) ? record.snapshot : undefined;
|
|
32
|
+
}
|
|
33
|
+
return [...jobs.values()].reverse().find(record => record.scopeId === scopeId && (requestId === undefined || record.snapshot.requestId === requestId))?.snapshot;
|
|
34
|
+
},
|
|
35
|
+
progress({ jobId, progress }) {
|
|
36
|
+
const record = jobs.get(jobId);
|
|
37
|
+
if (record?.snapshot.status !== 'running')
|
|
38
|
+
return;
|
|
39
|
+
record.snapshot = Object.freeze({ ...record.snapshot, progress: Object.freeze({ ...record.snapshot.progress, ...progress }) });
|
|
40
|
+
},
|
|
41
|
+
settle({ jobId, ...outcome }) {
|
|
42
|
+
const record = jobs.get(jobId);
|
|
43
|
+
if (record?.snapshot.status !== 'running')
|
|
44
|
+
return;
|
|
45
|
+
record.snapshot = Object.freeze({ ...record.snapshot, ...outcome });
|
|
46
|
+
// Keep the active job and a bounded tail of completed results; no whole-service inventory.
|
|
47
|
+
const terminal = [...jobs].filter(([, value]) => value.snapshot.status !== 'running');
|
|
48
|
+
for (const [id] of terminal.slice(0, Math.max(0, terminal.length - maxCompleted)))
|
|
49
|
+
jobs.delete(id);
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/** Human-readable recovery from a lost delegated response, based only on confirmed job facts.
|
|
54
|
+
* @param required.job - Scoped snapshot for this request; omit when a matching job could not be confirmed.
|
|
55
|
+
* @param required.statusToolId - Host tool to retrieve progress/final result; no provider polling here.
|
|
56
|
+
* @returns Pasteable ID, upload count, URL/status and next step. Unknown stays explicit.
|
|
57
|
+
* @complexity O(1), no I/O; output is independent of file count/export size.
|
|
58
|
+
*/
|
|
59
|
+
export function publishJobRecoveryMessage({ job, statusToolId }, _options = {}) {
|
|
60
|
+
if (!job)
|
|
61
|
+
return `Publish job status could not be confirmed for this call. Deployment: unknown; uploaded files: unknown; URL/status: unknown. Call ${statusToolId} with {} and check the hosting dashboard before retrying.`;
|
|
62
|
+
const progress = job.progress;
|
|
63
|
+
const uploaded = progress.totalFiles === undefined ? 'unknown' : progress.uploadedFiles ?? 'unknown';
|
|
64
|
+
const created = deploymentCreationLabel({ created: progress.deploymentCreated });
|
|
65
|
+
return `Publish job ${job.jobId}: ${job.status}, phase ${progress.phase}. Deployment: ${created}; uploaded files: ${uploaded} of ${progress.totalFiles ?? 'unknown'} distinct files; already stored: ${progress.reusedFiles ?? 'unknown'}. Deployment ID: ${progress.deploymentId ?? 'unknown'}; URL: ${progress.url || 'unknown'}; provider status: ${progress.providerStatus ?? 'unknown'}. Call ${statusToolId} with {"jobId":"${job.jobId}"} for the final result before retrying. The publish can continue after the tool call times out; an old site's 200 does not confirm this deployment.`;
|
|
66
|
+
}
|
|
67
|
+
/** Translate the provider fact without interpreting a missing response as a refusal.
|
|
68
|
+
* @complexity O(1) time/space, no I/O or errors.
|
|
69
|
+
*/
|
|
70
|
+
function deploymentCreationLabel({ created }, _options = {}) {
|
|
71
|
+
if (created === true)
|
|
72
|
+
return 'created';
|
|
73
|
+
return created === false ? 'not created' : 'unknown';
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=publish-jobs.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jini-ai/devops",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.22",
|
|
4
4
|
"description": "DevOps capabilities for deployment, source control, and CI/CD, exposed through independent subpaths.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -155,12 +155,12 @@
|
|
|
155
155
|
"@vitest/coverage-v8": "^2.1.9",
|
|
156
156
|
"undici": "^7.25.0",
|
|
157
157
|
"parse5": "7.3.0",
|
|
158
|
-
"@jini-ai/daemon": "0.6.
|
|
159
|
-
"@jini-ai/platform": "^0.6.
|
|
160
|
-
"@jini-ai/core": "^0.6.
|
|
158
|
+
"@jini-ai/daemon": "0.6.22",
|
|
159
|
+
"@jini-ai/platform": "^0.6.22",
|
|
160
|
+
"@jini-ai/core": "^0.6.22"
|
|
161
161
|
},
|
|
162
162
|
"dependencies": {
|
|
163
|
-
"@jini-ai/core": "^0.6.
|
|
163
|
+
"@jini-ai/core": "^0.6.22"
|
|
164
164
|
},
|
|
165
165
|
"peerDependencies": {
|
|
166
166
|
"typescript": "^5.6.0",
|