@huaweidevtools/aishell-dsh-deploy 0.0.0-stage → 0.0.1-beta.3
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 +201 -0
- package/README.md +164 -2
- package/cordis.patch.yml +15 -0
- package/lib/data/permission-registry.json +1 -0
- package/lib/data/terraform-examples.zip +0 -0
- package/lib/index.js +4796 -0
- package/lib/types/auth-http.d.ts +44 -0
- package/lib/types/auth-obs-signer.d.ts +46 -0
- package/lib/types/auth-signer.d.ts +46 -0
- package/lib/types/bridge.d.ts +70 -0
- package/lib/types/credentials.d.ts +105 -0
- package/lib/types/data-paths.d.ts +70 -0
- package/lib/types/deployment-state.d.ts +69 -0
- package/lib/types/gates/cost_gate.d.ts +24 -0
- package/lib/types/gates/credential_gate.d.ts +21 -0
- package/lib/types/gates/mirror.d.ts +27 -0
- package/lib/types/gates/networking_gate.d.ts +9 -0
- package/lib/types/gates/terraform_env.d.ts +26 -0
- package/lib/types/index.d.ts +96 -0
- package/lib/types/permission/gate.d.ts +87 -0
- package/lib/types/permission/mode.d.ts +69 -0
- package/lib/types/permission/registry.d.ts +109 -0
- package/lib/types/permission-context.d.ts +84 -0
- package/lib/types/permission-route.d.ts +78 -0
- package/lib/types/permission.d.ts +37 -0
- package/lib/types/prompt.d.ts +59 -0
- package/lib/types/schemas/cost.d.ts +108 -0
- package/lib/types/schemas/networking.d.ts +115 -0
- package/lib/types/security-groups.d.ts +43 -0
- package/lib/types/tools/annotations.d.ts +94 -0
- package/lib/types/tools/balance_summary.d.ts +69 -0
- package/lib/types/tools/cost.d.ts +16 -0
- package/lib/types/tools/deployment.d.ts +14 -0
- package/lib/types/tools/errors.d.ts +40 -0
- package/lib/types/tools/examples.d.ts +4 -0
- package/lib/types/tools/existing_resources.d.ts +29 -0
- package/lib/types/tools/index.d.ts +32 -0
- package/lib/types/tools/networking.d.ts +13 -0
- package/lib/types/tools/openapi.d.ts +113 -0
- package/lib/types/tools/provider_schema.d.ts +19 -0
- package/lib/types/tools/terraform.d.ts +32 -0
- package/lib/types/types.d.ts +84 -0
- package/lib/types/utils/hash.d.ts +11 -0
- package/lib/types/utils/tar.d.ts +29 -0
- package/lib/types/version.d.ts +18 -0
- package/package.json +59 -3
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The contract between the tool handlers and the harness adapter.
|
|
3
|
+
*
|
|
4
|
+
* ## What this file is
|
|
5
|
+
*
|
|
6
|
+
* Every tool in `tools/` returns a text result — `{ content, isError? }` — and
|
|
7
|
+
* takes one context object. That is the shape they are written against, and it
|
|
8
|
+
* is a good one: success and failure are explicit, and every diagnostic is
|
|
9
|
+
* somewhere the model reads.
|
|
10
|
+
*
|
|
11
|
+
* Flattening all of them into DSH's canonical-value form would be a mechanical
|
|
12
|
+
* edit across every file, and a mechanical edit is where a misplaced return
|
|
13
|
+
* hides until a tool runs. So the shape stays, and `bridge.ts` is the single
|
|
14
|
+
* place that translates it.
|
|
15
|
+
*
|
|
16
|
+
* ## Why everything is declared here
|
|
17
|
+
*
|
|
18
|
+
* These are local types, not imports from any protocol package: this plugin has
|
|
19
|
+
* no transport. `ToolRegistrar` is the one seam the tool modules depend on, and
|
|
20
|
+
* it is exactly what `bridge.ts` implements — a name, a declaration, a handler.
|
|
21
|
+
*
|
|
22
|
+
* The declarations are deliberately the *subset* the handlers use. Anything a
|
|
23
|
+
* handler needs that is not here fails to compile, which is what makes this
|
|
24
|
+
* boundary trustworthy rather than merely convenient.
|
|
25
|
+
*
|
|
26
|
+
* @module @huaweidevtools/aishell-dsh-deploy/types
|
|
27
|
+
*/
|
|
28
|
+
/** One text block of a tool result. */
|
|
29
|
+
export interface TextContent {
|
|
30
|
+
readonly type: 'text';
|
|
31
|
+
readonly text: string;
|
|
32
|
+
}
|
|
33
|
+
/** Any content block a handler may produce. */
|
|
34
|
+
export type ContentBlock = TextContent;
|
|
35
|
+
/** A completed tool call, success or failure. */
|
|
36
|
+
export interface CallToolResult {
|
|
37
|
+
readonly content: ContentBlock[];
|
|
38
|
+
/** Absent means success; `true` means the text is a diagnostic. */
|
|
39
|
+
readonly isError?: boolean;
|
|
40
|
+
readonly structuredContent?: Record<string, unknown>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Per-call context handed to a handler.
|
|
44
|
+
*
|
|
45
|
+
* Empty. It exists so a handler that later needs the caller's session or signal
|
|
46
|
+
* has one obvious place to take it from, rather than reaching into the harness
|
|
47
|
+
* from a tool module.
|
|
48
|
+
*/
|
|
49
|
+
export interface ToolContext {
|
|
50
|
+
}
|
|
51
|
+
/** The context type the tool modules name. */
|
|
52
|
+
export type ToolCtx = ToolContext;
|
|
53
|
+
/**
|
|
54
|
+
* What a tool declares when it registers.
|
|
55
|
+
*
|
|
56
|
+
* `annotations` is carried for the tools' own documentation; the harness has no
|
|
57
|
+
* equivalent field, so `bridge.ts` does not forward it.
|
|
58
|
+
*/
|
|
59
|
+
export interface ToolRegistrationConfig {
|
|
60
|
+
readonly title?: string;
|
|
61
|
+
readonly description?: string;
|
|
62
|
+
readonly annotations?: ToolAnnotations;
|
|
63
|
+
readonly inputSchema: unknown;
|
|
64
|
+
}
|
|
65
|
+
/** Risk hints a tool may declare about itself. */
|
|
66
|
+
export interface ToolAnnotations {
|
|
67
|
+
readonly title?: string;
|
|
68
|
+
readonly readOnlyHint?: boolean;
|
|
69
|
+
readonly destructiveHint?: boolean;
|
|
70
|
+
readonly idempotentHint?: boolean;
|
|
71
|
+
readonly openWorldHint?: boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The registration surface the tool modules use.
|
|
75
|
+
*
|
|
76
|
+
* Implemented by `bridge.ts`. The handler's argument is `any` rather than
|
|
77
|
+
* `unknown` because each registrar passes a handler typed to its own
|
|
78
|
+
* zod-inferred shape; a stricter signature would force a cast at all 17
|
|
79
|
+
* registration sites.
|
|
80
|
+
*/
|
|
81
|
+
export interface ToolRegistrar {
|
|
82
|
+
registerTool(name: string, config: ToolRegistrationConfig, handler: (args: any, ctx: ToolContext) => Promise<CallToolResult>): unknown;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SHA-256 hash of all .tf files in a deployment dir (§4.3 tf_hash).
|
|
3
|
+
*
|
|
4
|
+
* Deterministic: files sorted by name, content hashed, concatenated.
|
|
5
|
+
* "sha256:" + SHA256(filename1 + hash1 + filename2 + hash2 + ...)
|
|
6
|
+
*
|
|
7
|
+
* This is the "cost.json.tf_hash" — written by the cost gate after a
|
|
8
|
+
* successful apply, verified on subsequent applies.
|
|
9
|
+
*/
|
|
10
|
+
export declare function computeTfHash(dir: string): Promise<string>;
|
|
11
|
+
//# sourceMappingURL=hash.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zip archive extraction (terraform binary download + terraform examples).
|
|
3
|
+
*
|
|
4
|
+
* Uses adm-zip (pure JS, no native compilation) — chosen because:
|
|
5
|
+
* - terraform binary releases are zip-only.
|
|
6
|
+
* - terraform examples are bundled as zip to share one extraction path
|
|
7
|
+
* with the binary download (API definitions are NOT bundled — queried
|
|
8
|
+
* dynamically via the apiexplorer tool).
|
|
9
|
+
* - No system `unzip` dependency (sandboxes may lack it; Windows has none).
|
|
10
|
+
*
|
|
11
|
+
* 27MB terraform binary loads into memory — acceptable for a one-time install.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Extract a zip archive to a destination directory.
|
|
15
|
+
*
|
|
16
|
+
* NOTE: adm-zip's extractAllTo does NOT preserve unix exec permission bits —
|
|
17
|
+
* extracted files are mode 0666. Callers that need an executable binary (e.g.
|
|
18
|
+
* terraform_install's downloadAndExtract) must chmod it themselves after
|
|
19
|
+
* extraction. This is documented rather than fixed here because not every
|
|
20
|
+
* caller needs exec (data-asset zips don't), and a blanket chmod-all would
|
|
21
|
+
* be wrong for archives mixing executable and non-executable files.
|
|
22
|
+
*
|
|
23
|
+
* @returns the number of files extracted.
|
|
24
|
+
* @throws on read/extract failure (corrupt zip, disk full, permission).
|
|
25
|
+
*/
|
|
26
|
+
export declare function extractArchive(archivePath: string, dest: string): Promise<{
|
|
27
|
+
files: number;
|
|
28
|
+
}>;
|
|
29
|
+
//# sourceMappingURL=tar.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The version recorded in a deployment's `.deployment.json`.
|
|
3
|
+
*
|
|
4
|
+
* A deployment snapshot names the code that wrote it, so an old workspace can
|
|
5
|
+
* be traced to the path that produced it. This plugin's version is the honest
|
|
6
|
+
* value: there is no separate build to name.
|
|
7
|
+
*
|
|
8
|
+
* @module @huaweidevtools/aishell-dsh-deploy/version
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* What a snapshot records as `server_version`.
|
|
12
|
+
*
|
|
13
|
+
* The field name is fixed by `.deployment.json`'s published shape — workspaces
|
|
14
|
+
* written by earlier releases carry it — so it is kept even though there is no
|
|
15
|
+
* server.
|
|
16
|
+
*/
|
|
17
|
+
export declare const SERVER_VERSION = "aishell-deploy 0.1.0";
|
|
18
|
+
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huaweidevtools/aishell-dsh-deploy",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"description": "Huawei Cloud infrastructure tools for DSH — Terraform, OpenAPI, resource inventory, cost estimates",
|
|
4
|
+
"version": "0.0.1-beta.3",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/yusheng-g/aishell-dsh-plugins.git",
|
|
11
|
+
"directory": "packages/aishell-deploy"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "lib/index.js",
|
|
15
|
+
"types": "lib/types/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"default": "./lib/index.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"lib/index.js",
|
|
24
|
+
"lib/data/**/*",
|
|
25
|
+
"lib/types/**/*.d.ts",
|
|
26
|
+
"cordis.patch.yml"
|
|
27
|
+
],
|
|
28
|
+
"license": "Apache-2.0",
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"adm-zip": "^0.6.1",
|
|
31
|
+
"jsonpath-plus": "^10.4.0",
|
|
32
|
+
"zod": "^4.2.0",
|
|
33
|
+
"@huaweidevtools/aishell-dsh-credentials-store": "0.0.1-beta.3"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@deepseek-ai/cordis": "^4.0.4",
|
|
37
|
+
"@deepseek-ai/dsh-client-connection": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1",
|
|
38
|
+
"@deepseek-ai/dsh-llm": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1",
|
|
39
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1",
|
|
40
|
+
"@deepseek-ai/dsh-tools": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@deepseek-ai/cordis": "^4.0.4",
|
|
44
|
+
"@deepseek-ai/cordis-plugin-loader": "^1.0.5",
|
|
45
|
+
"@deepseek-ai/dsh-client-connection": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1",
|
|
46
|
+
"@deepseek-ai/dsh-llm": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1",
|
|
47
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1",
|
|
48
|
+
"@deepseek-ai/dsh-tools": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1",
|
|
49
|
+
"@deepseek-ai/schemastery": "3.18.4",
|
|
50
|
+
"tsdown": "^0.10.0",
|
|
51
|
+
"typescript": "^5.7.0",
|
|
52
|
+
"zod": "^4.2.0"
|
|
53
|
+
},
|
|
54
|
+
"dsh": {
|
|
55
|
+
"bundle": {
|
|
56
|
+
"patch": "./cordis.patch.yml"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build:bundle": "tsdown && node ../../scripts/build-deploy-data.mjs"
|
|
61
|
+
}
|
|
6
62
|
}
|