@standardagents/code 0.14.1-issue.650.d27328 → 0.14.1-issue.653.6647dc-linux-x64-gnu
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/standard +4 -0
- package/bin/standardd +4 -0
- package/bin/tmux +0 -0
- package/lib/standard-plugin-runner/THIRD-PARTY.txt +252 -0
- package/lib/standard-plugin-runner/index.mjs +1093 -0
- package/lib/standard-plugin-runner/loader.mjs +210817 -0
- package/lib/standard-plugin-runner/runtime.json +1 -0
- package/lib/standard-plugin-runner/sdk.mjs +634 -0
- package/lib/standard-plugin-runner/worker.mjs +1561 -0
- package/licenses/THIRD-PARTY.txt +152 -0
- package/manifest.json +1 -0
- package/manifest.sig +1 -0
- package/package.json +18 -30
- package/bin/standard.mjs +0 -4
- package/bin/standardd.mjs +0 -4
- package/lib/artifact.mjs +0 -326
- package/lib/backend-profile.mjs +0 -114
- package/lib/launcher.mjs +0 -75
- package/lib/platform.mjs +0 -50
- package/postinstall.mjs +0 -12
package/lib/backend-profile.mjs
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
const PROFILE_KEYS = ['schema', 'id', 'label', 'apiOrigin', 'relayEnvironment']
|
|
2
|
-
const PROFILE_ID = /^[a-z0-9][a-z0-9-]{0,47}$/
|
|
3
|
-
const DNS_LABEL = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/
|
|
4
|
-
const PROFILE_HOST_SUFFIXES = ['.standardcode.ai', '.standardagentbuilder.com']
|
|
5
|
-
|
|
6
|
-
export const BACKEND_PROFILE_SCHEMA = 1
|
|
7
|
-
|
|
8
|
-
export function isPreviewBuild(version) {
|
|
9
|
-
return typeof version === 'string' && /-(?:issue|branch)\./.test(version)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Validate and normalize the preview backend profile embedded in a native
|
|
14
|
-
* artifact. Production is represented by an absent or null profile.
|
|
15
|
-
*/
|
|
16
|
-
export function normalizeBackendProfile(value) {
|
|
17
|
-
if (value == null || value === '') return null
|
|
18
|
-
if (!isPlainObject(value)) throw new Error('backend profile must be an object')
|
|
19
|
-
const keys = Object.keys(value).sort()
|
|
20
|
-
if (keys.join(',') !== [...PROFILE_KEYS].sort().join(',')) {
|
|
21
|
-
throw new Error('backend profile has unexpected fields')
|
|
22
|
-
}
|
|
23
|
-
if (value.schema !== BACKEND_PROFILE_SCHEMA) throw new Error('backend profile schema is unsupported')
|
|
24
|
-
if (typeof value.id !== 'string' || !PROFILE_ID.test(value.id) || value.id === 'production') {
|
|
25
|
-
throw new Error('backend profile id is invalid')
|
|
26
|
-
}
|
|
27
|
-
if (typeof value.label !== 'string' || !/^[\x20-\x7e]{1,64}$/.test(value.label)) {
|
|
28
|
-
throw new Error('backend profile label must be printable ASCII up to 64 characters')
|
|
29
|
-
}
|
|
30
|
-
const apiOrigin = canonicalApiOrigin(value.apiOrigin)
|
|
31
|
-
if (apiOrigin === 'https://api.standardcode.ai') {
|
|
32
|
-
throw new Error('preview backend profile cannot use the production API origin')
|
|
33
|
-
}
|
|
34
|
-
if (!['staging', 'production'].includes(value.relayEnvironment)) {
|
|
35
|
-
throw new Error('backend profile relayEnvironment must be staging or production')
|
|
36
|
-
}
|
|
37
|
-
return {
|
|
38
|
-
schema: BACKEND_PROFILE_SCHEMA,
|
|
39
|
-
id: value.id,
|
|
40
|
-
label: value.label,
|
|
41
|
-
apiOrigin,
|
|
42
|
-
relayEnvironment: value.relayEnvironment,
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function serializeBackendProfile(value) {
|
|
47
|
-
const profile = normalizeBackendProfile(value)
|
|
48
|
-
return profile ? JSON.stringify(profile) : ''
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function backendProfilesEqual(left, right) {
|
|
52
|
-
const a = normalizeBackendProfile(left)
|
|
53
|
-
const b = normalizeBackendProfile(right)
|
|
54
|
-
return JSON.stringify(a) === JSON.stringify(b)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export function backendProfileIdentitiesEqual(left, right) {
|
|
58
|
-
const a = normalizeBackendProfile(left)
|
|
59
|
-
const b = normalizeBackendProfile(right)
|
|
60
|
-
return (a?.id ?? 'production') === (b?.id ?? 'production')
|
|
61
|
-
&& (a?.apiOrigin ?? 'https://api.standardcode.ai') === (b?.apiOrigin ?? 'https://api.standardcode.ai')
|
|
62
|
-
&& (a?.relayEnvironment ?? 'production') === (b?.relayEnvironment ?? 'production')
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export async function backendProfileFingerprint(value) {
|
|
66
|
-
const profile = normalizeBackendProfile(value)
|
|
67
|
-
const id = profile?.id ?? 'production'
|
|
68
|
-
const apiOrigin = profile?.apiOrigin ?? 'https://api.standardcode.ai'
|
|
69
|
-
const relayEnvironment = profile?.relayEnvironment ?? 'production'
|
|
70
|
-
const bytes = new TextEncoder().encode(
|
|
71
|
-
`standard-backend-v1\0${id}\0${apiOrigin}\0${relayEnvironment}`,
|
|
72
|
-
)
|
|
73
|
-
const digest = await crypto.subtle.digest('SHA-256', bytes)
|
|
74
|
-
return Array.from(new Uint8Array(digest), byte => byte.toString(16).padStart(2, '0')).join('')
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/** A preview backend has a separate follow channel on the same Git branch. */
|
|
78
|
-
export async function backendProfileTag(baseTag, value) {
|
|
79
|
-
const profile = normalizeBackendProfile(value)
|
|
80
|
-
if (!profile) return baseTag
|
|
81
|
-
if (!/^(?:branch-|issue-)[a-z0-9-]+$/.test(baseTag)) {
|
|
82
|
-
throw new Error('preview backend profiles require a branch channel')
|
|
83
|
-
}
|
|
84
|
-
const tag = `${baseTag}-b-${(await backendProfileFingerprint(profile)).slice(0, 16)}`
|
|
85
|
-
if (tag.length > 64) throw new Error('backend-specific channel exceeds the tag length limit')
|
|
86
|
-
return tag
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export function canonicalApiOrigin(value) {
|
|
90
|
-
if (typeof value !== 'string' || !value || value.trim() !== value) {
|
|
91
|
-
throw new Error('backend profile apiOrigin must be a canonical HTTPS origin')
|
|
92
|
-
}
|
|
93
|
-
let url
|
|
94
|
-
try { url = new URL(value) } catch { throw new Error('backend profile apiOrigin must be a canonical HTTPS origin') }
|
|
95
|
-
if (url.protocol !== 'https:' || url.username || url.password || url.port
|
|
96
|
-
|| !['', '/'].includes(url.pathname) || url.search || url.hash
|
|
97
|
-
|| value !== url.origin) {
|
|
98
|
-
throw new Error('backend profile apiOrigin must be a canonical HTTPS origin')
|
|
99
|
-
}
|
|
100
|
-
const hostname = url.hostname
|
|
101
|
-
if (!hostname || hostname.length > 253 || hostname !== hostname.toLowerCase()) {
|
|
102
|
-
throw new Error('backend profile apiOrigin hostname is invalid')
|
|
103
|
-
}
|
|
104
|
-
const labels = hostname.split('.')
|
|
105
|
-
if (labels.some(label => !DNS_LABEL.test(label))
|
|
106
|
-
|| !PROFILE_HOST_SUFFIXES.some(suffix => hostname.endsWith(suffix))) {
|
|
107
|
-
throw new Error('backend profile apiOrigin hostname is not a supported first-party host')
|
|
108
|
-
}
|
|
109
|
-
return url.origin
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function isPlainObject(value) {
|
|
113
|
-
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
114
|
-
}
|
package/lib/launcher.mjs
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { spawnSync } from 'node:child_process'
|
|
2
|
-
import { readFileSync, realpathSync, statSync } from 'node:fs'
|
|
3
|
-
import { createRequire } from 'node:module'
|
|
4
|
-
import { dirname, join } from 'node:path'
|
|
5
|
-
import process from 'node:process'
|
|
6
|
-
|
|
7
|
-
import { platformPackage } from './platform.mjs'
|
|
8
|
-
import { artifactBinaryPath, requireCompatibleGlibc, verifyNativeArtifact } from './artifact.mjs'
|
|
9
|
-
|
|
10
|
-
const require = createRequire(import.meta.url)
|
|
11
|
-
const COMMANDS = new Set(['standard', 'standardd'])
|
|
12
|
-
|
|
13
|
-
export function resolveBinary(command, options = {}) {
|
|
14
|
-
if (!COMMANDS.has(command)) {
|
|
15
|
-
throw new Error(`Unknown Standard executable: ${command}`)
|
|
16
|
-
}
|
|
17
|
-
const environment = options.environment ?? process.env
|
|
18
|
-
const overrideDirectory = environment.STANDARD_CODE_BINARY_DIR
|
|
19
|
-
const binaryPath = overrideDirectory
|
|
20
|
-
? join(overrideDirectory, command)
|
|
21
|
-
: resolvePackagedBinary(command, options)
|
|
22
|
-
const stat = statSync(binaryPath)
|
|
23
|
-
if (!stat.isFile()) {
|
|
24
|
-
throw new Error(`Resolved Standard executable is not a file: ${binaryPath}`)
|
|
25
|
-
}
|
|
26
|
-
return binaryPath
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function resolvePackagedBinary(command, options) {
|
|
30
|
-
const platform = platformPackage(
|
|
31
|
-
options.platform,
|
|
32
|
-
options.architecture,
|
|
33
|
-
options.report,
|
|
34
|
-
)
|
|
35
|
-
const resolve = options.resolve ?? require.resolve
|
|
36
|
-
try {
|
|
37
|
-
const root = dirname(realpathSync(resolve(`${platform.packageName}/manifest.json`)))
|
|
38
|
-
const version = JSON.parse(readFileSync(new URL('../package.json', import.meta.url))).version
|
|
39
|
-
const artifact = verifyNativeArtifact(root, { version, target: platform.rustTarget })
|
|
40
|
-
const report = options.report ?? process.report
|
|
41
|
-
requireCompatibleGlibc(artifact, report?.getReport()?.header?.glibcVersionRuntime)
|
|
42
|
-
return join(root, artifactBinaryPath(artifact, command))
|
|
43
|
-
} catch (error) {
|
|
44
|
-
const detail = error instanceof Error ? error.message : String(error)
|
|
45
|
-
throw new Error(
|
|
46
|
-
`The native package ${platform.packageName} is missing or incomplete. `
|
|
47
|
-
+ `Reinstall @standardagents/code for this platform. (${detail})`,
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function spawnBinary(command, args, options = {}) {
|
|
53
|
-
const binary = resolveBinary(command, options)
|
|
54
|
-
return spawnSync(binary, args, {
|
|
55
|
-
stdio: options.stdio ?? 'inherit',
|
|
56
|
-
env: options.environment ?? process.env,
|
|
57
|
-
})
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export function main(command) {
|
|
61
|
-
try {
|
|
62
|
-
const result = spawnBinary(command, process.argv.slice(2))
|
|
63
|
-
if (result.error) throw result.error
|
|
64
|
-
if (result.signal) {
|
|
65
|
-
console.error(`${command} terminated by ${result.signal}`)
|
|
66
|
-
process.exitCode = 1
|
|
67
|
-
return
|
|
68
|
-
}
|
|
69
|
-
process.exitCode = result.status ?? 1
|
|
70
|
-
} catch (error) {
|
|
71
|
-
const detail = error instanceof Error ? error.message : String(error)
|
|
72
|
-
console.error(`${command}: ${detail}`)
|
|
73
|
-
process.exitCode = 1
|
|
74
|
-
}
|
|
75
|
-
}
|
package/lib/platform.mjs
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
const PLATFORMS = new Map([
|
|
2
|
-
['darwin:arm64', {
|
|
3
|
-
packageName: '@standardagents/code-darwin-arm64',
|
|
4
|
-
rustTarget: 'aarch64-apple-darwin',
|
|
5
|
-
}],
|
|
6
|
-
['darwin:x64', {
|
|
7
|
-
packageName: '@standardagents/code-darwin-x64',
|
|
8
|
-
rustTarget: 'x86_64-apple-darwin',
|
|
9
|
-
}],
|
|
10
|
-
['linux:arm64', {
|
|
11
|
-
packageName: '@standardagents/code-linux-arm64-gnu',
|
|
12
|
-
rustTarget: 'aarch64-unknown-linux-gnu',
|
|
13
|
-
}],
|
|
14
|
-
['linux:x64', {
|
|
15
|
-
packageName: '@standardagents/code-linux-x64-gnu',
|
|
16
|
-
rustTarget: 'x86_64-unknown-linux-gnu',
|
|
17
|
-
}],
|
|
18
|
-
])
|
|
19
|
-
|
|
20
|
-
export function platformPackage(
|
|
21
|
-
platform = process.platform,
|
|
22
|
-
architecture = process.arch,
|
|
23
|
-
report = process.report,
|
|
24
|
-
) {
|
|
25
|
-
const entry = PLATFORMS.get(`${platform}:${architecture}`)
|
|
26
|
-
if (!entry) {
|
|
27
|
-
throw new Error(
|
|
28
|
-
`Standard does not yet provide binaries for ${platform}/${architecture}; `
|
|
29
|
-
+ 'Phase 0 supports macOS and glibc Linux on arm64/x64.',
|
|
30
|
-
)
|
|
31
|
-
}
|
|
32
|
-
if (platform === 'linux' && !isGlibc(report)) {
|
|
33
|
-
throw new Error(
|
|
34
|
-
'Standard Phase 0 Linux packages require glibc; a musl build is not published yet.',
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
return entry
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function supportedPlatforms() {
|
|
41
|
-
return [...PLATFORMS.values()].map((entry) => ({ ...entry }))
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function isGlibc(report) {
|
|
45
|
-
try {
|
|
46
|
-
return Boolean(report?.getReport()?.header?.glibcVersionRuntime)
|
|
47
|
-
} catch {
|
|
48
|
-
return false
|
|
49
|
-
}
|
|
50
|
-
}
|
package/postinstall.mjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { chmodSync } from 'node:fs'
|
|
2
|
-
|
|
3
|
-
import { resolveBinary } from './lib/launcher.mjs'
|
|
4
|
-
|
|
5
|
-
for (const command of ['standard', 'standardd']) {
|
|
6
|
-
try {
|
|
7
|
-
chmodSync(resolveBinary(command), 0o755)
|
|
8
|
-
} catch (error) {
|
|
9
|
-
const detail = error instanceof Error ? error.message : String(error)
|
|
10
|
-
console.warn(`@standardagents/code: ${detail}`)
|
|
11
|
-
}
|
|
12
|
-
}
|