@try-works/dsh-model-as-tool 0.1.3 → 0.4.0
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/bin/dsh-tool-mode-credentials.mjs +20 -0
- package/bin/dsh-tool-mode.mjs +202 -0
- package/catalog/desert-ant-models.json +693 -693
- package/client/client.model-tools.js +614 -0
- package/client/index.js +1717 -0
- package/lib/adapters/index.d.ts.map +1 -1
- package/lib/adapters/index.js +4 -4
- package/lib/bindings.d.ts.map +1 -1
- package/lib/bindings.js +26 -25
- package/lib/capability.d.ts.map +1 -1
- package/lib/capability.js +17 -0
- package/lib/capture-path.d.ts +97 -0
- package/lib/capture-path.d.ts.map +1 -0
- package/lib/capture-path.js +152 -0
- package/lib/diagnostics.d.ts +166 -0
- package/lib/diagnostics.d.ts.map +1 -0
- package/lib/diagnostics.js +135 -0
- package/lib/extension-dependencies.d.ts +325 -0
- package/lib/extension-dependencies.d.ts.map +1 -0
- package/lib/extension-dependencies.js +858 -0
- package/lib/extension-dispatch.d.ts +117 -0
- package/lib/extension-dispatch.d.ts.map +1 -0
- package/lib/extension-dispatch.js +124 -0
- package/lib/extension-registrar.d.ts +100 -0
- package/lib/extension-registrar.d.ts.map +1 -0
- package/lib/extension-registrar.js +134 -0
- package/lib/extensions-api.d.ts +221 -0
- package/lib/extensions-api.d.ts.map +1 -0
- package/lib/extensions-api.js +17 -0
- package/lib/extensions-remote.d.ts +54 -0
- package/lib/extensions-remote.d.ts.map +1 -0
- package/lib/extensions-remote.js +66 -0
- package/lib/extensions-service.d.ts +367 -0
- package/lib/extensions-service.d.ts.map +1 -0
- package/lib/extensions-service.js +1527 -0
- package/lib/harness-llm.d.ts +138 -0
- package/lib/harness-llm.d.ts.map +1 -0
- package/lib/harness-llm.js +218 -0
- package/lib/harness-serving.d.ts +95 -0
- package/lib/harness-serving.d.ts.map +1 -0
- package/lib/harness-serving.js +157 -0
- package/lib/headless.d.ts +97 -0
- package/lib/headless.d.ts.map +1 -0
- package/lib/headless.js +349 -0
- package/lib/http-acquisition.d.ts +27 -0
- package/lib/http-acquisition.d.ts.map +1 -0
- package/lib/http-acquisition.js +136 -0
- package/lib/index.d.ts +271 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2644 -70
- package/lib/invocation-accounting.d.ts +169 -0
- package/lib/invocation-accounting.d.ts.map +1 -0
- package/lib/invocation-accounting.js +148 -0
- package/lib/legacy-migration.d.ts +95 -0
- package/lib/legacy-migration.d.ts.map +1 -0
- package/lib/legacy-migration.js +429 -0
- package/lib/managed-workers.d.ts +151 -0
- package/lib/managed-workers.d.ts.map +1 -0
- package/lib/managed-workers.js +249 -0
- package/lib/mcp/client-grant.d.ts +74 -0
- package/lib/mcp/client-grant.d.ts.map +1 -0
- package/lib/mcp/client-grant.js +60 -0
- package/lib/mcp/credential-cli.d.ts +38 -0
- package/lib/mcp/credential-cli.d.ts.map +1 -0
- package/lib/mcp/credential-cli.js +148 -0
- package/lib/mcp/credential-store.d.ts +143 -0
- package/lib/mcp/credential-store.d.ts.map +1 -0
- package/lib/mcp/credential-store.js +454 -0
- package/lib/mcp/host-binding.d.ts +25 -0
- package/lib/mcp/host-binding.d.ts.map +1 -1
- package/lib/mcp/host-binding.js +107 -14
- package/lib/mcp/http.d.ts +68 -18
- package/lib/mcp/http.d.ts.map +1 -1
- package/lib/mcp/http.js +390 -62
- package/lib/mcp/oauth.d.ts +149 -0
- package/lib/mcp/oauth.d.ts.map +1 -0
- package/lib/mcp/oauth.js +396 -0
- package/lib/mcp/protocol.d.ts +46 -7
- package/lib/mcp/protocol.d.ts.map +1 -1
- package/lib/mcp/protocol.js +63 -16
- package/lib/mcp/rate-limit.d.ts +68 -0
- package/lib/mcp/rate-limit.d.ts.map +1 -0
- package/lib/mcp/rate-limit.js +114 -0
- package/lib/mcp/sdk-v2.d.ts +17 -0
- package/lib/mcp/sdk-v2.d.ts.map +1 -0
- package/lib/mcp/sdk-v2.js +181 -0
- package/lib/mcp/server.d.ts +11 -1
- package/lib/mcp/server.d.ts.map +1 -1
- package/lib/mcp/server.js +80 -13
- package/lib/mcp/stdio.d.ts.map +1 -1
- package/lib/mcp/stdio.js +9 -1
- package/lib/mcp/subscriptions.d.ts +43 -1
- package/lib/mcp/subscriptions.d.ts.map +1 -1
- package/lib/mcp/subscriptions.js +90 -9
- package/lib/model-qualification.d.ts +192 -0
- package/lib/model-qualification.d.ts.map +1 -0
- package/lib/model-qualification.js +178 -0
- package/lib/planning.d.ts +246 -0
- package/lib/planning.d.ts.map +1 -0
- package/lib/planning.js +457 -0
- package/lib/prepared-assets.d.ts +178 -0
- package/lib/prepared-assets.d.ts.map +1 -0
- package/lib/prepared-assets.js +286 -0
- package/lib/provider-bridge.d.ts +37 -0
- package/lib/provider-bridge.d.ts.map +1 -1
- package/lib/provider-bridge.js +189 -12
- package/lib/ptc-authority.d.ts +140 -0
- package/lib/ptc-authority.d.ts.map +1 -0
- package/lib/ptc-authority.js +216 -0
- package/lib/ptc-runtime.d.ts +156 -0
- package/lib/ptc-runtime.d.ts.map +1 -0
- package/lib/ptc-runtime.js +191 -0
- package/lib/publication.d.ts +2 -1
- package/lib/publication.d.ts.map +1 -1
- package/lib/publication.js +13 -5
- package/lib/receipt.d.ts.map +1 -1
- package/lib/receipt.js +8 -0
- package/lib/title-proposal.d.ts +194 -0
- package/lib/title-proposal.d.ts.map +1 -0
- package/lib/title-proposal.js +244 -0
- package/lib/tool-mode-run.d.ts +235 -0
- package/lib/tool-mode-run.d.ts.map +1 -0
- package/lib/tool-mode-run.js +283 -0
- package/lib/types.d.ts +3 -1
- package/lib/types.d.ts.map +1 -1
- package/lib/update-surface.d.ts +79 -0
- package/lib/update-surface.d.ts.map +1 -0
- package/lib/update-surface.js +224 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.d.ts +38 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.js +445 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.d.ts +14 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.js +63 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.d.ts +14 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.js +76 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/dsh.d.ts.map +1 -1
- package/node_modules/@try-works/tool-mode-contracts/lib/dsh.js +69 -55
- package/node_modules/@try-works/tool-mode-contracts/lib/index.d.ts +4 -1
- package/node_modules/@try-works/tool-mode-contracts/lib/index.d.ts.map +1 -1
- package/node_modules/@try-works/tool-mode-contracts/lib/index.js +26 -2
- package/node_modules/@try-works/tool-mode-contracts/lib/registry.d.ts +28 -2
- package/node_modules/@try-works/tool-mode-contracts/lib/registry.d.ts.map +1 -1
- package/node_modules/@try-works/tool-mode-contracts/lib/registry.js +93 -10
- package/node_modules/@try-works/tool-mode-contracts/package.json +0 -1
- package/node_modules/@try-works/tool-mode-extension-sdk/bin/dsh-tool-mode.mjs +20 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.d.ts +80 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.js +533 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.d.ts +83 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.js +125 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.d.ts +70 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.js +201 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.d.ts +57 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.js +83 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.d.ts +32 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.js +32 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.d.ts +86 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.js +191 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.d.ts +126 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.js +297 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.d.ts +216 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.js +800 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.d.ts +210 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.js +368 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.d.ts +63 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.js +149 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.d.ts +35 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.js +179 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.d.ts +179 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.js +235 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.d.ts +367 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.js +807 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.d.ts +44 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.js +243 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.d.ts +185 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.js +504 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.d.ts +17 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.js +80 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.d.ts +52 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.js +102 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.d.ts +171 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.js +271 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.d.ts +242 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.js +58 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.d.ts +118 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.js +113 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.d.ts +2 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.js +351 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.d.ts +150 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.js +670 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/package.json +53 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/schema/extension-manifest-1.1.0.schema.json +253 -0
- package/node_modules/@try-works/tool-mode-recipes/bin/tool-mode-recipe.mjs +15 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/broker.d.ts +427 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/broker.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/broker.js +592 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/cli.d.ts +60 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/cli.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/cli.js +936 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.d.ts +237 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.js +200 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.d.ts +85 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.js +176 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/images.d.ts +105 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/images.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/images.js +129 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/index.d.ts +25 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/index.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/index.js +25 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.d.ts +325 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.js +1310 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/templates.d.ts +51 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/templates.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/templates.js +310 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/titles.d.ts +227 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/titles.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/titles.js +407 -0
- package/node_modules/@try-works/tool-mode-recipes/package.json +56 -0
- package/node_modules/@try-works/tool-mode-recipes/recipes/describe-image.json +38 -0
- package/node_modules/@try-works/tool-mode-recipes/recipes/text-title.json +45 -0
- package/node_modules/@try-works/tool-mode-recipes/schema/harness-model-recipe.schema.json +273 -0
- package/package.json +43 -15
- package/remote/spec.mjs +462 -0
- package/remote/typert.host.mjs +14 -0
- package/remote/typert.remote-client.mjs +16 -0
- package/lib/adapters/tongue.d.ts +0 -31
- package/lib/adapters/tongue.d.ts.map +0 -1
- package/lib/adapters/tongue.js +0 -93
- package/lib/adapters/voz.d.ts +0 -28
- package/lib/adapters/voz.d.ts.map +0 -1
- package/lib/adapters/voz.js +0 -102
- /package/{lib → node_modules/@try-works/tool-mode-extension-sdk/lib}/licensing.d.ts +0 -0
- /package/{lib → node_modules/@try-works/tool-mode-extension-sdk/lib}/licensing.d.ts.map +0 -0
- /package/{lib → node_modules/@try-works/tool-mode-extension-sdk/lib}/licensing.js +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A real, npm-tarball-backed {@link ArchiveSource} (gzip + POSIX tar).
|
|
3
|
+
*
|
|
4
|
+
* npm publishes `.tgz` files; the ZIP reader cannot serve them. This reader
|
|
5
|
+
* applies the SAME defense discipline as the ZIP path, plus the inflate-time
|
|
6
|
+
* bound that a zip bomb's metadata makes unnecessary there:
|
|
7
|
+
*
|
|
8
|
+
* - gzip inflation is STREAMED under a byte cap (the cap fires BEFORE the
|
|
9
|
+
* inflated payload is allocated), then the expansion ratio is checked;
|
|
10
|
+
* - tar headers are parsed per block (regular/directory/symlink/hardlink, GNU
|
|
11
|
+
* longname 'L'/'K', pax 'x'/'g' path records); symlinks and hardlinks are
|
|
12
|
+
* reported as links so the entry-list validator REFUSES them — never resolved;
|
|
13
|
+
* - the entry list then flows through the shared `validateArchiveEntries`
|
|
14
|
+
* defenses (traversal, absolute paths, Windows device names, duplicates,
|
|
15
|
+
* case collisions, count/byte/ratio caps) exactly like the ZIP reader;
|
|
16
|
+
* - npm roots everything under `package/`: that one leading segment is
|
|
17
|
+
* stripped, the bare `package` directory entry is ignored, and a MIXED
|
|
18
|
+
* layout (entries both under and outside `package/`) is refused as
|
|
19
|
+
* ambiguous rather than guessed at;
|
|
20
|
+
* - truncation and malformed headers refuse with named codes.
|
|
21
|
+
*
|
|
22
|
+
* Like the ZIP reader, it carries no fetcher of its own: a caller supplies
|
|
23
|
+
* the tarball bytes (a host wraps its registry transport), and a test
|
|
24
|
+
* supplies bytes directly.
|
|
25
|
+
*
|
|
26
|
+
* @module @try-works/tool-mode-extension-sdk/install/tar-gzip-source
|
|
27
|
+
*/
|
|
28
|
+
import type { ArchiveSource, InstallSource } from './staged.ts';
|
|
29
|
+
/** Bounds for the inflate side of a tarball. */
|
|
30
|
+
export interface TarGzipLimits {
|
|
31
|
+
/** Maximum inflated bytes, enforced DURING inflation before allocation. */
|
|
32
|
+
readonly maxInflatedBytes: number;
|
|
33
|
+
/** Maximum inflated-to-compressed ratio, checked before the payload is kept. */
|
|
34
|
+
readonly maxExpansionRatio: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Build an {@link ArchiveSource} over npm `.tgz` (gzip+tar) bytes.
|
|
38
|
+
*
|
|
39
|
+
* @param fetchBytes - the tarball transport; absent, `fetch` refuses (the SDK
|
|
40
|
+
* carries no network stack — a host supplies its registry fetch).
|
|
41
|
+
* @param limits - inflate-time bounds, mirroring the shared archive defaults.
|
|
42
|
+
*/
|
|
43
|
+
export declare function createTarGzipArchiveSource(fetchBytes?: (source: InstallSource) => Promise<Uint8Array>, limits?: TarGzipLimits): ArchiveSource;
|
|
44
|
+
//# sourceMappingURL=tar-gzip-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tar-gzip-source.d.ts","sourceRoot":"","sources":["../../src/install/tar-gzip-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAOH,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAc/D,gDAAgD;AAChD,MAAM,WAAW,aAAa;IAC5B,2EAA2E;IAC3E,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;IACjC,gFAAgF;IAChF,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAA;CACnC;AA2LD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,UAAU,CAAC,EAC3D,MAAM,GAAE,aAAuC,GAC9C,aAAa,CAkCf"}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A real, npm-tarball-backed {@link ArchiveSource} (gzip + POSIX tar).
|
|
3
|
+
*
|
|
4
|
+
* npm publishes `.tgz` files; the ZIP reader cannot serve them. This reader
|
|
5
|
+
* applies the SAME defense discipline as the ZIP path, plus the inflate-time
|
|
6
|
+
* bound that a zip bomb's metadata makes unnecessary there:
|
|
7
|
+
*
|
|
8
|
+
* - gzip inflation is STREAMED under a byte cap (the cap fires BEFORE the
|
|
9
|
+
* inflated payload is allocated), then the expansion ratio is checked;
|
|
10
|
+
* - tar headers are parsed per block (regular/directory/symlink/hardlink, GNU
|
|
11
|
+
* longname 'L'/'K', pax 'x'/'g' path records); symlinks and hardlinks are
|
|
12
|
+
* reported as links so the entry-list validator REFUSES them — never resolved;
|
|
13
|
+
* - the entry list then flows through the shared `validateArchiveEntries`
|
|
14
|
+
* defenses (traversal, absolute paths, Windows device names, duplicates,
|
|
15
|
+
* case collisions, count/byte/ratio caps) exactly like the ZIP reader;
|
|
16
|
+
* - npm roots everything under `package/`: that one leading segment is
|
|
17
|
+
* stripped, the bare `package` directory entry is ignored, and a MIXED
|
|
18
|
+
* layout (entries both under and outside `package/`) is refused as
|
|
19
|
+
* ambiguous rather than guessed at;
|
|
20
|
+
* - truncation and malformed headers refuse with named codes.
|
|
21
|
+
*
|
|
22
|
+
* Like the ZIP reader, it carries no fetcher of its own: a caller supplies
|
|
23
|
+
* the tarball bytes (a host wraps its registry transport), and a test
|
|
24
|
+
* supplies bytes directly.
|
|
25
|
+
*
|
|
26
|
+
* @module @try-works/tool-mode-extension-sdk/install/tar-gzip-source
|
|
27
|
+
*/
|
|
28
|
+
import { gunzipSync } from 'node:zlib';
|
|
29
|
+
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
30
|
+
import { dirname, join, resolve, sep } from 'node:path';
|
|
31
|
+
import { ManagementError } from "./../errors.js";
|
|
32
|
+
import { DEFAULT_ARCHIVE_LIMITS } from "./archive.js";
|
|
33
|
+
/** The npm tarball wrapper directory. */
|
|
34
|
+
const NPM_ROOT = 'package';
|
|
35
|
+
/** The inflate bounds, mirrored from the shared archive defaults. */
|
|
36
|
+
const DEFAULT_TAR_GZIP_LIMITS = {
|
|
37
|
+
maxInflatedBytes: DEFAULT_ARCHIVE_LIMITS.maxTotalBytes,
|
|
38
|
+
maxExpansionRatio: DEFAULT_ARCHIVE_LIMITS.maxExpansionRatio,
|
|
39
|
+
};
|
|
40
|
+
/** Refuse a malformed or hostile tarball with one named, distinct message. */
|
|
41
|
+
function refuse(why) {
|
|
42
|
+
throw new ManagementError('INVALID_EXTENSION', 'install', `the npm tarball is refused: ${why}`, 'Repack the package so its tarball is a plain gzip+tar with package-relative regular files only.');
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Inflate a gzip payload under a byte cap enforced DURING inflation.
|
|
46
|
+
*
|
|
47
|
+
* `gunzipSync`'s `maxOutputLength` makes zlib refuse the moment the inflated
|
|
48
|
+
* stream would pass the bound — inside the C++ inflate loop, BEFORE the full
|
|
49
|
+
* payload is ever allocated — which is the bomb defense a post-hoc check
|
|
50
|
+
* cannot provide. The expansion ratio is then checked against the compressed
|
|
51
|
+
* size before the payload is kept.
|
|
52
|
+
*/
|
|
53
|
+
function gunzipBounded(bytes, limits) {
|
|
54
|
+
let payload;
|
|
55
|
+
try {
|
|
56
|
+
payload = gunzipSync(bytes, { maxOutputLength: limits.maxInflatedBytes });
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
if (error instanceof Error && error.code === 'ERR_BUFFER_TOO_LARGE') {
|
|
60
|
+
throw new ManagementError('INVALID_EXTENSION', 'install', `the npm tarball inflates past the ${limits.maxInflatedBytes}-byte bound (the cap fired BEFORE the payload was allocated)`, 'A tarball this large is not a package; it is a bomb or a mistake.');
|
|
61
|
+
}
|
|
62
|
+
refuse(`the gzip stream is malformed: ${error instanceof Error ? error.message : String(error)}`);
|
|
63
|
+
}
|
|
64
|
+
if (payload.byteLength / Math.max(1, bytes.byteLength) > limits.maxExpansionRatio) {
|
|
65
|
+
refuse(`the tarball expands ${(payload.byteLength / bytes.byteLength).toFixed(1)}x, over the ${limits.maxExpansionRatio}x ratio limit`);
|
|
66
|
+
}
|
|
67
|
+
return payload;
|
|
68
|
+
}
|
|
69
|
+
/** Parse an octal field (size/mode), refusing malformed values. */
|
|
70
|
+
function parseOctal(buffer, offset, length, what) {
|
|
71
|
+
const raw = buffer.subarray(offset, offset + length).toString('utf8').replace(/\0.*$/, '').trim();
|
|
72
|
+
if (raw.length === 0)
|
|
73
|
+
return 0;
|
|
74
|
+
if (!/^[0-7]+$/.test(raw))
|
|
75
|
+
refuse(`the ${what} field is not octal: ${JSON.stringify(raw)}`);
|
|
76
|
+
const value = parseInt(raw, 8);
|
|
77
|
+
if (!Number.isFinite(value) || value < 0)
|
|
78
|
+
refuse(`the ${what} field is invalid`);
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
81
|
+
/** Read a NUL- or length-terminated string field. */
|
|
82
|
+
function parseString(buffer, offset, length) {
|
|
83
|
+
const end = buffer.indexOf(0, offset);
|
|
84
|
+
const last = end === -1 || end > offset + length ? offset + length : end;
|
|
85
|
+
return buffer.subarray(offset, last).toString('utf8');
|
|
86
|
+
}
|
|
87
|
+
/** Parse one 512-byte tar header block. */
|
|
88
|
+
function parseHeader(block) {
|
|
89
|
+
const name = parseString(block, 0, 100);
|
|
90
|
+
const prefix = parseString(block, 345, 155);
|
|
91
|
+
const size = parseOctal(block, 124, 12, 'size');
|
|
92
|
+
const typeflag = parseString(block, 156, 1);
|
|
93
|
+
const linkname = parseString(block, 157, 100);
|
|
94
|
+
return { name, prefix, size, typeflag, linkname };
|
|
95
|
+
}
|
|
96
|
+
/** Parse every tar entry's header, walking the data blocks (bounded payload). */
|
|
97
|
+
function parseTar(payload) {
|
|
98
|
+
const entries = [];
|
|
99
|
+
let offset = 0;
|
|
100
|
+
let pendingLongName;
|
|
101
|
+
const paxPathOverrides = [];
|
|
102
|
+
let globalPaxPath;
|
|
103
|
+
while (offset + 512 <= payload.byteLength) {
|
|
104
|
+
const block = payload.subarray(offset, offset + 512);
|
|
105
|
+
if (block.every(byte => byte === 0))
|
|
106
|
+
break;
|
|
107
|
+
const header = parseHeader(block);
|
|
108
|
+
const dataOffset = offset + 512;
|
|
109
|
+
const padded = Math.ceil(header.size / 512) * 512;
|
|
110
|
+
if (dataOffset + padded > payload.byteLength)
|
|
111
|
+
refuse(`the header for ${JSON.stringify(header.name)} claims ${header.size} bytes that the tarball does not contain (truncated)`);
|
|
112
|
+
offset = dataOffset + padded;
|
|
113
|
+
if (offset > payload.byteLength)
|
|
114
|
+
refuse('the tarball ends inside an entry (truncated)');
|
|
115
|
+
const flag = header.typeflag === '' ? '0' : header.typeflag;
|
|
116
|
+
if (flag === 'L') {
|
|
117
|
+
pendingLongName = payload.subarray(dataOffset, dataOffset + header.size).toString('utf8').replace(/\0.*$/, '');
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
if (flag === 'K') {
|
|
121
|
+
// GNU longlink: the link target is replaced by the record's data.
|
|
122
|
+
const target = payload.subarray(dataOffset, dataOffset + header.size).toString('utf8').replace(/\0.*$/, '');
|
|
123
|
+
const last = entries[entries.length - 1];
|
|
124
|
+
if (last !== undefined)
|
|
125
|
+
entries[entries.length - 1] = { ...last, linkname: target };
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
if (flag === 'x' || flag === 'g') {
|
|
129
|
+
const record = payload.subarray(dataOffset, dataOffset + header.size).toString('utf8');
|
|
130
|
+
for (const line of record.split('\n')) {
|
|
131
|
+
const match = line.match(/^\d+ path=(.*)$/);
|
|
132
|
+
if (match !== null) {
|
|
133
|
+
if (flag === 'g')
|
|
134
|
+
globalPaxPath = match[1];
|
|
135
|
+
else
|
|
136
|
+
paxPathOverrides.push(match[1]);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
if (flag === '0') {
|
|
142
|
+
const name = pendingLongName ?? header.name;
|
|
143
|
+
const paxPath = flag === '0' ? paxPathOverrides.shift() ?? globalPaxPath : undefined;
|
|
144
|
+
pendingLongName = undefined;
|
|
145
|
+
entries.push({
|
|
146
|
+
path: paxPath ?? `${header.prefix.length > 0 ? `${header.prefix}/` : ''}${name}`,
|
|
147
|
+
size: header.size,
|
|
148
|
+
kind: 'file',
|
|
149
|
+
linkname: header.linkname,
|
|
150
|
+
dataOffset,
|
|
151
|
+
});
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
if (flag === '5') {
|
|
155
|
+
const name = pendingLongName ?? header.name;
|
|
156
|
+
pendingLongName = undefined;
|
|
157
|
+
entries.push({ path: `${header.prefix.length > 0 ? `${header.prefix}/` : ''}${name}`, size: 0, kind: 'directory', linkname: '', dataOffset });
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
if (flag === '2') {
|
|
161
|
+
entries.push({ path: `${header.prefix.length > 0 ? `${header.prefix}/` : ''}${header.name}`, size: 0, kind: 'symlink', linkname: header.linkname, dataOffset });
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
if (flag === '1') {
|
|
165
|
+
entries.push({ path: `${header.prefix.length > 0 ? `${header.prefix}/` : ''}${header.name}`, size: 0, kind: 'hardlink', linkname: header.linkname, dataOffset });
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
refuse(`the typeflag ${JSON.stringify(flag)} is not supported (only regular files, directories and refused links are admitted)`);
|
|
169
|
+
}
|
|
170
|
+
return entries;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Strip the npm `package/` wrapper: allowed only when EVERY entry sits under
|
|
174
|
+
* it (or is the wrapper directory itself); a mixed layout is refused.
|
|
175
|
+
* @returns the stripped entries, or the entries unchanged when no wrapper exists.
|
|
176
|
+
*/
|
|
177
|
+
function stripNpmRoot(entries) {
|
|
178
|
+
const tops = new Set();
|
|
179
|
+
for (const entry of entries) {
|
|
180
|
+
const segments = entry.path.split('/').filter(segment => segment.length > 0);
|
|
181
|
+
const first = segments[0];
|
|
182
|
+
if (first !== undefined)
|
|
183
|
+
tops.add(first);
|
|
184
|
+
}
|
|
185
|
+
if (!tops.has(NPM_ROOT))
|
|
186
|
+
return entries;
|
|
187
|
+
if (tops.size > 1) {
|
|
188
|
+
refuse(`the tarball mixes entries under ${JSON.stringify(NPM_ROOT + '/')} with entries outside it (${[...tops].map(entry => JSON.stringify(entry)).join(', ')}) — the layout is ambiguous`);
|
|
189
|
+
}
|
|
190
|
+
return entries
|
|
191
|
+
.map(entry => ({ ...entry, path: entry.path.slice(NPM_ROOT.length + 1) }))
|
|
192
|
+
.filter(entry => entry.path.length > 0);
|
|
193
|
+
}
|
|
194
|
+
/** Read one file entry's payload from the parsed tar (bounded by the entry size). */
|
|
195
|
+
function readFileData(payload, entry) {
|
|
196
|
+
return payload.subarray(entry.dataOffset, entry.dataOffset + entry.size);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Build an {@link ArchiveSource} over npm `.tgz` (gzip+tar) bytes.
|
|
200
|
+
*
|
|
201
|
+
* @param fetchBytes - the tarball transport; absent, `fetch` refuses (the SDK
|
|
202
|
+
* carries no network stack — a host supplies its registry fetch).
|
|
203
|
+
* @param limits - inflate-time bounds, mirroring the shared archive defaults.
|
|
204
|
+
*/
|
|
205
|
+
export function createTarGzipArchiveSource(fetchBytes, limits = DEFAULT_TAR_GZIP_LIMITS) {
|
|
206
|
+
return {
|
|
207
|
+
async fetch(source) {
|
|
208
|
+
if (fetchBytes === undefined) {
|
|
209
|
+
throw new Error(`no fetcher configured for source ${source.requested}`);
|
|
210
|
+
}
|
|
211
|
+
return fetchBytes(source);
|
|
212
|
+
},
|
|
213
|
+
list(bytes) {
|
|
214
|
+
const payload = gunzipBounded(bytes, limits);
|
|
215
|
+
const entries = stripNpmRoot(parseTar(payload));
|
|
216
|
+
return entries.map((entry) => ({
|
|
217
|
+
path: entry.path,
|
|
218
|
+
size: entry.size,
|
|
219
|
+
kind: entry.kind,
|
|
220
|
+
}));
|
|
221
|
+
},
|
|
222
|
+
extract(bytes, destination, root) {
|
|
223
|
+
const payload = gunzipBounded(bytes, limits);
|
|
224
|
+
const entries = stripNpmRoot(parseTar(payload));
|
|
225
|
+
const prefix = root.length > 0 ? `${root}/` : '';
|
|
226
|
+
const target = resolve(destination);
|
|
227
|
+
for (const entry of entries) {
|
|
228
|
+
if (entry.kind !== 'file')
|
|
229
|
+
continue;
|
|
230
|
+
const name = entry.path.startsWith(prefix) ? entry.path.slice(prefix.length) : entry.path;
|
|
231
|
+
if (name.length === 0)
|
|
232
|
+
continue;
|
|
233
|
+
// Confinement re-asserted at the write, exactly like the ZIP extractor.
|
|
234
|
+
const out = resolve(join(target, name));
|
|
235
|
+
if (out !== target && !out.startsWith(target + sep))
|
|
236
|
+
continue;
|
|
237
|
+
mkdirSync(dirname(out), { recursive: true });
|
|
238
|
+
writeFileSync(out, readFileData(payload, entry));
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
//# sourceMappingURL=tar-gzip-source.js.map
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EXT-30 staged update and rollback (slices 1+2 of the approved design,
|
|
3
|
+
* docs/tool-mode/EXT-30-UPDATE-DESIGN.md).
|
|
4
|
+
*
|
|
5
|
+
* The two properties this module exists to enforce:
|
|
6
|
+
*
|
|
7
|
+
* - **Side-by-side, never in place.** A new version is fetched into
|
|
8
|
+
* `staging/`, validated as DATA (manifest, integrity, schema/license/
|
|
9
|
+
* permission deltas, structural-static self-tests), approved by an operator,
|
|
10
|
+
* and only then promoted to its OWN version directory. The currently active
|
|
11
|
+
* version's bytes are never mutated.
|
|
12
|
+
* - **The active version is a POINTER, committed atomically.** The profile
|
|
13
|
+
* state document carries `activeVersions`/`previousVersions` maps written by
|
|
14
|
+
* the store's single atomic writer under the store lock. Rollback restores
|
|
15
|
+
* the pointer; it never copies bytes over a live install, never re-enables
|
|
16
|
+
* disabled tools, never undoes revocations (those facts live beside the
|
|
17
|
+
* pointer and are not touched).
|
|
18
|
+
*
|
|
19
|
+
* A post-commit rebind failure rolls the pointer back AUTOMATICALLY and names
|
|
20
|
+
* the reason. A corrupted version directory fails closed everywhere.
|
|
21
|
+
*
|
|
22
|
+
* Slice 1's self-tests are STRUCTURAL/STATIC only (manifest, referenced files,
|
|
23
|
+
* schema JSON parses): host-executed self-tests arrive with slice 3, and this
|
|
24
|
+
* module never executes extension code.
|
|
25
|
+
*
|
|
26
|
+
* @module @try-works/tool-mode-extension-sdk/install/update-flow
|
|
27
|
+
*/
|
|
28
|
+
import { type ArchiveSource, type InstallLimits, type InstallSource } from './staged.ts';
|
|
29
|
+
/** One schema compatibility finding (EXT-30's schema recheck). */
|
|
30
|
+
export interface SchemaDelta {
|
|
31
|
+
readonly toolName: string;
|
|
32
|
+
readonly file: 'input' | 'output';
|
|
33
|
+
/** True when a pinned composition would silently change meaning. */
|
|
34
|
+
readonly breaking: boolean;
|
|
35
|
+
readonly detail: string;
|
|
36
|
+
}
|
|
37
|
+
/** The staged update's validation report (EXT-30's gates, slice 1). */
|
|
38
|
+
export interface UpdateValidationReport {
|
|
39
|
+
readonly manifestOk: boolean;
|
|
40
|
+
/** The current version the deltas were computed against. */
|
|
41
|
+
readonly comparedAgainst: string;
|
|
42
|
+
readonly schemaDeltas: readonly SchemaDelta[];
|
|
43
|
+
/** Set when the manifest licence declaration changed. */
|
|
44
|
+
readonly licenseDelta?: string;
|
|
45
|
+
/** Permission EXPANSIONS, one entry per expansion (AT-35). */
|
|
46
|
+
readonly permissionDeltas: readonly string[];
|
|
47
|
+
readonly selfTests: {
|
|
48
|
+
readonly kind: 'structural-static';
|
|
49
|
+
readonly passed: boolean;
|
|
50
|
+
readonly detail: string;
|
|
51
|
+
};
|
|
52
|
+
/** True when an operator approval is required before the commit. */
|
|
53
|
+
readonly requiresApproval: boolean;
|
|
54
|
+
}
|
|
55
|
+
/** The outcome of a successful stage (nothing is visible or active yet). */
|
|
56
|
+
export interface UpdateStageResult {
|
|
57
|
+
readonly extensionId: string;
|
|
58
|
+
readonly stagedVersion: string;
|
|
59
|
+
/** Absolute path of the staged extraction (not the installed pool). */
|
|
60
|
+
readonly stagedPath: string;
|
|
61
|
+
readonly report: UpdateValidationReport;
|
|
62
|
+
}
|
|
63
|
+
/** The outcome of a commit (the pointer moved; the old pointer is the rollback target). */
|
|
64
|
+
export interface UpdateCommitResult {
|
|
65
|
+
readonly extensionId: string;
|
|
66
|
+
readonly activeVersion: string;
|
|
67
|
+
readonly previousVersion?: string;
|
|
68
|
+
}
|
|
69
|
+
/** The outcome of a rollback (pointer restore only). */
|
|
70
|
+
export interface UpdateRollbackResult {
|
|
71
|
+
readonly extensionId: string;
|
|
72
|
+
readonly activeVersion: string;
|
|
73
|
+
readonly previousVersion?: string;
|
|
74
|
+
/**
|
|
75
|
+
* The rebindRestored hook's own failure, when it threw or rejected. The hook
|
|
76
|
+
* is a POST-RESTORE observer: its error is reported here, never thrown — the
|
|
77
|
+
* pointer restore has already committed and must not be rolled back again.
|
|
78
|
+
*/
|
|
79
|
+
readonly hookFailure?: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Stage an update (EXT-30 slice 1).
|
|
83
|
+
*
|
|
84
|
+
* Fetch → integrity → entry validation → extract into `staging/` → manifest
|
|
85
|
+
* discovery → schema/licence/permission deltas against the current version →
|
|
86
|
+
* structural-static self-tests. A BREAKING schema delta or an unparseable
|
|
87
|
+
* schema REFUSES the stage (the staged directory is removed); a licence or
|
|
88
|
+
* permission delta only marks the stage as requiring approval. The installed
|
|
89
|
+
* version is never touched.
|
|
90
|
+
*
|
|
91
|
+
* @param options - the source, store, injected archive source, and limits.
|
|
92
|
+
* @returns the staged update and its validation report.
|
|
93
|
+
* @throws ManagementError for every rejection path.
|
|
94
|
+
*/
|
|
95
|
+
export declare function stageUpdate(options: {
|
|
96
|
+
readonly storeDir: string;
|
|
97
|
+
readonly source: InstallSource;
|
|
98
|
+
readonly archive: ArchiveSource;
|
|
99
|
+
readonly expectedSha512?: string;
|
|
100
|
+
/** The comparison base; defaults to the highest recorded version. */
|
|
101
|
+
readonly currentVersion?: string;
|
|
102
|
+
readonly limits?: InstallLimits;
|
|
103
|
+
}): Promise<UpdateStageResult>;
|
|
104
|
+
/**
|
|
105
|
+
* Record ONE operator approval decision for a staged update (EXT-30).
|
|
106
|
+
*
|
|
107
|
+
* The record is retained for the store's lifetime and is write-once per staged
|
|
108
|
+
* version (see {@link ExtensionStore.recordApproval}).
|
|
109
|
+
* @param options - the store, the staged identity, and the decision.
|
|
110
|
+
*/
|
|
111
|
+
export declare function recordApproval(options: {
|
|
112
|
+
readonly storeDir: string;
|
|
113
|
+
readonly extensionId: string;
|
|
114
|
+
readonly stagedVersion: string;
|
|
115
|
+
readonly decision: {
|
|
116
|
+
approved: true;
|
|
117
|
+
} | {
|
|
118
|
+
approved: false;
|
|
119
|
+
reason: string;
|
|
120
|
+
};
|
|
121
|
+
}): void;
|
|
122
|
+
/**
|
|
123
|
+
* Commit a staged, approved update (EXT-30, two-phase seam).
|
|
124
|
+
*
|
|
125
|
+
* Under the store lock, in order: verify the approval → verify the staged
|
|
126
|
+
* bytes (digest re-check, fail-closed) → verify the CURRENT active version's
|
|
127
|
+
* directory (fail-closed) → admit the staged version to its OWN version
|
|
128
|
+
* directory (never the live one) → **quiescePrevious** (the host stops
|
|
129
|
+
* old-generation admissions BEFORE the pointer moves; a failure aborts the
|
|
130
|
+
* commit with the pointer unchanged) → commit the pointer atomically via the
|
|
131
|
+
* profile-state writer → **rebindNext** (the host republishes the new
|
|
132
|
+
* generation; a failure rolls the pointer back AUTOMATICALLY and names the
|
|
133
|
+
* reason).
|
|
134
|
+
*
|
|
135
|
+
* REBIND-REVERT CONTRACT: the automatic rollback after a rebindNext failure
|
|
136
|
+
* runs NO further hooks — quiescePrevious is not re-run and no restore hook
|
|
137
|
+
* fires. A host whose rebind needs its own revert must supply it INSIDE its
|
|
138
|
+
* all-or-nothing rebindNext wrapper; the SDK never re-enters host hooks.
|
|
139
|
+
*
|
|
140
|
+
* NO-SEAM REFUSAL: a commit with no rebindNext REFUSES by default (the durable
|
|
141
|
+
* pointer must not advance while nothing republishes the surface). Pass
|
|
142
|
+
* `pointerOnly: true` as the explicit, documented deployment opt-out.
|
|
143
|
+
*
|
|
144
|
+
* @param options - the store, profile, staged identity, and the two-phase hooks.
|
|
145
|
+
* @returns the committed pointer and the previous one.
|
|
146
|
+
* @throws ManagementError for every rejection path.
|
|
147
|
+
*/
|
|
148
|
+
export declare function commitUpdate(options: {
|
|
149
|
+
readonly storeDir: string;
|
|
150
|
+
readonly profile: string;
|
|
151
|
+
readonly extensionId: string;
|
|
152
|
+
readonly stagedVersion: string;
|
|
153
|
+
/** Explicit opt-out: commit the pointer with NO hooks (deployment tooling only). */
|
|
154
|
+
readonly pointerOnly?: boolean;
|
|
155
|
+
readonly hooks?: {
|
|
156
|
+
/** Runs under the store lock BEFORE the pointer write; a failure aborts the commit. */
|
|
157
|
+
readonly quiescePrevious?: (previousVersion: string) => Promise<void>;
|
|
158
|
+
/** Runs AFTER the pointer write; a failure auto-rolls the pointer back. */
|
|
159
|
+
readonly rebindNext?: (stagedVersion: string) => Promise<void>;
|
|
160
|
+
};
|
|
161
|
+
}): Promise<UpdateCommitResult>;
|
|
162
|
+
/**
|
|
163
|
+
* Roll back one extension to its previous active version (EXT-30 slice 2).
|
|
164
|
+
*
|
|
165
|
+
* POINTER RESTORE ONLY: no bytes are copied over any live install, disabled
|
|
166
|
+
* tools stay disabled, revocations stay revoked (those facts live in the
|
|
167
|
+
* profile state beside the pointer). The previous version's directory is
|
|
168
|
+
* verified first; a corrupt previous version refuses the rollback (quarantine,
|
|
169
|
+
* the current pointer stays).
|
|
170
|
+
*
|
|
171
|
+
* The optional `rebindRestored` hook (the host's republish of the restored
|
|
172
|
+
* generation) runs AFTER the pointer restore. Its failure is REPORTED on the
|
|
173
|
+
* result as `hookFailure` — the restore stands and no second rollback runs.
|
|
174
|
+
*
|
|
175
|
+
* @param options - the store, profile, extension, and the optional restore hook.
|
|
176
|
+
* @returns the restored pointer.
|
|
177
|
+
*/
|
|
178
|
+
export declare function rollback(options: {
|
|
179
|
+
readonly storeDir: string;
|
|
180
|
+
readonly profile: string;
|
|
181
|
+
readonly extensionId: string;
|
|
182
|
+
/** Runs AFTER the pointer restore; a failure is reported, never rolled back again. */
|
|
183
|
+
readonly rebindRestored?: (restoredVersion: string) => Promise<void>;
|
|
184
|
+
}): Promise<UpdateRollbackResult>;
|
|
185
|
+
//# sourceMappingURL=update-flow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-flow.d.ts","sourceRoot":"","sources":["../../src/install/update-flow.ts"],"names":[],"mappings":"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"}
|