@t275005746/gse 0.1.0 → 0.1.1
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/.github/ISSUE_TEMPLATE/bug_report.yml +42 -42
- package/.github/ISSUE_TEMPLATE/change_request.yml +50 -50
- package/.github/ISSUE_TEMPLATE/config.yml +5 -5
- package/.github/PULL_REQUEST_TEMPLATE.md +38 -38
- package/.github/workflows/validate-gse.yml +33 -33
- package/.gse/README.md +18 -18
- package/.gse/gse-development-protocol.md +50 -50
- package/.gse/project-profile.md +29 -29
- package/.gse/quality-gates.md +25 -25
- package/.gse/releases/public-registry-publication-npm.md +49 -0
- package/.gse/releases/public-release-owner-required.md +65 -65
- package/.gse/releases/public-security-contact-owner-required.md +45 -45
- package/.gse/state.json +3 -4
- package/CHANGELOG.md +24 -24
- package/CONTRIBUTING.md +64 -64
- package/LICENSE +21 -21
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/SECURITY.md +41 -41
- package/SUPPORT.md +38 -38
- package/assets/marketplace/README.md +7 -7
- package/assets/marketplace/gse-listing.json +75 -75
- package/assets/templates/acceptance-execution-packet.md +73 -73
- package/assets/templates/adr.md +14 -14
- package/assets/templates/change-brief.md +16 -16
- package/assets/templates/design.md +18 -18
- package/assets/templates/dispatch-packet.md +104 -104
- package/assets/templates/evidence.md +14 -14
- package/assets/templates/execution-quality-pack.md +65 -65
- package/assets/templates/goal-map.md +21 -21
- package/assets/templates/host-adapter.md +48 -48
- package/assets/templates/host-ui-invocation-record.md +42 -42
- package/assets/templates/incident-review.md +60 -60
- package/assets/templates/public-channel-publication-record.md +49 -49
- package/assets/templates/public-ci-run-record.md +53 -53
- package/assets/templates/public-release-record.md +65 -65
- package/assets/templates/public-repository-settings-record.md +59 -59
- package/assets/templates/public-security-contact-record.md +45 -45
- package/assets/templates/release-trust-record.md +32 -32
- package/assets/templates/review.md +18 -18
- package/assets/templates/spec.md +16 -16
- package/assets/templates/target-adoption-evidence.md +29 -29
- package/assets/templates/tasks.md +17 -17
- package/assets/templates/update-release-acceptance-record.md +58 -58
- package/examples/README.md +22 -22
- package/examples/agent-runtime-host/.claude/gse-adapter.md +6 -6
- package/examples/agent-runtime-host/.codex/gse-adapter.md +7 -7
- package/examples/agent-runtime-host/.gse/goal-map.md +7 -7
- package/examples/agent-runtime-host/.gse/project-profile.md +27 -27
- package/examples/agent-runtime-host/.gse/tooling.md +5 -5
- package/examples/agent-runtime-host/.mcp.json +9 -9
- package/examples/agent-runtime-host/AGENTS.md +5 -5
- package/examples/agent-runtime-host/README.md +10 -10
- package/examples/agent-runtime-host/docs/model-routing.md +5 -5
- package/examples/cli-tool/.gse/project-profile.md +21 -21
- package/examples/cli-tool/AGENTS.md +5 -5
- package/examples/cli-tool/README.md +12 -12
- package/examples/cli-tool/package.json +21 -21
- package/examples/small-app/.env.example +2 -2
- package/examples/small-app/.github/workflows/ci.yml +8 -8
- package/examples/small-app/AGENTS.md +5 -5
- package/examples/small-app/README.md +12 -12
- package/examples/small-app/package.json +26 -26
- package/examples/small-app/playwright.config.ts +4 -4
- package/package.json +53 -53
- package/references/adoption-recipes.md +171 -171
- package/references/agent-roles.md +49 -49
- package/references/architecture-health.md +101 -101
- package/references/benchmark-audit.md +73 -73
- package/references/community-channels.md +46 -46
- package/references/compatibility.md +70 -70
- package/references/design-basis.md +38 -38
- package/references/domain-model.md +129 -129
- package/references/domain-quality-gates.md +75 -75
- package/references/drift-audit.md +81 -81
- package/references/evidence-taxonomy.md +123 -123
- package/references/file-ownership.md +107 -107
- package/references/final-readiness.md +84 -84
- package/references/forward-test.md +133 -133
- package/references/goal-map.md +36 -36
- package/references/host-adapters.md +119 -119
- package/references/learning-system.md +35 -35
- package/references/marketplace-discovery.md +46 -46
- package/references/model-routing.md +103 -103
- package/references/open-source-defaults.md +39 -39
- package/references/operating-model.md +52 -52
- package/references/packaging.md +277 -277
- package/references/project-agent-workspace.md +89 -89
- package/references/project-bootstrap.md +122 -122
- package/references/project-profile.md +57 -57
- package/references/public-release.md +174 -174
- package/references/quality-gates.md +100 -100
- package/references/recovery.md +176 -176
- package/references/release-trust.md +43 -43
- package/references/release.md +126 -126
- package/references/review.md +141 -141
- package/references/router.md +90 -90
- package/references/spec-workflow.md +66 -66
- package/references/task-levels.md +81 -81
- package/references/tool-adapters.md +73 -73
- package/scripts/audit-acceptance-execution-packet.mjs +133 -133
- package/scripts/audit-adoption-recipes.mjs +99 -99
- package/scripts/audit-change-lifecycle.mjs +77 -77
- package/scripts/audit-change-system.mjs +134 -134
- package/scripts/audit-ci-readiness.mjs +107 -107
- package/scripts/audit-close-gate.mjs +323 -323
- package/scripts/audit-command-adapters.mjs +91 -91
- package/scripts/audit-command-execution.mjs +210 -210
- package/scripts/audit-compatibility.mjs +149 -149
- package/scripts/audit-completion-readiness.mjs +292 -292
- package/scripts/audit-distribution.mjs +251 -251
- package/scripts/audit-domain-quality-gates.mjs +108 -108
- package/scripts/audit-evidence-placeholders.mjs +126 -126
- package/scripts/audit-final-readiness-promotion.mjs +255 -255
- package/scripts/audit-final-readiness.mjs +226 -226
- package/scripts/audit-fixtures.mjs +154 -154
- package/scripts/audit-fresh-session-readiness.mjs +177 -177
- package/scripts/audit-host-runtime-evidence-handoff.mjs +159 -159
- package/scripts/audit-host-runtime-invocation-drill.mjs +240 -240
- package/scripts/audit-host-runtime-invocations.mjs +254 -254
- package/scripts/audit-host-ui-invocation.mjs +132 -132
- package/scripts/audit-marketplace-discovery.mjs +122 -122
- package/scripts/audit-npm-package-metadata.mjs +155 -155
- package/scripts/audit-npm-publish-dry-run.mjs +191 -169
- package/scripts/audit-npm-tarball-install.mjs +191 -191
- package/scripts/audit-open-source-defaults.mjs +92 -92
- package/scripts/audit-open-source-readiness.mjs +97 -97
- package/scripts/audit-project.mjs +138 -138
- package/scripts/audit-public-acceptance-command-dry-run-drill.mjs +203 -203
- package/scripts/audit-public-acceptance-readiness.mjs +224 -224
- package/scripts/audit-public-channel-publication.mjs +248 -248
- package/scripts/audit-public-ci-run.mjs +184 -184
- package/scripts/audit-public-collaboration-templates.mjs +98 -98
- package/scripts/audit-public-external-gate-probe.mjs +206 -206
- package/scripts/audit-public-release-decision.mjs +201 -201
- package/scripts/audit-public-release-metadata.mjs +176 -176
- package/scripts/audit-public-repository-settings.mjs +237 -237
- package/scripts/audit-public-security-contact.mjs +171 -171
- package/scripts/audit-readme-docs.mjs +6 -4
- package/scripts/audit-recovery-readiness.mjs +98 -98
- package/scripts/audit-release-readiness.mjs +106 -106
- package/scripts/audit-release-trust.mjs +62 -62
- package/scripts/audit-remote-distribution.mjs +266 -266
- package/scripts/audit-roadmap-consistency.mjs +235 -235
- package/scripts/audit-signing.mjs +147 -147
- package/scripts/audit-state-freshness.mjs +14 -9
- package/scripts/audit-target-adoption-evidence.mjs +117 -117
- package/scripts/audit-target-project.mjs +507 -507
- package/scripts/audit-update-release-acceptance.mjs +136 -136
- package/scripts/audit-v1-target-validation.mjs +269 -269
- package/scripts/audit-validation-profiles.mjs +125 -125
- package/scripts/close-change.mjs +116 -116
- package/scripts/discover-project-profile.mjs +307 -307
- package/scripts/generate-command-adapter.mjs +231 -231
- package/scripts/generate-final-acceptance-packet.mjs +181 -181
- package/scripts/generate-final-form-progress-report.mjs +205 -205
- package/scripts/generate-host-runtime-evidence-handoff.mjs +206 -206
- package/scripts/generate-owner-external-gate-kit.mjs +295 -295
- package/scripts/generate-public-acceptance-handoff.mjs +168 -168
- package/scripts/generate-public-release-checklist.mjs +207 -207
- package/scripts/generate-release-bundle.mjs +505 -505
- package/scripts/generate-release-owner-action-plan.mjs +172 -172
- package/scripts/generate-release-status-manifest.mjs +200 -200
- package/scripts/generate-session-prompt.mjs +188 -188
- package/scripts/gse.mjs +67 -67
- package/scripts/init-change.mjs +265 -265
- package/scripts/init-project.mjs +785 -785
- package/scripts/install-gse.mjs +234 -234
- package/scripts/lib/evidence-placeholders.mjs +28 -28
- package/scripts/package-gse.mjs +174 -174
- package/scripts/probe-public-external-gates.mjs +167 -167
- package/scripts/record-host-invocation.mjs +151 -151
- package/scripts/record-public-channel-publication.mjs +178 -178
- package/scripts/record-public-ci-run.mjs +180 -180
- package/scripts/record-public-release.mjs +175 -175
- package/scripts/record-public-repository-settings.mjs +209 -209
- package/scripts/record-public-security-contact.mjs +157 -157
- package/scripts/sign-gse-package.mjs +83 -83
- package/scripts/update-project-state.mjs +223 -223
- package/scripts/verify-gse-package.mjs +85 -85
|
@@ -1,254 +1,254 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import fs from 'node:fs'
|
|
3
|
-
import os from 'node:os'
|
|
4
|
-
import path from 'node:path'
|
|
5
|
-
import { spawnSync } from 'node:child_process'
|
|
6
|
-
|
|
7
|
-
const args = process.argv.slice(2)
|
|
8
|
-
|
|
9
|
-
function readArg(name, fallback = null) {
|
|
10
|
-
const index = args.indexOf(name)
|
|
11
|
-
if (index === -1) return fallback
|
|
12
|
-
return args[index + 1] ?? fallback
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const root = path.resolve(readArg('--root', path.join(import.meta.dirname, '..')))
|
|
16
|
-
const recordsDir = path.resolve(readArg('--records-dir', path.join(root, '.gse', 'evidence', 'host-invocations')))
|
|
17
|
-
const jsonOnly = args.includes('--json')
|
|
18
|
-
|
|
19
|
-
function read(relativePathOrFullPath) {
|
|
20
|
-
const fullPath = path.isAbsolute(relativePathOrFullPath) ? relativePathOrFullPath : path.join(root, relativePathOrFullPath)
|
|
21
|
-
return fs.existsSync(fullPath) ? fs.readFileSync(fullPath, 'utf8').replace(/^\uFEFF/, '') : ''
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function exists(relativePath) {
|
|
25
|
-
return fs.existsSync(path.join(root, relativePath))
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function check(id, label, ok, evidence, risk = '') {
|
|
29
|
-
return { id, label, status: ok ? 'passed' : 'failed', evidence, risk }
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function run(commandArgs) {
|
|
33
|
-
const result = spawnSync(process.execPath, [path.join(root, 'scripts', 'record-host-invocation.mjs'), ...commandArgs], {
|
|
34
|
-
cwd: root,
|
|
35
|
-
encoding: 'utf8',
|
|
36
|
-
windowsHide: true,
|
|
37
|
-
})
|
|
38
|
-
return {
|
|
39
|
-
status: result.status ?? 1,
|
|
40
|
-
stdout: (result.stdout ?? '').trim(),
|
|
41
|
-
stderr: (result.stderr ?? '').trim(),
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function parseJson(text) {
|
|
46
|
-
try {
|
|
47
|
-
return JSON.parse(text)
|
|
48
|
-
} catch {
|
|
49
|
-
return null
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function listRecords(dir) {
|
|
54
|
-
if (!fs.existsSync(dir)) return []
|
|
55
|
-
return fs.readdirSync(dir)
|
|
56
|
-
.filter((item) => item.endsWith('.md'))
|
|
57
|
-
.map((item) => path.join(dir, item))
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function parseRecord(filePath) {
|
|
61
|
-
const text = read(filePath)
|
|
62
|
-
const field = (label) => {
|
|
63
|
-
const prefix = label.endsWith('?') ? '- ' + label + ' ' : '- ' + label + ':'
|
|
64
|
-
const line = text.split(/\r?\n/).find((item) => item.trimStart().startsWith(prefix))
|
|
65
|
-
return line ? line.slice(line.indexOf(prefix) + prefix.length).trim() : ''
|
|
66
|
-
}
|
|
67
|
-
return {
|
|
68
|
-
filePath,
|
|
69
|
-
text,
|
|
70
|
-
host: field('Host name'),
|
|
71
|
-
status: field('Status'),
|
|
72
|
-
nativeSlashCommand: field('Does this prove native slash-command support?'),
|
|
73
|
-
portableTextCommand: field('Does this prove portable text-command routing only?'),
|
|
74
|
-
generatedPointer: field('Does this rely on a generated pointer file?'),
|
|
75
|
-
ownerAcceptanceRequired: field('Does this require owner acceptance before being called trusted?'),
|
|
76
|
-
verificationCommand: field('Verification command'),
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const fixture = fs.mkdtempSync(path.join(os.tmpdir(), 'gse-host-invocation-audit-'))
|
|
81
|
-
const fixtureOut = path.join(fixture, 'codex-record.md')
|
|
82
|
-
const readyRun = run([
|
|
83
|
-
'--root',
|
|
84
|
-
root,
|
|
85
|
-
'--host',
|
|
86
|
-
'Codex',
|
|
87
|
-
'--host-version',
|
|
88
|
-
'fixture',
|
|
89
|
-
'--project',
|
|
90
|
-
'GSE fixture',
|
|
91
|
-
'--adapter-path',
|
|
92
|
-
'.codex/gse-command.md',
|
|
93
|
-
'--invocation-method',
|
|
94
|
-
'background-thread text command',
|
|
95
|
-
'--command',
|
|
96
|
-
'/gse help',
|
|
97
|
-
'--status',
|
|
98
|
-
'verified',
|
|
99
|
-
'--evidence-owner',
|
|
100
|
-
'fixture audit',
|
|
101
|
-
'--evidence',
|
|
102
|
-
'fixture transcript',
|
|
103
|
-
'--portable-text-command',
|
|
104
|
-
'true',
|
|
105
|
-
'--native-slash-command',
|
|
106
|
-
'false',
|
|
107
|
-
'--generated-pointer',
|
|
108
|
-
'true',
|
|
109
|
-
'--owner-acceptance-required',
|
|
110
|
-
'false',
|
|
111
|
-
'--out',
|
|
112
|
-
fixtureOut,
|
|
113
|
-
'--json',
|
|
114
|
-
])
|
|
115
|
-
const readyData = parseJson(readyRun.stdout)
|
|
116
|
-
const missingRun = run(['--root', root, '--host', 'Codex', '--dry-run', '--json'])
|
|
117
|
-
const missingData = parseJson(missingRun.stdout)
|
|
118
|
-
const contradictoryRun = run([
|
|
119
|
-
'--root',
|
|
120
|
-
root,
|
|
121
|
-
'--host',
|
|
122
|
-
'Codex',
|
|
123
|
-
'--invocation-method',
|
|
124
|
-
'native slash command',
|
|
125
|
-
'--status',
|
|
126
|
-
'accepted',
|
|
127
|
-
'--evidence-owner',
|
|
128
|
-
'fixture audit',
|
|
129
|
-
'--evidence',
|
|
130
|
-
'fixture transcript',
|
|
131
|
-
'--native-slash-command',
|
|
132
|
-
'true',
|
|
133
|
-
'--portable-text-command',
|
|
134
|
-
'true',
|
|
135
|
-
'--generated-pointer',
|
|
136
|
-
'true',
|
|
137
|
-
'--owner-acceptance-required',
|
|
138
|
-
'false',
|
|
139
|
-
'--dry-run',
|
|
140
|
-
'--json',
|
|
141
|
-
])
|
|
142
|
-
const contradictoryData = parseJson(contradictoryRun.stdout)
|
|
143
|
-
const acceptedPointerRun = run([
|
|
144
|
-
'--root',
|
|
145
|
-
root,
|
|
146
|
-
'--host',
|
|
147
|
-
'Generic pointer host',
|
|
148
|
-
'--invocation-method',
|
|
149
|
-
'generated pointer',
|
|
150
|
-
'--status',
|
|
151
|
-
'accepted',
|
|
152
|
-
'--evidence-owner',
|
|
153
|
-
'fixture audit',
|
|
154
|
-
'--evidence',
|
|
155
|
-
'fixture transcript',
|
|
156
|
-
'--verification-command',
|
|
157
|
-
'node scripts/audit-final-readiness.mjs --root __GSE__ --json',
|
|
158
|
-
'--native-slash-command',
|
|
159
|
-
'false',
|
|
160
|
-
'--portable-text-command',
|
|
161
|
-
'false',
|
|
162
|
-
'--generated-pointer',
|
|
163
|
-
'true',
|
|
164
|
-
'--owner-acceptance-required',
|
|
165
|
-
'false',
|
|
166
|
-
'--dry-run',
|
|
167
|
-
'--json',
|
|
168
|
-
])
|
|
169
|
-
const acceptedPointerData = parseJson(acceptedPointerRun.stdout)
|
|
170
|
-
|
|
171
|
-
const records = listRecords(recordsDir).map(parseRecord)
|
|
172
|
-
const closeableRecords = records.filter((record) => ['verified', 'accepted'].includes(record.status))
|
|
173
|
-
const nativeRecords = closeableRecords.filter((record) => record.nativeSlashCommand === 'true')
|
|
174
|
-
const portableRecords = closeableRecords.filter((record) => record.portableTextCommand === 'true')
|
|
175
|
-
const hostNames = [...new Set(closeableRecords.map((record) => record.host).filter(Boolean))]
|
|
176
|
-
const recordsHaveNoContradictoryClaims = records.every((record) => !(record.nativeSlashCommand === 'true' && (record.portableTextCommand === 'true' || record.generatedPointer === 'true')))
|
|
177
|
-
const acceptedRecordsAreSelfVerifying = records.every((record) => record.status !== 'accepted' || (record.ownerAcceptanceRequired === 'false' && Boolean(record.verificationCommand)))
|
|
178
|
-
const acceptedRecordsDoNotRelyOnGeneratedPointers = records.every((record) => record.status !== 'accepted' || record.generatedPointer !== 'true')
|
|
179
|
-
|
|
180
|
-
const checks = [
|
|
181
|
-
check('HRI01', 'host invocation record command exists', exists('scripts/record-host-invocation.mjs'), 'scripts/record-host-invocation.mjs'),
|
|
182
|
-
check('HRI02', 'host invocation record command writes a valid fixture record', readyRun.status === 0 && readyData?.status === 'written' && fs.existsSync(fixtureOut) && read(fixtureOut).includes('Host name: Codex'), 'record-host-invocation fixture write'),
|
|
183
|
-
check('HRI03', 'host invocation record command rejects missing required fields', missingRun.status !== 0 && missingData?.status === 'failed' && missingData?.errors?.some((item) => item.includes('--invocation-method')) && missingData?.errors?.some((item) => item.includes('--evidence-owner')), 'record-host-invocation missing-fields dry-run'),
|
|
184
|
-
check('HRI04', 'host invocation template preserves boundaries', read('assets/templates/host-ui-invocation-record.md').includes('Does this prove native slash-command support?') && read('assets/templates/host-ui-invocation-record.md').includes('Does this prove portable text-command routing only?'), 'assets/templates/host-ui-invocation-record.md'),
|
|
185
|
-
check('HRI05', 'host invocation readiness audit is wired into validator', read('scripts/validate-gse.mjs').includes('audit-host-runtime-invocations.mjs'), 'scripts/validate-gse.mjs'),
|
|
186
|
-
check('HRI06', 'existing host invocation records, if present, parse with required status fields', records.every((record) => record.host && record.status && record.nativeSlashCommand && record.portableTextCommand), records.length ? `${records.length} record(s)` : 'no persistent records yet'),
|
|
187
|
-
check('HRI07', 'record command rejects contradictory native and portable claims', contradictoryRun.status !== 0 && contradictoryData?.status === 'failed' && contradictoryData?.errors?.some((item) => item.includes('native slash-command records cannot also claim portable text-command routing')) && contradictoryData?.errors?.some((item) => item.includes('native slash-command records cannot rely on a generated pointer file')), 'record-host-invocation contradictory native/portable dry-run'),
|
|
188
|
-
check('HRI08', 'persistent host invocation records do not mix native proof with portable or generated-pointer proof', recordsHaveNoContradictoryClaims, records.length ? `${records.length} record(s)` : 'no persistent records yet'),
|
|
189
|
-
check('HRI09', 'accepted persistent host invocation records carry verification commands and no pending owner acceptance', acceptedRecordsAreSelfVerifying, records.length ? `${records.length} record(s)` : 'no persistent records yet'),
|
|
190
|
-
check('HRI10', 'accepted host invocation records do not rely on generated pointer proof', acceptedPointerRun.status !== 0 && acceptedPointerData?.status === 'failed' && acceptedPointerData?.errors?.some((item) => item.includes('accepted host invocation records must not rely on a generated pointer file')) && acceptedRecordsDoNotRelyOnGeneratedPointers, records.length ? `${records.length} record(s)` : 'record-host-invocation accepted pointer dry-run'),
|
|
191
|
-
]
|
|
192
|
-
|
|
193
|
-
fs.rmSync(fixture, { recursive: true, force: true })
|
|
194
|
-
|
|
195
|
-
const passed = checks.filter((item) => item.status === 'passed').length
|
|
196
|
-
const failed = checks.length - passed
|
|
197
|
-
const report = {
|
|
198
|
-
root,
|
|
199
|
-
recordsDir,
|
|
200
|
-
generatedAt: new Date().toISOString(),
|
|
201
|
-
summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
|
|
202
|
-
workflows: {
|
|
203
|
-
hostRuntimeInvocationRecords: failed === 0 ? 'verified' : 'failed',
|
|
204
|
-
realHostNativeSlashCommandRecords: nativeRecords.length,
|
|
205
|
-
realHostPortableTextCommandRecords: portableRecords.length,
|
|
206
|
-
},
|
|
207
|
-
inventory: {
|
|
208
|
-
records: records.length,
|
|
209
|
-
closeableRecords: closeableRecords.length,
|
|
210
|
-
hosts: hostNames,
|
|
211
|
-
nativeSlashCommandRecords: nativeRecords.length,
|
|
212
|
-
portableTextCommandRecords: portableRecords.length,
|
|
213
|
-
},
|
|
214
|
-
limits: [
|
|
215
|
-
'This audit verifies host invocation record mechanics and parses any persistent records under .gse/evidence/host-invocations.',
|
|
216
|
-
'It does not create runtime evidence for a host by itself.',
|
|
217
|
-
'Native slash-command support remains unverified for a host until a persistent verified or accepted record states native slash-command support true.',
|
|
218
|
-
],
|
|
219
|
-
checks,
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
function renderMarkdown(data) {
|
|
223
|
-
const lines = []
|
|
224
|
-
lines.push('# GSE Host Runtime Invocation Records Audit')
|
|
225
|
-
lines.push('')
|
|
226
|
-
lines.push('Generated: ' + data.generatedAt)
|
|
227
|
-
lines.push('Root: ' + data.root)
|
|
228
|
-
lines.push('')
|
|
229
|
-
lines.push('## Summary')
|
|
230
|
-
lines.push('')
|
|
231
|
-
lines.push('- Status: ' + data.summary.status)
|
|
232
|
-
lines.push('- Checks: ' + data.summary.passed + '/' + data.summary.total)
|
|
233
|
-
lines.push('- Records: ' + data.inventory.records)
|
|
234
|
-
lines.push('- Hosts: ' + (data.inventory.hosts.length ? data.inventory.hosts.join(', ') : 'none'))
|
|
235
|
-
lines.push('- Native slash-command records: ' + data.inventory.nativeSlashCommandRecords)
|
|
236
|
-
lines.push('- Portable text-command records: ' + data.inventory.portableTextCommandRecords)
|
|
237
|
-
lines.push('')
|
|
238
|
-
lines.push('## Checks')
|
|
239
|
-
lines.push('')
|
|
240
|
-
for (const item of data.checks) {
|
|
241
|
-
const marker = item.status === 'passed' ? '[x]' : '[ ]'
|
|
242
|
-
lines.push('- ' + marker + ' ' + item.id + ' ' + item.label + ': ' + item.evidence)
|
|
243
|
-
}
|
|
244
|
-
lines.push('')
|
|
245
|
-
lines.push('## Limits')
|
|
246
|
-
lines.push('')
|
|
247
|
-
for (const item of data.limits) lines.push('- ' + item)
|
|
248
|
-
return lines.join('\n') + '\n'
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
if (jsonOnly) console.log(JSON.stringify(report, null, 2))
|
|
252
|
-
else console.log(renderMarkdown(report))
|
|
253
|
-
|
|
254
|
-
if (failed > 0) process.exit(1)
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'node:fs'
|
|
3
|
+
import os from 'node:os'
|
|
4
|
+
import path from 'node:path'
|
|
5
|
+
import { spawnSync } from 'node:child_process'
|
|
6
|
+
|
|
7
|
+
const args = process.argv.slice(2)
|
|
8
|
+
|
|
9
|
+
function readArg(name, fallback = null) {
|
|
10
|
+
const index = args.indexOf(name)
|
|
11
|
+
if (index === -1) return fallback
|
|
12
|
+
return args[index + 1] ?? fallback
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const root = path.resolve(readArg('--root', path.join(import.meta.dirname, '..')))
|
|
16
|
+
const recordsDir = path.resolve(readArg('--records-dir', path.join(root, '.gse', 'evidence', 'host-invocations')))
|
|
17
|
+
const jsonOnly = args.includes('--json')
|
|
18
|
+
|
|
19
|
+
function read(relativePathOrFullPath) {
|
|
20
|
+
const fullPath = path.isAbsolute(relativePathOrFullPath) ? relativePathOrFullPath : path.join(root, relativePathOrFullPath)
|
|
21
|
+
return fs.existsSync(fullPath) ? fs.readFileSync(fullPath, 'utf8').replace(/^\uFEFF/, '') : ''
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function exists(relativePath) {
|
|
25
|
+
return fs.existsSync(path.join(root, relativePath))
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function check(id, label, ok, evidence, risk = '') {
|
|
29
|
+
return { id, label, status: ok ? 'passed' : 'failed', evidence, risk }
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function run(commandArgs) {
|
|
33
|
+
const result = spawnSync(process.execPath, [path.join(root, 'scripts', 'record-host-invocation.mjs'), ...commandArgs], {
|
|
34
|
+
cwd: root,
|
|
35
|
+
encoding: 'utf8',
|
|
36
|
+
windowsHide: true,
|
|
37
|
+
})
|
|
38
|
+
return {
|
|
39
|
+
status: result.status ?? 1,
|
|
40
|
+
stdout: (result.stdout ?? '').trim(),
|
|
41
|
+
stderr: (result.stderr ?? '').trim(),
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function parseJson(text) {
|
|
46
|
+
try {
|
|
47
|
+
return JSON.parse(text)
|
|
48
|
+
} catch {
|
|
49
|
+
return null
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function listRecords(dir) {
|
|
54
|
+
if (!fs.existsSync(dir)) return []
|
|
55
|
+
return fs.readdirSync(dir)
|
|
56
|
+
.filter((item) => item.endsWith('.md'))
|
|
57
|
+
.map((item) => path.join(dir, item))
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function parseRecord(filePath) {
|
|
61
|
+
const text = read(filePath)
|
|
62
|
+
const field = (label) => {
|
|
63
|
+
const prefix = label.endsWith('?') ? '- ' + label + ' ' : '- ' + label + ':'
|
|
64
|
+
const line = text.split(/\r?\n/).find((item) => item.trimStart().startsWith(prefix))
|
|
65
|
+
return line ? line.slice(line.indexOf(prefix) + prefix.length).trim() : ''
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
filePath,
|
|
69
|
+
text,
|
|
70
|
+
host: field('Host name'),
|
|
71
|
+
status: field('Status'),
|
|
72
|
+
nativeSlashCommand: field('Does this prove native slash-command support?'),
|
|
73
|
+
portableTextCommand: field('Does this prove portable text-command routing only?'),
|
|
74
|
+
generatedPointer: field('Does this rely on a generated pointer file?'),
|
|
75
|
+
ownerAcceptanceRequired: field('Does this require owner acceptance before being called trusted?'),
|
|
76
|
+
verificationCommand: field('Verification command'),
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const fixture = fs.mkdtempSync(path.join(os.tmpdir(), 'gse-host-invocation-audit-'))
|
|
81
|
+
const fixtureOut = path.join(fixture, 'codex-record.md')
|
|
82
|
+
const readyRun = run([
|
|
83
|
+
'--root',
|
|
84
|
+
root,
|
|
85
|
+
'--host',
|
|
86
|
+
'Codex',
|
|
87
|
+
'--host-version',
|
|
88
|
+
'fixture',
|
|
89
|
+
'--project',
|
|
90
|
+
'GSE fixture',
|
|
91
|
+
'--adapter-path',
|
|
92
|
+
'.codex/gse-command.md',
|
|
93
|
+
'--invocation-method',
|
|
94
|
+
'background-thread text command',
|
|
95
|
+
'--command',
|
|
96
|
+
'/gse help',
|
|
97
|
+
'--status',
|
|
98
|
+
'verified',
|
|
99
|
+
'--evidence-owner',
|
|
100
|
+
'fixture audit',
|
|
101
|
+
'--evidence',
|
|
102
|
+
'fixture transcript',
|
|
103
|
+
'--portable-text-command',
|
|
104
|
+
'true',
|
|
105
|
+
'--native-slash-command',
|
|
106
|
+
'false',
|
|
107
|
+
'--generated-pointer',
|
|
108
|
+
'true',
|
|
109
|
+
'--owner-acceptance-required',
|
|
110
|
+
'false',
|
|
111
|
+
'--out',
|
|
112
|
+
fixtureOut,
|
|
113
|
+
'--json',
|
|
114
|
+
])
|
|
115
|
+
const readyData = parseJson(readyRun.stdout)
|
|
116
|
+
const missingRun = run(['--root', root, '--host', 'Codex', '--dry-run', '--json'])
|
|
117
|
+
const missingData = parseJson(missingRun.stdout)
|
|
118
|
+
const contradictoryRun = run([
|
|
119
|
+
'--root',
|
|
120
|
+
root,
|
|
121
|
+
'--host',
|
|
122
|
+
'Codex',
|
|
123
|
+
'--invocation-method',
|
|
124
|
+
'native slash command',
|
|
125
|
+
'--status',
|
|
126
|
+
'accepted',
|
|
127
|
+
'--evidence-owner',
|
|
128
|
+
'fixture audit',
|
|
129
|
+
'--evidence',
|
|
130
|
+
'fixture transcript',
|
|
131
|
+
'--native-slash-command',
|
|
132
|
+
'true',
|
|
133
|
+
'--portable-text-command',
|
|
134
|
+
'true',
|
|
135
|
+
'--generated-pointer',
|
|
136
|
+
'true',
|
|
137
|
+
'--owner-acceptance-required',
|
|
138
|
+
'false',
|
|
139
|
+
'--dry-run',
|
|
140
|
+
'--json',
|
|
141
|
+
])
|
|
142
|
+
const contradictoryData = parseJson(contradictoryRun.stdout)
|
|
143
|
+
const acceptedPointerRun = run([
|
|
144
|
+
'--root',
|
|
145
|
+
root,
|
|
146
|
+
'--host',
|
|
147
|
+
'Generic pointer host',
|
|
148
|
+
'--invocation-method',
|
|
149
|
+
'generated pointer',
|
|
150
|
+
'--status',
|
|
151
|
+
'accepted',
|
|
152
|
+
'--evidence-owner',
|
|
153
|
+
'fixture audit',
|
|
154
|
+
'--evidence',
|
|
155
|
+
'fixture transcript',
|
|
156
|
+
'--verification-command',
|
|
157
|
+
'node scripts/audit-final-readiness.mjs --root __GSE__ --json',
|
|
158
|
+
'--native-slash-command',
|
|
159
|
+
'false',
|
|
160
|
+
'--portable-text-command',
|
|
161
|
+
'false',
|
|
162
|
+
'--generated-pointer',
|
|
163
|
+
'true',
|
|
164
|
+
'--owner-acceptance-required',
|
|
165
|
+
'false',
|
|
166
|
+
'--dry-run',
|
|
167
|
+
'--json',
|
|
168
|
+
])
|
|
169
|
+
const acceptedPointerData = parseJson(acceptedPointerRun.stdout)
|
|
170
|
+
|
|
171
|
+
const records = listRecords(recordsDir).map(parseRecord)
|
|
172
|
+
const closeableRecords = records.filter((record) => ['verified', 'accepted'].includes(record.status))
|
|
173
|
+
const nativeRecords = closeableRecords.filter((record) => record.nativeSlashCommand === 'true')
|
|
174
|
+
const portableRecords = closeableRecords.filter((record) => record.portableTextCommand === 'true')
|
|
175
|
+
const hostNames = [...new Set(closeableRecords.map((record) => record.host).filter(Boolean))]
|
|
176
|
+
const recordsHaveNoContradictoryClaims = records.every((record) => !(record.nativeSlashCommand === 'true' && (record.portableTextCommand === 'true' || record.generatedPointer === 'true')))
|
|
177
|
+
const acceptedRecordsAreSelfVerifying = records.every((record) => record.status !== 'accepted' || (record.ownerAcceptanceRequired === 'false' && Boolean(record.verificationCommand)))
|
|
178
|
+
const acceptedRecordsDoNotRelyOnGeneratedPointers = records.every((record) => record.status !== 'accepted' || record.generatedPointer !== 'true')
|
|
179
|
+
|
|
180
|
+
const checks = [
|
|
181
|
+
check('HRI01', 'host invocation record command exists', exists('scripts/record-host-invocation.mjs'), 'scripts/record-host-invocation.mjs'),
|
|
182
|
+
check('HRI02', 'host invocation record command writes a valid fixture record', readyRun.status === 0 && readyData?.status === 'written' && fs.existsSync(fixtureOut) && read(fixtureOut).includes('Host name: Codex'), 'record-host-invocation fixture write'),
|
|
183
|
+
check('HRI03', 'host invocation record command rejects missing required fields', missingRun.status !== 0 && missingData?.status === 'failed' && missingData?.errors?.some((item) => item.includes('--invocation-method')) && missingData?.errors?.some((item) => item.includes('--evidence-owner')), 'record-host-invocation missing-fields dry-run'),
|
|
184
|
+
check('HRI04', 'host invocation template preserves boundaries', read('assets/templates/host-ui-invocation-record.md').includes('Does this prove native slash-command support?') && read('assets/templates/host-ui-invocation-record.md').includes('Does this prove portable text-command routing only?'), 'assets/templates/host-ui-invocation-record.md'),
|
|
185
|
+
check('HRI05', 'host invocation readiness audit is wired into validator', read('scripts/validate-gse.mjs').includes('audit-host-runtime-invocations.mjs'), 'scripts/validate-gse.mjs'),
|
|
186
|
+
check('HRI06', 'existing host invocation records, if present, parse with required status fields', records.every((record) => record.host && record.status && record.nativeSlashCommand && record.portableTextCommand), records.length ? `${records.length} record(s)` : 'no persistent records yet'),
|
|
187
|
+
check('HRI07', 'record command rejects contradictory native and portable claims', contradictoryRun.status !== 0 && contradictoryData?.status === 'failed' && contradictoryData?.errors?.some((item) => item.includes('native slash-command records cannot also claim portable text-command routing')) && contradictoryData?.errors?.some((item) => item.includes('native slash-command records cannot rely on a generated pointer file')), 'record-host-invocation contradictory native/portable dry-run'),
|
|
188
|
+
check('HRI08', 'persistent host invocation records do not mix native proof with portable or generated-pointer proof', recordsHaveNoContradictoryClaims, records.length ? `${records.length} record(s)` : 'no persistent records yet'),
|
|
189
|
+
check('HRI09', 'accepted persistent host invocation records carry verification commands and no pending owner acceptance', acceptedRecordsAreSelfVerifying, records.length ? `${records.length} record(s)` : 'no persistent records yet'),
|
|
190
|
+
check('HRI10', 'accepted host invocation records do not rely on generated pointer proof', acceptedPointerRun.status !== 0 && acceptedPointerData?.status === 'failed' && acceptedPointerData?.errors?.some((item) => item.includes('accepted host invocation records must not rely on a generated pointer file')) && acceptedRecordsDoNotRelyOnGeneratedPointers, records.length ? `${records.length} record(s)` : 'record-host-invocation accepted pointer dry-run'),
|
|
191
|
+
]
|
|
192
|
+
|
|
193
|
+
fs.rmSync(fixture, { recursive: true, force: true })
|
|
194
|
+
|
|
195
|
+
const passed = checks.filter((item) => item.status === 'passed').length
|
|
196
|
+
const failed = checks.length - passed
|
|
197
|
+
const report = {
|
|
198
|
+
root,
|
|
199
|
+
recordsDir,
|
|
200
|
+
generatedAt: new Date().toISOString(),
|
|
201
|
+
summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
|
|
202
|
+
workflows: {
|
|
203
|
+
hostRuntimeInvocationRecords: failed === 0 ? 'verified' : 'failed',
|
|
204
|
+
realHostNativeSlashCommandRecords: nativeRecords.length,
|
|
205
|
+
realHostPortableTextCommandRecords: portableRecords.length,
|
|
206
|
+
},
|
|
207
|
+
inventory: {
|
|
208
|
+
records: records.length,
|
|
209
|
+
closeableRecords: closeableRecords.length,
|
|
210
|
+
hosts: hostNames,
|
|
211
|
+
nativeSlashCommandRecords: nativeRecords.length,
|
|
212
|
+
portableTextCommandRecords: portableRecords.length,
|
|
213
|
+
},
|
|
214
|
+
limits: [
|
|
215
|
+
'This audit verifies host invocation record mechanics and parses any persistent records under .gse/evidence/host-invocations.',
|
|
216
|
+
'It does not create runtime evidence for a host by itself.',
|
|
217
|
+
'Native slash-command support remains unverified for a host until a persistent verified or accepted record states native slash-command support true.',
|
|
218
|
+
],
|
|
219
|
+
checks,
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function renderMarkdown(data) {
|
|
223
|
+
const lines = []
|
|
224
|
+
lines.push('# GSE Host Runtime Invocation Records Audit')
|
|
225
|
+
lines.push('')
|
|
226
|
+
lines.push('Generated: ' + data.generatedAt)
|
|
227
|
+
lines.push('Root: ' + data.root)
|
|
228
|
+
lines.push('')
|
|
229
|
+
lines.push('## Summary')
|
|
230
|
+
lines.push('')
|
|
231
|
+
lines.push('- Status: ' + data.summary.status)
|
|
232
|
+
lines.push('- Checks: ' + data.summary.passed + '/' + data.summary.total)
|
|
233
|
+
lines.push('- Records: ' + data.inventory.records)
|
|
234
|
+
lines.push('- Hosts: ' + (data.inventory.hosts.length ? data.inventory.hosts.join(', ') : 'none'))
|
|
235
|
+
lines.push('- Native slash-command records: ' + data.inventory.nativeSlashCommandRecords)
|
|
236
|
+
lines.push('- Portable text-command records: ' + data.inventory.portableTextCommandRecords)
|
|
237
|
+
lines.push('')
|
|
238
|
+
lines.push('## Checks')
|
|
239
|
+
lines.push('')
|
|
240
|
+
for (const item of data.checks) {
|
|
241
|
+
const marker = item.status === 'passed' ? '[x]' : '[ ]'
|
|
242
|
+
lines.push('- ' + marker + ' ' + item.id + ' ' + item.label + ': ' + item.evidence)
|
|
243
|
+
}
|
|
244
|
+
lines.push('')
|
|
245
|
+
lines.push('## Limits')
|
|
246
|
+
lines.push('')
|
|
247
|
+
for (const item of data.limits) lines.push('- ' + item)
|
|
248
|
+
return lines.join('\n') + '\n'
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (jsonOnly) console.log(JSON.stringify(report, null, 2))
|
|
252
|
+
else console.log(renderMarkdown(report))
|
|
253
|
+
|
|
254
|
+
if (failed > 0) process.exit(1)
|