@zaalipro/dsh-workflows 0.1.0-rc.12
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/LICENSE +21 -0
- package/NOTICE.md +224 -0
- package/README.i18n.yaml +4 -0
- package/README.md +111 -0
- package/README.zh.md +111 -0
- package/cordis.patch.yml +10 -0
- package/docs/architecture.i18n.yaml +4 -0
- package/docs/architecture.md +177 -0
- package/docs/architecture.zh.md +177 -0
- package/docs/testing.i18n.yaml +4 -0
- package/docs/testing.md +125 -0
- package/docs/testing.zh.md +125 -0
- package/docs/user-guide.i18n.yaml +4 -0
- package/docs/user-guide.md +351 -0
- package/docs/user-guide.zh.md +351 -0
- package/lib/client-types/WorkflowMemberInspector.d.ts +28 -0
- package/lib/client-types/WorkflowMemberInspector.d.ts.map +1 -0
- package/lib/client-types/WorkflowMemberInspector.js +181 -0
- package/lib/client-types/WorkflowMemberInspector.js.map +1 -0
- package/lib/client-types/WorkflowRunPanel.d.ts +43 -0
- package/lib/client-types/WorkflowRunPanel.d.ts.map +1 -0
- package/lib/client-types/WorkflowRunPanel.js +130 -0
- package/lib/client-types/WorkflowRunPanel.js.map +1 -0
- package/lib/client-types/WorkflowsDashboard.d.ts +49 -0
- package/lib/client-types/WorkflowsDashboard.d.ts.map +1 -0
- package/lib/client-types/WorkflowsDashboard.js +942 -0
- package/lib/client-types/WorkflowsDashboard.js.map +1 -0
- package/lib/client-types/adapter.d.ts +60 -0
- package/lib/client-types/adapter.d.ts.map +1 -0
- package/lib/client-types/adapter.js +117 -0
- package/lib/client-types/adapter.js.map +1 -0
- package/lib/client-types/chat-renderer.d.ts +10 -0
- package/lib/client-types/chat-renderer.d.ts.map +1 -0
- package/lib/client-types/chat-renderer.js +11 -0
- package/lib/client-types/chat-renderer.js.map +1 -0
- package/lib/client-types/contract.d.ts +210 -0
- package/lib/client-types/contract.d.ts.map +1 -0
- package/lib/client-types/contract.js +37 -0
- package/lib/client-types/contract.js.map +1 -0
- package/lib/client-types/controller.d.ts +83 -0
- package/lib/client-types/controller.d.ts.map +1 -0
- package/lib/client-types/controller.js +705 -0
- package/lib/client-types/controller.js.map +1 -0
- package/lib/client-types/index.d.ts +19 -0
- package/lib/client-types/index.d.ts.map +1 -0
- package/lib/client-types/index.js +731 -0
- package/lib/client-types/index.js.map +1 -0
- package/lib/client-types/locales.d.ts +257 -0
- package/lib/client-types/locales.d.ts.map +1 -0
- package/lib/client-types/locales.js +270 -0
- package/lib/client-types/locales.js.map +1 -0
- package/lib/client-types/slot-components.d.ts +38 -0
- package/lib/client-types/slot-components.d.ts.map +1 -0
- package/lib/client-types/slot-components.js +22 -0
- package/lib/client-types/slot-components.js.map +1 -0
- package/lib/client-types/store.d.ts +69 -0
- package/lib/client-types/store.d.ts.map +1 -0
- package/lib/client-types/store.js +135 -0
- package/lib/client-types/store.js.map +1 -0
- package/lib/client-types/workflow-definition.d.ts +52 -0
- package/lib/client-types/workflow-definition.d.ts.map +1 -0
- package/lib/client-types/workflow-definition.js +135 -0
- package/lib/client-types/workflow-definition.js.map +1 -0
- package/lib/client.js +11065 -0
- package/lib/client.js.map +1 -0
- package/lib/compat-engine/index.js +1926 -0
- package/lib/compat-engine/index.js.map +1 -0
- package/lib/compat-engine/worker.cjs +1500 -0
- package/lib/compat-engine/worker.cjs.map +1 -0
- package/lib/typert.host.d.ts +3 -0
- package/lib/typert.host.js +1709 -0
- package/lib/typert.remote-client.d.ts +57 -0
- package/lib/typert.remote-client.js +1662 -0
- package/lib/types/commands/aliases.d.ts +4 -0
- package/lib/types/commands/aliases.d.ts.map +1 -0
- package/lib/types/commands/aliases.js +25 -0
- package/lib/types/commands/aliases.js.map +1 -0
- package/lib/types/commands/index.d.ts +66 -0
- package/lib/types/commands/index.d.ts.map +1 -0
- package/lib/types/commands/index.js +550 -0
- package/lib/types/commands/index.js.map +1 -0
- package/lib/types/commands/parser.d.ts +17 -0
- package/lib/types/commands/parser.d.ts.map +1 -0
- package/lib/types/commands/parser.js +45 -0
- package/lib/types/commands/parser.js.map +1 -0
- package/lib/types/config.d.ts +71 -0
- package/lib/types/config.d.ts.map +1 -0
- package/lib/types/config.js +109 -0
- package/lib/types/config.js.map +1 -0
- package/lib/types/index.d.ts +41 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +483 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/invariant.d.ts +21 -0
- package/lib/types/invariant.d.ts.map +1 -0
- package/lib/types/invariant.js +85 -0
- package/lib/types/invariant.js.map +1 -0
- package/lib/types/registry/definition.d.ts +24 -0
- package/lib/types/registry/definition.d.ts.map +1 -0
- package/lib/types/registry/definition.js +189 -0
- package/lib/types/registry/definition.js.map +1 -0
- package/lib/types/registry/index.d.ts +100 -0
- package/lib/types/registry/index.d.ts.map +1 -0
- package/lib/types/registry/index.js +899 -0
- package/lib/types/registry/index.js.map +1 -0
- package/lib/types/registry/names.d.ts +19 -0
- package/lib/types/registry/names.d.ts.map +1 -0
- package/lib/types/registry/names.js +69 -0
- package/lib/types/registry/names.js.map +1 -0
- package/lib/types/registry/remote.d.ts +15 -0
- package/lib/types/registry/remote.d.ts.map +1 -0
- package/lib/types/registry/remote.js +128 -0
- package/lib/types/registry/remote.js.map +1 -0
- package/lib/types/registry/roots.d.ts +44 -0
- package/lib/types/registry/roots.d.ts.map +1 -0
- package/lib/types/registry/roots.js +118 -0
- package/lib/types/registry/roots.js.map +1 -0
- package/lib/types/registry/types.d.ts +62 -0
- package/lib/types/registry/types.d.ts.map +1 -0
- package/lib/types/registry/types.js +2 -0
- package/lib/types/registry/types.js.map +1 -0
- package/lib/types/registry/watchers.d.ts +70 -0
- package/lib/types/registry/watchers.d.ts.map +1 -0
- package/lib/types/registry/watchers.js +152 -0
- package/lib/types/registry/watchers.js.map +1 -0
- package/lib/types/remote-events.d.ts +42 -0
- package/lib/types/remote-events.d.ts.map +1 -0
- package/lib/types/remote-events.js +21 -0
- package/lib/types/remote-events.js.map +1 -0
- package/lib/types/run-recorder.d.ts +44 -0
- package/lib/types/run-recorder.d.ts.map +1 -0
- package/lib/types/run-recorder.js +356 -0
- package/lib/types/run-recorder.js.map +1 -0
- package/lib/types/supervisor/canned-validate.d.ts +25 -0
- package/lib/types/supervisor/canned-validate.d.ts.map +1 -0
- package/lib/types/supervisor/canned-validate.js +122 -0
- package/lib/types/supervisor/canned-validate.js.map +1 -0
- package/lib/types/supervisor/completion-notice.d.ts +49 -0
- package/lib/types/supervisor/completion-notice.d.ts.map +1 -0
- package/lib/types/supervisor/completion-notice.js +281 -0
- package/lib/types/supervisor/completion-notice.js.map +1 -0
- package/lib/types/supervisor/cursors.d.ts +68 -0
- package/lib/types/supervisor/cursors.d.ts.map +1 -0
- package/lib/types/supervisor/cursors.js +158 -0
- package/lib/types/supervisor/cursors.js.map +1 -0
- package/lib/types/supervisor/engine-compat.d.ts +48 -0
- package/lib/types/supervisor/engine-compat.d.ts.map +1 -0
- package/lib/types/supervisor/engine-compat.js +116 -0
- package/lib/types/supervisor/engine-compat.js.map +1 -0
- package/lib/types/supervisor/index.d.ts +183 -0
- package/lib/types/supervisor/index.d.ts.map +1 -0
- package/lib/types/supervisor/index.js +2040 -0
- package/lib/types/supervisor/index.js.map +1 -0
- package/lib/types/supervisor/parallel-compat.d.ts +36 -0
- package/lib/types/supervisor/parallel-compat.d.ts.map +1 -0
- package/lib/types/supervisor/parallel-compat.js +180 -0
- package/lib/types/supervisor/parallel-compat.js.map +1 -0
- package/lib/types/supervisor/remote.d.ts +25 -0
- package/lib/types/supervisor/remote.d.ts.map +1 -0
- package/lib/types/supervisor/remote.js +478 -0
- package/lib/types/supervisor/remote.js.map +1 -0
- package/lib/types/supervisor/storage/bounded-file.d.ts +41 -0
- package/lib/types/supervisor/storage/bounded-file.d.ts.map +1 -0
- package/lib/types/supervisor/storage/bounded-file.js +186 -0
- package/lib/types/supervisor/storage/bounded-file.js.map +1 -0
- package/lib/types/supervisor/storage/details-codec.d.ts +14 -0
- package/lib/types/supervisor/storage/details-codec.d.ts.map +1 -0
- package/lib/types/supervisor/storage/details-codec.js +359 -0
- package/lib/types/supervisor/storage/details-codec.js.map +1 -0
- package/lib/types/supervisor/storage/index.d.ts +26 -0
- package/lib/types/supervisor/storage/index.d.ts.map +1 -0
- package/lib/types/supervisor/storage/index.js +100 -0
- package/lib/types/supervisor/storage/index.js.map +1 -0
- package/lib/types/supervisor/storage/lease.d.ts +34 -0
- package/lib/types/supervisor/storage/lease.d.ts.map +1 -0
- package/lib/types/supervisor/storage/lease.js +289 -0
- package/lib/types/supervisor/storage/lease.js.map +1 -0
- package/lib/types/supervisor/storage/manifest-codec.d.ts +10 -0
- package/lib/types/supervisor/storage/manifest-codec.d.ts.map +1 -0
- package/lib/types/supervisor/storage/manifest-codec.js +335 -0
- package/lib/types/supervisor/storage/manifest-codec.js.map +1 -0
- package/lib/types/supervisor/storage/manifest-store.d.ts +99 -0
- package/lib/types/supervisor/storage/manifest-store.d.ts.map +1 -0
- package/lib/types/supervisor/storage/manifest-store.js +1606 -0
- package/lib/types/supervisor/storage/manifest-store.js.map +1 -0
- package/lib/types/supervisor/storage/manifest-types.d.ts +269 -0
- package/lib/types/supervisor/storage/manifest-types.d.ts.map +1 -0
- package/lib/types/supervisor/storage/manifest-types.js +2 -0
- package/lib/types/supervisor/storage/manifest-types.js.map +1 -0
- package/lib/types/supervisor/storage/private-root.d.ts +143 -0
- package/lib/types/supervisor/storage/private-root.d.ts.map +1 -0
- package/lib/types/supervisor/storage/private-root.js +860 -0
- package/lib/types/supervisor/storage/private-root.js.map +1 -0
- package/lib/types/supervisor/storage/recovery.d.ts +14 -0
- package/lib/types/supervisor/storage/recovery.d.ts.map +1 -0
- package/lib/types/supervisor/storage/recovery.js +126 -0
- package/lib/types/supervisor/storage/recovery.js.map +1 -0
- package/lib/types/supervisor/storage/run-files.d.ts +67 -0
- package/lib/types/supervisor/storage/run-files.d.ts.map +1 -0
- package/lib/types/supervisor/storage/run-files.js +346 -0
- package/lib/types/supervisor/storage/run-files.js.map +1 -0
- package/lib/types/supervisor/types.d.ts +295 -0
- package/lib/types/supervisor/types.d.ts.map +1 -0
- package/lib/types/supervisor/types.js +3 -0
- package/lib/types/supervisor/types.js.map +1 -0
- package/lib/types/supervisor/value-view.d.ts +19 -0
- package/lib/types/supervisor/value-view.d.ts.map +1 -0
- package/lib/types/supervisor/value-view.js +183 -0
- package/lib/types/supervisor/value-view.js.map +1 -0
- package/lib/types/tool/index.d.ts +86 -0
- package/lib/types/tool/index.d.ts.map +1 -0
- package/lib/types/tool/index.js +810 -0
- package/lib/types/tool/index.js.map +1 -0
- package/lib/types/tool/schema.d.ts +158 -0
- package/lib/types/tool/schema.d.ts.map +1 -0
- package/lib/types/tool/schema.js +137 -0
- package/lib/types/tool/schema.js.map +1 -0
- package/lib/types/types.d.ts +9 -0
- package/lib/types/types.d.ts.map +1 -0
- package/lib/types/types.js +3 -0
- package/lib/types/types.js.map +1 -0
- package/lib/types/user-questions.d.ts +9 -0
- package/lib/types/user-questions.d.ts.map +1 -0
- package/lib/types/user-questions.js +91 -0
- package/lib/types/user-questions.js.map +1 -0
- package/package.json +291 -0
- package/skills/create-workflow/SKILL.md +166 -0
- package/vendor/workflow-engine/LICENSE +21 -0
- package/vendor/workflow-engine/README.md +1 -0
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
import { homedir } from 'node:os';
|
|
2
|
+
import { readFileSync, realpathSync } from 'node:fs';
|
|
3
|
+
import { basename, dirname, join, parse, resolve } from 'node:path';
|
|
4
|
+
import { createRequire } from 'node:module';
|
|
5
|
+
import { pathToFileURL } from 'node:url';
|
|
6
|
+
import { resolveWorkflowPackageConfig, Config, } from './config.js';
|
|
7
|
+
import { WorkflowPackageError, applyInvariant } from './invariant.js';
|
|
8
|
+
import { WorkflowRegistry } from './registry/index.js';
|
|
9
|
+
import { WorkflowDefinitionsRemote } from './registry/remote.js';
|
|
10
|
+
import { WorkflowSupervisor } from './supervisor/index.js';
|
|
11
|
+
import { WorkflowRunsRemote } from './supervisor/remote.js';
|
|
12
|
+
import { openWorkflowStorage } from './supervisor/storage/index.js';
|
|
13
|
+
import { WorkflowRunRecorder } from './run-recorder.js';
|
|
14
|
+
import { apply as applyUserQuestions } from './user-questions.js';
|
|
15
|
+
import { applyCommands, readPackagedSkill, registerTrustedWorkflowSkillSync, } from './commands/index.js';
|
|
16
|
+
import { applyToolShadow } from './tool/index.js';
|
|
17
|
+
import { registerWorkflowRemoteEvents } from './remote-events.js';
|
|
18
|
+
export { Config, resolveWorkflowPackageConfig, WorkflowPackageError, applyInvariant };
|
|
19
|
+
export const name = 'dsh-workflows';
|
|
20
|
+
export const version = '0.1.0-rc.12';
|
|
21
|
+
/** Host services the loader must wait for. Remote events are optional (absent on stock dsh). */
|
|
22
|
+
export const inject = [
|
|
23
|
+
'agents',
|
|
24
|
+
'commands',
|
|
25
|
+
'fs',
|
|
26
|
+
'skills',
|
|
27
|
+
'subagents',
|
|
28
|
+
'userQuestions',
|
|
29
|
+
'workflowEngine',
|
|
30
|
+
];
|
|
31
|
+
/** Exact package compatibility contract mirrored from package.json. */
|
|
32
|
+
export const HOST_COMPATIBILITY = Object.freeze({
|
|
33
|
+
host: '@deepseek-ai/dsh',
|
|
34
|
+
versions: Object.freeze(['0.1.6-alpha.1']),
|
|
35
|
+
evaluator: 'plugin-compat-engine-v1',
|
|
36
|
+
});
|
|
37
|
+
const INCOMPATIBLE_MESSAGE = '@zaalipro/dsh-workflows 0.1.0-rc.12 supports exactly official DeepSeek Harness 0.1.6-alpha.1';
|
|
38
|
+
const require = createRequire(import.meta.url);
|
|
39
|
+
export function isSupportedHostVersion(value) {
|
|
40
|
+
return typeof value === 'string'
|
|
41
|
+
&& HOST_COMPATIBILITY.versions.includes(value);
|
|
42
|
+
}
|
|
43
|
+
/** Both official workflow seams are lockstep release witnesses. */
|
|
44
|
+
export function isSupportedHostVersions(hostVersion, workflowVersion) {
|
|
45
|
+
return isSupportedHostVersion(hostVersion) && isSupportedHostVersion(workflowVersion);
|
|
46
|
+
}
|
|
47
|
+
export function assertSupportedHostVersions(hostVersion, workflowVersion) {
|
|
48
|
+
if (!isSupportedHostVersions(hostVersion, workflowVersion)) {
|
|
49
|
+
throw new WorkflowPackageError(INCOMPATIBLE_MESSAGE, 'WORKFLOW_INCOMPATIBLE_HOST');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function readPackageManifest(path) {
|
|
53
|
+
try {
|
|
54
|
+
const value = JSON.parse(readFileSync(path, 'utf8'));
|
|
55
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
56
|
+
? value
|
|
57
|
+
: undefined;
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function nearestPackage(entrypoint) {
|
|
64
|
+
let directory = dirname(entrypoint);
|
|
65
|
+
const filesystemRoot = parse(directory).root;
|
|
66
|
+
while (true) {
|
|
67
|
+
const manifest = readPackageManifest(join(directory, 'package.json'));
|
|
68
|
+
if (manifest !== undefined)
|
|
69
|
+
return { root: directory, manifest };
|
|
70
|
+
if (directory === filesystemRoot)
|
|
71
|
+
return undefined;
|
|
72
|
+
directory = dirname(directory);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function manifestBinTargets(manifest) {
|
|
76
|
+
if (typeof manifest.bin === 'string')
|
|
77
|
+
return [manifest.bin];
|
|
78
|
+
if (typeof manifest.bin !== 'object' || manifest.bin === null || Array.isArray(manifest.bin))
|
|
79
|
+
return [];
|
|
80
|
+
return Object.values(manifest.bin).filter((value) => typeof value === 'string');
|
|
81
|
+
}
|
|
82
|
+
function isManifestBin(entrypoint, root, manifest) {
|
|
83
|
+
return manifestBinTargets(manifest).some(target => {
|
|
84
|
+
try {
|
|
85
|
+
return realpathSync(resolve(root, target)) === entrypoint;
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Resolve the Host from the executable Node actually launched, not from the
|
|
94
|
+
* plugin's own dependency graph. A real DSH entrypoint is authoritative even
|
|
95
|
+
* when it is unsupported or incomplete; only non-DSH programs (Vitest,
|
|
96
|
+
* embedders, direct imports) may use the package-local fallback below.
|
|
97
|
+
*/
|
|
98
|
+
function executableHostVersions(entrypoint) {
|
|
99
|
+
if (typeof entrypoint !== 'string' || entrypoint.trim().length === 0)
|
|
100
|
+
return { kind: 'programmatic' };
|
|
101
|
+
let realEntrypoint;
|
|
102
|
+
try {
|
|
103
|
+
realEntrypoint = realpathSync(resolve(entrypoint));
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
return /^dsh(?:\.[cm]?js)?$/u.test(basename(entrypoint)) ? { kind: 'dsh' } : { kind: 'programmatic' };
|
|
107
|
+
}
|
|
108
|
+
const owner = nearestPackage(realEntrypoint);
|
|
109
|
+
if (owner?.manifest.name !== HOST_COMPATIBILITY.host) {
|
|
110
|
+
return /^dsh(?:\.[cm]?js)?$/u.test(basename(entrypoint)) ? { kind: 'dsh' } : { kind: 'programmatic' };
|
|
111
|
+
}
|
|
112
|
+
if (!isManifestBin(realEntrypoint, owner.root, owner.manifest))
|
|
113
|
+
return { kind: 'dsh' };
|
|
114
|
+
try {
|
|
115
|
+
const executableRequire = createRequire(pathToFileURL(realEntrypoint));
|
|
116
|
+
const workflowPath = executableRequire.resolve('@deepseek-ai/dsh-workflow/package.json');
|
|
117
|
+
const workflowManifest = readPackageManifest(workflowPath);
|
|
118
|
+
if (workflowManifest?.name !== '@deepseek-ai/dsh-workflow')
|
|
119
|
+
return { kind: 'dsh' };
|
|
120
|
+
return { kind: 'dsh', versions: [owner.manifest.version, workflowManifest.version] };
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
return { kind: 'dsh' };
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function packageLocalHostVersions() {
|
|
127
|
+
try {
|
|
128
|
+
const host = require('@deepseek-ai/dsh/package.json');
|
|
129
|
+
const workflow = require('@deepseek-ai/dsh-workflow/package.json');
|
|
130
|
+
if (host.name !== HOST_COMPATIBILITY.host || workflow.name !== '@deepseek-ai/dsh-workflow')
|
|
131
|
+
return undefined;
|
|
132
|
+
return [host.version, workflow.version];
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/** Exported for executable-identity regression tests and embedders' diagnostics. */
|
|
139
|
+
export function resolveInstalledHostVersions(entrypoint = process.argv[1]) {
|
|
140
|
+
const executable = executableHostVersions(entrypoint);
|
|
141
|
+
return executable.kind === 'dsh' ? executable.versions : packageLocalHostVersions();
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Verify both lockstep workflow packages exposed by the running CLI's module
|
|
145
|
+
* graph. Neither a context marker nor service method guessing can widen the
|
|
146
|
+
* package manifest's exact support window.
|
|
147
|
+
*/
|
|
148
|
+
export function isSupportedStockHost() {
|
|
149
|
+
const versions = resolveInstalledHostVersions();
|
|
150
|
+
return versions !== undefined && isSupportedHostVersions(...versions);
|
|
151
|
+
}
|
|
152
|
+
function isRecord(value) {
|
|
153
|
+
return typeof value === 'object' && value !== null;
|
|
154
|
+
}
|
|
155
|
+
/** Read an optional Cordis property without making a missing service throw. */
|
|
156
|
+
function optionalProperty(target, key) {
|
|
157
|
+
if (!isRecord(target) && typeof target !== 'function')
|
|
158
|
+
return undefined;
|
|
159
|
+
try {
|
|
160
|
+
return target[key];
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
return undefined;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/** True only for the exact official release supported by this artifact. */
|
|
167
|
+
export function isCompatibleHost(_ctx) {
|
|
168
|
+
try {
|
|
169
|
+
assertCompatibleHost();
|
|
170
|
+
return true;
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/** Verify the installed official release before opening plugin storage. */
|
|
177
|
+
export function assertCompatibleHost(_ctx) {
|
|
178
|
+
const versions = resolveInstalledHostVersions();
|
|
179
|
+
if (versions === undefined)
|
|
180
|
+
throw new WorkflowPackageError(INCOMPATIBLE_MESSAGE, 'WORKFLOW_INCOMPATIBLE_HOST');
|
|
181
|
+
assertSupportedHostVersions(...versions);
|
|
182
|
+
}
|
|
183
|
+
function expandHome(value) {
|
|
184
|
+
if (value === '~')
|
|
185
|
+
return homedir();
|
|
186
|
+
if (value.startsWith('~/') || value.startsWith('~\\'))
|
|
187
|
+
return join(homedir(), value.slice(2));
|
|
188
|
+
return value;
|
|
189
|
+
}
|
|
190
|
+
function hostHome(ctx) {
|
|
191
|
+
const candidates = [
|
|
192
|
+
optionalProperty(ctx, 'dshHome'),
|
|
193
|
+
optionalProperty(ctx, 'dshHomePath'),
|
|
194
|
+
optionalProperty(optionalProperty(ctx, 'homePaths'), 'dshHome'),
|
|
195
|
+
optionalProperty(optionalProperty(ctx, 'homePaths'), 'path'),
|
|
196
|
+
];
|
|
197
|
+
for (const candidate of candidates) {
|
|
198
|
+
try {
|
|
199
|
+
const value = typeof candidate === 'function' ? candidate() : candidate;
|
|
200
|
+
if (typeof value === 'string' && value.trim().length > 0)
|
|
201
|
+
return expandHome(value.trim());
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
// Never use an ambient process workspace when a host helper is absent.
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
const fromEnv = process.env.DSH_HOME;
|
|
208
|
+
if (typeof fromEnv === 'string' && fromEnv.trim().length > 0)
|
|
209
|
+
return expandHome(fromEnv.trim());
|
|
210
|
+
return join(homedir(), '.dsh');
|
|
211
|
+
}
|
|
212
|
+
function normalizeInputPaths(input) {
|
|
213
|
+
const result = { ...input };
|
|
214
|
+
if (result.dshHome !== undefined)
|
|
215
|
+
result.dshHome = expandHome(result.dshHome);
|
|
216
|
+
if (result.runsRoot !== undefined)
|
|
217
|
+
result.runsRoot = expandHome(result.runsRoot);
|
|
218
|
+
if (result.bundledDefinitionsDir !== undefined) {
|
|
219
|
+
result.bundledDefinitionsDir = expandHome(result.bundledDefinitionsDir);
|
|
220
|
+
}
|
|
221
|
+
return result;
|
|
222
|
+
}
|
|
223
|
+
function readService(ctx, service) {
|
|
224
|
+
const getter = optionalProperty(ctx, 'get');
|
|
225
|
+
if (typeof getter === 'function') {
|
|
226
|
+
try {
|
|
227
|
+
const value = getter.call(ctx, service);
|
|
228
|
+
if (value !== undefined)
|
|
229
|
+
return value;
|
|
230
|
+
}
|
|
231
|
+
catch {
|
|
232
|
+
// Small plain fixtures do not implement Cordis reflection.
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return optionalProperty(ctx, service);
|
|
236
|
+
}
|
|
237
|
+
function requireService(ctx, service) {
|
|
238
|
+
const value = readService(ctx, service);
|
|
239
|
+
if (value === undefined || value === null) {
|
|
240
|
+
throw new Error(`workflow package requires the Host service "${service}"`);
|
|
241
|
+
}
|
|
242
|
+
return value;
|
|
243
|
+
}
|
|
244
|
+
function requireFunction(value, member, service) {
|
|
245
|
+
if (typeof value !== 'function') {
|
|
246
|
+
throw new Error(`workflow package requires ${service}.${member} from official DeepSeek Harness 0.1.6-alpha.1`);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
function hasRemoteEventRegistry(ctx) {
|
|
250
|
+
const remoteEvents = readService(ctx, 'apiRemoteEvents');
|
|
251
|
+
if (remoteEvents === undefined || remoteEvents === null)
|
|
252
|
+
return false;
|
|
253
|
+
requireFunction(optionalProperty(remoteEvents, 'register'), 'register', 'apiRemoteEvents');
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
256
|
+
/** Required service faces on official dsh 0.1.6-alpha.1. */
|
|
257
|
+
function assertStockFaces(ctx) {
|
|
258
|
+
requireService(ctx, 'agents');
|
|
259
|
+
requireFunction(optionalProperty(requireService(ctx, 'commands'), 'register'), 'register', 'commands');
|
|
260
|
+
requireService(ctx, 'fs');
|
|
261
|
+
const skills = requireService(ctx, 'skills');
|
|
262
|
+
if (typeof optionalProperty(skills, 'registerTrustedPackageSkill') !== 'function'
|
|
263
|
+
&& typeof optionalProperty(skills, 'registerProvider') !== 'function') {
|
|
264
|
+
throw new Error('workflow package requires skills.registerProvider on official DeepSeek Harness 0.1.6-alpha.1');
|
|
265
|
+
}
|
|
266
|
+
const subagents = requireService(ctx, 'subagents');
|
|
267
|
+
requireFunction(optionalProperty(subagents, 'getProvider'), 'getProvider', 'subagents');
|
|
268
|
+
requireFunction(optionalProperty(subagents, 'start'), 'start', 'subagents');
|
|
269
|
+
requireService(ctx, 'userQuestions');
|
|
270
|
+
requireFunction(optionalProperty(requireService(ctx, 'workflowEngine'), 'start'), 'start', 'workflowEngine');
|
|
271
|
+
// Headless may omit the Web Remote lane; a present partial service is a
|
|
272
|
+
// composition error and must fail before storage is opened.
|
|
273
|
+
hasRemoteEventRegistry(ctx);
|
|
274
|
+
if (optionalProperty(ctx, 'provide') === undefined
|
|
275
|
+
&& optionalProperty(optionalProperty(ctx, 'reflect'), 'provide') === undefined) {
|
|
276
|
+
throw new Error('workflow package requires a Cordis service-registration context');
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
function asCleanup(value) {
|
|
280
|
+
if (typeof value === 'function')
|
|
281
|
+
return value;
|
|
282
|
+
if (isRecord(value) && typeof value.dispose === 'function') {
|
|
283
|
+
return () => value.dispose.call(value);
|
|
284
|
+
}
|
|
285
|
+
return undefined;
|
|
286
|
+
}
|
|
287
|
+
function ownEffect(ctx, dispose, label) {
|
|
288
|
+
const effect = optionalProperty(ctx, 'effect');
|
|
289
|
+
if (typeof effect === 'function')
|
|
290
|
+
effect.call(ctx, () => dispose, label);
|
|
291
|
+
}
|
|
292
|
+
async function invokeCleanup(value) {
|
|
293
|
+
const cleanup = asCleanup(value);
|
|
294
|
+
if (cleanup !== undefined)
|
|
295
|
+
await cleanup();
|
|
296
|
+
}
|
|
297
|
+
/** Provide a package-owned service, with a plain-fixture fallback. */
|
|
298
|
+
function provideService(ctx, service, value) {
|
|
299
|
+
const provide = optionalProperty(ctx, 'provide');
|
|
300
|
+
if (typeof provide === 'function') {
|
|
301
|
+
const disposer = provide.call(ctx, service, value);
|
|
302
|
+
return () => invokeCleanup(disposer);
|
|
303
|
+
}
|
|
304
|
+
const hadOwn = Object.prototype.hasOwnProperty.call(ctx, service);
|
|
305
|
+
const previous = optionalProperty(ctx, service);
|
|
306
|
+
ctx[service] = value;
|
|
307
|
+
return async () => {
|
|
308
|
+
if (hadOwn)
|
|
309
|
+
ctx[service] = previous;
|
|
310
|
+
else {
|
|
311
|
+
try {
|
|
312
|
+
delete ctx[service];
|
|
313
|
+
}
|
|
314
|
+
catch {
|
|
315
|
+
ctx[service] = undefined;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
/** Load the private evaluator only on the verified stock host. */
|
|
321
|
+
async function createCompatibilityEngine(ctx, config) {
|
|
322
|
+
const subagents = readService(ctx, 'subagents');
|
|
323
|
+
if (subagents === undefined || typeof optionalProperty(subagents, 'getProvider') !== 'function'
|
|
324
|
+
|| typeof optionalProperty(subagents, 'start') !== 'function') {
|
|
325
|
+
throw new WorkflowPackageError('official DeepSeek Harness 0.1.6-alpha.1 requires the subagents service for plugin workflows', 'WORKFLOW_INCOMPATIBLE_HOST');
|
|
326
|
+
}
|
|
327
|
+
const asset = import.meta.url.endsWith('.ts')
|
|
328
|
+
? new URL('../lib/compat-engine/index.js', import.meta.url)
|
|
329
|
+
: new URL('../compat-engine/index.js', import.meta.url);
|
|
330
|
+
const module = await import(asset.href);
|
|
331
|
+
return new module.default(ctx, {
|
|
332
|
+
provider: 'spawn',
|
|
333
|
+
maxConcurrentAgents: config.maxConcurrentAgents,
|
|
334
|
+
maxTotalAgents: config.maxAgentBudget,
|
|
335
|
+
maxJournalBytes: config.maxJournalBytes,
|
|
336
|
+
maxChildPromptBytes: config.maxPromptBytes,
|
|
337
|
+
maxEventTextBytes: config.maxEventTextBytes,
|
|
338
|
+
scratchMaxOperations: config.scratchMaxOperations,
|
|
339
|
+
scratchMaxPendingOperations: config.scratchMaxPendingOperations,
|
|
340
|
+
scratchMaxFiles: config.scratchMaxFiles,
|
|
341
|
+
scratchMaxFileBytes: config.scratchMaxFileBytes,
|
|
342
|
+
scratchMaxTotalBytes: config.scratchMaxTotalBytes,
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
/** Build an idempotent, supervisor-first/storage-last aggregate disposer. */
|
|
346
|
+
function makeTeardown(resources) {
|
|
347
|
+
let task;
|
|
348
|
+
return () => {
|
|
349
|
+
if (task !== undefined)
|
|
350
|
+
return task;
|
|
351
|
+
task = (async () => {
|
|
352
|
+
let first;
|
|
353
|
+
const attempt = async (operation) => {
|
|
354
|
+
if (operation === undefined)
|
|
355
|
+
return;
|
|
356
|
+
try {
|
|
357
|
+
await operation();
|
|
358
|
+
}
|
|
359
|
+
catch (error) {
|
|
360
|
+
first ??= error;
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
try {
|
|
364
|
+
resources.supervisor?.closeAdmissionSync();
|
|
365
|
+
}
|
|
366
|
+
catch (error) {
|
|
367
|
+
first ??= error;
|
|
368
|
+
}
|
|
369
|
+
await attempt(resources.supervisor === undefined ? undefined : () => resources.supervisor.dispose());
|
|
370
|
+
await attempt(resources.recorder === undefined ? undefined : () => resources.recorder.dispose());
|
|
371
|
+
await attempt(resources.questions);
|
|
372
|
+
await attempt(resources.commands);
|
|
373
|
+
await attempt(resources.tool);
|
|
374
|
+
await attempt(resources.skill);
|
|
375
|
+
await attempt(resources.remoteEvents);
|
|
376
|
+
await attempt(resources.remotes);
|
|
377
|
+
await attempt(resources.recorderService);
|
|
378
|
+
await attempt(resources.supervisorService);
|
|
379
|
+
await attempt(resources.registry === undefined ? undefined : () => resources.registry.dispose());
|
|
380
|
+
await attempt(resources.registryService);
|
|
381
|
+
await attempt(resources.storeService);
|
|
382
|
+
await attempt(resources.storageService);
|
|
383
|
+
// Storage.dispose() closes all private directories and releases the
|
|
384
|
+
// lifetime lease last.
|
|
385
|
+
await attempt(resources.storage === undefined ? undefined : () => resources.storage.dispose());
|
|
386
|
+
if (first !== undefined)
|
|
387
|
+
throw first;
|
|
388
|
+
})();
|
|
389
|
+
return task;
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
/** Compose the complete Host-side workflow product as one lifecycle unit. */
|
|
393
|
+
export async function apply(ctx, input = {}) {
|
|
394
|
+
// Compatibility is checked before config/home inspection and before any
|
|
395
|
+
// plugin storage or package-asset I/O. Disabled is a supported-Host policy,
|
|
396
|
+
// not an escape hatch for loading this artifact on an unsupported release.
|
|
397
|
+
assertCompatibleHost();
|
|
398
|
+
const config = resolveWorkflowPackageConfig(normalizeInputPaths(input), hostHome(ctx));
|
|
399
|
+
if (config.enabled === false)
|
|
400
|
+
return;
|
|
401
|
+
// Preflight faces before the process-global storage lease.
|
|
402
|
+
// The Host never imports ./client here.
|
|
403
|
+
assertStockFaces(ctx);
|
|
404
|
+
await readPackagedSkill();
|
|
405
|
+
const resources = {};
|
|
406
|
+
const teardown = makeTeardown(resources);
|
|
407
|
+
try {
|
|
408
|
+
// Import and construct the package evaluator before opening storage. The
|
|
409
|
+
// supported stock engine is never used for plugin workflow execution.
|
|
410
|
+
resources.compatibilityEngine = await createCompatibilityEngine(ctx, config);
|
|
411
|
+
// Official 0.1.6-alpha.1 exposes fs.openPrivateDirectory(), but its production
|
|
412
|
+
// capability does not include the complete inventory/publication/removal
|
|
413
|
+
// face this retained run store requires. Keep the Host filesystem for
|
|
414
|
+
// workspace definitions and script_path authorization/path normalization;
|
|
415
|
+
// stock RC2 script_path content uses the package's bounded local
|
|
416
|
+
// O_NOFOLLOW compatibility reader. Persistent run storage uses the
|
|
417
|
+
// package-owned local descriptor implementation on this exact Host.
|
|
418
|
+
resources.storage = await openWorkflowStorage(config);
|
|
419
|
+
resources.storageService = provideService(ctx, 'workflowStorage', resources.storage);
|
|
420
|
+
resources.storeService = provideService(ctx, 'workflowStore', resources.storage.store);
|
|
421
|
+
ownEffect(ctx, resources.storageService, 'dsh-workflows: workflowStorage');
|
|
422
|
+
ownEffect(ctx, resources.storeService, 'dsh-workflows: workflowStore');
|
|
423
|
+
resources.registry = new WorkflowRegistry(ctx, config);
|
|
424
|
+
resources.registryService = provideService(ctx, 'workflows', resources.registry);
|
|
425
|
+
ownEffect(ctx, resources.registryService, 'dsh-workflows: registry');
|
|
426
|
+
resources.supervisor = new WorkflowSupervisor(ctx, config, resources.storage.store, resources.compatibilityEngine);
|
|
427
|
+
resources.supervisorService = provideService(ctx, 'workflowSupervisor', resources.supervisor);
|
|
428
|
+
await resources.supervisor.initialize();
|
|
429
|
+
ownEffect(ctx, resources.supervisorService, 'dsh-workflows: supervisor');
|
|
430
|
+
resources.recorder = new WorkflowRunRecorder(ctx);
|
|
431
|
+
resources.recorderService = provideService(ctx, 'workflowRunRecorder', resources.recorder);
|
|
432
|
+
ownEffect(ctx, resources.recorderService, 'dsh-workflows: recorder');
|
|
433
|
+
resources.questions = asCleanup(applyUserQuestions(ctx));
|
|
434
|
+
resources.commands = asCleanup(applyCommands(ctx, { enabled: true, registerSkill: false }));
|
|
435
|
+
ownEffect(ctx, resources.questions, 'dsh-workflows: user-questions');
|
|
436
|
+
ownEffect(ctx, resources.commands, 'dsh-workflows: commands');
|
|
437
|
+
// The helper re-reads the asset to retain the standalone registration API;
|
|
438
|
+
// the pre-read above guarantees missing assets fail before storage.
|
|
439
|
+
resources.skill = asCleanup(registerTrustedWorkflowSkillSync(ctx));
|
|
440
|
+
ownEffect(ctx, resources.skill, 'dsh-workflows: create-workflow skill');
|
|
441
|
+
resources.tool = asCleanup(applyToolShadow(ctx, {
|
|
442
|
+
enabled: true,
|
|
443
|
+
services: { registry: resources.registry, supervisor: resources.supervisor, recorder: resources.recorder },
|
|
444
|
+
}));
|
|
445
|
+
ownEffect(ctx, resources.tool, 'dsh-workflows: tool shadow');
|
|
446
|
+
resources.definitionsRemote = new WorkflowDefinitionsRemote(ctx);
|
|
447
|
+
resources.runsRemote = new WorkflowRunsRemote(ctx);
|
|
448
|
+
resources.remotes = async () => {
|
|
449
|
+
await invokeCleanup(resources.runsRemote);
|
|
450
|
+
await invokeCleanup(resources.definitionsRemote);
|
|
451
|
+
};
|
|
452
|
+
ownEffect(ctx, resources.remotes, 'dsh-workflows: remotes');
|
|
453
|
+
if (hasRemoteEventRegistry(ctx)) {
|
|
454
|
+
resources.remoteEvents = asCleanup(registerWorkflowRemoteEvents(ctx, {
|
|
455
|
+
remoteQueueMaxSessions: config.remoteQueueMaxSessions,
|
|
456
|
+
}));
|
|
457
|
+
ownEffect(ctx, resources.remoteEvents, 'dsh-workflows: remote events');
|
|
458
|
+
}
|
|
459
|
+
try {
|
|
460
|
+
applyInvariant(ctx);
|
|
461
|
+
}
|
|
462
|
+
catch { /* invariants is optional and not injected */ }
|
|
463
|
+
const effect = optionalProperty(ctx, 'effect');
|
|
464
|
+
if (typeof effect === 'function')
|
|
465
|
+
effect.call(ctx, () => teardown, 'dsh-workflows: aggregate teardown');
|
|
466
|
+
}
|
|
467
|
+
catch (error) {
|
|
468
|
+
const done = teardown();
|
|
469
|
+
await Promise.resolve(done).catch(() => undefined);
|
|
470
|
+
await Promise.resolve(teardown()).catch(() => undefined);
|
|
471
|
+
throw error;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
// Loaders may pass the function itself as the Cordis plugin object.
|
|
475
|
+
;
|
|
476
|
+
apply.inject = inject;
|
|
477
|
+
apply.Config = Config;
|
|
478
|
+
export * from './types.js';
|
|
479
|
+
export * from './registry/index.js';
|
|
480
|
+
export { WorkflowSupervisor } from './supervisor/index.js';
|
|
481
|
+
export { WorkflowDefinitionsRemote } from './registry/remote.js';
|
|
482
|
+
export { WorkflowRunsRemote } from './supervisor/remote.js';
|
|
483
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0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yB,EAAE,MAAM,sBAAsB,CAAA;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Package error taxonomy and lifecycle invariant diagnostics. */
|
|
2
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
+
import { HarnessError } from '@deepseek-ai/dsh-llm';
|
|
4
|
+
/** Stable package failure codes exposed across tool, command, and Remote boundaries. */
|
|
5
|
+
export type WorkflowPackageErrorCode = 'WORKFLOW_INCOMPATIBLE_HOST' | 'WORKFLOW_REGISTRY_DISABLED' | 'WORKFLOW_DEFINITION_INVALID' | 'WORKFLOW_STORAGE_OWNED' | 'WORKFLOW_STORAGE_UNSUPPORTED' | 'WORKFLOW_STORAGE_UNSAFE' | 'WORKFLOW_STORAGE_CORRUPT' | 'WORKFLOW_STORAGE_LIMIT' | 'WORKFLOW_RUN_NOT_FOUND' | 'WORKFLOW_RUN_NOT_OWNED' | 'WORKFLOW_INVALID_STATE' | 'WORKFLOW_STALE_REVISION' | 'WORKFLOW_LIMIT' | 'WORKFLOW_CURSOR_INVALID';
|
|
6
|
+
/** Package-owned error retaining Harness's machine-routable error identity. */
|
|
7
|
+
export declare class WorkflowPackageError extends HarnessError {
|
|
8
|
+
readonly code: WorkflowPackageErrorCode;
|
|
9
|
+
constructor(message: string, code: WorkflowPackageErrorCode, options?: ErrorOptions);
|
|
10
|
+
}
|
|
11
|
+
/** Return diagnostics for the package's registry/storage lifecycle invariants. */
|
|
12
|
+
export declare function checkWorkflowRegistryStorageInvariant(state: unknown): readonly string[];
|
|
13
|
+
/**
|
|
14
|
+
* Runtime-invariant companion hook.
|
|
15
|
+
*
|
|
16
|
+
* The package keeps this entrypoint side-effect free when the optional official
|
|
17
|
+
* invariant registry is not part of a profile. Lifecycle ownership checks are
|
|
18
|
+
* enforced by the concrete components and their tests.
|
|
19
|
+
*/
|
|
20
|
+
export declare function applyInvariant(ctx: Context): void;
|
|
21
|
+
//# sourceMappingURL=invariant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invariant.d.ts","sourceRoot":"","sources":["../../src/invariant.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAEnD,wFAAwF;AACxF,MAAM,MAAM,wBAAwB,GAChC,4BAA4B,GAC5B,4BAA4B,GAC5B,6BAA6B,GAC7B,wBAAwB,GACxB,8BAA8B,GAC9B,yBAAyB,GACzB,0BAA0B,GAC1B,wBAAwB,GACxB,wBAAwB,GACxB,wBAAwB,GACxB,wBAAwB,GACxB,yBAAyB,GACzB,gBAAgB,GAChB,yBAAyB,CAAA;AAE7B,+EAA+E;AAC/E,qBAAa,oBAAqB,SAAQ,YAAY;IACpD,SAAiB,IAAI,EAAE,wBAAwB,CAAA;gBAEnC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,wBAAwB,EAAE,OAAO,CAAC,EAAE,YAAY;CAIpF;AAID,kFAAkF;AAClF,wBAAgB,qCAAqC,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAqDvF;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAiBjD"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { HarnessError } from '@deepseek-ai/dsh-llm';
|
|
2
|
+
/** Package-owned error retaining Harness's machine-routable error identity. */
|
|
3
|
+
export class WorkflowPackageError extends HarnessError {
|
|
4
|
+
constructor(message, code, options) {
|
|
5
|
+
super(message, code, options);
|
|
6
|
+
this.name = 'WorkflowPackageError';
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
const TERMINAL_HEAD_STATUSES = new Set(['completed', 'failed', 'cancelled', 'interrupted']);
|
|
10
|
+
/** Return diagnostics for the package's registry/storage lifecycle invariants. */
|
|
11
|
+
export function checkWorkflowRegistryStorageInvariant(state) {
|
|
12
|
+
const value = state;
|
|
13
|
+
const errors = [];
|
|
14
|
+
if (value?.registry?.enabled === false && (value.registry.watchers ?? 0) > 0) {
|
|
15
|
+
errors.push('disabled registry has active watchers');
|
|
16
|
+
}
|
|
17
|
+
if (value?.storage?.recovered === false && value.storage.exposed === true) {
|
|
18
|
+
errors.push('storage is exposed before recovery');
|
|
19
|
+
}
|
|
20
|
+
for (const issue of value?.issues ?? [])
|
|
21
|
+
errors.push(String(issue));
|
|
22
|
+
if (value?.disposed === true && value.storage?.leaseOwned === true) {
|
|
23
|
+
errors.push('disposed storage still owns a lease/descriptor/operation');
|
|
24
|
+
}
|
|
25
|
+
let missingIdentity = false;
|
|
26
|
+
let digestMismatch = false;
|
|
27
|
+
let terminalNone = false;
|
|
28
|
+
for (const head of value?.heads ?? []) {
|
|
29
|
+
if (head.runDirectoryExists === false || head.detailFileExists === false)
|
|
30
|
+
missingIdentity = true;
|
|
31
|
+
if (typeof head.detailSha256 === 'string'
|
|
32
|
+
&& typeof head.fileSha256 === 'string'
|
|
33
|
+
&& head.detailSha256 !== head.fileSha256)
|
|
34
|
+
digestMismatch = true;
|
|
35
|
+
if (typeof head.detailRevision === 'number'
|
|
36
|
+
&& typeof head.fileRevision === 'number'
|
|
37
|
+
&& head.detailRevision !== head.fileRevision)
|
|
38
|
+
digestMismatch = true;
|
|
39
|
+
if (TERMINAL_HEAD_STATUSES.has(String(head.status)) && head.completionNotice?.state === 'none') {
|
|
40
|
+
terminalNone = true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (missingIdentity) {
|
|
44
|
+
errors.push('a manifest references a missing/identity-mismatched run directory or immutable detail file');
|
|
45
|
+
}
|
|
46
|
+
if (digestMismatch)
|
|
47
|
+
errors.push('a detail snapshot/revision/digest disagrees with its head');
|
|
48
|
+
if (terminalNone)
|
|
49
|
+
errors.push("a terminal row has completionNotice.state === 'none'");
|
|
50
|
+
return errors;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Runtime-invariant companion hook.
|
|
54
|
+
*
|
|
55
|
+
* The package keeps this entrypoint side-effect free when the optional official
|
|
56
|
+
* invariant registry is not part of a profile. Lifecycle ownership checks are
|
|
57
|
+
* enforced by the concrete components and their tests.
|
|
58
|
+
*/
|
|
59
|
+
export function applyInvariant(ctx) {
|
|
60
|
+
let invariants;
|
|
61
|
+
try {
|
|
62
|
+
const get = ctx.get;
|
|
63
|
+
if (typeof get === 'function') {
|
|
64
|
+
try {
|
|
65
|
+
invariants = get.call(ctx, 'invariants');
|
|
66
|
+
}
|
|
67
|
+
catch { /* Cordis throws for an uninjected service; fall through. */ }
|
|
68
|
+
}
|
|
69
|
+
if (invariants === undefined) {
|
|
70
|
+
try {
|
|
71
|
+
invariants = ctx.invariants;
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (typeof invariants?.register !== 'function')
|
|
82
|
+
return;
|
|
83
|
+
invariants.register('@zaalipro/dsh-workflows', () => undefined);
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=invariant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invariant.js","sourceRoot":"","sources":["../../src/invariant.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAmBnD,+EAA+E;AAC/E,MAAM,OAAO,oBAAqB,SAAQ,YAAY;IAGpD,YAAY,OAAe,EAAE,IAA8B,EAAE,OAAsB;QACjF,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;QAC7B,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAA;IACpC,CAAC;CACF;AAED,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,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AAM;YAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,OAAM;IACR,CAAC;IACD,IAAI,OAAO,UAAU,EAAE,QAAQ,KAAK,UAAU;QAAE,OAAM;IACtD,UAAU,CAAC,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;AACjE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { WorkflowDefinition, WorkflowDefinitionEnvelope, WorkflowScope } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Parse a byte-bounded, fatal-UTF-8 workflow envelope and verify that its
|
|
4
|
+
* metadata name equals the filename-derived expected name.
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseWorkflowDefinition(bytes: Uint8Array, path: string, scope: WorkflowScope, expectedName: string, maxBytes: number): WorkflowDefinition;
|
|
7
|
+
/**
|
|
8
|
+
* Compatibility parser for already-decoded definition text. Filesystem
|
|
9
|
+
* callers should prefer {@link parseWorkflowDefinition} so the byte cap and
|
|
10
|
+
* fatal UTF-8 decoding occur at the same boundary.
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseDefinitionFile(raw: string, path: string, expectedName: string): Omit<WorkflowDefinition, 'scope'>;
|
|
13
|
+
/** Validate an in-memory envelope and return a normalized detached copy. */
|
|
14
|
+
export declare function validateDefinitionEnvelope(envelope: WorkflowDefinitionEnvelope, source?: string): WorkflowDefinitionEnvelope;
|
|
15
|
+
/**
|
|
16
|
+
* Serialize a revalidated envelope to canonical UTF-8 bytes. Key order is
|
|
17
|
+
* `meta`, then `script`, indentation is two spaces, and exactly one LF follows.
|
|
18
|
+
*/
|
|
19
|
+
export declare function serializeWorkflowDefinition(envelope: WorkflowDefinitionEnvelope): Uint8Array;
|
|
20
|
+
/** Legacy string serializer retained for source compatibility. */
|
|
21
|
+
export declare function serializeDefinition(envelope: WorkflowDefinitionEnvelope): string;
|
|
22
|
+
/** Extract the name candidate from one direct definition entry. */
|
|
23
|
+
export declare function filenameStem(path: string): string;
|
|
24
|
+
//# sourceMappingURL=definition.d.ts.map
|