@dayzehq/cli 0.0.0-stage → 0.2.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 (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +305 -2
  3. package/dist/add.d.ts +6 -0
  4. package/dist/add.js +72 -0
  5. package/dist/admin.d.ts +110 -0
  6. package/dist/admin.js +408 -0
  7. package/dist/agent-bridge.d.ts +50 -0
  8. package/dist/agent-bridge.js +146 -0
  9. package/dist/agent-mcp.d.ts +4 -0
  10. package/dist/agent-mcp.js +36 -0
  11. package/dist/ai-consent.d.ts +18 -0
  12. package/dist/ai-consent.js +93 -0
  13. package/dist/args.d.ts +5 -0
  14. package/dist/args.js +127 -0
  15. package/dist/auth.d.ts +20 -0
  16. package/dist/auth.js +198 -0
  17. package/dist/channel.d.ts +55 -0
  18. package/dist/channel.js +250 -0
  19. package/dist/chat.d.ts +67 -0
  20. package/dist/chat.js +170 -0
  21. package/dist/cli-errors.d.ts +13 -0
  22. package/dist/cli-errors.js +30 -0
  23. package/dist/coding-context.d.ts +12 -0
  24. package/dist/coding-context.js +130 -0
  25. package/dist/coding.d.ts +35 -0
  26. package/dist/coding.js +283 -0
  27. package/dist/config.d.ts +36 -0
  28. package/dist/config.js +149 -0
  29. package/dist/day.d.ts +22 -0
  30. package/dist/day.js +54 -0
  31. package/dist/dayze-cli-runtime +0 -0
  32. package/dist/dayze-days.d.ts +56 -0
  33. package/dist/dayze-days.js +276 -0
  34. package/dist/doctor.d.ts +32 -0
  35. package/dist/doctor.js +225 -0
  36. package/dist/focus.d.ts +9 -0
  37. package/dist/focus.js +163 -0
  38. package/dist/index.d.ts +2 -0
  39. package/dist/index.js +675 -0
  40. package/dist/inventory.d.ts +73 -0
  41. package/dist/inventory.js +1272 -0
  42. package/dist/life.d.ts +48 -0
  43. package/dist/life.js +146 -0
  44. package/dist/me.d.ts +94 -0
  45. package/dist/me.js +789 -0
  46. package/dist/people.d.ts +232 -0
  47. package/dist/people.js +2034 -0
  48. package/dist/projects.d.ts +21 -0
  49. package/dist/projects.js +132 -0
  50. package/dist/request-deadline.d.ts +11 -0
  51. package/dist/request-deadline.js +34 -0
  52. package/dist/runtime-build.json +1 -0
  53. package/dist/ui.d.ts +37 -0
  54. package/dist/ui.js +219 -0
  55. package/dist/version.d.ts +4 -0
  56. package/dist/version.js +16 -0
  57. package/package.json +54 -4
package/dist/life.d.ts ADDED
@@ -0,0 +1,48 @@
1
+ /**
2
+ * CLI: dayze life — Life Schema entity reads (PHI-2097 / PHI-819).
3
+ */
4
+ import { type DayzeCredentials } from './config.js';
5
+ export type LifeCommandOptions = {
6
+ json?: boolean;
7
+ };
8
+ /** Kinds served by GET /api/cli/life/entity today. */
9
+ export declare const LIFE_ENTITY_KINDS: readonly ["person", "event", "moment", "place", "inventory_item"];
10
+ export type LifeEntityKind = (typeof LIFE_ENTITY_KINDS)[number];
11
+ export type LifeEntityEnvelope = {
12
+ entity_id: string;
13
+ kind: string;
14
+ subtype?: string | null;
15
+ owner_id: string;
16
+ lifecycle?: string;
17
+ created_at?: string | null;
18
+ updated_at?: string | null;
19
+ observed_at?: string | null;
20
+ valid_from?: string | null;
21
+ valid_to?: string | null;
22
+ provenance?: {
23
+ source?: string | null;
24
+ actor?: string | null;
25
+ };
26
+ confidence?: number | null;
27
+ assertion?: string | null;
28
+ sensitivity_tier?: string | null;
29
+ evidence_refs?: string[];
30
+ access_policy_ref?: string | null;
31
+ audit_ref?: string | null;
32
+ inspect_path?: string | null;
33
+ };
34
+ export type LifeEntityResponse = {
35
+ envelope: LifeEntityEnvelope;
36
+ };
37
+ export type LifeCommand = {
38
+ kind: 'show';
39
+ entityKind: string;
40
+ id: string;
41
+ } | {
42
+ kind: 'help';
43
+ };
44
+ export declare function parseLifeArgs(positional: string[]): LifeCommand;
45
+ export declare function fetchLifeEntity(creds: DayzeCredentials, entityKind: string, id: string): Promise<LifeEntityResponse>;
46
+ export declare function printLifeEntity(envelope: LifeEntityEnvelope): void;
47
+ export declare function printLifeHelp(): void;
48
+ export declare function runLifeCommand(creds: DayzeCredentials, positional: string[], options?: LifeCommandOptions): Promise<void>;
package/dist/life.js ADDED
@@ -0,0 +1,146 @@
1
+ /**
2
+ * CLI: dayze life — Life Schema entity reads (PHI-2097 / PHI-819).
3
+ */
4
+ import { authHeader } from './config.js';
5
+ import { printJson } from './cli-errors.js';
6
+ import { fetchJsonWithDeadline } from './request-deadline.js';
7
+ import * as ui from './ui.js';
8
+ import { CLI_USER_AGENT } from './version.js';
9
+ /** Kinds served by GET /api/cli/life/entity today. */
10
+ export const LIFE_ENTITY_KINDS = [
11
+ 'person',
12
+ 'event',
13
+ 'moment',
14
+ 'place',
15
+ 'inventory_item',
16
+ ];
17
+ function peelFlag(args, name) {
18
+ const eq = args.find((a) => a.startsWith(`--${name}=`));
19
+ if (eq) {
20
+ return {
21
+ value: eq.slice(name.length + 3),
22
+ rest: args.filter((a) => a !== eq),
23
+ };
24
+ }
25
+ const idx = args.indexOf(`--${name}`);
26
+ if (idx >= 0) {
27
+ const value = args[idx + 1];
28
+ return {
29
+ value,
30
+ rest: args.filter((_, i) => i !== idx && i !== idx + 1),
31
+ };
32
+ }
33
+ return { rest: args };
34
+ }
35
+ export function parseLifeArgs(positional) {
36
+ const [head, ...rest] = positional;
37
+ if (!head || head === 'help' || head === '--help' || head === '-h') {
38
+ return { kind: 'help' };
39
+ }
40
+ if (head === 'show' || head === 'get' || head === 'view') {
41
+ const kindFlag = peelFlag(rest, 'kind');
42
+ const idFlag = peelFlag(kindFlag.rest, 'id');
43
+ const entityKind = (kindFlag.value || '').trim();
44
+ const id = (idFlag.value || '').trim();
45
+ if (!entityKind || !id)
46
+ return { kind: 'help' };
47
+ return { kind: 'show', entityKind, id };
48
+ }
49
+ return { kind: 'help' };
50
+ }
51
+ export async function fetchLifeEntity(creds, entityKind, id) {
52
+ const header = authHeader(creds);
53
+ if (!header)
54
+ throw new Error('Not logged in');
55
+ const params = new URLSearchParams({
56
+ kind: entityKind,
57
+ id,
58
+ _t: String(Date.now()),
59
+ });
60
+ return fetchJsonWithDeadline(`${creds.apiBase}/api/cli/life/entity?${params}`, {
61
+ headers: {
62
+ Authorization: header,
63
+ Accept: 'application/json',
64
+ 'User-Agent': CLI_USER_AGENT,
65
+ 'Cache-Control': 'no-store',
66
+ },
67
+ cache: 'no-store',
68
+ }, {
69
+ timeoutMessage: 'Loading life entity timed out after 15 seconds. Check your connection and retry dayze life show.',
70
+ httpErrorMessage: (status, bodyPreview) => `Failed to load life entity (${status}): ${bodyPreview}`,
71
+ });
72
+ }
73
+ function kv(label, value) {
74
+ console.log(` ${ui.c.dim(label.padEnd(16))} ${value}`);
75
+ }
76
+ export function printLifeEntity(envelope) {
77
+ console.log('');
78
+ console.log(`${ui.c.brandBold('◆ Life entity')} ${ui.c.dim(`${envelope.kind} · ${envelope.entity_id}`)}`);
79
+ console.log(ui.c.dim('─'.repeat(52)));
80
+ kv('Kind', envelope.kind);
81
+ if (envelope.subtype)
82
+ kv('Subtype', String(envelope.subtype));
83
+ kv('Owner', envelope.owner_id);
84
+ if (envelope.lifecycle)
85
+ kv('Lifecycle', envelope.lifecycle);
86
+ if (envelope.sensitivity_tier)
87
+ kv('Sensitivity', String(envelope.sensitivity_tier));
88
+ if (envelope.assertion)
89
+ kv('Assertion', String(envelope.assertion));
90
+ if (envelope.confidence != null)
91
+ kv('Confidence', String(envelope.confidence));
92
+ if (envelope.provenance?.source)
93
+ kv('Source', String(envelope.provenance.source));
94
+ if (envelope.provenance?.actor)
95
+ kv('Actor', String(envelope.provenance.actor));
96
+ if (envelope.created_at)
97
+ kv('Created', envelope.created_at);
98
+ if (envelope.updated_at)
99
+ kv('Updated', envelope.updated_at);
100
+ if (envelope.observed_at)
101
+ kv('Observed', envelope.observed_at);
102
+ if (envelope.valid_from)
103
+ kv('Valid from', envelope.valid_from);
104
+ if (envelope.valid_to)
105
+ kv('Valid to', envelope.valid_to);
106
+ if (envelope.inspect_path)
107
+ kv('Inspect', envelope.inspect_path);
108
+ if (envelope.evidence_refs?.length) {
109
+ console.log('');
110
+ console.log(ui.c.bold(' Evidence'));
111
+ for (const ref of envelope.evidence_refs) {
112
+ console.log(` ${ui.c.dim('·')} ${ref}`);
113
+ }
114
+ }
115
+ console.log('');
116
+ }
117
+ export function printLifeHelp() {
118
+ console.log(`
119
+ ${ui.c.brandBold('dayze life')} ${ui.c.dim('— Life Schema entity reads')}
120
+
121
+ dayze life show --kind=<kind> --id=<uuid>
122
+ dayze life show --kind person --id 00000000-0000-4000-8000-000000000301
123
+
124
+ Kinds: ${LIFE_ENTITY_KINDS.join(' · ')}
125
+
126
+ Requires LIFE_SCHEMA_ENTITY_READ_ENABLED on the API host.
127
+ `.trimEnd());
128
+ }
129
+ export async function runLifeCommand(creds, positional, options = {}) {
130
+ const json = Boolean(options.json);
131
+ const cmd = parseLifeArgs(positional);
132
+ switch (cmd.kind) {
133
+ case 'help':
134
+ printLifeHelp();
135
+ return;
136
+ case 'show': {
137
+ const { envelope } = await fetchLifeEntity(creds, cmd.entityKind, cmd.id);
138
+ if (json) {
139
+ printJson({ envelope });
140
+ return;
141
+ }
142
+ printLifeEntity(envelope);
143
+ return;
144
+ }
145
+ }
146
+ }
package/dist/me.d.ts ADDED
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Self-dossier — your life profile in the same shape as a contact detail card.
3
+ * Interactive: a agent · e edit · Esc quit
4
+ */
5
+ import { type DayzeCredentials } from './config.js';
6
+ export type MeCommandOptions = {
7
+ json?: boolean;
8
+ /** Opt in to a third-party public-IP lookup (ipify). Off by default. */
9
+ publicIp?: boolean;
10
+ };
11
+ /** True when `--public-ip` or `DAYZE_PUBLIC_IP=1` (also `true`/`yes`) is set. */
12
+ export declare function isPublicIpLookupEnabled(flag?: boolean): boolean;
13
+ export type SelfProfile = {
14
+ id: string;
15
+ email?: string | null;
16
+ name?: string | null;
17
+ legal_name?: string | null;
18
+ handle?: string | null;
19
+ birthday?: string | null;
20
+ birth_time?: string | null;
21
+ birth_location?: string | null;
22
+ location?: string | null;
23
+ timezone?: string | null;
24
+ profile_image_url?: string | null;
25
+ bio?: string | null;
26
+ instagram_handle?: string | null;
27
+ imessage_phone_e164?: string | null;
28
+ is_pro?: boolean | null;
29
+ dayze_coin?: number | null;
30
+ created_at?: string | null;
31
+ updated_at?: string | null;
32
+ polaris_enabled?: boolean | null;
33
+ location_enabled?: boolean | null;
34
+ };
35
+ export type SelfAgentMemory = {
36
+ preferred_name?: string | null;
37
+ occupation?: string | null;
38
+ company?: string | null;
39
+ home_location?: string | null;
40
+ work_location?: string | null;
41
+ current_city?: string | null;
42
+ current_country?: string | null;
43
+ interests?: string[] | null;
44
+ hobbies?: string[] | null;
45
+ dietary_preferences?: string[] | null;
46
+ music_preferences?: string[] | null;
47
+ food_preferences?: string[] | null;
48
+ communication_style?: string | null;
49
+ language?: string | null;
50
+ goals?: unknown;
51
+ personality_notes?: string | null;
52
+ timezone?: string | null;
53
+ };
54
+ /** Network / device footprint (security-style session card). */
55
+ export type SelfSession = {
56
+ request_ip?: string | null;
57
+ public_ip?: string | null;
58
+ user_agent?: string | null;
59
+ /** Live egress geo for this CLI/web call (refreshes when VPN changes). */
60
+ network_now?: {
61
+ ip?: string | null;
62
+ city?: string | null;
63
+ region?: string | null;
64
+ country?: string | null;
65
+ vpn?: boolean | null;
66
+ proxy?: boolean | null;
67
+ tor?: boolean | null;
68
+ } | null;
69
+ last_signin?: {
70
+ ip?: string | null;
71
+ city?: string | null;
72
+ region?: string | null;
73
+ country?: string | null;
74
+ vpn?: boolean | null;
75
+ proxy?: boolean | null;
76
+ tor?: boolean | null;
77
+ client_kind?: string | null;
78
+ updated_at?: string | null;
79
+ } | null;
80
+ };
81
+ export type SelfDossier = {
82
+ profile: SelfProfile;
83
+ agent: SelfAgentMemory | null;
84
+ session?: SelfSession | null;
85
+ };
86
+ export declare function fetchSelfDossier(creds: DayzeCredentials, options?: Pick<MeCommandOptions, 'publicIp'>): Promise<SelfDossier>;
87
+ /** Third-party egress lookup — only used when public-IP opt-in is enabled. */
88
+ export declare function discoverPublicIp(): Promise<string | null>;
89
+ export declare function patchSelfDossier(creds: DayzeCredentials, patch: {
90
+ profile?: Record<string, string | null>;
91
+ agent?: Record<string, string | null>;
92
+ }): Promise<SelfDossier>;
93
+ export declare function printSelfDossier(profile: SelfProfile, agent: SelfAgentMemory | null, footerHint?: boolean, session?: SelfSession | null): void;
94
+ export declare function runMeCommand(credsIn: DayzeCredentials, options?: MeCommandOptions): Promise<void>;