gigabuddy 0.6.0 → 0.7.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gigabuddy",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Command-line sign-in for Gigabuddy. Authenticates your machine and configures npm for @gigabuddy packages.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -0,0 +1,61 @@
1
+ /** One vouched sender. `placeId` scopes the vouch to wakes from that room. */
2
+ export interface TrustedSender {
3
+ id: string;
4
+ name?: string;
5
+ placeId?: string;
6
+ placeName?: string;
7
+ addedAt?: string;
8
+ }
9
+ /** The slice of channel-policy.json this command owns. Other keys pass through untouched. */
10
+ export interface ChannelPolicy {
11
+ trustedSenders?: Array<TrustedSender | string>;
12
+ [key: string]: unknown;
13
+ }
14
+ export interface RosterMember {
15
+ actorId: string;
16
+ actorType?: string;
17
+ displayName?: string;
18
+ }
19
+ export interface Room {
20
+ id: string;
21
+ name: string;
22
+ members: RosterMember[];
23
+ }
24
+ /** Everything that touches the network or the clock — injected so the command is testable offline. */
25
+ export interface TrustDeps {
26
+ /** GET `url` with the human's bearer, parsed as JSON. */
27
+ fetchJson: (url: string) => Promise<unknown>;
28
+ now?: () => Date;
29
+ say?: (line?: string) => void;
30
+ }
31
+ export interface TrustOptions {
32
+ /** Room name or `place:` id to resolve in. Defaults to the repo's pinned room. */
33
+ in?: string;
34
+ account?: string;
35
+ staging?: boolean;
36
+ cwd?: string;
37
+ }
38
+ export declare function policyPath(repoRoot: string): string;
39
+ export declare function readPolicy(repoRoot: string): ChannelPolicy;
40
+ export declare function writePolicy(repoRoot: string, policy: ChannelPolicy): void;
41
+ /** Normalise the legacy bare-string form to entries. */
42
+ export declare function trustedSendersOf(policy: ChannelPolicy): TrustedSender[];
43
+ /**
44
+ * Pick the room: a `place:` id matches by id, anything else by exact
45
+ * (case-insensitive) name. Ambiguity is an error that lists the candidates —
46
+ * never a guess.
47
+ */
48
+ export declare function resolveRoom(rooms: Room[], query: string): Room;
49
+ /**
50
+ * Pick the member: a prefixed id (`user:` / `agent:` / `buddy:` …) matches by
51
+ * id, anything else by exact (case-insensitive) display name. Same rule: two
52
+ * members with one name is an error listing both ids, not a pick.
53
+ */
54
+ export declare function resolveMember(room: Room, query: string): RosterMember;
55
+ /** Bearer-authenticated JSON GET on the human credential. */
56
+ export declare function defaultDeps(options: TrustOptions): TrustDeps & {
57
+ apiUrl: string;
58
+ };
59
+ export declare function trustCommand(sub: string | undefined, target: string | undefined, options?: TrustOptions, deps?: TrustDeps & {
60
+ apiUrl?: string;
61
+ }): Promise<void>;