@provian/cli 0.0.0-stage → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/LICENSE +21 -0
  3. package/README.md +267 -2
  4. package/bin/provian.mjs +15 -0
  5. package/dist/cli/agent-config.d.ts +32 -0
  6. package/dist/cli/agent-config.d.ts.map +1 -0
  7. package/dist/cli/agent-config.js +48 -0
  8. package/dist/cli/agent-config.js.map +1 -0
  9. package/dist/cli/commands.d.ts +32 -0
  10. package/dist/cli/commands.d.ts.map +1 -0
  11. package/dist/cli/commands.js +528 -0
  12. package/dist/cli/commands.js.map +1 -0
  13. package/dist/cli/commons-institutions-commands.d.ts +161 -0
  14. package/dist/cli/commons-institutions-commands.d.ts.map +1 -0
  15. package/dist/cli/commons-institutions-commands.js +1580 -0
  16. package/dist/cli/commons-institutions-commands.js.map +1 -0
  17. package/dist/cli/git-identity-commands.d.ts +30 -0
  18. package/dist/cli/git-identity-commands.d.ts.map +1 -0
  19. package/dist/cli/git-identity-commands.js +176 -0
  20. package/dist/cli/git-identity-commands.js.map +1 -0
  21. package/dist/cli/parse-args.d.ts +26 -0
  22. package/dist/cli/parse-args.d.ts.map +1 -0
  23. package/dist/cli/parse-args.js +55 -0
  24. package/dist/cli/parse-args.js.map +1 -0
  25. package/dist/cli/pes-commands.d.ts +37 -0
  26. package/dist/cli/pes-commands.d.ts.map +1 -0
  27. package/dist/cli/pes-commands.js +137 -0
  28. package/dist/cli/pes-commands.js.map +1 -0
  29. package/dist/cli/presentation-commands.d.ts +113 -0
  30. package/dist/cli/presentation-commands.d.ts.map +1 -0
  31. package/dist/cli/presentation-commands.js +851 -0
  32. package/dist/cli/presentation-commands.js.map +1 -0
  33. package/dist/cli/relay-http.d.ts +31 -0
  34. package/dist/cli/relay-http.d.ts.map +1 -0
  35. package/dist/cli/relay-http.js +73 -0
  36. package/dist/cli/relay-http.js.map +1 -0
  37. package/dist/cli/runtime-detect.d.ts +51 -0
  38. package/dist/cli/runtime-detect.d.ts.map +1 -0
  39. package/dist/cli/runtime-detect.js +78 -0
  40. package/dist/cli/runtime-detect.js.map +1 -0
  41. package/dist/cli/session.d.ts +39 -0
  42. package/dist/cli/session.d.ts.map +1 -0
  43. package/dist/cli/session.js +166 -0
  44. package/dist/cli/session.js.map +1 -0
  45. package/dist/cli/sovereign-key-intake.d.ts +17 -0
  46. package/dist/cli/sovereign-key-intake.d.ts.map +1 -0
  47. package/dist/cli/sovereign-key-intake.js +47 -0
  48. package/dist/cli/sovereign-key-intake.js.map +1 -0
  49. package/dist/index.d.ts +14 -0
  50. package/dist/index.d.ts.map +1 -0
  51. package/dist/index.js +16 -0
  52. package/dist/index.js.map +1 -0
  53. package/package.json +57 -4
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Burn-to-present CLI verbs — signed challenges, the pre-burn requester
3
+ * check, and the replay-safe verifier.
4
+ *
5
+ * requester side: challenge, verify, requester-key
6
+ * presenter side: check-challenge, respond, present
7
+ *
8
+ * Every presenter path verifies the challenge BEFORE any burn and prints one of
9
+ * Requester: <identity> — VERIFIED
10
+ * Requester: <audience> — UNVERIFIED (unsigned challenge)
11
+ * A SIGNED challenge that is invalid, expired, or addressed to another presenter
12
+ * is REFUSED (exit non-zero) and nothing is burned (Unknown = Block).
13
+ *
14
+ * All protocol logic lives in @provian/agent-sdk — envelope verification
15
+ * (`verifyChallengeEnvelope` / `CommonsInstitutions.checkChallengeBeforeBurn`), the burn +
16
+ * present sequence (`CommonsInstitutions.respondToChallenge`), and the presentation
17
+ * verifier (`verifyPresentationToken`, which enforces predicates-require-
18
+ * reputation, presenter binding, the challenge deadline, and accept-once). This
19
+ * module only parses flags, prints the requester line, and asks for confirmation.
20
+ *
21
+ * Human-readable lines go to stderr (deps.log); stdout stays the one JSON result
22
+ * the bin prints, so the output can be piped.
23
+ */
24
+ import { CommonsInstitutions, verifyPresentationToken, type CommonsInstitutionsConfig, type ChallengeEnvelope, type ChallengeVerdict, type FetchRequesterKeys, type ArchivedPeSource, type LocalPeStoreResolution, type PeFact, type PredicateRequest, type CanonicalDisclosureRequest, type DisclosureAnswerInput } from '@provian/agent-sdk';
25
+ type CommandResult = Record<string, unknown>;
26
+ type Flags = Record<string, string | boolean>;
27
+ type Lists = Record<string, string[]>;
28
+ /** Default kid for a domain requester key (`provian requester-key`, `provian challenge --domain`). */
29
+ export declare const DEFAULT_REQUESTER_KID = "k1";
30
+ export interface PresentationCliDeps {
31
+ /** Build the CommonsInstitutions client from the env credentials. */
32
+ makeInstitutions: (cfg: CommonsInstitutionsConfig) => CommonsInstitutions;
33
+ /** Human-readable lines (the requester line, prompts' context). Default: stderr. */
34
+ log: (line: string) => void;
35
+ /** Ask a yes/no question. Only called when `isInteractive()` is true. */
36
+ confirm: (question: string) => Promise<boolean>;
37
+ /** True when a prompt can be answered (a TTY on stdin). */
38
+ isInteractive: () => boolean;
39
+ /** Home directory — the default seen-store lives at ~/.provian/presentations-seen.json. */
40
+ homeDir: () => string;
41
+ /** Domain-requester key source (default: the SDK's SSRF-guarded well-known fetch). */
42
+ fetchRequesterKeys?: FetchRequesterKeys;
43
+ /** fetch used for the Provian JWKS (default: global fetch). */
44
+ fetchFn?: typeof fetch;
45
+ /** stdin for --from-stdin key intake. */
46
+ stdin?: NodeJS.ReadableStream;
47
+ /** The presentation verifier (default: the SDK's verifyPresentationToken). */
48
+ verifyToken: typeof verifyPresentationToken;
49
+ /** This machine's PE store — a pe_fact carries the PE and its proof from it (the relay keeps no PE). */
50
+ openPeStore: () => LocalPeStoreResolution;
51
+ /**
52
+ * This machine's paid PE Archive : a PE dropped here after its day was confirmed
53
+ * in the Archive is pulled back, opened with the agent's key on this machine, and presented like a
54
+ * local one. Opened only when such a PE is named. Default: from ~/.provian/credentials.
55
+ */
56
+ openArchive?: () => Promise<ArchivedPeSource | null>;
57
+ }
58
+ export declare function defaultPresentationDeps(): PresentationCliDeps;
59
+ /**
60
+ * a burn that was broadcast but not presented (BurnNotPresentedError) — print its handle so
61
+ * the operator resumes with --burn-tx instead of burning again.
62
+ */
63
+ export declare function burnHandle(err: unknown): CommandResult;
64
+ /**
65
+ * Parse one `--predicate` expression:
66
+ * work.total>=10 work.total>10 work.total<=10 work.total<10 work.total=10
67
+ * 'standing.adverse_events in:{0}' (membership in a numeric set)
68
+ */
69
+ export declare function parsePredicateExpression(expr: string): PredicateRequest;
70
+ /** Read a flag value that is inline JSON or `@<path>` to a JSON file. */
71
+ export declare function readJsonArg(value: string, flagName: string): unknown;
72
+ /**
73
+ * Every predicate the caller named: `--predicates-json '[…]'` (or `@file`) first,
74
+ * then each `--predicate <expr>` in order. Validated by the SDK's
75
+ * normalizePredicateRequests (fail-closed: one malformed entry refuses them all).
76
+ */
77
+ /**
78
+ * 2026-10-10: the requester-named disclosure requests: `--disclosures-json '[…]'` (or `@file`).
79
+ * Validated by the SDK's normalizeDisclosureRequests (fail-closed).
80
+ */
81
+ export declare function collectDisclosures(flags: Flags): CanonicalDisclosureRequest[];
82
+ /**
83
+ * 2026-10-10: the presenter's answers to a challenge's disclosure requests. Without `--disclose`
84
+ * every request is DECLINED (signed as declined); `--disclose` elects every request, `--disclose
85
+ * <n>[,<n>…]` elects by 0-based index; elected requests are answered from this machine's PE store.
86
+ */
87
+ export declare function collectDisclosureAnswers(flags: Flags, env: ChallengeEnvelope | undefined, deps: PresentationCliDeps): Promise<DisclosureAnswerInput[] | undefined>;
88
+ export declare function collectPredicates(flags: Flags, lists?: Lists): PredicateRequest[];
89
+ /** `--pe <pe_id>[:<pe_hash>]` (repeatable) → the tokens, syntax-checked. */
90
+ export declare function collectPeTokens(flags: Flags, lists?: Lists): string[];
91
+ /**
92
+ * PE meter: the relay keeps no PE, so a pe_fact carries the PE itself and its two-hop inclusion
93
+ * proof, both from THIS machine's store. A PE not held here, not batched, or whose day is not yet
94
+ * anchored on Base cannot be presented, and is refused before anything is burned or signed.
95
+ */
96
+ export declare function resolvePeFacts(tokens: readonly string[], deps: Pick<PresentationCliDeps, 'openPeStore' | 'openArchive'>): Promise<PeFact[]>;
97
+ /**
98
+ * Parse `--challenge-json` (inline JSON or @file). Accepts the bare wire
99
+ * envelope or the object `provian challenge` prints (whose `challenge` field is
100
+ * the envelope). Structural only — the caller verifies it.
101
+ */
102
+ export declare function parseChallengeArg(value: string): ChallengeEnvelope;
103
+ export declare function requesterLine(v: ChallengeVerdict): string;
104
+ export declare function cmdPresentationChallenge(flags: Flags, lists?: Lists, depsIn?: Partial<PresentationCliDeps>): Promise<CommandResult>;
105
+ export declare function cmdCheckChallenge(flags: Flags, _lists?: Lists, depsIn?: Partial<PresentationCliDeps>): Promise<CommandResult>;
106
+ export declare function cmdRespond(flags: Flags, lists?: Lists, depsIn?: Partial<PresentationCliDeps>): Promise<CommandResult>;
107
+ export declare function cmdPresent(flags: Flags, lists?: Lists, depsIn?: Partial<PresentationCliDeps>): Promise<CommandResult>;
108
+ export declare function defaultSeenStorePath(deps: Pick<PresentationCliDeps, 'homeDir'>): string;
109
+ export declare function cmdVerifyPresentation(flags: Flags, lists?: Lists, depsIn?: Partial<PresentationCliDeps>): Promise<CommandResult>;
110
+ export declare function cmdRequesterKey(flags: Flags, _lists?: Lists, depsIn?: Partial<PresentationCliDeps>): Promise<CommandResult>;
111
+ export declare function printPresentationHelp(): void;
112
+ export {};
113
+ //# sourceMappingURL=presentation-commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentation-commands.d.ts","sourceRoot":"","sources":["../../src/cli/presentation-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAMH,OAAO,EACL,mBAAmB,EAUnB,uBAAuB,EAWvB,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,MAAM,EACX,KAAK,gBAAgB,EAErB,KAAK,0BAA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