@senpiper/sp-agent 0.1.7 → 0.1.9
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/INSTALL.md +2 -2
- package/README.md +10 -10
- package/dist/distribution.d.ts +2 -2
- package/dist/distribution.d.ts.map +1 -1
- package/dist/distribution.js +2 -1
- package/dist/distribution.js.map +1 -1
- package/dist/extension-identity.generated.d.ts +3 -3
- package/dist/extension-identity.generated.d.ts.map +1 -1
- package/dist/extension-identity.generated.js +3 -3
- package/dist/extension-identity.generated.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/node_modules/@senpiper/pi-coding-agent/dist/bundle/chunks/{chunk-BFHDVWYY.js → chunk-IK73Y232.js} +1 -1
- package/node_modules/@senpiper/pi-coding-agent/dist/bundle/chunks/github-copilot.js +1 -1
- package/node_modules/@senpiper/pi-coding-agent/dist/bundle/cli.js +1 -1
- package/node_modules/@senpiper/pi-coding-agent/dist/bundle/index.js +1 -1
- package/node_modules/@senpiper/pi-coding-agent/dist/bundle/rpc-entry.js +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/cerebras.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai-cn.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/TERMINAL_WEB_BRIDGE.md +3 -3
- package/node_modules/@senpiper/sp-agent-extensions/dist/extension.d.ts.map +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/extension.js +2 -0
- package/node_modules/@senpiper/sp-agent-extensions/dist/extension.js.map +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/startup-header.d.ts +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/startup-header.d.ts.map +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/startup-header.js +13 -2
- package/node_modules/@senpiper/sp-agent-extensions/dist/startup-header.js.map +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/terminal-web-bridge.d.ts.map +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/terminal-web-bridge.js +7 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/terminal-web-bridge.js.map +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/web-command.d.ts +5 -0
- package/node_modules/@senpiper/sp-agent-extensions/dist/web-command.d.ts.map +1 -0
- package/node_modules/@senpiper/sp-agent-extensions/dist/web-command.js +95 -0
- package/node_modules/@senpiper/sp-agent-extensions/dist/web-command.js.map +1 -0
- package/node_modules/@senpiper/sp-agent-extensions/package.json +1 -1
- package/package.json +3 -3
package/INSTALL.md
CHANGED
|
@@ -33,8 +33,8 @@ sp --health-check
|
|
|
33
33
|
sp-web --help
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
The version should match the release you installed, and the health check
|
|
37
|
+
should print `ok`.
|
|
38
38
|
|
|
39
39
|
### npm 12
|
|
40
40
|
|
package/README.md
CHANGED
|
@@ -41,26 +41,26 @@ Set `SP_WEB_DISABLE=1` to run SP without automatically starting the web sidecar.
|
|
|
41
41
|
|
|
42
42
|
Build SP Web in a disposable copy of its repository, not a checkout running a development server. Pack the production build with `npm pack --ignore-scripts`.
|
|
43
43
|
|
|
44
|
-
Pass
|
|
44
|
+
Set the intended source versions before building. Pass the web tarball and its build lockfile to the SP release command. The dry run validates the web artifact, builds the SP tarball, and checks a clean global installation without publishing:
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
|
-
|
|
48
|
-
--
|
|
49
|
-
--web-
|
|
47
|
+
node scripts/publish-sp-packages.mjs --dry-run \
|
|
48
|
+
--registry https://registry.npmjs.org \
|
|
49
|
+
--web-tarball /absolute/path/senpiper-sp-web-0.1.1.tgz \
|
|
50
|
+
--web-lockfile /absolute/path/web-build/package-lock.json \
|
|
51
|
+
--output /absolute/path/release-artifacts
|
|
50
52
|
```
|
|
51
53
|
|
|
52
|
-
|
|
54
|
+
Copy the exact validated web tarball into that output directory alongside the SP tarball. Keep exactly one tarball for each package there. Log in with an npm account that has write access to the `@senpiper` scope, then publish from an interactive terminal:
|
|
53
55
|
|
|
54
56
|
```bash
|
|
55
57
|
npm run login:sp:npm
|
|
56
58
|
npm whoami --registry https://registry.npmjs.org
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
--web-tarball /absolute/path/senpiper-sp-web-0.1.0.tgz \
|
|
60
|
-
--web-lockfile /absolute/path/web-build/package-lock.json
|
|
59
|
+
node scripts/publish-sp-npm-artifacts.mjs /absolute/path/release-artifacts --check
|
|
60
|
+
node scripts/publish-sp-npm-artifacts.mjs /absolute/path/release-artifacts
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
The
|
|
63
|
+
The artifact publisher checks registry hashes, publishes Web first and then SP, and verifies each published hash. Complete npm's interactive 2FA prompt when requested. `--check` checks artifacts and registry state without publishing. If interrupted, rerun with the same artifacts; matching published versions are verified and skipped. Do not rebuild between attempts. The private runtime and extension packages remain bundled and do not need separate public releases.
|
|
64
64
|
|
|
65
65
|
The private `packages/sp-web-contract` workspace only records the required web version for source development. It is not the web application and is never used as the release artifact.
|
|
66
66
|
|
package/dist/distribution.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export declare function createSpExtensionRunnerOptions(extensions: readonly Exte
|
|
|
36
36
|
export declare function createSpMainOptions(): Promise<MainOptions>;
|
|
37
37
|
export declare const requiredExtension: {
|
|
38
38
|
readonly name: "@senpiper/sp-agent-extensions";
|
|
39
|
-
readonly version: "0.1.
|
|
40
|
-
readonly digest: "sha256:
|
|
39
|
+
readonly version: "0.1.3";
|
|
40
|
+
readonly digest: "sha256:fc164bd7a6ff6afa815a094cfb7c8c9a1c3380f1f6a71921217216da5cef5295";
|
|
41
41
|
};
|
|
42
42
|
//# sourceMappingURL=distribution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"distribution.d.ts","sourceRoot":"","sources":["../src/distribution.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACX,SAAS,EACT,gBAAgB,EAChB,sBAAsB,EACtB,WAAW,EACX,mBAAmB,EACnB,MAAM,2BAA2B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AA8B,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,GAAG,sBAAsB,CAevG;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,WAAW,CAAC,CAqBhE;AAED,eAAO,MAAM,iBAAiB;;;;CAIpB,CAAC","sourcesContent":["import { createHash } from \"node:crypto\";\nimport { existsSync, readdirSync, readFileSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, parse, relative } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport type {\n\tExtension,\n\tExtensionFactory,\n\tExtensionRunnerOptions,\n\tMainOptions,\n\tModelProviderPolicy,\n} from \"@senpiper/pi-coding-agent\";\nimport type { TerminalWebBridgeOptions } from \"@senpiper/sp-agent-extensions\";\nimport { EMBEDDED_REQUIRED_EXTENSION_IDENTITY } from \"./extension-identity.generated.ts\";\nimport { createSpSessionManager } from \"./sdk.ts\";\nimport { spWriterLeases } from \"./writer-leases.ts\";\n\nexport { configureSpEnvironment } from \"./environment.ts\";\nexport { SP_AGENT_VERSION } from \"./version.ts\";\n\ndeclare const SP_AGENT_COMPILED: boolean;\n\nexport const REQUIRED_EXTENSION_OWNER = \"<inline:sp-agent>\";\n\ninterface PackageManifest {\n\tname?: string;\n\tversion?: string;\n}\n\ninterface EmbeddedExtensionIdentity {\n\trequired: { name: string; version: string };\n\tartifact: { name: string; version: string; digest: string };\n}\n\nexport interface RequiredExtensionModule {\n\tcreateSpAgentExtension: (options?: TerminalWebBridgeOptions) => ExtensionFactory;\n\thandleSpCommand: (args: string[]) => Promise<boolean>;\n\treadSpGatewayApiKey: () => unknown;\n\treadSpGatewayState: () => unknown;\n\tSP_GATEWAY_PROVIDER_ID: string;\n}\n\ninterface RequiredExtensionValidationOptions {\n\tcompiled?: boolean;\n\tembeddedIdentity?: EmbeddedExtensionIdentity;\n\tresolvedEntrypoint?: string;\n}\n\ninterface RequiredExtensionLoadOptions extends RequiredExtensionValidationOptions {\n\timportExtension?: (specifier: string) => Promise<unknown>;\n}\n\nfunction findPackageManifest(entrypoint: string) {\n\tlet directory = dirname(entrypoint);\n\tconst root = parse(directory).root;\n\twhile (directory !== root) {\n\t\tconst manifestPath = join(directory, \"package.json\");\n\t\tif (existsSync(manifestPath)) return manifestPath;\n\t\tdirectory = dirname(directory);\n\t}\n\treturn undefined;\n}\n\nfunction collectJavaScriptFiles(directory: string): string[] {\n\tconst files: string[] = [];\n\tfor (const entry of readdirSync(directory, { withFileTypes: true })) {\n\t\tconst path = join(directory, entry.name);\n\t\tif (entry.isDirectory()) files.push(...collectJavaScriptFiles(path));\n\t\telse if (entry.isFile() && entry.name.endsWith(\".js\")) files.push(path);\n\t}\n\treturn files.sort((left, right) => relative(directory, left).localeCompare(relative(directory, right)));\n}\n\nfunction digestArtifact(directory: string) {\n\tconst files = collectJavaScriptFiles(directory);\n\tif (files.length === 0) throw new Error(`Required extension artifact contains no JavaScript: ${directory}`);\n\tconst hash = createHash(\"sha256\");\n\tfor (const path of files) {\n\t\tconst artifactPath = relative(directory, path).replaceAll(\"\\\\\", \"/\");\n\t\tconst content = readFileSync(path);\n\t\thash.update(`${artifactPath}\\0${content.byteLength}\\0`);\n\t\thash.update(content);\n\t}\n\treturn `sha256:${hash.digest(\"hex\")}`;\n}\n\nfunction assertEmbeddedIdentity(identity: EmbeddedExtensionIdentity) {\n\tif (\n\t\tidentity.artifact.name !== identity.required.name ||\n\t\tidentity.artifact.version !== identity.required.version ||\n\t\t!/^sha256:[0-9a-f]{64}$/u.test(identity.artifact.digest)\n\t) {\n\t\tthrow new Error(\n\t\t\t`Required extension build identity mismatch: expected ${identity.required.name}@${identity.required.version}.`,\n\t\t);\n\t}\n}\n\nfunction isCompiledExecutable() {\n\treturn typeof SP_AGENT_COMPILED !== \"undefined\" && SP_AGENT_COMPILED;\n}\n\nexport function assertRequiredExtensionIdentity(options: RequiredExtensionValidationOptions = {}) {\n\tconst identity = options.embeddedIdentity ?? EMBEDDED_REQUIRED_EXTENSION_IDENTITY;\n\tassertEmbeddedIdentity(identity);\n\tif (options.compiled ?? isCompiledExecutable()) return;\n\n\tconst resolved = options.resolvedEntrypoint ?? import.meta.resolve(identity.required.name);\n\tif (!resolved.startsWith(\"file:\")) {\n\t\tthrow new Error(`Cannot verify required extension ${identity.required.name}: ${resolved}`);\n\t}\n\tconst entrypoint = fileURLToPath(resolved);\n\tconst manifestPath = findPackageManifest(entrypoint);\n\tif (!manifestPath) {\n\t\tthrow new Error(`Cannot find the manifest for required extension ${identity.required.name}.`);\n\t}\n\tconst packageDirectory = dirname(manifestPath);\n\tconst entrypointRelativePath = relative(packageDirectory, entrypoint);\n\tif (\n\t\tentrypointRelativePath === \"\" ||\n\t\tentrypointRelativePath === \"..\" ||\n\t\tentrypointRelativePath.startsWith(\"../\") ||\n\t\tentrypointRelativePath.startsWith(\"..\\\\\") ||\n\t\tisAbsolute(entrypointRelativePath)\n\t) {\n\t\tthrow new Error(`Required extension entrypoint is outside its package: ${entrypoint}`);\n\t}\n\tconst manifest = JSON.parse(readFileSync(manifestPath, \"utf8\")) as PackageManifest;\n\tif (manifest.name !== identity.required.name || manifest.version !== identity.required.version) {\n\t\tthrow new Error(\n\t\t\t`Required extension mismatch: expected ${identity.required.name}@${identity.required.version}, found ${manifest.name ?? \"unknown\"}@${manifest.version ?? \"unknown\"}.`,\n\t\t);\n\t}\n\tconst digest = digestArtifact(dirname(entrypoint));\n\tif (digest !== identity.artifact.digest) {\n\t\tthrow new Error(\n\t\t\t`Required extension authenticity check failed for ${identity.required.name}@${identity.required.version}.`,\n\t\t);\n\t}\n}\n\nfunction assertRequiredExtensionExports(value: unknown): asserts value is RequiredExtensionModule {\n\tif (typeof value !== \"object\" || value === null) {\n\t\tthrow new Error(`Required extension ${requiredExtension.name}@${requiredExtension.version} is invalid.`);\n\t}\n\tconst module = value as Record<string, unknown>;\n\tif (\n\t\ttypeof module.createSpAgentExtension !== \"function\" ||\n\t\ttypeof module.handleSpCommand !== \"function\" ||\n\t\ttypeof module.readSpGatewayApiKey !== \"function\" ||\n\t\ttypeof module.readSpGatewayState !== \"function\" ||\n\t\ttypeof module.SP_GATEWAY_PROVIDER_ID !== \"string\"\n\t) {\n\t\tthrow new Error(`Required extension ${requiredExtension.name}@${requiredExtension.version} is invalid.`);\n\t}\n}\n\nlet requiredExtensionPromise: Promise<RequiredExtensionModule> | undefined;\n\nexport async function loadRequiredExtension(options: RequiredExtensionLoadOptions = {}) {\n\tconst usesDefaultLoader = Object.keys(options).length === 0;\n\tif (usesDefaultLoader && requiredExtensionPromise) return requiredExtensionPromise;\n\n\tassertRequiredExtensionIdentity(options);\n\tconst compiled = options.compiled ?? isCompiledExecutable();\n\tconst specifier = compiled\n\t\t? EMBEDDED_REQUIRED_EXTENSION_IDENTITY.required.name\n\t\t: (options.resolvedEntrypoint ?? import.meta.resolve(EMBEDDED_REQUIRED_EXTENSION_IDENTITY.required.name));\n\tconst load = async () => {\n\t\tconst imported = options.importExtension\n\t\t\t? await options.importExtension(specifier)\n\t\t\t: compiled\n\t\t\t\t? await import(\"@senpiper/sp-agent-extensions\")\n\t\t\t\t: await import(specifier);\n\t\tassertRequiredExtensionExports(imported);\n\t\treturn imported;\n\t};\n\tconst promise = load();\n\tif (usesDefaultLoader) requiredExtensionPromise = promise;\n\treturn promise;\n}\n\nexport function createSpModelProviderPolicy(extension: RequiredExtensionModule): ModelProviderPolicy {\n\tconst configured = extension.readSpGatewayState() !== undefined;\n\tif (configured) extension.readSpGatewayApiKey();\n\treturn {\n\t\tallowedProviderIds: [extension.SP_GATEWAY_PROVIDER_ID],\n\t\trequiredProviderIds: configured ? [extension.SP_GATEWAY_PROVIDER_ID] : [],\n\t\tallowModelConfiguration: false,\n\t\tproviderOwners: { [extension.SP_GATEWAY_PROVIDER_ID]: REQUIRED_EXTENSION_OWNER },\n\t};\n}\n\nexport function createSpExtensionRunnerOptions(extensions: readonly Extension[]): ExtensionRunnerOptions {\n\tconst owner = extensions.find((extension) => extension.path === REQUIRED_EXTENSION_OWNER);\n\tif (!owner) throw new Error(\"Required SP extension did not load.\");\n\treturn {\n\t\tcommandOwnership: {\n\t\t\treservedCommandNames: [\"login\", \"onboarding\"],\n\t\t\towners: new Map([\n\t\t\t\t[\"login\", owner],\n\t\t\t\t[\"onboarding\", owner],\n\t\t\t]),\n\t\t},\n\t\tresourceOwnership: {\n\t\t\ttoolOwners: new Map([[\"ask_user_question\", owner]]),\n\t\t},\n\t};\n}\n\nexport async function createSpMainOptions(): Promise<MainOptions> {\n\tconst extension = await loadRequiredExtension();\n\tconst sessions = await createSpSessionManager();\n\treturn {\n\t\tsessionWriterLeaseProvider: spWriterLeases,\n\t\tonSessionHistoryRoot: (root, customSessionDir) => sessions.setHistoryRoot(root, customSessionDir),\n\t\tonSessionRuntime: (runtime) => sessions.attachRuntime(runtime),\n\t\textensionFactories: [\n\t\t\t{\n\t\t\t\tname: \"sp-agent\",\n\t\t\t\tfactory: extension.createSpAgentExtension({\n\t\t\t\t\tsessions,\n\t\t\t\t\twriterLeaseVersion: 1,\n\t\t\t\t\tonReady: (bridge) => sessions.trackBridge(bridge),\n\t\t\t\t}),\n\t\t\t},\n\t\t],\n\t\tincludeBuiltInExtensions: false,\n\t\tmodelProviderPolicy: createSpModelProviderPolicy(extension),\n\t\textensionRunnerOptionsResolver: createSpExtensionRunnerOptions,\n\t};\n}\n\nexport const requiredExtension = {\n\tname: EMBEDDED_REQUIRED_EXTENSION_IDENTITY.required.name,\n\tversion: EMBEDDED_REQUIRED_EXTENSION_IDENTITY.required.version,\n\tdigest: EMBEDDED_REQUIRED_EXTENSION_IDENTITY.artifact.digest,\n} as const;\n"]}
|
|
1
|
+
{"version":3,"file":"distribution.d.ts","sourceRoot":"","sources":["../src/distribution.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACX,SAAS,EACT,gBAAgB,EAChB,sBAAsB,EACtB,WAAW,EACX,mBAAmB,EACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAK9E,OAA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,mBAAmB,IAAI,OAAO,CAAC,WAAW,CAAC,CAqBhE;AAED,eAAO,MAAM,iBAAiB;;;;CAIpB,CAAC","sourcesContent":["import { createHash } from \"node:crypto\";\nimport { existsSync, readdirSync, readFileSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, parse, relative } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport type {\n\tExtension,\n\tExtensionFactory,\n\tExtensionRunnerOptions,\n\tMainOptions,\n\tModelProviderPolicy,\n} from \"@senpiper/pi-coding-agent\";\nimport type { TerminalWebBridgeOptions } from \"@senpiper/sp-agent-extensions\";\nimport { EMBEDDED_REQUIRED_EXTENSION_IDENTITY } from \"./extension-identity.generated.ts\";\nimport { createSpSessionManager } from \"./sdk.ts\";\nimport { spWriterLeases } from \"./writer-leases.ts\";\n\nexport { configureSpEnvironment } from \"./environment.ts\";\nexport { SP_AGENT_VERSION } from \"./version.ts\";\n\ndeclare const SP_AGENT_COMPILED: boolean;\n\nexport const REQUIRED_EXTENSION_OWNER = \"<inline:sp-agent>\";\n\ninterface PackageManifest {\n\tname?: string;\n\tversion?: string;\n}\n\ninterface EmbeddedExtensionIdentity {\n\trequired: { name: string; version: string };\n\tartifact: { name: string; version: string; digest: string };\n}\n\nexport interface RequiredExtensionModule {\n\tcreateSpAgentExtension: (options?: TerminalWebBridgeOptions) => ExtensionFactory;\n\thandleSpCommand: (args: string[]) => Promise<boolean>;\n\treadSpGatewayApiKey: () => unknown;\n\treadSpGatewayState: () => unknown;\n\tSP_GATEWAY_PROVIDER_ID: string;\n}\n\ninterface RequiredExtensionValidationOptions {\n\tcompiled?: boolean;\n\tembeddedIdentity?: EmbeddedExtensionIdentity;\n\tresolvedEntrypoint?: string;\n}\n\ninterface RequiredExtensionLoadOptions extends RequiredExtensionValidationOptions {\n\timportExtension?: (specifier: string) => Promise<unknown>;\n}\n\nfunction findPackageManifest(entrypoint: string) {\n\tlet directory = dirname(entrypoint);\n\tconst root = parse(directory).root;\n\twhile (directory !== root) {\n\t\tconst manifestPath = join(directory, \"package.json\");\n\t\tif (existsSync(manifestPath)) return manifestPath;\n\t\tdirectory = dirname(directory);\n\t}\n\treturn undefined;\n}\n\nfunction collectJavaScriptFiles(directory: string): string[] {\n\tconst files: string[] = [];\n\tfor (const entry of readdirSync(directory, { withFileTypes: true })) {\n\t\tconst path = join(directory, entry.name);\n\t\tif (entry.isDirectory()) files.push(...collectJavaScriptFiles(path));\n\t\telse if (entry.isFile() && entry.name.endsWith(\".js\")) files.push(path);\n\t}\n\treturn files.sort((left, right) => relative(directory, left).localeCompare(relative(directory, right)));\n}\n\nfunction digestArtifact(directory: string) {\n\tconst files = collectJavaScriptFiles(directory);\n\tif (files.length === 0) throw new Error(`Required extension artifact contains no JavaScript: ${directory}`);\n\tconst hash = createHash(\"sha256\");\n\tfor (const path of files) {\n\t\tconst artifactPath = relative(directory, path).replaceAll(\"\\\\\", \"/\");\n\t\tconst content = readFileSync(path);\n\t\thash.update(`${artifactPath}\\0${content.byteLength}\\0`);\n\t\thash.update(content);\n\t}\n\treturn `sha256:${hash.digest(\"hex\")}`;\n}\n\nfunction assertEmbeddedIdentity(identity: EmbeddedExtensionIdentity) {\n\tif (\n\t\tidentity.artifact.name !== identity.required.name ||\n\t\tidentity.artifact.version !== identity.required.version ||\n\t\t!/^sha256:[0-9a-f]{64}$/u.test(identity.artifact.digest)\n\t) {\n\t\tthrow new Error(\n\t\t\t`Required extension build identity mismatch: expected ${identity.required.name}@${identity.required.version}.`,\n\t\t);\n\t}\n}\n\nfunction isCompiledExecutable() {\n\treturn typeof SP_AGENT_COMPILED !== \"undefined\" && SP_AGENT_COMPILED;\n}\n\nexport function assertRequiredExtensionIdentity(options: RequiredExtensionValidationOptions = {}) {\n\tconst identity = options.embeddedIdentity ?? EMBEDDED_REQUIRED_EXTENSION_IDENTITY;\n\tassertEmbeddedIdentity(identity);\n\tif (options.compiled ?? isCompiledExecutable()) return;\n\n\tconst resolved = options.resolvedEntrypoint ?? import.meta.resolve(identity.required.name);\n\tif (!resolved.startsWith(\"file:\")) {\n\t\tthrow new Error(`Cannot verify required extension ${identity.required.name}: ${resolved}`);\n\t}\n\tconst entrypoint = fileURLToPath(resolved);\n\tconst manifestPath = findPackageManifest(entrypoint);\n\tif (!manifestPath) {\n\t\tthrow new Error(`Cannot find the manifest for required extension ${identity.required.name}.`);\n\t}\n\tconst packageDirectory = dirname(manifestPath);\n\tconst entrypointRelativePath = relative(packageDirectory, entrypoint);\n\tif (\n\t\tentrypointRelativePath === \"\" ||\n\t\tentrypointRelativePath === \"..\" ||\n\t\tentrypointRelativePath.startsWith(\"../\") ||\n\t\tentrypointRelativePath.startsWith(\"..\\\\\") ||\n\t\tisAbsolute(entrypointRelativePath)\n\t) {\n\t\tthrow new Error(`Required extension entrypoint is outside its package: ${entrypoint}`);\n\t}\n\tconst manifest = JSON.parse(readFileSync(manifestPath, \"utf8\")) as PackageManifest;\n\tif (manifest.name !== identity.required.name || manifest.version !== identity.required.version) {\n\t\tthrow new Error(\n\t\t\t`Required extension mismatch: expected ${identity.required.name}@${identity.required.version}, found ${manifest.name ?? \"unknown\"}@${manifest.version ?? \"unknown\"}.`,\n\t\t);\n\t}\n\tconst digest = digestArtifact(dirname(entrypoint));\n\tif (digest !== identity.artifact.digest) {\n\t\tthrow new Error(\n\t\t\t`Required extension authenticity check failed for ${identity.required.name}@${identity.required.version}.`,\n\t\t);\n\t}\n}\n\nfunction assertRequiredExtensionExports(value: unknown): asserts value is RequiredExtensionModule {\n\tif (typeof value !== \"object\" || value === null) {\n\t\tthrow new Error(`Required extension ${requiredExtension.name}@${requiredExtension.version} is invalid.`);\n\t}\n\tconst module = value as Record<string, unknown>;\n\tif (\n\t\ttypeof module.createSpAgentExtension !== \"function\" ||\n\t\ttypeof module.handleSpCommand !== \"function\" ||\n\t\ttypeof module.readSpGatewayApiKey !== \"function\" ||\n\t\ttypeof module.readSpGatewayState !== \"function\" ||\n\t\ttypeof module.SP_GATEWAY_PROVIDER_ID !== \"string\"\n\t) {\n\t\tthrow new Error(`Required extension ${requiredExtension.name}@${requiredExtension.version} is invalid.`);\n\t}\n}\n\nlet requiredExtensionPromise: Promise<RequiredExtensionModule> | undefined;\n\nexport async function loadRequiredExtension(options: RequiredExtensionLoadOptions = {}) {\n\tconst usesDefaultLoader = Object.keys(options).length === 0;\n\tif (usesDefaultLoader && requiredExtensionPromise) return requiredExtensionPromise;\n\n\tassertRequiredExtensionIdentity(options);\n\tconst compiled = options.compiled ?? isCompiledExecutable();\n\tconst specifier = compiled\n\t\t? EMBEDDED_REQUIRED_EXTENSION_IDENTITY.required.name\n\t\t: (options.resolvedEntrypoint ?? import.meta.resolve(EMBEDDED_REQUIRED_EXTENSION_IDENTITY.required.name));\n\tconst load = async () => {\n\t\tconst imported = options.importExtension\n\t\t\t? await options.importExtension(specifier)\n\t\t\t: compiled\n\t\t\t\t? await import(\"@senpiper/sp-agent-extensions\")\n\t\t\t\t: await import(specifier);\n\t\tassertRequiredExtensionExports(imported);\n\t\treturn imported;\n\t};\n\tconst promise = load();\n\tif (usesDefaultLoader) requiredExtensionPromise = promise;\n\treturn promise;\n}\n\nexport function createSpModelProviderPolicy(extension: RequiredExtensionModule): ModelProviderPolicy {\n\tconst configured = extension.readSpGatewayState() !== undefined;\n\tif (configured) extension.readSpGatewayApiKey();\n\treturn {\n\t\tallowedProviderIds: [extension.SP_GATEWAY_PROVIDER_ID],\n\t\trequiredProviderIds: configured ? [extension.SP_GATEWAY_PROVIDER_ID] : [],\n\t\tallowModelConfiguration: false,\n\t\tproviderOwners: { [extension.SP_GATEWAY_PROVIDER_ID]: REQUIRED_EXTENSION_OWNER },\n\t};\n}\n\nexport function createSpExtensionRunnerOptions(extensions: readonly Extension[]): ExtensionRunnerOptions {\n\tconst owner = extensions.find((extension) => extension.path === REQUIRED_EXTENSION_OWNER);\n\tif (!owner) throw new Error(\"Required SP extension did not load.\");\n\treturn {\n\t\tcommandOwnership: {\n\t\t\treservedCommandNames: [\"login\", \"onboarding\", \"web\"],\n\t\t\towners: new Map([\n\t\t\t\t[\"login\", owner],\n\t\t\t\t[\"onboarding\", owner],\n\t\t\t\t[\"web\", owner],\n\t\t\t]),\n\t\t},\n\t\tresourceOwnership: {\n\t\t\ttoolOwners: new Map([[\"ask_user_question\", owner]]),\n\t\t},\n\t};\n}\n\nexport async function createSpMainOptions(): Promise<MainOptions> {\n\tconst extension = await loadRequiredExtension();\n\tconst sessions = await createSpSessionManager();\n\treturn {\n\t\tsessionWriterLeaseProvider: spWriterLeases,\n\t\tonSessionHistoryRoot: (root, customSessionDir) => sessions.setHistoryRoot(root, customSessionDir),\n\t\tonSessionRuntime: (runtime) => sessions.attachRuntime(runtime),\n\t\textensionFactories: [\n\t\t\t{\n\t\t\t\tname: \"sp-agent\",\n\t\t\t\tfactory: extension.createSpAgentExtension({\n\t\t\t\t\tsessions,\n\t\t\t\t\twriterLeaseVersion: 1,\n\t\t\t\t\tonReady: (bridge) => sessions.trackBridge(bridge),\n\t\t\t\t}),\n\t\t\t},\n\t\t],\n\t\tincludeBuiltInExtensions: false,\n\t\tmodelProviderPolicy: createSpModelProviderPolicy(extension),\n\t\textensionRunnerOptionsResolver: createSpExtensionRunnerOptions,\n\t};\n}\n\nexport const requiredExtension = {\n\tname: EMBEDDED_REQUIRED_EXTENSION_IDENTITY.required.name,\n\tversion: EMBEDDED_REQUIRED_EXTENSION_IDENTITY.required.version,\n\tdigest: EMBEDDED_REQUIRED_EXTENSION_IDENTITY.artifact.digest,\n} as const;\n"]}
|
package/dist/distribution.js
CHANGED
|
@@ -147,10 +147,11 @@ export function createSpExtensionRunnerOptions(extensions) {
|
|
|
147
147
|
throw new Error("Required SP extension did not load.");
|
|
148
148
|
return {
|
|
149
149
|
commandOwnership: {
|
|
150
|
-
reservedCommandNames: ["login", "onboarding"],
|
|
150
|
+
reservedCommandNames: ["login", "onboarding", "web"],
|
|
151
151
|
owners: new Map([
|
|
152
152
|
["login", owner],
|
|
153
153
|
["onboarding", owner],
|
|
154
|
+
["web", owner],
|
|
154
155
|
]),
|
|
155
156
|
},
|
|
156
157
|
resourceOwnership: {
|
package/dist/distribution.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"distribution.js","sourceRoot":"","sources":["../src/distribution.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AASzC,OAAO,EAAE,oCAAoC,EAAE,MAAM,mCAAmC,CAAC;AACzF,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAIhD,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CAAC;AA8B5D,SAAS,mBAAmB,CAAC,UAAkB,EAAE;IAChD,IAAI,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACpC,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC;IACnC,OAAO,SAAS,KAAK,IAAI,EAAE,CAAC;QAC3B,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QACrD,IAAI,UAAU,CAAC,YAAY,CAAC;YAAE,OAAO,YAAY,CAAC;QAClD,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,SAAS,CAAC;AAAA,CACjB;AAED,SAAS,sBAAsB,CAAC,SAAiB,E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,GAAG;IAChC,IAAI,EAAE,oCAAoC,CAAC,QAAQ,CAAC,IAAI;IACxD,OAAO,EAAE,oCAAoC,CAAC,QAAQ,CAAC,OAAO;IAC9D,MAAM,EAAE,oCAAoC,CAAC,QAAQ,CAAC,MAAM;CACnD,CAAC","sourcesContent":["import { createHash } from \"node:crypto\";\nimport { existsSync, readdirSync, readFileSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, parse, relative } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport type {\n\tExtension,\n\tExtensionFactory,\n\tExtensionRunnerOptions,\n\tMainOptions,\n\tModelProviderPolicy,\n} from \"@senpiper/pi-coding-agent\";\nimport type { TerminalWebBridgeOptions } from \"@senpiper/sp-agent-extensions\";\nimport { EMBEDDED_REQUIRED_EXTENSION_IDENTITY } from \"./extension-identity.generated.ts\";\nimport { createSpSessionManager } from \"./sdk.ts\";\nimport { spWriterLeases } from \"./writer-leases.ts\";\n\nexport { configureSpEnvironment } from \"./environment.ts\";\nexport { SP_AGENT_VERSION } from \"./version.ts\";\n\ndeclare const SP_AGENT_COMPILED: boolean;\n\nexport const REQUIRED_EXTENSION_OWNER = \"<inline:sp-agent>\";\n\ninterface PackageManifest {\n\tname?: string;\n\tversion?: string;\n}\n\ninterface EmbeddedExtensionIdentity {\n\trequired: { name: string; version: string };\n\tartifact: { name: string; version: string; digest: string };\n}\n\nexport interface RequiredExtensionModule {\n\tcreateSpAgentExtension: (options?: TerminalWebBridgeOptions) => ExtensionFactory;\n\thandleSpCommand: (args: string[]) => Promise<boolean>;\n\treadSpGatewayApiKey: () => unknown;\n\treadSpGatewayState: () => unknown;\n\tSP_GATEWAY_PROVIDER_ID: string;\n}\n\ninterface RequiredExtensionValidationOptions {\n\tcompiled?: boolean;\n\tembeddedIdentity?: EmbeddedExtensionIdentity;\n\tresolvedEntrypoint?: string;\n}\n\ninterface RequiredExtensionLoadOptions extends RequiredExtensionValidationOptions {\n\timportExtension?: (specifier: string) => Promise<unknown>;\n}\n\nfunction findPackageManifest(entrypoint: string) {\n\tlet directory = dirname(entrypoint);\n\tconst root = parse(directory).root;\n\twhile (directory !== root) {\n\t\tconst manifestPath = join(directory, \"package.json\");\n\t\tif (existsSync(manifestPath)) return manifestPath;\n\t\tdirectory = dirname(directory);\n\t}\n\treturn undefined;\n}\n\nfunction collectJavaScriptFiles(directory: string): string[] {\n\tconst files: string[] = [];\n\tfor (const entry of readdirSync(directory, { withFileTypes: true })) {\n\t\tconst path = join(directory, entry.name);\n\t\tif (entry.isDirectory()) files.push(...collectJavaScriptFiles(path));\n\t\telse if (entry.isFile() && entry.name.endsWith(\".js\")) files.push(path);\n\t}\n\treturn files.sort((left, right) => relative(directory, left).localeCompare(relative(directory, right)));\n}\n\nfunction digestArtifact(directory: string) {\n\tconst files = collectJavaScriptFiles(directory);\n\tif (files.length === 0) throw new Error(`Required extension artifact contains no JavaScript: ${directory}`);\n\tconst hash = createHash(\"sha256\");\n\tfor (const path of files) {\n\t\tconst artifactPath = relative(directory, path).replaceAll(\"\\\\\", \"/\");\n\t\tconst content = readFileSync(path);\n\t\thash.update(`${artifactPath}\\0${content.byteLength}\\0`);\n\t\thash.update(content);\n\t}\n\treturn `sha256:${hash.digest(\"hex\")}`;\n}\n\nfunction assertEmbeddedIdentity(identity: EmbeddedExtensionIdentity) {\n\tif (\n\t\tidentity.artifact.name !== identity.required.name ||\n\t\tidentity.artifact.version !== identity.required.version ||\n\t\t!/^sha256:[0-9a-f]{64}$/u.test(identity.artifact.digest)\n\t) {\n\t\tthrow new Error(\n\t\t\t`Required extension build identity mismatch: expected ${identity.required.name}@${identity.required.version}.`,\n\t\t);\n\t}\n}\n\nfunction isCompiledExecutable() {\n\treturn typeof SP_AGENT_COMPILED !== \"undefined\" && SP_AGENT_COMPILED;\n}\n\nexport function assertRequiredExtensionIdentity(options: RequiredExtensionValidationOptions = {}) {\n\tconst identity = options.embeddedIdentity ?? EMBEDDED_REQUIRED_EXTENSION_IDENTITY;\n\tassertEmbeddedIdentity(identity);\n\tif (options.compiled ?? isCompiledExecutable()) return;\n\n\tconst resolved = options.resolvedEntrypoint ?? import.meta.resolve(identity.required.name);\n\tif (!resolved.startsWith(\"file:\")) {\n\t\tthrow new Error(`Cannot verify required extension ${identity.required.name}: ${resolved}`);\n\t}\n\tconst entrypoint = fileURLToPath(resolved);\n\tconst manifestPath = findPackageManifest(entrypoint);\n\tif (!manifestPath) {\n\t\tthrow new Error(`Cannot find the manifest for required extension ${identity.required.name}.`);\n\t}\n\tconst packageDirectory = dirname(manifestPath);\n\tconst entrypointRelativePath = relative(packageDirectory, entrypoint);\n\tif (\n\t\tentrypointRelativePath === \"\" ||\n\t\tentrypointRelativePath === \"..\" ||\n\t\tentrypointRelativePath.startsWith(\"../\") ||\n\t\tentrypointRelativePath.startsWith(\"..\\\\\") ||\n\t\tisAbsolute(entrypointRelativePath)\n\t) {\n\t\tthrow new Error(`Required extension entrypoint is outside its package: ${entrypoint}`);\n\t}\n\tconst manifest = JSON.parse(readFileSync(manifestPath, \"utf8\")) as PackageManifest;\n\tif (manifest.name !== identity.required.name || manifest.version !== identity.required.version) {\n\t\tthrow new Error(\n\t\t\t`Required extension mismatch: expected ${identity.required.name}@${identity.required.version}, found ${manifest.name ?? \"unknown\"}@${manifest.version ?? \"unknown\"}.`,\n\t\t);\n\t}\n\tconst digest = digestArtifact(dirname(entrypoint));\n\tif (digest !== identity.artifact.digest) {\n\t\tthrow new Error(\n\t\t\t`Required extension authenticity check failed for ${identity.required.name}@${identity.required.version}.`,\n\t\t);\n\t}\n}\n\nfunction assertRequiredExtensionExports(value: unknown): asserts value is RequiredExtensionModule {\n\tif (typeof value !== \"object\" || value === null) {\n\t\tthrow new Error(`Required extension ${requiredExtension.name}@${requiredExtension.version} is invalid.`);\n\t}\n\tconst module = value as Record<string, unknown>;\n\tif (\n\t\ttypeof module.createSpAgentExtension !== \"function\" ||\n\t\ttypeof module.handleSpCommand !== \"function\" ||\n\t\ttypeof module.readSpGatewayApiKey !== \"function\" ||\n\t\ttypeof module.readSpGatewayState !== \"function\" ||\n\t\ttypeof module.SP_GATEWAY_PROVIDER_ID !== \"string\"\n\t) {\n\t\tthrow new Error(`Required extension ${requiredExtension.name}@${requiredExtension.version} is invalid.`);\n\t}\n}\n\nlet requiredExtensionPromise: Promise<RequiredExtensionModule> | undefined;\n\nexport async function loadRequiredExtension(options: RequiredExtensionLoadOptions = {}) {\n\tconst usesDefaultLoader = Object.keys(options).length === 0;\n\tif (usesDefaultLoader && requiredExtensionPromise) return requiredExtensionPromise;\n\n\tassertRequiredExtensionIdentity(options);\n\tconst compiled = options.compiled ?? isCompiledExecutable();\n\tconst specifier = compiled\n\t\t? EMBEDDED_REQUIRED_EXTENSION_IDENTITY.required.name\n\t\t: (options.resolvedEntrypoint ?? import.meta.resolve(EMBEDDED_REQUIRED_EXTENSION_IDENTITY.required.name));\n\tconst load = async () => {\n\t\tconst imported = options.importExtension\n\t\t\t? await options.importExtension(specifier)\n\t\t\t: compiled\n\t\t\t\t? await import(\"@senpiper/sp-agent-extensions\")\n\t\t\t\t: await import(specifier);\n\t\tassertRequiredExtensionExports(imported);\n\t\treturn imported;\n\t};\n\tconst promise = load();\n\tif (usesDefaultLoader) requiredExtensionPromise = promise;\n\treturn promise;\n}\n\nexport function createSpModelProviderPolicy(extension: RequiredExtensionModule): ModelProviderPolicy {\n\tconst configured = extension.readSpGatewayState() !== undefined;\n\tif (configured) extension.readSpGatewayApiKey();\n\treturn {\n\t\tallowedProviderIds: [extension.SP_GATEWAY_PROVIDER_ID],\n\t\trequiredProviderIds: configured ? [extension.SP_GATEWAY_PROVIDER_ID] : [],\n\t\tallowModelConfiguration: false,\n\t\tproviderOwners: { [extension.SP_GATEWAY_PROVIDER_ID]: REQUIRED_EXTENSION_OWNER },\n\t};\n}\n\nexport function createSpExtensionRunnerOptions(extensions: readonly Extension[]): ExtensionRunnerOptions {\n\tconst owner = extensions.find((extension) => extension.path === REQUIRED_EXTENSION_OWNER);\n\tif (!owner) throw new Error(\"Required SP extension did not load.\");\n\treturn {\n\t\tcommandOwnership: {\n\t\t\treservedCommandNames: [\"login\", \"onboarding\"],\n\t\t\towners: new Map([\n\t\t\t\t[\"login\", owner],\n\t\t\t\t[\"onboarding\", owner],\n\t\t\t]),\n\t\t},\n\t\tresourceOwnership: {\n\t\t\ttoolOwners: new Map([[\"ask_user_question\", owner]]),\n\t\t},\n\t};\n}\n\nexport async function createSpMainOptions(): Promise<MainOptions> {\n\tconst extension = await loadRequiredExtension();\n\tconst sessions = await createSpSessionManager();\n\treturn {\n\t\tsessionWriterLeaseProvider: spWriterLeases,\n\t\tonSessionHistoryRoot: (root, customSessionDir) => sessions.setHistoryRoot(root, customSessionDir),\n\t\tonSessionRuntime: (runtime) => sessions.attachRuntime(runtime),\n\t\textensionFactories: [\n\t\t\t{\n\t\t\t\tname: \"sp-agent\",\n\t\t\t\tfactory: extension.createSpAgentExtension({\n\t\t\t\t\tsessions,\n\t\t\t\t\twriterLeaseVersion: 1,\n\t\t\t\t\tonReady: (bridge) => sessions.trackBridge(bridge),\n\t\t\t\t}),\n\t\t\t},\n\t\t],\n\t\tincludeBuiltInExtensions: false,\n\t\tmodelProviderPolicy: createSpModelProviderPolicy(extension),\n\t\textensionRunnerOptionsResolver: createSpExtensionRunnerOptions,\n\t};\n}\n\nexport const requiredExtension = {\n\tname: EMBEDDED_REQUIRED_EXTENSION_IDENTITY.required.name,\n\tversion: EMBEDDED_REQUIRED_EXTENSION_IDENTITY.required.version,\n\tdigest: EMBEDDED_REQUIRED_EXTENSION_IDENTITY.artifact.digest,\n} as const;\n"]}
|
|
1
|
+
{"version":3,"file":"distribution.js","sourceRoot":"","sources":["../src/distribution.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,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,iBAAiB,EAAE;YAClB,UAAU,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC,CAAC;SACnD;KACD,CAAC;AAAA,CACF;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,GAAyB;IACjE,MAAM,SAAS,GAAG,MAAM,qBAAqB,EAAE,CAAC;IAChD,MAAM,QAAQ,GAAG,MAAM,sBAAsB,EAAE,CAAC;IAChD,OAAO;QACN,0BAA0B,EAAE,cAAc;QAC1C,oBAAoB,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,EAAE,gBAAgB,CAAC;QACjG,gBAAgB,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;QAC9D,kBAAkB,EAAE;YACnB;gBACC,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,SAAS,CAAC,sBAAsB,CAAC;oBACzC,QAAQ;oBACR,kBAAkB,EAAE,CAAC;oBACrB,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC;iBACjD,CAAC;aACF;SACD;QACD,wBAAwB,EAAE,KAAK;QAC/B,mBAAmB,EAAE,2BAA2B,CAAC,SAAS,CAAC;QAC3D,8BAA8B,EAAE,8BAA8B;KAC9D,CAAC;AAAA,CACF;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAChC,IAAI,EAAE,oCAAoC,CAAC,QAAQ,CAAC,IAAI;IACxD,OAAO,EAAE,oCAAoC,CAAC,QAAQ,CAAC,OAAO;IAC9D,MAAM,EAAE,oCAAoC,CAAC,QAAQ,CAAC,MAAM;CACnD,CAAC","sourcesContent":["import { createHash } from \"node:crypto\";\nimport { existsSync, readdirSync, readFileSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, parse, relative } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport type {\n\tExtension,\n\tExtensionFactory,\n\tExtensionRunnerOptions,\n\tMainOptions,\n\tModelProviderPolicy,\n} from \"@senpiper/pi-coding-agent\";\nimport type { TerminalWebBridgeOptions } from \"@senpiper/sp-agent-extensions\";\nimport { EMBEDDED_REQUIRED_EXTENSION_IDENTITY } from \"./extension-identity.generated.ts\";\nimport { createSpSessionManager } from \"./sdk.ts\";\nimport { spWriterLeases } from \"./writer-leases.ts\";\n\nexport { configureSpEnvironment } from \"./environment.ts\";\nexport { SP_AGENT_VERSION } from \"./version.ts\";\n\ndeclare const SP_AGENT_COMPILED: boolean;\n\nexport const REQUIRED_EXTENSION_OWNER = \"<inline:sp-agent>\";\n\ninterface PackageManifest {\n\tname?: string;\n\tversion?: string;\n}\n\ninterface EmbeddedExtensionIdentity {\n\trequired: { name: string; version: string };\n\tartifact: { name: string; version: string; digest: string };\n}\n\nexport interface RequiredExtensionModule {\n\tcreateSpAgentExtension: (options?: TerminalWebBridgeOptions) => ExtensionFactory;\n\thandleSpCommand: (args: string[]) => Promise<boolean>;\n\treadSpGatewayApiKey: () => unknown;\n\treadSpGatewayState: () => unknown;\n\tSP_GATEWAY_PROVIDER_ID: string;\n}\n\ninterface RequiredExtensionValidationOptions {\n\tcompiled?: boolean;\n\tembeddedIdentity?: EmbeddedExtensionIdentity;\n\tresolvedEntrypoint?: string;\n}\n\ninterface RequiredExtensionLoadOptions extends RequiredExtensionValidationOptions {\n\timportExtension?: (specifier: string) => Promise<unknown>;\n}\n\nfunction findPackageManifest(entrypoint: string) {\n\tlet directory = dirname(entrypoint);\n\tconst root = parse(directory).root;\n\twhile (directory !== root) {\n\t\tconst manifestPath = join(directory, \"package.json\");\n\t\tif (existsSync(manifestPath)) return manifestPath;\n\t\tdirectory = dirname(directory);\n\t}\n\treturn undefined;\n}\n\nfunction collectJavaScriptFiles(directory: string): string[] {\n\tconst files: string[] = [];\n\tfor (const entry of readdirSync(directory, { withFileTypes: true })) {\n\t\tconst path = join(directory, entry.name);\n\t\tif (entry.isDirectory()) files.push(...collectJavaScriptFiles(path));\n\t\telse if (entry.isFile() && entry.name.endsWith(\".js\")) files.push(path);\n\t}\n\treturn files.sort((left, right) => relative(directory, left).localeCompare(relative(directory, right)));\n}\n\nfunction digestArtifact(directory: string) {\n\tconst files = collectJavaScriptFiles(directory);\n\tif (files.length === 0) throw new Error(`Required extension artifact contains no JavaScript: ${directory}`);\n\tconst hash = createHash(\"sha256\");\n\tfor (const path of files) {\n\t\tconst artifactPath = relative(directory, path).replaceAll(\"\\\\\", \"/\");\n\t\tconst content = readFileSync(path);\n\t\thash.update(`${artifactPath}\\0${content.byteLength}\\0`);\n\t\thash.update(content);\n\t}\n\treturn `sha256:${hash.digest(\"hex\")}`;\n}\n\nfunction assertEmbeddedIdentity(identity: EmbeddedExtensionIdentity) {\n\tif (\n\t\tidentity.artifact.name !== identity.required.name ||\n\t\tidentity.artifact.version !== identity.required.version ||\n\t\t!/^sha256:[0-9a-f]{64}$/u.test(identity.artifact.digest)\n\t) {\n\t\tthrow new Error(\n\t\t\t`Required extension build identity mismatch: expected ${identity.required.name}@${identity.required.version}.`,\n\t\t);\n\t}\n}\n\nfunction isCompiledExecutable() {\n\treturn typeof SP_AGENT_COMPILED !== \"undefined\" && SP_AGENT_COMPILED;\n}\n\nexport function assertRequiredExtensionIdentity(options: RequiredExtensionValidationOptions = {}) {\n\tconst identity = options.embeddedIdentity ?? EMBEDDED_REQUIRED_EXTENSION_IDENTITY;\n\tassertEmbeddedIdentity(identity);\n\tif (options.compiled ?? isCompiledExecutable()) return;\n\n\tconst resolved = options.resolvedEntrypoint ?? import.meta.resolve(identity.required.name);\n\tif (!resolved.startsWith(\"file:\")) {\n\t\tthrow new Error(`Cannot verify required extension ${identity.required.name}: ${resolved}`);\n\t}\n\tconst entrypoint = fileURLToPath(resolved);\n\tconst manifestPath = findPackageManifest(entrypoint);\n\tif (!manifestPath) {\n\t\tthrow new Error(`Cannot find the manifest for required extension ${identity.required.name}.`);\n\t}\n\tconst packageDirectory = dirname(manifestPath);\n\tconst entrypointRelativePath = relative(packageDirectory, entrypoint);\n\tif (\n\t\tentrypointRelativePath === \"\" ||\n\t\tentrypointRelativePath === \"..\" ||\n\t\tentrypointRelativePath.startsWith(\"../\") ||\n\t\tentrypointRelativePath.startsWith(\"..\\\\\") ||\n\t\tisAbsolute(entrypointRelativePath)\n\t) {\n\t\tthrow new Error(`Required extension entrypoint is outside its package: ${entrypoint}`);\n\t}\n\tconst manifest = JSON.parse(readFileSync(manifestPath, \"utf8\")) as PackageManifest;\n\tif (manifest.name !== identity.required.name || manifest.version !== identity.required.version) {\n\t\tthrow new Error(\n\t\t\t`Required extension mismatch: expected ${identity.required.name}@${identity.required.version}, found ${manifest.name ?? \"unknown\"}@${manifest.version ?? \"unknown\"}.`,\n\t\t);\n\t}\n\tconst digest = digestArtifact(dirname(entrypoint));\n\tif (digest !== identity.artifact.digest) {\n\t\tthrow new Error(\n\t\t\t`Required extension authenticity check failed for ${identity.required.name}@${identity.required.version}.`,\n\t\t);\n\t}\n}\n\nfunction assertRequiredExtensionExports(value: unknown): asserts value is RequiredExtensionModule {\n\tif (typeof value !== \"object\" || value === null) {\n\t\tthrow new Error(`Required extension ${requiredExtension.name}@${requiredExtension.version} is invalid.`);\n\t}\n\tconst module = value as Record<string, unknown>;\n\tif (\n\t\ttypeof module.createSpAgentExtension !== \"function\" ||\n\t\ttypeof module.handleSpCommand !== \"function\" ||\n\t\ttypeof module.readSpGatewayApiKey !== \"function\" ||\n\t\ttypeof module.readSpGatewayState !== \"function\" ||\n\t\ttypeof module.SP_GATEWAY_PROVIDER_ID !== \"string\"\n\t) {\n\t\tthrow new Error(`Required extension ${requiredExtension.name}@${requiredExtension.version} is invalid.`);\n\t}\n}\n\nlet requiredExtensionPromise: Promise<RequiredExtensionModule> | undefined;\n\nexport async function loadRequiredExtension(options: RequiredExtensionLoadOptions = {}) {\n\tconst usesDefaultLoader = Object.keys(options).length === 0;\n\tif (usesDefaultLoader && requiredExtensionPromise) return requiredExtensionPromise;\n\n\tassertRequiredExtensionIdentity(options);\n\tconst compiled = options.compiled ?? isCompiledExecutable();\n\tconst specifier = compiled\n\t\t? EMBEDDED_REQUIRED_EXTENSION_IDENTITY.required.name\n\t\t: (options.resolvedEntrypoint ?? import.meta.resolve(EMBEDDED_REQUIRED_EXTENSION_IDENTITY.required.name));\n\tconst load = async () => {\n\t\tconst imported = options.importExtension\n\t\t\t? await options.importExtension(specifier)\n\t\t\t: compiled\n\t\t\t\t? await import(\"@senpiper/sp-agent-extensions\")\n\t\t\t\t: await import(specifier);\n\t\tassertRequiredExtensionExports(imported);\n\t\treturn imported;\n\t};\n\tconst promise = load();\n\tif (usesDefaultLoader) requiredExtensionPromise = promise;\n\treturn promise;\n}\n\nexport function createSpModelProviderPolicy(extension: RequiredExtensionModule): ModelProviderPolicy {\n\tconst configured = extension.readSpGatewayState() !== undefined;\n\tif (configured) extension.readSpGatewayApiKey();\n\treturn {\n\t\tallowedProviderIds: [extension.SP_GATEWAY_PROVIDER_ID],\n\t\trequiredProviderIds: configured ? [extension.SP_GATEWAY_PROVIDER_ID] : [],\n\t\tallowModelConfiguration: false,\n\t\tproviderOwners: { [extension.SP_GATEWAY_PROVIDER_ID]: REQUIRED_EXTENSION_OWNER },\n\t};\n}\n\nexport function createSpExtensionRunnerOptions(extensions: readonly Extension[]): ExtensionRunnerOptions {\n\tconst owner = extensions.find((extension) => extension.path === REQUIRED_EXTENSION_OWNER);\n\tif (!owner) throw new Error(\"Required SP extension did not load.\");\n\treturn {\n\t\tcommandOwnership: {\n\t\t\treservedCommandNames: [\"login\", \"onboarding\", \"web\"],\n\t\t\towners: new Map([\n\t\t\t\t[\"login\", owner],\n\t\t\t\t[\"onboarding\", owner],\n\t\t\t\t[\"web\", owner],\n\t\t\t]),\n\t\t},\n\t\tresourceOwnership: {\n\t\t\ttoolOwners: new Map([[\"ask_user_question\", owner]]),\n\t\t},\n\t};\n}\n\nexport async function createSpMainOptions(): Promise<MainOptions> {\n\tconst extension = await loadRequiredExtension();\n\tconst sessions = await createSpSessionManager();\n\treturn {\n\t\tsessionWriterLeaseProvider: spWriterLeases,\n\t\tonSessionHistoryRoot: (root, customSessionDir) => sessions.setHistoryRoot(root, customSessionDir),\n\t\tonSessionRuntime: (runtime) => sessions.attachRuntime(runtime),\n\t\textensionFactories: [\n\t\t\t{\n\t\t\t\tname: \"sp-agent\",\n\t\t\t\tfactory: extension.createSpAgentExtension({\n\t\t\t\t\tsessions,\n\t\t\t\t\twriterLeaseVersion: 1,\n\t\t\t\t\tonReady: (bridge) => sessions.trackBridge(bridge),\n\t\t\t\t}),\n\t\t\t},\n\t\t],\n\t\tincludeBuiltInExtensions: false,\n\t\tmodelProviderPolicy: createSpModelProviderPolicy(extension),\n\t\textensionRunnerOptionsResolver: createSpExtensionRunnerOptions,\n\t};\n}\n\nexport const requiredExtension = {\n\tname: EMBEDDED_REQUIRED_EXTENSION_IDENTITY.required.name,\n\tversion: EMBEDDED_REQUIRED_EXTENSION_IDENTITY.required.version,\n\tdigest: EMBEDDED_REQUIRED_EXTENSION_IDENTITY.artifact.digest,\n} as const;\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export declare const EMBEDDED_REQUIRED_EXTENSION_IDENTITY: {
|
|
2
2
|
readonly required: {
|
|
3
3
|
readonly name: "@senpiper/sp-agent-extensions";
|
|
4
|
-
readonly version: "0.1.
|
|
4
|
+
readonly version: "0.1.3";
|
|
5
5
|
};
|
|
6
6
|
readonly artifact: {
|
|
7
7
|
readonly name: "@senpiper/sp-agent-extensions";
|
|
8
|
-
readonly version: "0.1.
|
|
9
|
-
readonly digest: "sha256:
|
|
8
|
+
readonly version: "0.1.3";
|
|
9
|
+
readonly digest: "sha256:fc164bd7a6ff6afa815a094cfb7c8c9a1c3380f1f6a71921217216da5cef5295";
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
12
|
//# sourceMappingURL=extension-identity.generated.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension-identity.generated.d.ts","sourceRoot":"","sources":["../src/extension-identity.generated.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,oCAAoC;;;;;;;;;;CAUvC,CAAC","sourcesContent":["// Generated by scripts/generate-sp-extension-identity.mjs. Do not edit.\nexport const EMBEDDED_REQUIRED_EXTENSION_IDENTITY = {\n\trequired: {\n\t\tname: \"@senpiper/sp-agent-extensions\",\n\t\tversion: \"0.1.
|
|
1
|
+
{"version":3,"file":"extension-identity.generated.d.ts","sourceRoot":"","sources":["../src/extension-identity.generated.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,oCAAoC;;;;;;;;;;CAUvC,CAAC","sourcesContent":["// Generated by scripts/generate-sp-extension-identity.mjs. Do not edit.\nexport const EMBEDDED_REQUIRED_EXTENSION_IDENTITY = {\n\trequired: {\n\t\tname: \"@senpiper/sp-agent-extensions\",\n\t\tversion: \"0.1.3\",\n\t},\n\tartifact: {\n\t\tname: \"@senpiper/sp-agent-extensions\",\n\t\tversion: \"0.1.3\",\n\t\tdigest: \"sha256:fc164bd7a6ff6afa815a094cfb7c8c9a1c3380f1f6a71921217216da5cef5295\",\n\t},\n} as const;\n"]}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
export const EMBEDDED_REQUIRED_EXTENSION_IDENTITY = {
|
|
3
3
|
required: {
|
|
4
4
|
name: "@senpiper/sp-agent-extensions",
|
|
5
|
-
version: "0.1.
|
|
5
|
+
version: "0.1.3",
|
|
6
6
|
},
|
|
7
7
|
artifact: {
|
|
8
8
|
name: "@senpiper/sp-agent-extensions",
|
|
9
|
-
version: "0.1.
|
|
10
|
-
digest: "sha256:
|
|
9
|
+
version: "0.1.3",
|
|
10
|
+
digest: "sha256:fc164bd7a6ff6afa815a094cfb7c8c9a1c3380f1f6a71921217216da5cef5295",
|
|
11
11
|
},
|
|
12
12
|
};
|
|
13
13
|
//# sourceMappingURL=extension-identity.generated.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension-identity.generated.js","sourceRoot":"","sources":["../src/extension-identity.generated.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,MAAM,CAAC,MAAM,oCAAoC,GAAG;IACnD,QAAQ,EAAE;QACT,IAAI,EAAE,+BAA+B;QACrC,OAAO,EAAE,OAAO;KAChB;IACD,QAAQ,EAAE;QACT,IAAI,EAAE,+BAA+B;QACrC,OAAO,EAAE,OAAO;QAChB,MAAM,EAAE,yEAAyE;KACjF;CACQ,CAAC","sourcesContent":["// Generated by scripts/generate-sp-extension-identity.mjs. Do not edit.\nexport const EMBEDDED_REQUIRED_EXTENSION_IDENTITY = {\n\trequired: {\n\t\tname: \"@senpiper/sp-agent-extensions\",\n\t\tversion: \"0.1.
|
|
1
|
+
{"version":3,"file":"extension-identity.generated.js","sourceRoot":"","sources":["../src/extension-identity.generated.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,MAAM,CAAC,MAAM,oCAAoC,GAAG;IACnD,QAAQ,EAAE;QACT,IAAI,EAAE,+BAA+B;QACrC,OAAO,EAAE,OAAO;KAChB;IACD,QAAQ,EAAE;QACT,IAAI,EAAE,+BAA+B;QACrC,OAAO,EAAE,OAAO;QAChB,MAAM,EAAE,yEAAyE;KACjF;CACQ,CAAC","sourcesContent":["// Generated by scripts/generate-sp-extension-identity.mjs. Do not edit.\nexport const EMBEDDED_REQUIRED_EXTENSION_IDENTITY = {\n\trequired: {\n\t\tname: \"@senpiper/sp-agent-extensions\",\n\t\tversion: \"0.1.3\",\n\t},\n\tartifact: {\n\t\tname: \"@senpiper/sp-agent-extensions\",\n\t\tversion: \"0.1.3\",\n\t\tdigest: \"sha256:fc164bd7a6ff6afa815a094cfb7c8c9a1c3380f1f6a71921217216da5cef5295\",\n\t},\n} as const;\n"]}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SP_AGENT_VERSION = "0.1.
|
|
1
|
+
export declare const SP_AGENT_VERSION = "0.1.9";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,UAAU,CAAC","sourcesContent":["export const SP_AGENT_VERSION = \"0.1.
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,UAAU,CAAC","sourcesContent":["export const SP_AGENT_VERSION = \"0.1.9\";\n"]}
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const SP_AGENT_VERSION = "0.1.
|
|
1
|
+
export const SP_AGENT_VERSION = "0.1.9";
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC","sourcesContent":["export const SP_AGENT_VERSION = \"0.1.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC","sourcesContent":["export const SP_AGENT_VERSION = \"0.1.9\";\n"]}
|