@peac/cli 0.13.4 → 0.14.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/dist/commands/emit-lifecycle.d.ts +140 -0
- package/dist/commands/emit-lifecycle.d.ts.map +1 -0
- package/dist/commands/observe-command.d.ts +135 -0
- package/dist/commands/observe-command.d.ts.map +1 -0
- package/dist/commands/record-command.d.ts +102 -0
- package/dist/commands/record-command.d.ts.map +1 -0
- package/dist/index.cjs +1922 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1930 -10
- package/dist/index.mjs.map +1 -1
- package/dist/lib/capture.d.ts +118 -0
- package/dist/lib/capture.d.ts.map +1 -0
- package/dist/lib/cli-limits.d.ts +49 -0
- package/dist/lib/cli-limits.d.ts.map +1 -0
- package/dist/lib/command-option-validation.d.ts +94 -0
- package/dist/lib/command-option-validation.d.ts.map +1 -0
- package/dist/lib/issuer-key-loader.d.ts +56 -0
- package/dist/lib/issuer-key-loader.d.ts.map +1 -0
- package/dist/lib/observation-builder.d.ts +79 -0
- package/dist/lib/observation-builder.d.ts.map +1 -0
- package/dist/lib/observation-pipeline.d.ts +96 -0
- package/dist/lib/observation-pipeline.d.ts.map +1 -0
- package/dist/lib/output-preflight.d.ts +28 -0
- package/dist/lib/output-preflight.d.ts.map +1 -0
- package/dist/lib/secret-scan.d.ts +35 -0
- package/dist/lib/secret-scan.d.ts.map +1 -0
- package/package.json +8 -8
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `peac emit lifecycle` subcommand.
|
|
3
|
+
*
|
|
4
|
+
* Issues a Wire 0.2 compact JWS lifecycle observation record from
|
|
5
|
+
* caller-supplied flags. The caller observed the lifecycle event (an
|
|
6
|
+
* external approval, evaluation, experiment, workflow transition, or
|
|
7
|
+
* mode tag); the CLI is the issuance path; the caller's issuer is the
|
|
8
|
+
* signer-of-record. PEAC provides the record format, validation, and
|
|
9
|
+
* signing path. PEAC does not capture, observe, decide, evaluate,
|
|
10
|
+
* score, transition, orchestrate, schedule, or vouch for the truth of
|
|
11
|
+
* the event.
|
|
12
|
+
*
|
|
13
|
+
* Signing UX uses the existing PEAC issuer-key reference convention
|
|
14
|
+
* (mirrors `peac record command`):
|
|
15
|
+
*
|
|
16
|
+
* --issuer-key <env:VAR | file:/path>
|
|
17
|
+
* --issuer-id <url>
|
|
18
|
+
* --unsafe-ephemeral-key
|
|
19
|
+
*
|
|
20
|
+
* `--observed-at` is REQUIRED. The wrapper does not silently default the
|
|
21
|
+
* external event time to the wrapper-invocation time; that would
|
|
22
|
+
* misrepresent when the external system observed the event.
|
|
23
|
+
*
|
|
24
|
+
* Stable error codes:
|
|
25
|
+
* lifecycle.missing_required_field (missing flag for required field)
|
|
26
|
+
* lifecycle.event_kind_unknown (--event-kind not in the 9 enum)
|
|
27
|
+
* lifecycle.invalid_observed_at (--observed-at not RFC 3339)
|
|
28
|
+
* lifecycle.opaque_ref_grammar_violation
|
|
29
|
+
* lifecycle.approver_ref_pii_blocked
|
|
30
|
+
* lifecycle.ref_must_be_string
|
|
31
|
+
* lifecycle.inline_value_blocked
|
|
32
|
+
* cli.issuer_key_required (no signing input supplied)
|
|
33
|
+
* cli.issuer_id_required
|
|
34
|
+
* cli.issuer_id_invalid
|
|
35
|
+
* cli.unsafe_ephemeral_key_mutex (--issuer-key and --unsafe-ephemeral-key both supplied)
|
|
36
|
+
* cli.issuer_key_load_failed (from the shared issuer-key loader)
|
|
37
|
+
* cli.issuer_key_invalid (from the shared issuer-key loader)
|
|
38
|
+
* cli.signing_failed
|
|
39
|
+
* cli.output_write_failed
|
|
40
|
+
*/
|
|
41
|
+
import { Command } from 'commander';
|
|
42
|
+
import { type LifecycleEventKind } from '@peac/schema';
|
|
43
|
+
/**
|
|
44
|
+
* Discriminator literal -> canonical record-type URI. The two arrays move
|
|
45
|
+
* together; this is a defense-in-depth check.
|
|
46
|
+
*/
|
|
47
|
+
declare const EVENT_KINDS: readonly LifecycleEventKind[];
|
|
48
|
+
declare const TYPE_URI_BY_EVENT_KIND: Readonly<Record<LifecycleEventKind, string>>;
|
|
49
|
+
declare const OBSERVED_MODES: readonly ["deterministic_script", "templated_flow", "agent_loop", "human_step", "hybrid"];
|
|
50
|
+
type ObservedMode = (typeof OBSERVED_MODES)[number];
|
|
51
|
+
export declare const EMIT_LIFECYCLE_ERROR_CODES: {
|
|
52
|
+
readonly missingRequiredField: "lifecycle.missing_required_field";
|
|
53
|
+
readonly eventKindUnknown: "lifecycle.event_kind_unknown";
|
|
54
|
+
readonly invalidObservedAt: "lifecycle.invalid_observed_at";
|
|
55
|
+
readonly invalidObservedMode: "lifecycle.invalid_observed_mode";
|
|
56
|
+
readonly invalidState: "lifecycle.invalid_state";
|
|
57
|
+
readonly issuerKeyRequired: "cli.issuer_key_required";
|
|
58
|
+
readonly issuerIdRequired: "cli.issuer_id_required";
|
|
59
|
+
readonly issuerIdInvalid: "cli.issuer_id_invalid";
|
|
60
|
+
readonly unsafeEphemeralKeyMutex: "cli.unsafe_ephemeral_key_mutex";
|
|
61
|
+
readonly issuerKeyLoadFailed: "cli.issuer_key_load_failed";
|
|
62
|
+
readonly issuerKeyInvalid: "cli.issuer_key_invalid";
|
|
63
|
+
readonly signingFailed: "cli.signing_failed";
|
|
64
|
+
readonly outputWriteFailed: "cli.output_write_failed";
|
|
65
|
+
};
|
|
66
|
+
export interface EmitLifecycleOptions {
|
|
67
|
+
eventKind?: string;
|
|
68
|
+
subjectRef?: string;
|
|
69
|
+
parentRef?: string;
|
|
70
|
+
upstreamArtifactRef?: string;
|
|
71
|
+
upstreamArtifactDigest?: string;
|
|
72
|
+
policyRef?: string;
|
|
73
|
+
policyDigest?: string;
|
|
74
|
+
rubricRef?: string;
|
|
75
|
+
approvalRef?: string;
|
|
76
|
+
approverRef?: string;
|
|
77
|
+
experimentRef?: string;
|
|
78
|
+
cohortRef?: string;
|
|
79
|
+
variantRef?: string;
|
|
80
|
+
observedMode?: string;
|
|
81
|
+
resultRef?: string;
|
|
82
|
+
resultDigest?: string;
|
|
83
|
+
scoreRef?: string;
|
|
84
|
+
fromState?: string;
|
|
85
|
+
toState?: string;
|
|
86
|
+
observedAt?: string;
|
|
87
|
+
issuerKey?: string;
|
|
88
|
+
issuerId?: string;
|
|
89
|
+
unsafeEphemeralKey: boolean;
|
|
90
|
+
output: string;
|
|
91
|
+
}
|
|
92
|
+
export interface EmitLifecycleIO {
|
|
93
|
+
writeStdout: (chunk: string) => void;
|
|
94
|
+
writeStderr: (chunk: string) => void;
|
|
95
|
+
/**
|
|
96
|
+
* Environment used to resolve `env:VAR` issuer-key references.
|
|
97
|
+
* Defaults to `process.env`. Tests inject custom env.
|
|
98
|
+
*/
|
|
99
|
+
issuerKeyEnv: NodeJS.ProcessEnv;
|
|
100
|
+
}
|
|
101
|
+
export interface EmitLifecycleResult {
|
|
102
|
+
exitCode: number;
|
|
103
|
+
}
|
|
104
|
+
interface ValidationFailure {
|
|
105
|
+
code: string;
|
|
106
|
+
message: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Validate flag combinations BEFORE building the observation, loading
|
|
110
|
+
* the key, or signing. Surfaces stable codes that match the schema's
|
|
111
|
+
* lifecycle.* codes for schema-domain failures.
|
|
112
|
+
*/
|
|
113
|
+
export declare function validateEmitLifecycleOptions(opts: EmitLifecycleOptions): ValidationFailure[];
|
|
114
|
+
/**
|
|
115
|
+
* Build the lifecycle observation object from validated CLI options.
|
|
116
|
+
* Only fields populated by flags are included; the schema validator
|
|
117
|
+
* accepts the discriminated-union shape per event_kind.
|
|
118
|
+
*/
|
|
119
|
+
export declare function buildLifecycleObservation(opts: EmitLifecycleOptions): Record<string, unknown>;
|
|
120
|
+
/**
|
|
121
|
+
* Pure handler: validates flags, preflights output and key, builds the
|
|
122
|
+
* observation, validates against the schema, signs as Wire 0.2 JWS, emits.
|
|
123
|
+
* Tests drive this directly without going through commander.
|
|
124
|
+
*/
|
|
125
|
+
export declare function runEmitLifecycle(options: Partial<EmitLifecycleOptions>, io?: Partial<EmitLifecycleIO>): Promise<EmitLifecycleResult>;
|
|
126
|
+
/**
|
|
127
|
+
* Commander factory for the `lifecycle` subcommand under the `emit`
|
|
128
|
+
* parent group. Wires --flag parsing and delegates to the pure handler.
|
|
129
|
+
*/
|
|
130
|
+
export declare function emitLifecycleSubcommand(): Command;
|
|
131
|
+
/**
|
|
132
|
+
* Commander factory for the public `peac emit` parent group. Adds the
|
|
133
|
+
* `lifecycle` subcommand. Additional `emit` subcommands can be
|
|
134
|
+
* registered by their own profiles.
|
|
135
|
+
*/
|
|
136
|
+
export declare function emitCommand(): Command;
|
|
137
|
+
/** Re-exports for tests. */
|
|
138
|
+
export { TYPE_URI_BY_EVENT_KIND, EVENT_KINDS, OBSERVED_MODES };
|
|
139
|
+
export type { ObservedMode };
|
|
140
|
+
//# sourceMappingURL=emit-lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit-lifecycle.d.ts","sourceRoot":"","sources":["../../src/commands/emit-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAKL,KAAK,kBAAkB,EAExB,MAAM,cAAc,CAAC;AAWtB;;;GAGG;AACH,QAAA,MAAM,WAAW,EAAE,SAAS,kBAAkB,EAUpC,CAAC;AAEX,QAAA,MAAM,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAarE,CAAC;AAEL,QAAA,MAAM,cAAc,2FAMV,CAAC;AACX,KAAK,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpD,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;CAc7B,CAAC;AAEX,MAAM,WAAW,oBAAoB;IACnC,SAAS,CAAC,EAAE,MAAM,C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AAC,IAAI,EAAE,oBAAoB,GAAG,iBAAiB,EAAE,CAmL5F;AA0CD;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAmD7F;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,OAAO,CAAC,oBAAoB,CAAC,EACtC,EAAE,GAAE,OAAO,CAAC,eAAe,CAAM,GAChC,OAAO,CAAC,mBAAmB,CAAC,CA8E9B;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,OAAO,CAwGjD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAMrC;AAED,4BAA4B;AAC5B,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;AAC/D,YAAY,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `peac observe command` subcommand.
|
|
3
|
+
*
|
|
4
|
+
* Wraps a child process and emits an unsigned CLI execution observation
|
|
5
|
+
* record to stdout (or `--output <file>`). Hard security defaults:
|
|
6
|
+
* - argv hashed
|
|
7
|
+
* - stdout/stderr length + sha256 + truncated only (no sample without
|
|
8
|
+
* double-opt-in raw mode)
|
|
9
|
+
* - stdin closed (none)
|
|
10
|
+
* - env capture deny-by-default
|
|
11
|
+
* - cwd hashed; binary path hashed
|
|
12
|
+
* - secret-scan on
|
|
13
|
+
* - shell binary detected without --shell-mode hard-fails
|
|
14
|
+
*
|
|
15
|
+
* The wrapper is an OBSERVER, not a sandbox / permission system / shell
|
|
16
|
+
* orchestrator / process supervisor / job scheduler. It does not
|
|
17
|
+
* synthesize shell syntax; the command after `--` is spawned exactly as
|
|
18
|
+
* supplied with `shell: false`.
|
|
19
|
+
*/
|
|
20
|
+
import { Command } from 'commander';
|
|
21
|
+
import { preflightOutputWritable, resolveProgramPath, runObservationCore, type CoreObservationOptions, type CoreObservationIO } from '../lib/observation-pipeline.js';
|
|
22
|
+
import { type ValidationFailure } from '../lib/command-option-validation.js';
|
|
23
|
+
import type { ArgvMode, CwdMode, BinaryPathMode, EnvMode, StdinMode, ExitCodeMode, ExecutionMode } from '../lib/observation-builder.js';
|
|
24
|
+
export { preflightOutputWritable, resolveProgramPath, runObservationCore };
|
|
25
|
+
export type { CoreObservationOptions, CoreObservationIO };
|
|
26
|
+
/**
|
|
27
|
+
* Stable error codes surfaced to the user via stderr + non-zero exit.
|
|
28
|
+
* Mirrors the shared `COMMAND_OPTION_ERROR_CODES` set plus a few
|
|
29
|
+
* subcommand-specific codes (spawn-failed, schema-rejection,
|
|
30
|
+
* output-write-failed) that originate inside `runObservationCore` or
|
|
31
|
+
* the emit step rather than the option-validation layer.
|
|
32
|
+
*/
|
|
33
|
+
export declare const OBSERVE_COMMAND_ERROR_CODES: {
|
|
34
|
+
readonly envModeInconsistent: "cli.env_mode_inconsistent";
|
|
35
|
+
readonly schemaRejection: "cli.schema_rejection";
|
|
36
|
+
readonly unsupportedFlag: "cli.unsupported_flag";
|
|
37
|
+
readonly spawnFailed: "cli.spawn_failed";
|
|
38
|
+
readonly outputWriteFailed: "cli.output_write_failed";
|
|
39
|
+
readonly programRequired: "cli.program_required";
|
|
40
|
+
readonly unsafeFlagRequired: "cli.unsafe_flag_required";
|
|
41
|
+
readonly secretScanDisableRequiresUnsafeFlag: "cli.secret_scan_disable_requires_unsafe_flag";
|
|
42
|
+
readonly shellModeRequired: "cli.shell_mode_required";
|
|
43
|
+
readonly argvTokenTooLong: "cli.argv_token_too_long";
|
|
44
|
+
readonly outOfRange: "cli.out_of_range";
|
|
45
|
+
readonly invalidPolicyDigest: "cli.invalid_policy_digest";
|
|
46
|
+
readonly invalidConfigDigest: "cli.invalid_config_digest";
|
|
47
|
+
readonly invalidApprovalRef: "cli.invalid_approval_ref";
|
|
48
|
+
readonly invalidEnvKey: "cli.invalid_env_key";
|
|
49
|
+
readonly signingInputRequired: "cli.signing_input_required";
|
|
50
|
+
readonly signingInputConflict: "cli.signing_input_conflict";
|
|
51
|
+
readonly issuerIdRequired: "cli.issuer_id_required";
|
|
52
|
+
readonly issuerIdInvalid: "cli.issuer_id_invalid";
|
|
53
|
+
};
|
|
54
|
+
export interface ObserveCommandOptions {
|
|
55
|
+
/** Resolved CLI flag values; tests construct this directly. */
|
|
56
|
+
captureMode: ArgvMode;
|
|
57
|
+
unsafeAllowRawCapture: boolean;
|
|
58
|
+
captureStdinMode: StdinMode;
|
|
59
|
+
captureStdoutBytes: number;
|
|
60
|
+
captureStderrBytes: number;
|
|
61
|
+
captureArgvBytes: number;
|
|
62
|
+
envAllow: string[];
|
|
63
|
+
envMode: EnvMode;
|
|
64
|
+
unsafeAllowRawEnv: boolean;
|
|
65
|
+
captureCwdMode: CwdMode;
|
|
66
|
+
captureBinaryPath: BinaryPathMode;
|
|
67
|
+
secretScan: boolean;
|
|
68
|
+
unsafeDisableSecretScan: boolean;
|
|
69
|
+
policyDigest?: string;
|
|
70
|
+
configDigest?: string;
|
|
71
|
+
approvalRef?: string;
|
|
72
|
+
executionMode: ExecutionMode;
|
|
73
|
+
shellMode: boolean;
|
|
74
|
+
output: string;
|
|
75
|
+
timeoutMs: number;
|
|
76
|
+
killGraceMs: number;
|
|
77
|
+
exitCodeMode: ExitCodeMode;
|
|
78
|
+
}
|
|
79
|
+
export interface ObserveCommandIO {
|
|
80
|
+
/** Defaults to process.stdout.write. */
|
|
81
|
+
writeStdout: (chunk: string) => void;
|
|
82
|
+
/** Defaults to process.stderr.write. */
|
|
83
|
+
writeStderr: (chunk: string) => void;
|
|
84
|
+
/**
|
|
85
|
+
* Environment passed to the child process. Defaults to process.env.
|
|
86
|
+
* Distinct from `captureEnv` so env-capture policy (what PEAC RECORDS)
|
|
87
|
+
* stays decoupled from execution env (what the child RECEIVES).
|
|
88
|
+
*/
|
|
89
|
+
childEnv: NodeJS.ProcessEnv;
|
|
90
|
+
/**
|
|
91
|
+
* Environment inspected by --env-allow for record entries. Defaults
|
|
92
|
+
* to process.env. Tests override either side independently.
|
|
93
|
+
*/
|
|
94
|
+
captureEnv: NodeJS.ProcessEnv;
|
|
95
|
+
/** Defaults to process.cwd(). */
|
|
96
|
+
cwd: string;
|
|
97
|
+
/** Defaults to a tiny version constant. */
|
|
98
|
+
peacCliVersion: string;
|
|
99
|
+
}
|
|
100
|
+
export interface ObserveCommandResult {
|
|
101
|
+
exitCode: number;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Commander integer flag parser that surfaces NaN / non-integer input
|
|
105
|
+
* as `Number.NaN` instead of silently coercing. The shared option
|
|
106
|
+
* validator rejects NaN via `isValidIntInRange` and emits
|
|
107
|
+
* `cli.out_of_range`.
|
|
108
|
+
*/
|
|
109
|
+
export declare function parseIntegerFlag(raw: string): number;
|
|
110
|
+
/**
|
|
111
|
+
* Validate flag combinations BEFORE spawning the child. Delegates to
|
|
112
|
+
* `validateCoreCommandOptions` so observe command and record command
|
|
113
|
+
* share one source of truth for option validation.
|
|
114
|
+
*/
|
|
115
|
+
export declare function validateObserveOptions(opts: ObserveCommandOptions, childArgv: string[]): ValidationFailure[];
|
|
116
|
+
/**
|
|
117
|
+
* Pure handler: validates flags, runs the child, builds the
|
|
118
|
+
* observation, validates against the schema, emits JSON. Tests drive
|
|
119
|
+
* this directly without going through commander.
|
|
120
|
+
*/
|
|
121
|
+
export declare function runObserveCommand(options: Partial<ObserveCommandOptions>, childArgv: string[], io?: Partial<ObserveCommandIO>): Promise<ObserveCommandResult>;
|
|
122
|
+
/**
|
|
123
|
+
* Commander factory for the inner `command` subcommand of the
|
|
124
|
+
* `peac observe` group. Wires --flag parsing and delegates to the pure
|
|
125
|
+
* handler. Public invocation: `peac observe command -- <program> [args...]`.
|
|
126
|
+
*/
|
|
127
|
+
export declare function observeCommandSubcommand(): Command;
|
|
128
|
+
/**
|
|
129
|
+
* Commander factory for the public `peac observe` parent group. Adds
|
|
130
|
+
* the `command` subcommand. Future observation surfaces (e.g.,
|
|
131
|
+
* `peac observe mcp`, `peac observe http`) attach here without
|
|
132
|
+
* widening the verb namespace.
|
|
133
|
+
*/
|
|
134
|
+
export declare function observeCommand(): Command;
|
|
135
|
+
//# sourceMappingURL=observe-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observe-command.d.ts","sourceRoot":"","sources":["../../src/commands/observe-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAG5C,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACvB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EACV,QAAQ,EACR,OAAO,EACP,cAAc,EACd,OAAO,EACP,SAAS,EACT,YAAY,EACZ,aAAa,EACd,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAC;AAC3E,YAAY,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,CAAC;AAgB1D;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;CAO9B,CAAC;AAEX,MAAM,WAAW,qBAAqB;IACpC,+DAA+D;IAC/D,WAAW,EAAE,QAAQ,CAAC;IACtB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,gBAAgB,EAAE,SAAS,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,cAAc,EAAE,O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AoB,CAAC,CA4D/B;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CA4JlD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAMxC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `peac record command` subcommand.
|
|
3
|
+
*
|
|
4
|
+
* Wraps a child process and emits a Wire 0.2 compact JWS containing
|
|
5
|
+
* the same `org.peacprotocol/cli-execution` observation as
|
|
6
|
+
* `observe command`, signed by the supplied issuer key. Reuses the
|
|
7
|
+
* shared capture / build / validate pipeline from
|
|
8
|
+
* `lib/observation-pipeline.ts` so a record produced by record command
|
|
9
|
+
* is identical to one from observe command (modulo the outer signing
|
|
10
|
+
* envelope).
|
|
11
|
+
*
|
|
12
|
+
* Signing UX uses the existing PEAC issuer-key reference convention:
|
|
13
|
+
*
|
|
14
|
+
* --issuer-key <env:VAR | file:/path>
|
|
15
|
+
* --issuer-id <url>
|
|
16
|
+
* --unsafe-ephemeral-key
|
|
17
|
+
*
|
|
18
|
+
* The wrapper is an OBSERVER, not a sandbox / permission system /
|
|
19
|
+
* shell orchestrator / process supervisor / job scheduler. PEAC does
|
|
20
|
+
* NOT publish or distribute the issuer key; --unsafe-ephemeral-key
|
|
21
|
+
* produces a structurally valid record whose public key is not
|
|
22
|
+
* published through normal issuer-key discovery (use only for local
|
|
23
|
+
* development and tests).
|
|
24
|
+
*/
|
|
25
|
+
import { Command } from 'commander';
|
|
26
|
+
import { type ObserveCommandOptions } from './observe-command.js';
|
|
27
|
+
import { type ValidationFailure } from '../lib/command-option-validation.js';
|
|
28
|
+
/**
|
|
29
|
+
* Stable error codes surfaced before the child runs OR after signing
|
|
30
|
+
* fails. Inherits the shared option-validation set so observe command
|
|
31
|
+
* and record command never disagree on validation-layer codes.
|
|
32
|
+
*/
|
|
33
|
+
export declare const RECORD_COMMAND_ERROR_CODES: {
|
|
34
|
+
readonly outputWriteFailed: "cli.output_write_failed";
|
|
35
|
+
readonly issuerKeyLoadFailed: "cli.issuer_key_load_failed";
|
|
36
|
+
readonly issuerKeyInvalid: "cli.issuer_key_invalid";
|
|
37
|
+
readonly signingFailed: "cli.signing_failed";
|
|
38
|
+
readonly programRequired: "cli.program_required";
|
|
39
|
+
readonly unsafeFlagRequired: "cli.unsafe_flag_required";
|
|
40
|
+
readonly secretScanDisableRequiresUnsafeFlag: "cli.secret_scan_disable_requires_unsafe_flag";
|
|
41
|
+
readonly shellModeRequired: "cli.shell_mode_required";
|
|
42
|
+
readonly argvTokenTooLong: "cli.argv_token_too_long";
|
|
43
|
+
readonly outOfRange: "cli.out_of_range";
|
|
44
|
+
readonly invalidPolicyDigest: "cli.invalid_policy_digest";
|
|
45
|
+
readonly invalidConfigDigest: "cli.invalid_config_digest";
|
|
46
|
+
readonly invalidApprovalRef: "cli.invalid_approval_ref";
|
|
47
|
+
readonly invalidEnvKey: "cli.invalid_env_key";
|
|
48
|
+
readonly signingInputRequired: "cli.signing_input_required";
|
|
49
|
+
readonly signingInputConflict: "cli.signing_input_conflict";
|
|
50
|
+
readonly issuerIdRequired: "cli.issuer_id_required";
|
|
51
|
+
readonly issuerIdInvalid: "cli.issuer_id_invalid";
|
|
52
|
+
};
|
|
53
|
+
/** Record-command options = observe command options + signing inputs. */
|
|
54
|
+
export interface RecordCommandOptions extends ObserveCommandOptions {
|
|
55
|
+
issuerKey?: string;
|
|
56
|
+
issuerId?: string;
|
|
57
|
+
unsafeEphemeralKey: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface RecordCommandIO {
|
|
60
|
+
writeStdout: (chunk: string) => void;
|
|
61
|
+
writeStderr: (chunk: string) => void;
|
|
62
|
+
childEnv: NodeJS.ProcessEnv;
|
|
63
|
+
captureEnv: NodeJS.ProcessEnv;
|
|
64
|
+
/**
|
|
65
|
+
* Environment used to resolve `env:VAR` issuer-key references.
|
|
66
|
+
* Defaults to `process.env`. Distinct from `childEnv` and `captureEnv`
|
|
67
|
+
* because issuer-key access policy is independent of capture policy.
|
|
68
|
+
*/
|
|
69
|
+
issuerKeyEnv: NodeJS.ProcessEnv;
|
|
70
|
+
cwd: string;
|
|
71
|
+
peacCliVersion: string;
|
|
72
|
+
}
|
|
73
|
+
export interface RecordCommandResult {
|
|
74
|
+
exitCode: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Validate flag combinations (observe + signing) BEFORE spawning the
|
|
78
|
+
* child or loading the issuer key. Delegates to the shared
|
|
79
|
+
* `validateCoreCommandOptions` for observe-style checks and
|
|
80
|
+
* `validateSigningOptions` for the signing-input mutex and canonical
|
|
81
|
+
* issuer URL preflight.
|
|
82
|
+
*/
|
|
83
|
+
export declare function validateRecordOptions(opts: RecordCommandOptions, childArgv: string[]): ValidationFailure[];
|
|
84
|
+
/**
|
|
85
|
+
* Pure handler: validates flags, preflights output and key, runs the
|
|
86
|
+
* child, builds the observation, signs as Wire 0.2 JWS, emits.
|
|
87
|
+
*/
|
|
88
|
+
export declare function runRecordCommand(options: Partial<RecordCommandOptions>, childArgv: string[], io?: Partial<RecordCommandIO>): Promise<RecordCommandResult>;
|
|
89
|
+
/**
|
|
90
|
+
* Commander factory for the `command` subcommand under the `record`
|
|
91
|
+
* parent group. Mirrors `observeCommandSubcommand()` flag set + adds
|
|
92
|
+
* the three signing inputs.
|
|
93
|
+
*/
|
|
94
|
+
export declare function recordCommandSubcommand(): Command;
|
|
95
|
+
/**
|
|
96
|
+
* Commander factory for the public `peac record` parent group. Adds
|
|
97
|
+
* the `command` subcommand. Future signed-record surfaces (e.g.,
|
|
98
|
+
* `peac record mcp`, `peac record http`) attach here without widening
|
|
99
|
+
* the verb namespace.
|
|
100
|
+
*/
|
|
101
|
+
export declare function recordCommand(): Command;
|
|
102
|
+
//# sourceMappingURL=record-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-command.d.ts","sourceRoot":"","sources":["../../src/commands/record-command.ts"],"names":[],"mappings":"AAAA;;;;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