@gestaltrun/dsh-workspace-bundle 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.i18n.yaml +37 -0
- package/README.md +92 -2
- package/README.zh.md +93 -0
- package/lib/index.js +2868 -0
- package/lib/types/agent-config-contract/agent-configs.d.ts +621 -0
- package/lib/types/agent-config-contract/agent-configs.js +68 -0
- package/lib/types/agent-config-contract/cs-hosting.d.ts +1333 -0
- package/lib/types/agent-config-contract/cs-hosting.js +163 -0
- package/lib/types/agent-config-contract/errors.d.ts +224 -0
- package/lib/types/agent-config-contract/errors.js +202 -0
- package/lib/types/agent-config-contract/ids.d.ts +65 -0
- package/lib/types/agent-config-contract/ids.js +35 -0
- package/lib/types/agent-config-contract/route.d.ts +56 -0
- package/lib/types/agent-config-contract/route.js +1 -0
- package/lib/types/agent-config-contract/test-account-claim.d.ts +24 -0
- package/lib/types/agent-config-contract/test-account-claim.js +5 -0
- package/lib/types/agent-config-format.d.ts +86 -0
- package/lib/types/agent-config-format.js +119 -0
- package/lib/types/agent-config-observation.d.ts +64 -0
- package/lib/types/agent-config-observation.js +448 -0
- package/lib/types/agent-config-source.d.ts +78 -0
- package/lib/types/agent-config-source.js +411 -0
- package/lib/types/agent-config-types.d.ts +67 -0
- package/lib/types/agent-config-types.js +1 -0
- package/lib/types/bundled-agent-config.d.ts +29 -0
- package/lib/types/bundled-agent-config.js +47 -0
- package/lib/types/config.d.ts +34 -0
- package/lib/types/config.js +53 -0
- package/lib/types/definition.d.ts +82 -0
- package/lib/types/definition.js +20 -0
- package/lib/types/digest.d.ts +38 -0
- package/lib/types/digest.js +243 -0
- package/lib/types/errors.d.ts +22 -0
- package/lib/types/errors.js +26 -0
- package/lib/types/filesystem.d.ts +16 -0
- package/lib/types/filesystem.js +64 -0
- package/lib/types/index.d.ts +28 -0
- package/lib/types/index.js +19 -0
- package/lib/types/journal.d.ts +51 -0
- package/lib/types/journal.js +109 -0
- package/lib/types/local-host-identity.d.ts +65 -0
- package/lib/types/local-host-identity.js +87 -0
- package/lib/types/local-host-replacement.d.ts +49 -0
- package/lib/types/local-host-replacement.js +112 -0
- package/lib/types/paths.d.ts +26 -0
- package/lib/types/paths.js +48 -0
- package/lib/types/provider.d.ts +83 -0
- package/lib/types/provider.js +560 -0
- package/lib/types/session-events.d.ts +23 -0
- package/lib/types/session-events.js +14 -0
- package/lib/types/types.d.ts +126 -0
- package/lib/types/types.js +1 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +69 -3
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/** Client-safe types of the WorkspaceBundles seam; importing them loads no Host code. */
|
|
2
|
+
import type { Branded } from '@deepseek-ai/dsh-brand';
|
|
3
|
+
import type { WorkspaceBundleId, WorkspaceBundleKey, WorkspaceId, WorkspaceOrigin } from '@deepseek-ai/dsh-workspace/types';
|
|
4
|
+
import type { BundledAgentConfigReceipt } from './bundled-agent-config.ts';
|
|
5
|
+
export type { WorkspaceBundleId, WorkspaceBundleKey, WorkspaceId, WorkspaceOrigin };
|
|
6
|
+
/** SHA-256 hex digest of one template file. */
|
|
7
|
+
export type WorkspaceTemplateFileDigest = Branded<'WorkspaceTemplateFileDigest'>;
|
|
8
|
+
/** SHA-256 hex digest of the ordered path+file-digest catalog. */
|
|
9
|
+
export type WorkspaceTemplateDigest = Branded<'WorkspaceTemplateDigest'>;
|
|
10
|
+
/** One file listed in a template manifest. */
|
|
11
|
+
export interface WorkspaceTemplateFile {
|
|
12
|
+
readonly path: string;
|
|
13
|
+
readonly bytes: number;
|
|
14
|
+
readonly digest: WorkspaceTemplateFileDigest;
|
|
15
|
+
}
|
|
16
|
+
/** Repository and commit of the packaged customer-service instruction files. */
|
|
17
|
+
export interface WorkspaceTemplateSource {
|
|
18
|
+
readonly repository: string;
|
|
19
|
+
readonly commit: string;
|
|
20
|
+
}
|
|
21
|
+
/** Verified catalog of a packaged Workspace template. */
|
|
22
|
+
export interface WorkspaceTemplateManifest {
|
|
23
|
+
readonly formatVersion: 1;
|
|
24
|
+
readonly pluginVersion: string;
|
|
25
|
+
readonly source?: WorkspaceTemplateSource;
|
|
26
|
+
readonly files: readonly WorkspaceTemplateFile[];
|
|
27
|
+
readonly digest: WorkspaceTemplateDigest;
|
|
28
|
+
}
|
|
29
|
+
/** A registered template the Host can materialize. */
|
|
30
|
+
export interface WorkspaceTemplate {
|
|
31
|
+
readonly bundleId: WorkspaceBundleId;
|
|
32
|
+
readonly workspaceKey: WorkspaceBundleKey;
|
|
33
|
+
readonly title: string;
|
|
34
|
+
readonly sourceRoot: string;
|
|
35
|
+
readonly manifest: WorkspaceTemplateManifest;
|
|
36
|
+
/** Published gzip digest for downloaded or bundled content; absent for repository templates. */
|
|
37
|
+
readonly agentConfigSha256?: string;
|
|
38
|
+
/** Publication receipt adjacent to a shipped template, outside its file catalog. */
|
|
39
|
+
readonly agentConfigReceipt?: BundledAgentConfigReceipt;
|
|
40
|
+
}
|
|
41
|
+
/** Deployment settings the Provider resolves once at load. */
|
|
42
|
+
export interface WorkspaceBundlesSpec {
|
|
43
|
+
/** Parent of each `{bundleId}/{workspaceKey}` Workspace root. */
|
|
44
|
+
readonly materializeRoot: string;
|
|
45
|
+
/** Parent of the immutable template copies used when the package source is gone. */
|
|
46
|
+
readonly templateCacheRoot: string;
|
|
47
|
+
/** Parent of per-Workspace journal files. */
|
|
48
|
+
readonly journalRoot: string;
|
|
49
|
+
/** How long upgrade waits for acquired leases to drain, in milliseconds. */
|
|
50
|
+
readonly quiesceTimeoutMs: number;
|
|
51
|
+
/** How long a successful upgrade waits before deleting the backup, in milliseconds. */
|
|
52
|
+
readonly recycleTimeoutMs: number;
|
|
53
|
+
/** 内容分配查询间隔,单位毫秒。 */
|
|
54
|
+
readonly agentConfigPollIntervalMs: number;
|
|
55
|
+
/** 每次查询和下载共享的超时,单位毫秒。 */
|
|
56
|
+
readonly agentConfigRequestTimeoutMs: number;
|
|
57
|
+
/** 压缩Agent 配置字节上限。 */
|
|
58
|
+
readonly agentConfigMaxDownloadBytes: number;
|
|
59
|
+
/** 解压 JSON 和文件总字节上限。 */
|
|
60
|
+
readonly agentConfigMaxExpandedBytes: number;
|
|
61
|
+
/** 仅允许显式配置的本地测试文件服务使用 HTTP。 */
|
|
62
|
+
readonly allowLoopbackAgentConfigHttp: boolean;
|
|
63
|
+
}
|
|
64
|
+
/** Named configuration failure. */
|
|
65
|
+
export type WorkspaceBundlesConfigErrorCode = 'WORKSPACE_BUNDLES_MATERIALIZE_ROOT_MISSING' | 'WORKSPACE_BUNDLES_TEMPLATE_CACHE_ROOT_MISSING' | 'WORKSPACE_BUNDLES_JOURNAL_ROOT_MISSING' | 'WORKSPACE_BUNDLES_PATH_INVALID' | 'WORKSPACE_BUNDLES_TIMEOUT_INVALID';
|
|
66
|
+
/** Named runtime failure of template access, materialize, or upgrade. */
|
|
67
|
+
export type WorkspaceBundleErrorCode = 'WORKSPACE_BUNDLE_NOT_REGISTERED' | 'WORKSPACE_BUNDLE_TEMPLATE_INVALID' | 'WORKSPACE_BUNDLE_PATH_TRAVERSAL' | 'WORKSPACE_BUNDLE_SYMLINK_REJECTED' | 'WORKSPACE_BUNDLE_MISSING_ASSET' | 'WORKSPACE_BUNDLE_DIGEST_MISMATCH' | 'WORKSPACE_BUNDLE_QUIESCE_TIMEOUT' | 'WORKSPACE_BUNDLE_CRASH_INJECTED' | 'WORKSPACE_BUNDLE_IDENTITY_INVALID';
|
|
68
|
+
/** Observable upgrade barrier: consumers must not read a half-replaced tree. */
|
|
69
|
+
export type WorkspaceBundleBarrier = 'open' | 'updating';
|
|
70
|
+
/** Durable upgrade journal. `updating` means consumers are barred. */
|
|
71
|
+
export interface WorkspaceBundleJournal {
|
|
72
|
+
readonly phase: 'idle' | 'updating';
|
|
73
|
+
readonly fromDigest: WorkspaceTemplateDigest | null;
|
|
74
|
+
readonly toDigest: WorkspaceTemplateDigest | null;
|
|
75
|
+
readonly pluginVersion: string | null;
|
|
76
|
+
readonly stagingPath: string | null;
|
|
77
|
+
readonly backupPath: string | null;
|
|
78
|
+
readonly swapComplete: boolean;
|
|
79
|
+
/** 新Agent 配置身份;旧 journal 没有此字段。 */
|
|
80
|
+
readonly agentConfigSha256?: string | null;
|
|
81
|
+
}
|
|
82
|
+
/** Durable product record for one bundled Workspace. */
|
|
83
|
+
export interface WorkspaceBundleRecord {
|
|
84
|
+
readonly version: 1;
|
|
85
|
+
readonly bundleId: WorkspaceBundleId;
|
|
86
|
+
readonly workspaceKey: WorkspaceBundleKey;
|
|
87
|
+
readonly workspaceId: WorkspaceId | null;
|
|
88
|
+
readonly path: string;
|
|
89
|
+
readonly pluginVersion: string;
|
|
90
|
+
readonly templateDigest: WorkspaceTemplateDigest;
|
|
91
|
+
/** 已提交Agent 配置身份;旧 record 缺失时表示内置模板。 */
|
|
92
|
+
readonly agentConfigSha256?: string | null;
|
|
93
|
+
readonly registered: boolean;
|
|
94
|
+
readonly journal: WorkspaceBundleJournal;
|
|
95
|
+
readonly lastFailure: {
|
|
96
|
+
readonly code: WorkspaceBundleErrorCode;
|
|
97
|
+
readonly message: string;
|
|
98
|
+
readonly at: string;
|
|
99
|
+
} | null;
|
|
100
|
+
}
|
|
101
|
+
/** Points where tests inject a crash; production never sets them. */
|
|
102
|
+
export type WorkspaceBundleCrashPoint = 'after-staging' | 'after-journal-updating' | 'after-quiesce' | 'after-rename-backup' | 'after-rename-staging' | 'after-verify' | 'after-journal-commit';
|
|
103
|
+
/** Filesystem operations the materializer uses so tests can inject crashes. */
|
|
104
|
+
export interface WorkspaceBundleFs {
|
|
105
|
+
mkdir(path: string): Promise<void>;
|
|
106
|
+
writeFile(path: string, data: Uint8Array | string): Promise<void>;
|
|
107
|
+
readFile(path: string): Promise<Buffer>;
|
|
108
|
+
rename(from: string, to: string): Promise<void>;
|
|
109
|
+
rm(path: string, options?: {
|
|
110
|
+
recursive?: boolean;
|
|
111
|
+
}): Promise<void>;
|
|
112
|
+
lstat(path: string): Promise<{
|
|
113
|
+
isFile(): boolean;
|
|
114
|
+
isDirectory(): boolean;
|
|
115
|
+
isSymbolicLink(): boolean;
|
|
116
|
+
}>;
|
|
117
|
+
readdir(path: string): Promise<readonly string[]>;
|
|
118
|
+
realpath(path: string): Promise<string>;
|
|
119
|
+
copyFile(from: string, to: string): Promise<void>;
|
|
120
|
+
exists(path: string): Promise<boolean>;
|
|
121
|
+
}
|
|
122
|
+
/** Identity of one bundled Workspace. */
|
|
123
|
+
export interface WorkspaceBundleIdentity {
|
|
124
|
+
readonly bundleId: WorkspaceBundleId;
|
|
125
|
+
readonly workspaceKey: WorkspaceBundleKey;
|
|
126
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,72 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gestaltrun/dsh-workspace-bundle",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "WorkspaceBundles Service Definition and Provider: packaged templates, stable hidden Workspaces, and whole-tree upgrades",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"types": "lib/types/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib/types/index.d.ts",
|
|
11
|
+
"default": "./lib/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./types": {
|
|
14
|
+
"types": "./lib/types/types.d.ts",
|
|
15
|
+
"default": "./lib/types/types.js"
|
|
16
|
+
},
|
|
17
|
+
"./package.json": "./package.json",
|
|
18
|
+
"./locale/*.json": "./locale/*.json"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"lib/index.js",
|
|
22
|
+
"lib/types/**/*.js",
|
|
23
|
+
"lib/types/**/*.d.ts",
|
|
24
|
+
"locale/*.json",
|
|
25
|
+
"README.md",
|
|
26
|
+
"README.zh.md",
|
|
27
|
+
"LICENSE"
|
|
28
|
+
],
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/gestaltrun/deepseek-harness.git",
|
|
33
|
+
"directory": "product/workspace-bundle"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public",
|
|
37
|
+
"registry": "https://registry.npmjs.org/",
|
|
38
|
+
"tag": "candidate"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@deepseek-ai/cordis": "4.0.6-alpha.1",
|
|
42
|
+
"@deepseek-ai/dsh-brand": "0.2.2-alpha.2",
|
|
43
|
+
"@deepseek-ai/dsh-workspace": "0.2.2-alpha.2",
|
|
44
|
+
"@deepseek-ai/schemastery": "3.18.6-alpha.1",
|
|
45
|
+
"@deepseek-ai/dsh-session": "0.2.2-alpha.2",
|
|
46
|
+
"@deepseek-ai/dsh-atomic-write": "0.2.2-alpha.2",
|
|
47
|
+
"@gestaltrun/dsh-merchant-account": ">=0.1.0-gestaltrun.0"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@deepseek-ai/cordis": "4.0.6-alpha.1",
|
|
51
|
+
"@deepseek-ai/dsh-brand": "0.2.2-alpha.2",
|
|
52
|
+
"@deepseek-ai/dsh-workspace": "0.2.2-alpha.2",
|
|
53
|
+
"@deepseek-ai/schemastery": "3.18.6-alpha.1",
|
|
54
|
+
"@types/node": "22.20.0",
|
|
55
|
+
"typescript": "6.0.3",
|
|
56
|
+
"tsdown": "0.22.2",
|
|
57
|
+
"vitest": "4.1.8",
|
|
58
|
+
"@deepseek-ai/dsh-session": "0.2.2-alpha.2",
|
|
59
|
+
"@types/semver": "7.7.1",
|
|
60
|
+
"@deepseek-ai/dsh-atomic-write": "0.2.2-alpha.2",
|
|
61
|
+
"@gestaltrun/dsh-merchant-account": "0.1.5"
|
|
62
|
+
},
|
|
63
|
+
"dependencies": {
|
|
64
|
+
"semver": "7.8.5",
|
|
65
|
+
"zod": "4.4.3"
|
|
66
|
+
},
|
|
67
|
+
"scripts": {
|
|
68
|
+
"build": "tsc -p tsconfig.build.host.json && tsdown --config tsdown.host.config.ts",
|
|
69
|
+
"typecheck": "tsc -p tsconfig.host.json --noEmit && tsc -p tsconfig.test.host.json --noEmit",
|
|
70
|
+
"test": "vitest run && node --test tests/*.test.mjs"
|
|
71
|
+
}
|
|
6
72
|
}
|