gooseworks 0.5.9-dev.53.c1bd6be2 → 0.5.9-dev.56.eca9486d
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/claude-mcp.d.ts +7 -1
- package/dist/agents/claude-mcp.d.ts.map +1 -1
- package/dist/agents/claude-mcp.js +43 -10
- package/dist/agents/claude-mcp.js.map +1 -1
- package/dist/auth/credentials.d.ts +8 -0
- package/dist/auth/credentials.d.ts.map +1 -1
- package/dist/auth/credentials.js +35 -1
- package/dist/auth/credentials.js.map +1 -1
- package/dist/auth/device-flow.d.ts +4 -1
- package/dist/auth/device-flow.d.ts.map +1 -1
- package/dist/auth/device-flow.js +8 -3
- package/dist/auth/device-flow.js.map +1 -1
- package/dist/auth/oauth-server.d.ts +9 -1
- package/dist/auth/oauth-server.d.ts.map +1 -1
- package/dist/auth/oauth-server.js +19 -11
- package/dist/auth/oauth-server.js.map +1 -1
- package/dist/auth/revoke.d.ts +10 -0
- package/dist/auth/revoke.d.ts.map +1 -0
- package/dist/auth/revoke.js +31 -0
- package/dist/auth/revoke.js.map +1 -0
- package/dist/commands/login.d.ts +15 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +34 -10
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.d.ts.map +1 -1
- package/dist/commands/logout.js +29 -11
- package/dist/commands/logout.js.map +1 -1
- package/dist/commands/video.d.ts +35 -0
- package/dist/commands/video.d.ts.map +1 -1
- package/dist/commands/video.js +475 -39
- package/dist/commands/video.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/kit/core/canonical.d.ts +3 -1
- package/dist/kit/core/canonical.d.ts.map +1 -1
- package/dist/kit/core/canonical.js +1 -1
- package/dist/kit/core/canonical.js.map +1 -1
- package/dist/kit/core/check.d.ts +2 -0
- package/dist/kit/core/check.d.ts.map +1 -1
- package/dist/kit/core/check.js +12 -2
- package/dist/kit/core/check.js.map +1 -1
- package/dist/kit/core/detach.d.ts +11 -0
- package/dist/kit/core/detach.d.ts.map +1 -0
- package/dist/kit/core/detach.js +72 -0
- package/dist/kit/core/detach.js.map +1 -0
- package/dist/kit/core/diff.d.ts +5 -0
- package/dist/kit/core/diff.d.ts.map +1 -0
- package/dist/kit/core/diff.js +132 -0
- package/dist/kit/core/diff.js.map +1 -0
- package/dist/kit/core/errors.d.ts +7 -1
- package/dist/kit/core/errors.d.ts.map +1 -1
- package/dist/kit/core/errors.js +11 -1
- package/dist/kit/core/errors.js.map +1 -1
- package/dist/kit/core/eyes.d.ts +80 -0
- package/dist/kit/core/eyes.d.ts.map +1 -0
- package/dist/kit/core/eyes.js +366 -0
- package/dist/kit/core/eyes.js.map +1 -0
- package/dist/kit/core/files.js +2 -2
- package/dist/kit/core/files.js.map +1 -1
- package/dist/kit/core/lock.d.ts +4 -0
- package/dist/kit/core/lock.d.ts.map +1 -0
- package/dist/kit/core/lock.js +13 -0
- package/dist/kit/core/lock.js.map +1 -0
- package/dist/kit/core/log.d.ts +38 -2
- package/dist/kit/core/log.d.ts.map +1 -1
- package/dist/kit/core/log.js +38 -5
- package/dist/kit/core/log.js.map +1 -1
- package/dist/kit/core/outcome.d.ts +114 -0
- package/dist/kit/core/outcome.d.ts.map +1 -0
- package/dist/kit/core/outcome.js +246 -0
- package/dist/kit/core/outcome.js.map +1 -0
- package/dist/kit/core/patch.d.ts +64 -0
- package/dist/kit/core/patch.d.ts.map +1 -0
- package/dist/kit/core/patch.js +289 -0
- package/dist/kit/core/patch.js.map +1 -0
- package/dist/kit/core/paths.d.ts +17 -0
- package/dist/kit/core/paths.d.ts.map +1 -1
- package/dist/kit/core/paths.js +21 -0
- package/dist/kit/core/paths.js.map +1 -1
- package/dist/kit/core/pieces.d.ts +16 -4
- package/dist/kit/core/pieces.d.ts.map +1 -1
- package/dist/kit/core/pieces.js +84 -27
- package/dist/kit/core/pieces.js.map +1 -1
- package/dist/kit/core/progress-reporter.d.ts +21 -4
- package/dist/kit/core/progress-reporter.d.ts.map +1 -1
- package/dist/kit/core/progress-reporter.js +74 -12
- package/dist/kit/core/progress-reporter.js.map +1 -1
- package/dist/kit/core/progress.d.ts +18 -1
- package/dist/kit/core/progress.d.ts.map +1 -1
- package/dist/kit/core/progress.js +44 -1
- package/dist/kit/core/progress.js.map +1 -1
- package/dist/kit/core/refusal-log.d.ts +7 -0
- package/dist/kit/core/refusal-log.d.ts.map +1 -0
- package/dist/kit/core/refusal-log.js +54 -0
- package/dist/kit/core/refusal-log.js.map +1 -0
- package/dist/kit/core/run.d.ts +35 -5
- package/dist/kit/core/run.d.ts.map +1 -1
- package/dist/kit/core/run.js +497 -79
- package/dist/kit/core/run.js.map +1 -1
- package/dist/kit/core/save.d.ts +7 -3
- package/dist/kit/core/save.d.ts.map +1 -1
- package/dist/kit/core/save.js +57 -20
- package/dist/kit/core/save.js.map +1 -1
- package/dist/kit/core/style.js +1 -1
- package/dist/kit/core/style.js.map +1 -1
- package/dist/kit/line/client.d.ts +14 -2
- package/dist/kit/line/client.d.ts.map +1 -1
- package/dist/kit/line/client.js +40 -20
- package/dist/kit/line/client.js.map +1 -1
- package/dist/kit/line/types.d.ts +33 -1
- package/dist/kit/line/types.d.ts.map +1 -1
- package/dist/kit/maker/inputs.js +1 -1
- package/dist/kit/maker/make.d.ts.map +1 -1
- package/dist/kit/maker/make.js +4 -2
- package/dist/kit/maker/make.js.map +1 -1
- package/dist/kit/maker/parts/html-frames/{1.2.0 → 1.2.1}/part.json +1 -1
- package/dist/kit/parts/catalog.d.ts +3 -20
- package/dist/kit/parts/catalog.d.ts.map +1 -1
- package/dist/kit/parts/catalog.js +6 -41
- package/dist/kit/parts/catalog.js.map +1 -1
- package/dist/kit/parts/loader.d.ts +7 -2
- package/dist/kit/parts/loader.d.ts.map +1 -1
- package/dist/kit/parts/loader.js +88 -23
- package/dist/kit/parts/loader.js.map +1 -1
- package/dist/skills/master-skill.d.ts +1 -3
- package/dist/skills/master-skill.d.ts.map +1 -1
- package/dist/skills/master-skill.js +12 -14
- package/dist/skills/master-skill.js.map +1 -1
- package/dist/skills/routes.js +4 -4
- package/dist/skills/routes.js.map +1 -1
- package/dist/skills/server-entry-skills.d.ts +6 -6
- package/dist/skills/server-entry-skills.js +15 -15
- package/dist/skills/server-entry-skills.js.map +1 -1
- package/dist/utils/browser-preflight.d.ts +3 -0
- package/dist/utils/browser-preflight.d.ts.map +1 -1
- package/dist/utils/browser-preflight.js +27 -6
- package/dist/utils/browser-preflight.js.map +1 -1
- package/dist/utils/exit.d.ts +6 -0
- package/dist/utils/exit.d.ts.map +1 -0
- package/dist/utils/exit.js +37 -0
- package/dist/utils/exit.js.map +1 -0
- package/package.json +13 -2
- package/skills/goose-ads/SKILL.md +3 -3
- package/skills/goose-product-photos/SKILL.md +3 -3
- package/skills/goose-video/SKILL.md +5 -5
- package/skills/goose-video-local/SKILL.md +3 -3
- package/skills/gooseworks/SKILL.md +6 -8
- package/skills/make-custom-video/SKILL.md +2 -2
- package/skills/manifest.json +7 -7
- package/skills/routes.json +3 -3
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { ProgressStep } from '../line/types';
|
|
2
|
+
import { type SheetTile } from './eyes';
|
|
3
|
+
import { type RunLayout } from './paths';
|
|
4
|
+
import type { MakeResult } from './run';
|
|
5
|
+
/** The exit code of each outcome. 2 is left to the command line's own usage errors. */
|
|
6
|
+
export declare const EXIT_CODES: {
|
|
7
|
+
/** The video is made and passed its checks. */
|
|
8
|
+
readonly done: 0;
|
|
9
|
+
/** It can't go on as it is: the plan, a check or a part needs a change first. */
|
|
10
|
+
readonly failed: 1;
|
|
11
|
+
/** The person or the card stopped it. */
|
|
12
|
+
readonly stopped: 3;
|
|
13
|
+
/** Something on the way failed for now: the same command carries on and keeps what was made. */
|
|
14
|
+
readonly run_again: 4;
|
|
15
|
+
/** This video needs a newer GooseWorks than this computer could get. */
|
|
16
|
+
readonly update_kit: 5;
|
|
17
|
+
/** This computer needs to sign in to GooseWorks, with the account the video belongs to. */
|
|
18
|
+
readonly sign_in: 6;
|
|
19
|
+
};
|
|
20
|
+
export type Outcome = keyof typeof EXIT_CODES;
|
|
21
|
+
/** Codes the server keeps the video in Making for (gooseworks-app video-line/run-failure.ts RESUMABLE_CODES). */
|
|
22
|
+
export declare const RESUMABLE_CODES: ReadonlySet<string>;
|
|
23
|
+
/** What an end says, as far as the outcome goes. */
|
|
24
|
+
export type Ended = Pick<MakeResult, 'status'> & {
|
|
25
|
+
code?: string;
|
|
26
|
+
next?: string;
|
|
27
|
+
};
|
|
28
|
+
export declare function outcomeOf(result: Ended): Outcome;
|
|
29
|
+
/** last-result.json, and the JSON last line of `video make --json`. */
|
|
30
|
+
export interface ResultRecord {
|
|
31
|
+
event: 'result';
|
|
32
|
+
video_id: string;
|
|
33
|
+
status: MakeResult['status'] | 'not_started';
|
|
34
|
+
outcome: Outcome;
|
|
35
|
+
exit_code: number;
|
|
36
|
+
/** The words for the person. */
|
|
37
|
+
message: string;
|
|
38
|
+
code?: string;
|
|
39
|
+
/** The finished video on this computer. */
|
|
40
|
+
final?: string;
|
|
41
|
+
/** Frames across the finished video, to look at before saying it is ready (`video verify` says what to look for). */
|
|
42
|
+
contact_sheet?: string;
|
|
43
|
+
/** What the final checks noted without failing the video. */
|
|
44
|
+
warnings?: string[];
|
|
45
|
+
/** This run's own log, for support. */
|
|
46
|
+
log?: string;
|
|
47
|
+
ended_at: string;
|
|
48
|
+
}
|
|
49
|
+
export declare function resultRecord(videoId: string, result: Ended & {
|
|
50
|
+
message: string;
|
|
51
|
+
final?: string;
|
|
52
|
+
contact_sheet?: string;
|
|
53
|
+
warnings?: string[];
|
|
54
|
+
log?: string;
|
|
55
|
+
}, at?: Date): ResultRecord;
|
|
56
|
+
/**
|
|
57
|
+
* Saves how the run ended. Written in one go, so a process that is ending right after (or being
|
|
58
|
+
* ended) still leaves the whole record; a failed write never hides the run's own words.
|
|
59
|
+
*/
|
|
60
|
+
export declare function saveResult(layout: RunLayout, record: ResultRecord): void;
|
|
61
|
+
/** detached.json: the process making this video in the background. */
|
|
62
|
+
export interface DetachedRecord {
|
|
63
|
+
pid: number;
|
|
64
|
+
started_at: string;
|
|
65
|
+
output: string;
|
|
66
|
+
}
|
|
67
|
+
/** The card's rows as the run left them, saved for `video status`. */
|
|
68
|
+
export interface ProgressRecord {
|
|
69
|
+
note: string;
|
|
70
|
+
steps: ProgressStep[];
|
|
71
|
+
at: string;
|
|
72
|
+
}
|
|
73
|
+
/** What `video status` says about one video on this computer. */
|
|
74
|
+
export interface VideoStatus {
|
|
75
|
+
event: 'status';
|
|
76
|
+
video_id: string;
|
|
77
|
+
/** making: a run is going; waiting: a detached run waits for another to finish first; else how the last run ended. */
|
|
78
|
+
state: 'making' | 'waiting' | Outcome | 'not_started';
|
|
79
|
+
/** The detached process, while it lives. */
|
|
80
|
+
pid?: number;
|
|
81
|
+
note?: string;
|
|
82
|
+
steps?: ProgressStep[];
|
|
83
|
+
/** The last run's words and exit code, once it ended. */
|
|
84
|
+
message?: string;
|
|
85
|
+
exit_code?: number;
|
|
86
|
+
final?: string;
|
|
87
|
+
contact_sheet?: string;
|
|
88
|
+
warnings?: string[];
|
|
89
|
+
log?: string;
|
|
90
|
+
output?: string;
|
|
91
|
+
updated_at?: string;
|
|
92
|
+
}
|
|
93
|
+
/** The newest run's own log, or null when no run of this video has one here. */
|
|
94
|
+
export declare function latestRunLog(layout: RunLayout): Promise<string | null>;
|
|
95
|
+
/** The last `lines` lines of a file, or null when it can't be read. */
|
|
96
|
+
export declare function tailOf(file: string, lines: number): Promise<string[] | null>;
|
|
97
|
+
/** Reads the run folder: is a run going, how far it got, and how the last one ended. */
|
|
98
|
+
export declare function videoStatus(home: string, videoId: string): Promise<VideoStatus>;
|
|
99
|
+
/** What `video verify` says about one video: where its final and frame sheet are, and what to look for. */
|
|
100
|
+
export interface VerifyRecord {
|
|
101
|
+
event: 'verify';
|
|
102
|
+
video_id: string;
|
|
103
|
+
final?: string;
|
|
104
|
+
contact_sheet?: string;
|
|
105
|
+
tiles?: SheetTile[];
|
|
106
|
+
/** What the final checks noted without failing the video. */
|
|
107
|
+
warnings: string[];
|
|
108
|
+
look_for: string[];
|
|
109
|
+
}
|
|
110
|
+
/** Reads the finished video's folder for `video verify`. */
|
|
111
|
+
export declare function verifyOf(home: string, videoId: string): Promise<VerifyRecord>;
|
|
112
|
+
/** `video verify` for the person, or the AI, about to say the video is ready. */
|
|
113
|
+
export declare function verifyLines(found: VerifyRecord): string[];
|
|
114
|
+
//# sourceMappingURL=outcome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outcome.d.ts","sourceRoot":"","sources":["../../../src/kit/core/outcome.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC7D,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGxC,uFAAuF;AACvF,eAAO,MAAM,UAAU;IACrB,+CAA+C;;IAE/C,iFAAiF;;IAEjF,yCAAyC;;IAEzC,gGAAgG;;IAEhG,wEAAwE;;IAExE,2FAA2F;;CAEnF,CAAC;AAEX,MAAM,MAAM,OAAO,GAAG,MAAM,OAAO,UAAU,CAAC;AAE9C,iHAAiH;AACjH,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,MAAM,CAA8G,CAAC;AAa/J,oDAAoD;AACpD,MAAM,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAElF,wBAAgB,SAAS,CAAC,MAAM,EAAE,KAAK,GAAG,OAAO,CAMhD;AAED,uEAAuE;AACvE,MAAM,WAAW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,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,4DAA4D;AAC5D,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAsBnF;AAED,iFAAiF;AACjF,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,EAAE,CAYzD"}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.RESUMABLE_CODES = exports.EXIT_CODES = void 0;
|
|
37
|
+
exports.outcomeOf = outcomeOf;
|
|
38
|
+
exports.resultRecord = resultRecord;
|
|
39
|
+
exports.saveResult = saveResult;
|
|
40
|
+
exports.latestRunLog = latestRunLog;
|
|
41
|
+
exports.tailOf = tailOf;
|
|
42
|
+
exports.videoStatus = videoStatus;
|
|
43
|
+
exports.verifyOf = verifyOf;
|
|
44
|
+
exports.verifyLines = verifyLines;
|
|
45
|
+
// How a `video make` ended, for whoever runs it: one stable exit code per outcome, the JSON last
|
|
46
|
+
// line `--json` prints, and the record `video status` reads back. An exit code never changes
|
|
47
|
+
// meaning; a new outcome gets a new code.
|
|
48
|
+
const promises_1 = require("fs/promises");
|
|
49
|
+
const fs_1 = require("fs");
|
|
50
|
+
const path = __importStar(require("path"));
|
|
51
|
+
const eyes_1 = require("./eyes");
|
|
52
|
+
const paths_1 = require("./paths");
|
|
53
|
+
const save_1 = require("./save");
|
|
54
|
+
/** The exit code of each outcome. 2 is left to the command line's own usage errors. */
|
|
55
|
+
exports.EXIT_CODES = {
|
|
56
|
+
/** The video is made and passed its checks. */
|
|
57
|
+
done: 0,
|
|
58
|
+
/** It can't go on as it is: the plan, a check or a part needs a change first. */
|
|
59
|
+
failed: 1,
|
|
60
|
+
/** The person or the card stopped it. */
|
|
61
|
+
stopped: 3,
|
|
62
|
+
/** Something on the way failed for now: the same command carries on and keeps what was made. */
|
|
63
|
+
run_again: 4,
|
|
64
|
+
/** This video needs a newer GooseWorks than this computer could get. */
|
|
65
|
+
update_kit: 5,
|
|
66
|
+
/** This computer needs to sign in to GooseWorks, with the account the video belongs to. */
|
|
67
|
+
sign_in: 6,
|
|
68
|
+
};
|
|
69
|
+
/** Codes the server keeps the video in Making for (gooseworks-app video-line/run-failure.ts RESUMABLE_CODES). */
|
|
70
|
+
exports.RESUMABLE_CODES = new Set(['timeout', 'tool_failed', 'needs_missing', 'provider_slow', 'price_unavailable', 'stopped_here']);
|
|
71
|
+
/** Codes a run stops on that the same command gets past later, besides the line's own resumable ones. */
|
|
72
|
+
const RUN_AGAIN_CODES = new Set([
|
|
73
|
+
...exports.RESUMABLE_CODES,
|
|
74
|
+
'unreachable',
|
|
75
|
+
'bad_cache',
|
|
76
|
+
'parts_not_ready',
|
|
77
|
+
'plan_changed',
|
|
78
|
+
'line_unavailable',
|
|
79
|
+
'internal_error',
|
|
80
|
+
]);
|
|
81
|
+
function outcomeOf(result) {
|
|
82
|
+
if (result.status === 'done')
|
|
83
|
+
return 'done';
|
|
84
|
+
if (result.status === 'update_kit')
|
|
85
|
+
return 'update_kit';
|
|
86
|
+
if (result.next === 'sign_in')
|
|
87
|
+
return 'sign_in';
|
|
88
|
+
if (result.next === 'retry' || (result.code && RUN_AGAIN_CODES.has(result.code)))
|
|
89
|
+
return 'run_again';
|
|
90
|
+
return result.status === 'stopped' ? 'stopped' : 'failed';
|
|
91
|
+
}
|
|
92
|
+
function resultRecord(videoId, result, at = new Date()) {
|
|
93
|
+
const outcome = outcomeOf(result);
|
|
94
|
+
return {
|
|
95
|
+
event: 'result',
|
|
96
|
+
video_id: videoId,
|
|
97
|
+
status: result.status,
|
|
98
|
+
outcome,
|
|
99
|
+
exit_code: exports.EXIT_CODES[outcome],
|
|
100
|
+
message: result.message,
|
|
101
|
+
...(result.code ? { code: result.code } : {}),
|
|
102
|
+
...(result.status === 'done' && result.final ? { final: result.final } : {}),
|
|
103
|
+
...(result.status === 'done' && result.contact_sheet ? { contact_sheet: result.contact_sheet } : {}),
|
|
104
|
+
...(result.status === 'done' && result.warnings?.length ? { warnings: result.warnings } : {}),
|
|
105
|
+
...(result.log ? { log: result.log } : {}),
|
|
106
|
+
ended_at: at.toISOString(),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Saves how the run ended. Written in one go, so a process that is ending right after (or being
|
|
111
|
+
* ended) still leaves the whole record; a failed write never hides the run's own words.
|
|
112
|
+
*/
|
|
113
|
+
function saveResult(layout, record) {
|
|
114
|
+
try {
|
|
115
|
+
(0, fs_1.mkdirSync)(layout.root, { recursive: true, mode: 0o700 });
|
|
116
|
+
const temp = `${layout.result}.${process.pid}.pending`;
|
|
117
|
+
(0, fs_1.writeFileSync)(temp, JSON.stringify(record, null, 2) + '\n', { mode: 0o600 });
|
|
118
|
+
(0, fs_1.renameSync)(temp, layout.result);
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
// The run's words are printed either way.
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/** The newest run's own log, or null when no run of this video has one here. */
|
|
125
|
+
async function latestRunLog(layout) {
|
|
126
|
+
const names = await (0, promises_1.readdir)(layout.runs).catch(() => []);
|
|
127
|
+
const logs = names.filter((name) => name.endsWith('.ndjson')).sort();
|
|
128
|
+
return logs.length ? path.join(layout.runs, logs[logs.length - 1]) : null;
|
|
129
|
+
}
|
|
130
|
+
/** The last `lines` lines of a file, or null when it can't be read. */
|
|
131
|
+
async function tailOf(file, lines) {
|
|
132
|
+
const handle = await (0, promises_1.open)(file, 'r').catch(() => null);
|
|
133
|
+
if (!handle)
|
|
134
|
+
return null;
|
|
135
|
+
try {
|
|
136
|
+
// Read back from the end in chunks until enough lines are in hand, never more than TAIL_MAX_BYTES.
|
|
137
|
+
const size = (await handle.stat()).size;
|
|
138
|
+
const chunks = [];
|
|
139
|
+
let start = size;
|
|
140
|
+
let newlines = 0;
|
|
141
|
+
while (start > 0 && newlines <= lines && size - start < TAIL_MAX_BYTES) {
|
|
142
|
+
const length = Math.min(TAIL_CHUNK, start);
|
|
143
|
+
start -= length;
|
|
144
|
+
const chunk = Buffer.alloc(length);
|
|
145
|
+
await handle.read(chunk, 0, length, start);
|
|
146
|
+
chunks.unshift(chunk);
|
|
147
|
+
for (const byte of chunk)
|
|
148
|
+
if (byte === 10)
|
|
149
|
+
newlines++;
|
|
150
|
+
}
|
|
151
|
+
const all = Buffer.concat(chunks).toString('utf8').split('\n');
|
|
152
|
+
// The first piece may be the end of a line cut by the chunk edge.
|
|
153
|
+
if (start > 0)
|
|
154
|
+
all.shift();
|
|
155
|
+
const kept = all.filter((line) => line.length > 0);
|
|
156
|
+
return kept.slice(Math.max(kept.length - lines, 0));
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
finally {
|
|
162
|
+
await handle.close().catch(() => undefined);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
const TAIL_CHUNK = 64 * 1024;
|
|
166
|
+
const TAIL_MAX_BYTES = 8 * 1024 * 1024;
|
|
167
|
+
/** Reads the run folder: is a run going, how far it got, and how the last one ended. */
|
|
168
|
+
async function videoStatus(home, videoId) {
|
|
169
|
+
const layout = (0, paths_1.runLayout)(home, videoId);
|
|
170
|
+
const [detached, result, progress, held, log] = await Promise.all([
|
|
171
|
+
(0, save_1.readJson)(layout.detached),
|
|
172
|
+
(0, save_1.readJson)(layout.result),
|
|
173
|
+
(0, save_1.readJson)(layout.progress),
|
|
174
|
+
(0, save_1.runLockHeld)(layout),
|
|
175
|
+
latestRunLog(layout),
|
|
176
|
+
]);
|
|
177
|
+
// A detached run that already left its result is over, even if its pid now belongs to another process.
|
|
178
|
+
const endedSince = detached && result && typeof result.ended_at === 'string' && result.ended_at >= detached.started_at;
|
|
179
|
+
const background = detached && !endedSince && (0, save_1.isAlive)(detached.pid) ? detached : null;
|
|
180
|
+
const rows = progress && Array.isArray(progress.steps) ? { note: progress.note, steps: progress.steps, updated_at: progress.at } : {};
|
|
181
|
+
const where = { ...(log ? { log } : {}), ...(detached?.output ? { output: detached.output } : {}) };
|
|
182
|
+
if (held || background) {
|
|
183
|
+
return {
|
|
184
|
+
event: 'status',
|
|
185
|
+
video_id: videoId,
|
|
186
|
+
state: held ? 'making' : 'waiting',
|
|
187
|
+
...(background ? { pid: background.pid } : {}),
|
|
188
|
+
...rows,
|
|
189
|
+
...where,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
if (result && typeof result.exit_code === 'number' && result.outcome in exports.EXIT_CODES) {
|
|
193
|
+
return {
|
|
194
|
+
event: 'status',
|
|
195
|
+
video_id: videoId,
|
|
196
|
+
state: result.outcome,
|
|
197
|
+
message: result.message,
|
|
198
|
+
exit_code: result.exit_code,
|
|
199
|
+
...(result.final ? { final: result.final } : {}),
|
|
200
|
+
...(result.contact_sheet ? { contact_sheet: result.contact_sheet } : {}),
|
|
201
|
+
...(result.warnings?.length ? { warnings: result.warnings } : {}),
|
|
202
|
+
...rows,
|
|
203
|
+
...where,
|
|
204
|
+
updated_at: result.ended_at,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
return { event: 'status', video_id: videoId, state: 'not_started', ...rows, ...where };
|
|
208
|
+
}
|
|
209
|
+
/** Reads the finished video's folder for `video verify`. */
|
|
210
|
+
async function verifyOf(home, videoId) {
|
|
211
|
+
const layout = (0, paths_1.runLayout)(home, videoId);
|
|
212
|
+
const final = path.join(layout.final, 'final.mp4');
|
|
213
|
+
const [eyes, result, made] = await Promise.all([
|
|
214
|
+
(0, save_1.readJson)(path.join(layout.final, 'eyes.json')),
|
|
215
|
+
(0, save_1.readJson)(layout.result),
|
|
216
|
+
(0, promises_1.stat)(final).then((info) => info.isFile(), () => false),
|
|
217
|
+
]);
|
|
218
|
+
const record = { event: 'verify', video_id: videoId, warnings: [], look_for: eyes_1.LOOK_FOR };
|
|
219
|
+
// Only the final the last run finished and our server passed: never a leftover from a run that ended otherwise.
|
|
220
|
+
if (!made || result?.status !== 'done' || result.final !== final)
|
|
221
|
+
return record;
|
|
222
|
+
const sheet = typeof eyes?.contact_sheet === 'string' ? eyes.contact_sheet : null;
|
|
223
|
+
const warned = Array.isArray(result.warnings) ? result.warnings : (eyes?.warnings ?? []).map((w) => w.message);
|
|
224
|
+
return {
|
|
225
|
+
...record,
|
|
226
|
+
final,
|
|
227
|
+
...(sheet && (await (0, promises_1.stat)(sheet).then(() => true, () => false)) ? { contact_sheet: sheet, tiles: eyes.tiles } : {}),
|
|
228
|
+
warnings: warned.filter((w) => typeof w === 'string'),
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
/** `video verify` for the person, or the AI, about to say the video is ready. */
|
|
232
|
+
function verifyLines(found) {
|
|
233
|
+
if (!found.final)
|
|
234
|
+
return ['This video hasn’t been finished on this computer, so there is nothing to look at yet.'];
|
|
235
|
+
return [
|
|
236
|
+
`The finished video: ${found.final}`,
|
|
237
|
+
found.contact_sheet
|
|
238
|
+
? `Its frame sheet: ${found.contact_sheet} (frames across the video, labelled by scene: S2 4.1 is scene 2 at 4.1 seconds, END the end card)`
|
|
239
|
+
: 'No frame sheet was made for it, so watch the video itself.',
|
|
240
|
+
'Before you say it is ready, check:',
|
|
241
|
+
...found.look_for.map((item) => `- ${item}`),
|
|
242
|
+
'If any of that is wrong, it isn’t ready: say what you saw and fix that scene first.',
|
|
243
|
+
...found.warnings.map((warning) => `Our check noted: ${warning}`),
|
|
244
|
+
];
|
|
245
|
+
}
|
|
246
|
+
//# sourceMappingURL=outcome.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outcome.js","sourceRoot":"","sources":["../../../src/kit/core/outcome.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,8BAMC;AAuBD,oCAgBC;AAMD,gCASC;AAsCD,oCAIC;AAGD,wBA2BC;AAMD,kCAwCC;AAeD,4BAsBC;AAGD,kCAYC;AArRD,iGAAiG;AACjG,6FAA6F;AAC7F,0CAA0C;AAC1C,0CAAkD;AAClD,2BAA0D;AAC1D,2CAA6B;AAE7B,iCAA6D;AAC7D,mCAAoD;AAEpD,iCAAwD;AAExD,uFAAuF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CAAC;KAClE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { PartRef, PartsLock } from '../part-interface';
|
|
2
|
+
import type { PartLoader } from '../parts/loader';
|
|
3
|
+
import { type RunLayout } from './paths';
|
|
4
|
+
/** All steps' diffs together (the server's MAX_PATCH_DIFF_CHARS). */
|
|
5
|
+
export declare const MAX_PATCH_DIFF_CHARS: number;
|
|
6
|
+
export declare const MAX_PATCHED_STEPS = 4;
|
|
7
|
+
export declare const MAX_PATCHED_FILES = 20;
|
|
8
|
+
export interface PatchedFile {
|
|
9
|
+
path: string;
|
|
10
|
+
original_sha256: string;
|
|
11
|
+
patched_sha256: string;
|
|
12
|
+
}
|
|
13
|
+
export interface PatchStep {
|
|
14
|
+
step: string;
|
|
15
|
+
part: PartRef;
|
|
16
|
+
files: PatchedFile[];
|
|
17
|
+
diff: string;
|
|
18
|
+
/** sha256 of the whole diff, which may have been cut to fit. */
|
|
19
|
+
diff_sha256: string;
|
|
20
|
+
diff_truncated: boolean;
|
|
21
|
+
}
|
|
22
|
+
/** What the hand-over carries; the server checks it against the lock it hands over. */
|
|
23
|
+
export interface KitPatch {
|
|
24
|
+
patch: 1;
|
|
25
|
+
/** canonicalHash of the steps without their diff text. */
|
|
26
|
+
sha256: string;
|
|
27
|
+
steps: PatchStep[];
|
|
28
|
+
}
|
|
29
|
+
export declare function patchSha256(steps: PatchStep[]): string;
|
|
30
|
+
/** One step's own fingerprint in its step hash, so an edited step and every step after it run again. */
|
|
31
|
+
export declare function stepPatchHash(step: PatchStep): string;
|
|
32
|
+
/** Where a step's edit lives. */
|
|
33
|
+
export declare function patchFolders(layout: RunLayout, step: string): {
|
|
34
|
+
code: string;
|
|
35
|
+
original: string;
|
|
36
|
+
record: string;
|
|
37
|
+
};
|
|
38
|
+
export interface TakenOut {
|
|
39
|
+
dir: string;
|
|
40
|
+
part: PartRef;
|
|
41
|
+
/** The copy was already there, edits and all. */
|
|
42
|
+
kept: boolean;
|
|
43
|
+
/** Where an older copy for another version was moved. */
|
|
44
|
+
movedAside: string | null;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* `video step <id> <step> --edit`: the step's locked part, checked against the lock like any load,
|
|
48
|
+
* copied into <run>/patches/<step>/ to edit. A copy of the same part version is kept as it is.
|
|
49
|
+
*/
|
|
50
|
+
export declare function takeOutStep(input: {
|
|
51
|
+
home: string;
|
|
52
|
+
videoId: string;
|
|
53
|
+
step: string;
|
|
54
|
+
env: NodeJS.ProcessEnv;
|
|
55
|
+
loader: PartLoader;
|
|
56
|
+
now?: () => Date;
|
|
57
|
+
}): Promise<TakenOut>;
|
|
58
|
+
/** The edit of each named step, read from its folder and checked against its untouched copy. */
|
|
59
|
+
export declare function readPatch(layout: RunLayout, steps: string[]): Promise<KitPatch>;
|
|
60
|
+
/** Why the lock this hand-over gave can't take the edit (the server checks the same), or null. */
|
|
61
|
+
export declare function patchLockProblem(patch: KitPatch, lock: PartsLock): string | null;
|
|
62
|
+
/** Every file hash the edited copy of a step must have: the lock's, with the edited files' new hashes. */
|
|
63
|
+
export declare function patchedFiles(step: PatchStep, lock: PartsLock): Record<string, string>;
|
|
64
|
+
//# sourceMappingURL=patch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../../src/kit/core/patch.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAKlD,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAOpD,qEAAqE;AACrE,eAAO,MAAM,oBAAoB,QAAY,CAAC;AAC9C,eAAO,MAAM,iBAAiB,IAAI,CAAC;AACnC,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAA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