@harperfast/harper 5.2.0-alpha.4 → 5.2.0-alpha.6
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/agent/agent.ts +152 -10
- package/agent/bestPractices.ts +58 -0
- package/agent/mcpTools.ts +122 -0
- package/agent/operations.ts +10 -1
- package/agent/registryTools.ts +117 -0
- package/agent/session.ts +16 -7
- package/agent/tools/fsTools.ts +74 -27
- package/agent/tools/inspectorTool.ts +459 -0
- package/agent/toolset.ts +27 -7
- package/agent/types.ts +2 -0
- package/components/Application.ts +566 -85
- package/components/OptionsWatcher.ts +62 -2
- package/components/Scope.ts +31 -8
- package/components/componentLoader.ts +5 -1
- package/components/componentSecrets.ts +514 -55
- package/components/deploymentRecorder.ts +7 -6
- package/components/gitCredentialHelper.js +115 -0
- package/components/gitCredentialServer.ts +251 -0
- package/components/mcp/tools/application.ts +197 -23
- package/components/mcp/tools/operations.ts +1 -1
- package/components/mcp/tools/schemas/derive.ts +6 -2
- package/components/operations.js +21 -19
- package/components/operationsValidation.js +86 -21
- package/components/secretOperations.ts +110 -30
- package/config/harperConfigEnvVars.ts +90 -5
- package/config-root.schema.json +4 -0
- package/dist/agent/agent.d.ts +24 -3
- package/dist/agent/agent.js +172 -10
- package/dist/agent/agent.js.map +1 -1
- package/dist/agent/bestPractices.d.ts +24 -0
- package/dist/agent/bestPractices.js +60 -0
- package/dist/agent/bestPractices.js.map +1 -0
- package/dist/agent/mcpTools.d.ts +24 -0
- package/dist/agent/mcpTools.js +115 -0
- package/dist/agent/mcpTools.js.map +1 -0
- package/dist/agent/operations.js +10 -1
- package/dist/agent/operations.js.map +1 -1
- package/dist/agent/registryTools.d.ts +45 -0
- package/dist/agent/registryTools.js +113 -0
- package/dist/agent/registryTools.js.map +1 -0
- package/dist/agent/session.js +16 -7
- package/dist/agent/session.js.map +1 -1
- package/dist/agent/tools/fsTools.js +70 -28
- package/dist/agent/tools/fsTools.js.map +1 -1
- package/dist/agent/tools/inspectorTool.d.ts +40 -0
- package/dist/agent/tools/inspectorTool.js +428 -0
- package/dist/agent/tools/inspectorTool.js.map +1 -0
- package/dist/agent/toolset.d.ts +16 -6
- package/dist/agent/toolset.js +17 -7
- package/dist/agent/toolset.js.map +1 -1
- package/dist/agent/types.d.ts +2 -0
- package/dist/components/Application.d.ts +73 -18
- package/dist/components/Application.js +475 -64
- package/dist/components/Application.js.map +1 -1
- package/dist/components/OptionsWatcher.d.ts +1 -1
- package/dist/components/OptionsWatcher.js +65 -2
- package/dist/components/OptionsWatcher.js.map +1 -1
- package/dist/components/Scope.d.ts +8 -6
- package/dist/components/Scope.js +22 -6
- package/dist/components/Scope.js.map +1 -1
- package/dist/components/componentLoader.js +5 -1
- package/dist/components/componentLoader.js.map +1 -1
- package/dist/components/componentSecrets.d.ts +33 -7
- package/dist/components/componentSecrets.js +473 -59
- package/dist/components/componentSecrets.js.map +1 -1
- package/dist/components/deploymentRecorder.d.ts +2 -2
- package/dist/components/deploymentRecorder.js +1 -1
- package/dist/components/deploymentRecorder.js.map +1 -1
- package/dist/components/gitCredentialHelper.d.ts +1 -0
- package/dist/components/gitCredentialHelper.js +113 -0
- package/dist/components/gitCredentialHelper.js.map +1 -0
- package/dist/components/gitCredentialServer.d.ts +33 -0
- package/dist/components/gitCredentialServer.js +236 -0
- package/dist/components/gitCredentialServer.js.map +1 -0
- package/dist/components/mcp/tools/application.d.ts +19 -0
- package/dist/components/mcp/tools/application.js +180 -22
- package/dist/components/mcp/tools/application.js.map +1 -1
- package/dist/components/mcp/tools/operations.d.ts +13 -0
- package/dist/components/mcp/tools/operations.js +1 -0
- package/dist/components/mcp/tools/operations.js.map +1 -1
- package/dist/components/mcp/tools/schemas/derive.js +6 -2
- package/dist/components/mcp/tools/schemas/derive.js.map +1 -1
- package/dist/components/operations.js +23 -21
- package/dist/components/operations.js.map +1 -1
- package/dist/components/operationsValidation.js +84 -21
- package/dist/components/operationsValidation.js.map +1 -1
- package/dist/components/secretOperations.d.ts +33 -11
- package/dist/components/secretOperations.js +90 -26
- package/dist/components/secretOperations.js.map +1 -1
- package/dist/config/harperConfigEnvVars.d.ts +21 -0
- package/dist/config/harperConfigEnvVars.js +95 -5
- package/dist/config/harperConfigEnvVars.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/dist/resources/Resource.d.ts +19 -0
- package/dist/resources/Resource.js +93 -2
- package/dist/resources/Resource.js.map +1 -1
- package/dist/resources/Table.d.ts +9 -0
- package/dist/resources/Table.js +256 -50
- package/dist/resources/Table.js.map +1 -1
- package/dist/resources/analytics/read.js +28 -25
- package/dist/resources/analytics/read.js.map +1 -1
- package/dist/resources/defineResource.d.ts +180 -0
- package/dist/resources/defineResource.js +505 -0
- package/dist/resources/defineResource.js.map +1 -0
- package/dist/resources/defineTable.d.ts +221 -0
- package/dist/resources/defineTable.js +227 -0
- package/dist/resources/defineTable.js.map +1 -0
- package/dist/resources/jsonSchemaTypes.d.ts +2 -0
- package/dist/resources/jsonSchemaTypes.js +12 -4
- package/dist/resources/jsonSchemaTypes.js.map +1 -1
- package/dist/resources/openApi.js +69 -13
- package/dist/resources/openApi.js.map +1 -1
- package/dist/resources/search.js +6 -8
- package/dist/resources/search.js.map +1 -1
- package/dist/server/graphqlQuerying.js +4 -2
- package/dist/server/graphqlQuerying.js.map +1 -1
- package/dist/server/http.d.ts +12 -0
- package/dist/server/http.js +35 -15
- package/dist/server/http.js.map +1 -1
- package/dist/server/serverHelpers/serverUtilities.js +8 -5
- package/dist/server/serverHelpers/serverUtilities.js.map +1 -1
- package/dist/server/serverHelpers/uwsServer.js +23 -0
- package/dist/server/serverHelpers/uwsServer.js.map +1 -1
- package/dist/utility/errors/hdbError.d.ts +21 -0
- package/dist/utility/errors/hdbError.js +23 -1
- package/dist/utility/errors/hdbError.js.map +1 -1
- package/dist/validation/configValidator.js +22 -6
- package/dist/validation/configValidator.js.map +1 -1
- package/index.ts +33 -0
- package/npm-shrinkwrap.json +9197 -15236
- package/package.json +5 -3
- package/resources/DESIGN.md +42 -15
- package/resources/Resource.ts +99 -2
- package/resources/Table.ts +275 -71
- package/resources/analytics/read.ts +30 -25
- package/resources/defineResource.ts +651 -0
- package/resources/defineTable.ts +407 -0
- package/resources/jsonSchemaTypes.ts +12 -4
- package/resources/openApi.ts +68 -16
- package/resources/search.ts +5 -8
- package/server/graphqlQuerying.ts +4 -2
- package/server/http.ts +40 -16
- package/server/serverHelpers/serverUtilities.ts +19 -6
- package/server/serverHelpers/uwsServer.ts +24 -0
- package/studio/web/assets/{Chat-D4FIaBu7.js → Chat-CTjtL8Z4.js} +2 -2
- package/studio/web/assets/{Chat-D4FIaBu7.js.map → Chat-CTjtL8Z4.js.map} +1 -1
- package/studio/web/assets/{FloatingChat-DGUC3L4r.js → FloatingChat-CafHR4Ur.js} +4 -4
- package/studio/web/assets/{FloatingChat-DGUC3L4r.js.map → FloatingChat-CafHR4Ur.js.map} +1 -1
- package/studio/web/assets/{applications-D8Am9ikM.js → applications-Buh_q0Vj.js} +2 -2
- package/studio/web/assets/{applications-D8Am9ikM.js.map → applications-Buh_q0Vj.js.map} +1 -1
- package/studio/web/assets/{index-HGL4WHdb.js → index-0hXeECkS.js} +6 -6
- package/studio/web/assets/{index-HGL4WHdb.js.map → index-0hXeECkS.js.map} +1 -1
- package/studio/web/assets/{index.lazy-Dk5j1AoQ.js → index.lazy-B00B7VBT.js} +4 -4
- package/studio/web/assets/{index.lazy-Dk5j1AoQ.js.map → index.lazy-B00B7VBT.js.map} +1 -1
- package/studio/web/assets/{profile-7bu_CF1f.js → profile-Cg2wwYPn.js} +2 -2
- package/studio/web/assets/{profile-7bu_CF1f.js.map → profile-Cg2wwYPn.js.map} +1 -1
- package/studio/web/assets/{setComponentFile-MfYm9F94.js → setComponentFile-DCaDIvyB.js} +2 -2
- package/studio/web/assets/{setComponentFile-MfYm9F94.js.map → setComponentFile-DCaDIvyB.js.map} +1 -1
- package/studio/web/assets/{setup-SKA4UhdE.js → setup-CAVcAQjK.js} +2 -2
- package/studio/web/assets/{setup-SKA4UhdE.js.map → setup-CAVcAQjK.js.map} +1 -1
- package/studio/web/assets/{status-DetVLUxR.js → status-BRXorNdD.js} +2 -2
- package/studio/web/assets/{status-DetVLUxR.js.map → status-BRXorNdD.js.map} +1 -1
- package/studio/web/assets/{swagger-ui-react-DLeYARY2.js → swagger-ui-react-Dy1D62vO.js} +2 -2
- package/studio/web/assets/{swagger-ui-react-DLeYARY2.js.map → swagger-ui-react-Dy1D62vO.js.map} +1 -1
- package/studio/web/assets/{tsMode-DGO-jIF7.js → tsMode-A8gbL74v.js} +2 -2
- package/studio/web/assets/{tsMode-DGO-jIF7.js.map → tsMode-A8gbL74v.js.map} +1 -1
- package/studio/web/assets/{useEntityRestURL-4M2i6bo4.js → useEntityRestURL-cDodrVcQ.js} +2 -2
- package/studio/web/assets/{useEntityRestURL-4M2i6bo4.js.map → useEntityRestURL-cDodrVcQ.js.map} +1 -1
- package/studio/web/index.html +1 -1
- package/utility/errors/hdbError.ts +32 -0
- package/validation/configValidator.ts +23 -6
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type Logger } from '../utility/logging/logger.ts';
|
|
2
|
+
import type { CredentialReference, ResolvedCredential, ResolvedRegistryCredential } from './secretOperations.ts';
|
|
3
|
+
import { type ResolvedGitCredential } from './gitCredentialServer.ts';
|
|
2
4
|
import { Readable } from 'node:stream';
|
|
3
5
|
interface ApplicationConfig {
|
|
4
6
|
package: string;
|
|
@@ -7,11 +9,7 @@ interface ApplicationConfig {
|
|
|
7
9
|
timeout?: number;
|
|
8
10
|
allowInstallScripts?: boolean;
|
|
9
11
|
};
|
|
10
|
-
|
|
11
|
-
registry: string;
|
|
12
|
-
secret: string;
|
|
13
|
-
scope?: string;
|
|
14
|
-
}[];
|
|
12
|
+
credentials?: CredentialReference[];
|
|
15
13
|
[key: string]: unknown;
|
|
16
14
|
}
|
|
17
15
|
export declare class InvalidPackageIdentifierError extends TypeError {
|
|
@@ -26,10 +24,10 @@ export declare class InvalidInstallCommandError extends TypeError {
|
|
|
26
24
|
export declare class InvalidInstallTimeoutError extends TypeError {
|
|
27
25
|
constructor(applicationName: string, timeout: unknown);
|
|
28
26
|
}
|
|
29
|
-
export declare class
|
|
30
|
-
constructor(applicationName: string,
|
|
27
|
+
export declare class InvalidCredentialsPropertyError extends TypeError {
|
|
28
|
+
constructor(applicationName: string, credentials: unknown);
|
|
31
29
|
}
|
|
32
|
-
export declare class
|
|
30
|
+
export declare class InvalidCredentialEntryError extends TypeError {
|
|
33
31
|
constructor(applicationName: string);
|
|
34
32
|
}
|
|
35
33
|
export declare function assertApplicationConfig(applicationName: string, applicationConfig: Record<'package', unknown> & Record<string, unknown>): asserts applicationConfig is ApplicationConfig;
|
|
@@ -40,7 +38,20 @@ export declare function assertApplicationConfig(applicationName: string, applica
|
|
|
40
38
|
* an unverified host key.
|
|
41
39
|
*/
|
|
42
40
|
export declare function isSSHAuthFailure(stderr: string): boolean;
|
|
41
|
+
interface GitReference {
|
|
42
|
+
cloneUrl: string;
|
|
43
|
+
committish?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Parses a `git+ssh://…`/`git+https://…`/`git+http://…`/`git+file://…`/`git://…`, or hosted-git
|
|
47
|
+
* shorthand (`github:owner/repo`, `gitlab:owner/repo`, `bitbucket:owner/repo`, `gist:id`) package
|
|
48
|
+
* identifier into a plain clone URL and optional committish, without depending on npm's own git-spec
|
|
49
|
+
* parser (npm-package-arg/hosted-git-info aren't dependencies of this repo). Returns null for any
|
|
50
|
+
* other form.
|
|
51
|
+
*/
|
|
52
|
+
export declare function parseGitReference(packageIdentifier: string): GitReference | null;
|
|
43
53
|
export declare const ASIDE_STAGING_DIR = ".deploy-aside";
|
|
54
|
+
export declare const GIT_CREDENTIAL_HELPER_PATH: string;
|
|
44
55
|
/**
|
|
45
56
|
* Extract an application given payload (content of the application) or package (npm-compatible identifier to the application).
|
|
46
57
|
*
|
|
@@ -80,7 +91,7 @@ interface ApplicationOptions {
|
|
|
80
91
|
allowInstallScripts?: boolean;
|
|
81
92
|
};
|
|
82
93
|
onInstallLine?: OnInstallLine;
|
|
83
|
-
|
|
94
|
+
credentials?: ResolvedCredential[];
|
|
84
95
|
}
|
|
85
96
|
export declare class Application {
|
|
86
97
|
#private;
|
|
@@ -96,10 +107,14 @@ export declare class Application {
|
|
|
96
107
|
dirPath: string;
|
|
97
108
|
logger: Logger;
|
|
98
109
|
packageManagerPrefix: string;
|
|
99
|
-
|
|
110
|
+
registryCredentials?: ResolvedRegistryCredential[];
|
|
111
|
+
gitCredentials?: ResolvedGitCredential[];
|
|
100
112
|
npmUserconfigPath?: string;
|
|
101
|
-
constructor({ name, payload, packageIdentifier, install, onInstallLine,
|
|
113
|
+
constructor({ name, payload, packageIdentifier, install, onInstallLine, credentials }: ApplicationOptions);
|
|
102
114
|
writeTransientNpmrc(): Promise<void>;
|
|
115
|
+
get gitCredentialEnv(): Record<string, string> | undefined;
|
|
116
|
+
startGitCredentialSession(): Promise<void>;
|
|
117
|
+
cleanupGitCredentialSession(): Promise<void>;
|
|
103
118
|
cleanupTransientNpmrc(): Promise<void>;
|
|
104
119
|
}
|
|
105
120
|
/**
|
|
@@ -131,13 +146,53 @@ export declare function prepareApplication(application: Application): Promise<vo
|
|
|
131
146
|
* operations may conflict with each other (such as writing to the same directory).
|
|
132
147
|
*/
|
|
133
148
|
export declare function installApplications(): Promise<void>;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
149
|
+
/**
|
|
150
|
+
* Rewrite every occurrence of `sshDir` in an ssh `config` file's contents to `tempDir`, matching
|
|
151
|
+
* either slash direction per path segment (and case-insensitively on `win32`) rather than relying
|
|
152
|
+
* on the two strings being byte-identical.
|
|
153
|
+
*
|
|
154
|
+
* A plain string substitution (`sshConfig.split(sshDir).join(tempDir)`) doesn't hold
|
|
155
|
+
* cross-platform: ssh config files are frequently forward-slash even on Windows, while `sshDir`
|
|
156
|
+
* (built via `path.join`) is backslash there, so the split would silently never match; Windows
|
|
157
|
+
* paths are also case-insensitive. `sshDir` is split into segments on either separator *before*
|
|
158
|
+
* escaping, so escaping a regex-special character within a segment (e.g. a literal paren in a
|
|
159
|
+
* directory name) can't interact with the separator substitution. A trailing lookahead keeps
|
|
160
|
+
* `sshDir` from partial-matching a sibling directory whose name happens to start with it (e.g.
|
|
161
|
+
* `.../ssh` vs `.../sshhh`).
|
|
162
|
+
*
|
|
163
|
+
* Exported only so unit tests can pin the Windows-path behavior (mixed slash direction, case
|
|
164
|
+
* insensitivity) directly via the `platform` override, without needing to run on Windows.
|
|
165
|
+
*/
|
|
166
|
+
export declare function rewriteSshConfigPaths(sshConfig: string, sshDir: string, tempDir: string, platform?: string): string;
|
|
167
|
+
/**
|
|
168
|
+
* Materialize the SSH deploy keys for the lifetime of a single git-over-SSH spawn.
|
|
169
|
+
*
|
|
170
|
+
* Keys are sealed at rest as `enc:v1:` envelopes (Harper Pro's `add_ssh_key`), but ssh needs a key
|
|
171
|
+
* *file*, so each key is decrypted into a fresh 0700 temp dir as a 0600 file and the ssh config is
|
|
172
|
+
* copied with its `IdentityFile` paths repointed at the transient copies. The caller removes the
|
|
173
|
+
* dir as soon as the spawn settles, so the plaintext never outlives the git invocation. Legacy
|
|
174
|
+
* plaintext keys (written before sealing, or on a node with no custody) are copied through
|
|
175
|
+
* unchanged, so this is a no-op for them beyond the temp dir.
|
|
176
|
+
*
|
|
177
|
+
* A key that cannot be decrypted — no custody registered on this node, an envelope sealed under a
|
|
178
|
+
* different cluster key, or a tampered envelope — is logged and skipped rather than failing the
|
|
179
|
+
* spawn: a deploy that doesn't need that key is unaffected, and one that does fails with the usual
|
|
180
|
+
* SSH auth error (see `isSSHAuthFailure`). No log or error message here carries key material or
|
|
181
|
+
* the envelope.
|
|
182
|
+
*
|
|
183
|
+
* @returns The `GIT_SSH_COMMAND` to use plus its cleanup, or undefined when no keys are configured.
|
|
184
|
+
*/
|
|
185
|
+
export declare function materializeGitSSH(): Promise<{
|
|
186
|
+
command: string;
|
|
187
|
+
cleanup: () => Promise<void>;
|
|
188
|
+
} | undefined>;
|
|
189
|
+
export declare function buildNpmrcContent(registryCredentials: ResolvedRegistryCredential[]): string;
|
|
190
|
+
/**
|
|
191
|
+
* Run a command with the deploy's SSH key material materialized only for the duration of the
|
|
192
|
+
* spawn. The keys are decrypted to a transient 0700 dir (see `materializeGitSSH`) and removed as
|
|
193
|
+
* soon as the process settles — on success, failure, and timeout alike.
|
|
194
|
+
*/
|
|
195
|
+
export declare function nonInteractiveSpawn(applicationName: string, command: string, args: string[], cwd: string, timeoutMs?: number, onLine?: (stream: 'stdout' | 'stderr', line: string) => void, npmUserconfigPath?: string, gitCredentialEnv?: Record<string, string>): Promise<{
|
|
141
196
|
stdout: string;
|
|
142
197
|
stderr: string;
|
|
143
198
|
code: number;
|