@deveye/types 0.18.2 → 0.19.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 +1 -1
- package/src/domain/device.ts +6 -2
- package/src/domain/featureDomain.ts +46 -0
- package/src/domain/featureRegistry.ts +28 -0
- package/src/domain/home.ts +7 -4
- package/src/domain/live.ts +15 -5
- package/src/domain/project.ts +56 -0
- package/src/domain/report.ts +34 -2
- package/src/domain/secrecy.ts +3 -0
- package/src/domain/twoFactor.ts +7 -3
- package/src/domain/workspace.ts +1 -1
- package/src/domain/workspaceRole.ts +9 -2
- package/src/features/admin.ts +1 -51
- package/src/features/domain.ts +40 -0
- package/src/features/home.ts +1 -1
- package/src/features/links.ts +37 -0
- package/src/features/registry.ts +4 -0
- package/src/features/secrecy.ts +22 -8
- package/src/features/twoFactor.ts +1 -1
- package/src/features/user.ts +32 -4
- package/src/features/workspace.ts +2 -2
- package/src/http/auth.ts +64 -11
- package/src/http/device.ts +14 -10
- package/src/index.ts +65 -10
- package/src/protocol/agent.ts +38 -0
- package/src/protocol/error.ts +3 -0
- package/src/sdk/client-ambient.d.ts +60 -1
- package/src/sdk/client.ts +103 -5
- package/src/sdk/domains.test.ts +30 -0
- package/src/sdk/domains.ts +29 -0
- package/src/sdk/manifest.test.ts +60 -0
- package/src/sdk/manifest.ts +97 -4
- package/src/sdk/providers.ts +126 -4
- package/src/sdk/server.ts +198 -10
- package/src/sdk/testing.test.ts +55 -1
- package/src/sdk/testing.ts +192 -2
package/src/features/user.ts
CHANGED
|
@@ -37,17 +37,29 @@ export const THEME_SLOT_COUNT = 5;
|
|
|
37
37
|
*/
|
|
38
38
|
export const THEME_SLOT_IMAGE_MAX_LENGTH = 1_500_000;
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* A wallpaper value: an image data URL, or an https URL. The theme belongs to
|
|
42
|
+
* the workspace, so every member's browser loads what one member saved: a free
|
|
43
|
+
* string would let `http:` or any other scheme through to all of them.
|
|
44
|
+
*/
|
|
45
|
+
const THEME_IMAGE =
|
|
46
|
+
/^(data:image\/(png|jpeg|webp|avif|gif);base64,[A-Za-z0-9+/]+=*|https:\/\/[^\s"'()\\]+)$/;
|
|
47
|
+
|
|
40
48
|
export const themeStateSchema = z.object({
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
/** A hex colour: it is written as-is into CSS custom properties on every member's page. */
|
|
50
|
+
accent: z
|
|
51
|
+
.string()
|
|
52
|
+
.regex(/^#[0-9a-fA-F]{6}$/)
|
|
53
|
+
.nullable(),
|
|
54
|
+
bgPreset: z.string().max(40).nullable(),
|
|
55
|
+
bgImage: z.string().max(THEME_IMAGE_MAX_LENGTH).regex(THEME_IMAGE).nullable(),
|
|
44
56
|
/**
|
|
45
57
|
* Saved background gallery: up to THEME_SLOT_COUNT slots, each a compressed
|
|
46
58
|
* data URL / raw URL, or null for an empty slot. Defaults to empty so themes
|
|
47
59
|
* saved before this field parse cleanly.
|
|
48
60
|
*/
|
|
49
61
|
bgImages: z
|
|
50
|
-
.array(z.string().max(THEME_SLOT_IMAGE_MAX_LENGTH).nullable())
|
|
62
|
+
.array(z.string().max(THEME_SLOT_IMAGE_MAX_LENGTH).regex(THEME_IMAGE).nullable())
|
|
51
63
|
.max(THEME_SLOT_COUNT)
|
|
52
64
|
.default([]),
|
|
53
65
|
bgDim: z.number().int().min(0).max(100),
|
|
@@ -93,7 +105,23 @@ export const userSetUsername = {
|
|
|
93
105
|
output: z.object({ username: usernameSchema })
|
|
94
106
|
};
|
|
95
107
|
|
|
108
|
+
/** The plan of an account, as a plan provider states it (`sdk/providers.ts`). */
|
|
109
|
+
export const accountPlanSchema = z.object({
|
|
110
|
+
id: z.string(),
|
|
111
|
+
label: z.string(),
|
|
112
|
+
limits: z.record(z.string(), z.number().int().nonnegative()),
|
|
113
|
+
trialEndsAt: z.number().int().nonnegative().optional()
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
/** The caller's plan. `null`: this DevEye has no plan provider, everything is unlimited. */
|
|
117
|
+
export const userPlan = {
|
|
118
|
+
command: 'user.plan' as const,
|
|
119
|
+
input: z.object({}),
|
|
120
|
+
output: z.object({ plan: accountPlanSchema.nullable() })
|
|
121
|
+
};
|
|
122
|
+
|
|
96
123
|
export const userCommands = [
|
|
124
|
+
userPlan,
|
|
97
125
|
userSetAvatar,
|
|
98
126
|
userSetTheme,
|
|
99
127
|
userSetColor,
|
|
@@ -75,8 +75,8 @@ export const workspaceRemoveMember = {
|
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
* Ajoute un membre à l'espace actif, désigné par son adresse. Pas de lien ni
|
|
78
|
-
* d'acceptation : le compte existe
|
|
79
|
-
*
|
|
78
|
+
* d'acceptation : le compte existe déjà, et un lien serait un secret
|
|
79
|
+
* transmissible de plus.
|
|
80
80
|
*/
|
|
81
81
|
export const workspaceAddMember = {
|
|
82
82
|
command: 'workspace.addMember' as const,
|
package/src/http/auth.ts
CHANGED
|
@@ -38,19 +38,12 @@ export const loginRequestSchema = z.object({
|
|
|
38
38
|
|
|
39
39
|
export type LoginRequest = z.infer<typeof loginRequestSchema>;
|
|
40
40
|
|
|
41
|
-
/**
|
|
42
|
-
export const
|
|
43
|
-
inviteToken: z.string().min(1),
|
|
44
|
-
username: usernameSchema,
|
|
45
|
-
email: z.string().email().max(320),
|
|
46
|
-
password: z.string().min(8).max(512)
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
export type RegisterRequest = z.infer<typeof registerRequestSchema>;
|
|
41
|
+
/** A password being chosen: the one account policy, at sign-up and at change. */
|
|
42
|
+
export const passwordSchema = z.string().min(8).max(512);
|
|
50
43
|
|
|
51
44
|
export const changePasswordRequestSchema = z.object({
|
|
52
45
|
currentPassword: z.string().min(1).max(512),
|
|
53
|
-
newPassword:
|
|
46
|
+
newPassword: passwordSchema
|
|
54
47
|
});
|
|
55
48
|
|
|
56
49
|
export type ChangePasswordRequest = z.infer<typeof changePasswordRequestSchema>;
|
|
@@ -75,7 +68,7 @@ export type LoginResponse = z.infer<typeof loginResponseSchema>;
|
|
|
75
68
|
|
|
76
69
|
export const twoFactorChallengeRequestSchema = z.object({
|
|
77
70
|
/** A 6-digit TOTP code or a recovery backup code. */
|
|
78
|
-
code: z.string().min(6).max(
|
|
71
|
+
code: z.string().min(6).max(24)
|
|
79
72
|
});
|
|
80
73
|
|
|
81
74
|
export type TwoFactorChallengeRequest = z.infer<typeof twoFactorChallengeRequestSchema>;
|
|
@@ -87,3 +80,63 @@ export type RefreshResponse = z.infer<typeof refreshResponseSchema>;
|
|
|
87
80
|
export const meResponseSchema = sessionBundleSchema;
|
|
88
81
|
|
|
89
82
|
export type MeResponse = z.infer<typeof meResponseSchema>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Self-service sign-up, in three steps: ask (`/signup`), open the mailed link
|
|
86
|
+
* (`/signup/verify`), choose a password (`/signup/complete`). No account exists
|
|
87
|
+
* before the last one.
|
|
88
|
+
*/
|
|
89
|
+
export const signupAvailabilitySchema = z.object({
|
|
90
|
+
/** Can an account be self-created here: the server allows it, or no account exists yet. */
|
|
91
|
+
open: z.boolean()
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
export type SignupAvailability = z.infer<typeof signupAvailabilitySchema>;
|
|
95
|
+
|
|
96
|
+
export const signupStartRequestSchema = z.object({
|
|
97
|
+
username: usernameSchema,
|
|
98
|
+
email: z.string().email().max(320),
|
|
99
|
+
/** Opaque hint carried to the first session (`signupPlan`), for whoever sent the visitor. */
|
|
100
|
+
plan: z
|
|
101
|
+
.string()
|
|
102
|
+
.regex(/^[a-z0-9_-]{1,64}$/)
|
|
103
|
+
.optional()
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
export type SignupStartRequest = z.infer<typeof signupStartRequestSchema>;
|
|
107
|
+
|
|
108
|
+
export const signupStartResponseSchema = z.object({
|
|
109
|
+
/** Lets the asking tab follow the request (`X-Signup-Watch`). It is NOT the mailed token. */
|
|
110
|
+
watchToken: z.string()
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
export type SignupStartResponse = z.infer<typeof signupStartResponseSchema>;
|
|
114
|
+
|
|
115
|
+
export const signupStatusSchema = z.object({
|
|
116
|
+
/** `opened`: the mailed link was followed. An unknown watch token reads `pending`. */
|
|
117
|
+
state: z.enum(['pending', 'opened', 'done', 'expired'])
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
export type SignupStatus = z.infer<typeof signupStatusSchema>;
|
|
121
|
+
|
|
122
|
+
export const signupVerifyRequestSchema = z.object({ token: z.string().min(1).max(128) });
|
|
123
|
+
|
|
124
|
+
export type SignupVerifyRequest = z.infer<typeof signupVerifyRequestSchema>;
|
|
125
|
+
|
|
126
|
+
export const signupVerifyResponseSchema = z.object({ username: z.string(), email: z.string() });
|
|
127
|
+
|
|
128
|
+
export type SignupVerifyResponse = z.infer<typeof signupVerifyResponseSchema>;
|
|
129
|
+
|
|
130
|
+
export const signupCompleteRequestSchema = z.object({
|
|
131
|
+
token: z.string().min(1).max(128),
|
|
132
|
+
password: passwordSchema
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
export type SignupCompleteRequest = z.infer<typeof signupCompleteRequestSchema>;
|
|
136
|
+
|
|
137
|
+
export const signupCompleteResponseSchema = sessionBundleSchema.extend({
|
|
138
|
+
/** The `plan` hint given at the first step, delivered once. */
|
|
139
|
+
signupPlan: z.string().nullable()
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
export type SignupCompleteResponse = z.infer<typeof signupCompleteResponseSchema>;
|
package/src/http/device.ts
CHANGED
|
@@ -11,17 +11,18 @@ import { devicePlatformSchema, deviceSchema } from '../domain/device';
|
|
|
11
11
|
* 4. The user confirms the device in the Clients page to activate it.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Hard cap on a code lifetime (30 days). A link code is a standing key to the
|
|
16
|
+
* workspace: it always expires.
|
|
17
|
+
*/
|
|
15
18
|
export const LINK_CODE_TTL_MAX_SECONDS = 30 * 24 * 60 * 60;
|
|
16
19
|
|
|
17
20
|
/**
|
|
18
|
-
* Request a new link code. `ttlSeconds
|
|
19
|
-
*
|
|
20
|
-
* - `null` → no expiry (valid until used or deleted),
|
|
21
|
-
* - a number → custom lifetime in seconds.
|
|
21
|
+
* Request a new link code. `ttlSeconds` omitted → server default lifetime,
|
|
22
|
+
* otherwise a lifetime in seconds.
|
|
22
23
|
*/
|
|
23
24
|
export const linkCodeRequestSchema = z.object({
|
|
24
|
-
ttlSeconds: z.number().int().positive().max(LINK_CODE_TTL_MAX_SECONDS).
|
|
25
|
+
ttlSeconds: z.number().int().positive().max(LINK_CODE_TTL_MAX_SECONDS).optional(),
|
|
25
26
|
/**
|
|
26
27
|
* Approve the device the moment it enrols with this code, instead of
|
|
27
28
|
* leaving it `pending` for manual approval. Defaults to `false`.
|
|
@@ -60,17 +61,20 @@ export const enrollDeviceRequestSchema = z.object({
|
|
|
60
61
|
code: z.string().min(6).max(32),
|
|
61
62
|
name: z.string().min(1).max(128),
|
|
62
63
|
fingerprint: z.string().min(1).max(128),
|
|
63
|
-
platform: devicePlatformSchema.default('linux')
|
|
64
|
-
/** X25519 public key (base64) for command signature verification. */
|
|
65
|
-
publicKey: z.string().min(1).max(256)
|
|
64
|
+
platform: devicePlatformSchema.default('linux')
|
|
66
65
|
});
|
|
67
66
|
|
|
68
67
|
export type EnrollDeviceRequest = z.infer<typeof enrollDeviceRequestSchema>;
|
|
69
68
|
|
|
70
69
|
export const enrollDeviceResponseSchema = z.object({
|
|
71
70
|
deviceId: z.uuid(),
|
|
72
|
-
/**
|
|
71
|
+
/** Device token (JWT), rotated by the server before it expires. Stored only on the agent. */
|
|
73
72
|
deviceToken: z.string().min(1),
|
|
73
|
+
/**
|
|
74
|
+
* The server's order-signing public key (Ed25519, base64): the agent pins it
|
|
75
|
+
* and refuses any high-impact order that does not carry its signature.
|
|
76
|
+
*/
|
|
77
|
+
orderSigningKey: z.string().length(44),
|
|
74
78
|
device: deviceSchema
|
|
75
79
|
});
|
|
76
80
|
|
package/src/index.ts
CHANGED
|
@@ -183,12 +183,18 @@ export {
|
|
|
183
183
|
packageListPushSchema,
|
|
184
184
|
packageProgressPushSchema,
|
|
185
185
|
packageStartedPushSchema,
|
|
186
|
+
AGENT_TOKEN_ROTATE,
|
|
187
|
+
agentTokenRotatePayloadSchema,
|
|
188
|
+
orderSignatureSchema,
|
|
189
|
+
SIGNED_AGENT_COMMANDS,
|
|
186
190
|
syncIndexEntrySchema,
|
|
187
191
|
syncShareAssignmentSchema
|
|
188
192
|
} from './protocol/agent';
|
|
189
193
|
export type {
|
|
190
194
|
AgentClientMessage,
|
|
191
195
|
AgentConfigPayload,
|
|
196
|
+
AgentTokenRotatePayload,
|
|
197
|
+
OrderSignature,
|
|
192
198
|
AgentFilesAnalyzePayload,
|
|
193
199
|
AgentFilesDownloadPayload,
|
|
194
200
|
AgentFilesListPayload,
|
|
@@ -386,8 +392,21 @@ export type {
|
|
|
386
392
|
FileSearchFilter,
|
|
387
393
|
FileUsageEntry
|
|
388
394
|
} from './domain/deviceFiles';
|
|
389
|
-
export {
|
|
390
|
-
|
|
395
|
+
export {
|
|
396
|
+
itemProjectGroupSchema,
|
|
397
|
+
itemProjectSchema,
|
|
398
|
+
itemProjectsBlockerSchema,
|
|
399
|
+
itemProjectsStateSchema,
|
|
400
|
+
projectStatusSchema,
|
|
401
|
+
PROJECT_STATUS_LABELS
|
|
402
|
+
} from './domain/project';
|
|
403
|
+
export type {
|
|
404
|
+
ItemProject,
|
|
405
|
+
ItemProjectGroup,
|
|
406
|
+
ItemProjectsBlocker,
|
|
407
|
+
ItemProjectsState,
|
|
408
|
+
ProjectStatus
|
|
409
|
+
} from './domain/project';
|
|
391
410
|
export { presenceEventSchema } from './domain/presence';
|
|
392
411
|
export type { PresenceEvent, PresenceRow } from './domain/presence';
|
|
393
412
|
export { userRoleSchema } from './domain/role';
|
|
@@ -553,6 +572,7 @@ export { packageManagerIdSchema, packageManagerSchema } from './domain/packages'
|
|
|
553
572
|
export type { PackageManager, PackageManagerId } from './domain/packages';
|
|
554
573
|
export {
|
|
555
574
|
agentInfoSchema,
|
|
575
|
+
agentPolicySchema,
|
|
556
576
|
agentServiceScopeSchema,
|
|
557
577
|
AUTH_LOGIN_LIMIT,
|
|
558
578
|
AUTH_SOURCE_LIMIT,
|
|
@@ -579,6 +599,7 @@ export {
|
|
|
579
599
|
} from './domain/report';
|
|
580
600
|
export type {
|
|
581
601
|
AgentInfo,
|
|
602
|
+
AgentPolicy,
|
|
582
603
|
AgentServiceScope,
|
|
583
604
|
AuthLogin,
|
|
584
605
|
AuthSource,
|
|
@@ -681,7 +702,27 @@ export {
|
|
|
681
702
|
shareSet,
|
|
682
703
|
sharingCommands
|
|
683
704
|
} from './features/sharing';
|
|
684
|
-
export {
|
|
705
|
+
export { linksCommands, projectLinksGet, projectLinksSet } from './features/links';
|
|
706
|
+
export {
|
|
707
|
+
PROJECT_LINKED_FEATURES,
|
|
708
|
+
SHAREABLE_FEATURES,
|
|
709
|
+
SHARE_WIRED_FEATURES
|
|
710
|
+
} from './domain/featureRegistry';
|
|
711
|
+
export {
|
|
712
|
+
DNS_RECORD_TYPES,
|
|
713
|
+
FEATURE_DOMAIN_HOST_MAX,
|
|
714
|
+
dnsRecordSchema,
|
|
715
|
+
domainStateSchema,
|
|
716
|
+
featureDomainSchema
|
|
717
|
+
} from './domain/featureDomain';
|
|
718
|
+
export type { DnsRecord, DomainState, FeatureDomain } from './domain/featureDomain';
|
|
719
|
+
export {
|
|
720
|
+
domainAdd,
|
|
721
|
+
domainCommands,
|
|
722
|
+
domainList,
|
|
723
|
+
domainRemove,
|
|
724
|
+
domainVerify
|
|
725
|
+
} from './features/domain';
|
|
685
726
|
export {
|
|
686
727
|
metricSeriesPointSchema,
|
|
687
728
|
metricSnapshotSchema,
|
|
@@ -718,16 +759,12 @@ export type {
|
|
|
718
759
|
export {
|
|
719
760
|
adminCommands,
|
|
720
761
|
adminDeleteUser,
|
|
721
|
-
adminInviteCreate,
|
|
722
|
-
adminInviteList,
|
|
723
|
-
adminInviteRevoke,
|
|
724
|
-
adminInviteSchema,
|
|
725
762
|
adminSetUserRole,
|
|
726
763
|
adminSetUserStatus,
|
|
727
764
|
adminUserList,
|
|
728
765
|
adminUserSchema
|
|
729
766
|
} from './features/admin';
|
|
730
|
-
export type {
|
|
767
|
+
export type { AdminUser } from './features/admin';
|
|
731
768
|
export {
|
|
732
769
|
workspaceActivate,
|
|
733
770
|
workspaceAdd,
|
|
@@ -751,7 +788,9 @@ export {
|
|
|
751
788
|
THEME_SLOT_COUNT,
|
|
752
789
|
THEME_SLOT_IMAGE_MAX_LENGTH,
|
|
753
790
|
themeStateSchema,
|
|
791
|
+
accountPlanSchema,
|
|
754
792
|
userCommands,
|
|
793
|
+
userPlan,
|
|
755
794
|
userSetAvatar,
|
|
756
795
|
userSetColor,
|
|
757
796
|
userSetSetting,
|
|
@@ -816,6 +855,7 @@ export {
|
|
|
816
855
|
secrecyHold,
|
|
817
856
|
secrecyLock,
|
|
818
857
|
secrecyRecover,
|
|
858
|
+
secrecyRegenerateRecovery,
|
|
819
859
|
secrecySetReauth,
|
|
820
860
|
secrecyStatus,
|
|
821
861
|
secrecyTouch,
|
|
@@ -850,9 +890,17 @@ export {
|
|
|
850
890
|
loginRequestSchema,
|
|
851
891
|
loginResponseSchema,
|
|
852
892
|
meResponseSchema,
|
|
893
|
+
passwordSchema,
|
|
853
894
|
refreshResponseSchema,
|
|
854
|
-
registerRequestSchema,
|
|
855
895
|
sessionBundleSchema,
|
|
896
|
+
signupAvailabilitySchema,
|
|
897
|
+
signupCompleteRequestSchema,
|
|
898
|
+
signupCompleteResponseSchema,
|
|
899
|
+
signupStartRequestSchema,
|
|
900
|
+
signupStartResponseSchema,
|
|
901
|
+
signupStatusSchema,
|
|
902
|
+
signupVerifyRequestSchema,
|
|
903
|
+
signupVerifyResponseSchema,
|
|
856
904
|
twoFactorChallengeRequestSchema
|
|
857
905
|
} from './http/auth';
|
|
858
906
|
export type {
|
|
@@ -862,8 +910,15 @@ export type {
|
|
|
862
910
|
LoginResponse,
|
|
863
911
|
MeResponse,
|
|
864
912
|
RefreshResponse,
|
|
865
|
-
RegisterRequest,
|
|
866
913
|
SessionBundle,
|
|
914
|
+
SignupAvailability,
|
|
915
|
+
SignupCompleteRequest,
|
|
916
|
+
SignupCompleteResponse,
|
|
917
|
+
SignupStartRequest,
|
|
918
|
+
SignupStartResponse,
|
|
919
|
+
SignupStatus,
|
|
920
|
+
SignupVerifyRequest,
|
|
921
|
+
SignupVerifyResponse,
|
|
867
922
|
TwoFactorChallengeRequest
|
|
868
923
|
} from './http/auth';
|
|
869
924
|
export {
|
package/src/protocol/agent.ts
CHANGED
|
@@ -580,6 +580,10 @@ export const AGENT_COLLECT = 'agent.collect' as const;
|
|
|
580
580
|
export const AGENT_SCAN = 'agent.scan' as const;
|
|
581
581
|
/** Push the per-device collection config (cadences + capture mode) to the agent. */
|
|
582
582
|
export const AGENT_CONFIG = 'agent.config' as const;
|
|
583
|
+
/** Server → agent: a fresh device token replacing the one about to expire; the agent persists it. */
|
|
584
|
+
export const AGENT_TOKEN_ROTATE = 'agent.tokenRotate' as const;
|
|
585
|
+
export const agentTokenRotatePayloadSchema = z.object({ token: z.string().min(1).max(4096) });
|
|
586
|
+
export type AgentTokenRotatePayload = z.infer<typeof agentTokenRotatePayloadSchema>;
|
|
583
587
|
/** Tell the agent to self-destruct (wipe its local config + binary) and exit. */
|
|
584
588
|
export const AGENT_DESTROY = 'agent.destroy' as const;
|
|
585
589
|
/** Tell the agent to download, verify and swap in a newer signed binary. */
|
|
@@ -1107,11 +1111,45 @@ export const agentServerMessageSchema = z.discriminatedUnion('command', [
|
|
|
1107
1111
|
z.object({
|
|
1108
1112
|
command: z.literal(AGENT_SYNC_DELETE),
|
|
1109
1113
|
payload: agentSyncDeletePayloadSchema
|
|
1114
|
+
}),
|
|
1115
|
+
z.object({
|
|
1116
|
+
command: z.literal(AGENT_TOKEN_ROTATE),
|
|
1117
|
+
payload: agentTokenRotatePayloadSchema
|
|
1110
1118
|
})
|
|
1111
1119
|
]);
|
|
1112
1120
|
|
|
1113
1121
|
export type AgentServerMessage = z.infer<typeof agentServerMessageSchema>;
|
|
1114
1122
|
|
|
1123
|
+
/**
|
|
1124
|
+
* Signature of a high-impact order, carried next to `command` and `payload` as
|
|
1125
|
+
* `sig`. Ed25519 over `command \n nonce \n issuedAt \n` followed by the exact
|
|
1126
|
+
* bytes of the payload as sent. The agent verifies it against the key pinned at
|
|
1127
|
+
* enrolment, refuses an `issuedAt` more than five minutes off, and refuses a
|
|
1128
|
+
* nonce it has already seen.
|
|
1129
|
+
*/
|
|
1130
|
+
export const orderSignatureSchema = z.object({
|
|
1131
|
+
nonce: z.string().length(32),
|
|
1132
|
+
issuedAt: z.number().int().positive(),
|
|
1133
|
+
signature: z.string().length(88)
|
|
1134
|
+
});
|
|
1135
|
+
export type OrderSignature = z.infer<typeof orderSignatureSchema>;
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* The orders the server signs (`ORDER_SIGNING_KEY`) and the agent refuses
|
|
1139
|
+
* unsigned: what runs code, writes or deletes files, changes the agent's
|
|
1140
|
+
* privileges or its life. Mirror of `SIGNED_COMMANDS` in `agent/src/protocol.rs`.
|
|
1141
|
+
*/
|
|
1142
|
+
export const SIGNED_AGENT_COMMANDS: ReadonlySet<string> = new Set([
|
|
1143
|
+
AGENT_TERM_OPEN,
|
|
1144
|
+
AGENT_FILES_MUTATE,
|
|
1145
|
+
AGENT_FILES_UPLOAD,
|
|
1146
|
+
AGENT_SERVICE,
|
|
1147
|
+
AGENT_POWER,
|
|
1148
|
+
AGENT_DESTROY,
|
|
1149
|
+
AGENT_PKG_UPGRADE,
|
|
1150
|
+
AGENT_LIFECYCLE
|
|
1151
|
+
]);
|
|
1152
|
+
|
|
1115
1153
|
/**
|
|
1116
1154
|
* Server -> web client push events (no requestId), carried in the standard
|
|
1117
1155
|
* ServerMessage envelope. These constants name those unsolicited events.
|
package/src/protocol/error.ts
CHANGED
|
@@ -9,6 +9,9 @@ export const ErrorCodeSchema = z.enum([
|
|
|
9
9
|
'conflict',
|
|
10
10
|
'validation',
|
|
11
11
|
'rate_limited',
|
|
12
|
+
// The account's plan does not allow one more of what the command creates.
|
|
13
|
+
// `details` carries `{ feature, key, limit, plan }`.
|
|
14
|
+
'quota_exceeded',
|
|
12
15
|
'internal',
|
|
13
16
|
'unsupported_version',
|
|
14
17
|
// Password-based encryption is enabled but the session has not yet been
|
|
@@ -25,12 +25,13 @@ declare module 'deveye-sdk-client' {
|
|
|
25
25
|
} from 'react';
|
|
26
26
|
import type {
|
|
27
27
|
FeatureAccess,
|
|
28
|
+
FeatureDomain,
|
|
28
29
|
FeatureId,
|
|
29
30
|
MinimalUser,
|
|
30
31
|
User,
|
|
31
32
|
WorkspaceCapability
|
|
32
33
|
} from '@deveye/types';
|
|
33
|
-
import type { FeatureManifest, ManifestCommand } from '@deveye/types/sdk';
|
|
34
|
+
import type { AccountPlan, FeatureManifest, ManifestCommand } from '@deveye/types/sdk';
|
|
34
35
|
import type { SdkDeviceSummary } from '@deveye/types/sdk/client';
|
|
35
36
|
|
|
36
37
|
// ── UI kit ─────────────────────────────────────────────────────────────
|
|
@@ -72,6 +73,31 @@ declare module 'deveye-sdk-client' {
|
|
|
72
73
|
'aria-label'?: string;
|
|
73
74
|
disabled?: boolean;
|
|
74
75
|
}): ReactNode;
|
|
76
|
+
/**
|
|
77
|
+
* A single choice where each option explains itself: one card per option,
|
|
78
|
+
* label and consequences together. For two or three choices that commit
|
|
79
|
+
* the user; a harmless setting stays a `SegmentedControl`. A description
|
|
80
|
+
* may hold its own clickable elements without checking the card.
|
|
81
|
+
*/
|
|
82
|
+
export function ChoiceCards<T extends string>(props: {
|
|
83
|
+
value: T;
|
|
84
|
+
options: readonly {
|
|
85
|
+
value: T;
|
|
86
|
+
label: string;
|
|
87
|
+
description: ReactNode;
|
|
88
|
+
/** Icon class (`icon-lock`...), shown next to the label. */
|
|
89
|
+
icon?: string;
|
|
90
|
+
/** Why the option is not offered: makes it inert, shown under the description. */
|
|
91
|
+
unavailable?: ReactNode;
|
|
92
|
+
}[];
|
|
93
|
+
onChange: (value: T) => void;
|
|
94
|
+
disabled?: boolean;
|
|
95
|
+
/** The choice being applied: its card says so, the others wait. */
|
|
96
|
+
pending?: T | null;
|
|
97
|
+
/** A pointer click on a card, the current choice included: for a choice that advances a step. */
|
|
98
|
+
onPick?: (value: T) => void;
|
|
99
|
+
'aria-label'?: string;
|
|
100
|
+
}): ReactNode;
|
|
75
101
|
/**
|
|
76
102
|
* Le bouton d'enregistrement d'un panneau de réglages : « Enregistrement… »
|
|
77
103
|
* pendant l'aller-retour, « Enregistré » quelques secondes, puis l'intitulé
|
|
@@ -134,6 +160,15 @@ declare module 'deveye-sdk-client' {
|
|
|
134
160
|
body: ReactNode;
|
|
135
161
|
width?: number;
|
|
136
162
|
}): Promise<unknown>;
|
|
163
|
+
/** The technical terms the app's glossary defines. */
|
|
164
|
+
export type GlossaryTermId =
|
|
165
|
+
'zeroKnowledge' | 'encryption' | 'twoFactor' | 'webhook' | 'imap' | 'smtp' | 'proxy';
|
|
166
|
+
/**
|
|
167
|
+
* A technical term inside a sentence: reads like the surrounding text and
|
|
168
|
+
* opens its plain-language definition on click. `children` is the term as
|
|
169
|
+
* the sentence spells it; it defaults to the definition's title.
|
|
170
|
+
*/
|
|
171
|
+
export function Term(props: { id: GlossaryTermId; children?: ReactNode }): ReactNode;
|
|
137
172
|
/** Request the enclosing Dialog's guarded close (the unsaved-changes prompt included). */
|
|
138
173
|
export function useDialogClose(): () => void;
|
|
139
174
|
/** Register `fn` as the enclosing Dialog's primary action (Enter triggers it); `null` clears it. */
|
|
@@ -422,6 +457,12 @@ declare module 'deveye-sdk-client' {
|
|
|
422
457
|
/** Device paths as the agent reports them: Windows or POSIX, joined accordingly. */
|
|
423
458
|
export function isWinPath(p: string): boolean;
|
|
424
459
|
export function joinPath(base: string, name: string): string;
|
|
460
|
+
/**
|
|
461
|
+
* The `href` for a link whose address comes from data (a remote feed, another
|
|
462
|
+
* member's input, a probe): only http(s) and mailto come out, anything else is
|
|
463
|
+
* `undefined`. Use it on every `<a href>` you do not write yourself.
|
|
464
|
+
*/
|
|
465
|
+
export function safeHref(url: string | null | undefined): string | undefined;
|
|
425
466
|
/**
|
|
426
467
|
* The DevEye version this interface was built from: what an agent's
|
|
427
468
|
* reported version is compared against to offer a self-update.
|
|
@@ -435,6 +476,13 @@ declare module 'deveye-sdk-client' {
|
|
|
435
476
|
export function httpGet<T>(path: string, outputSchema?: ZodType<T>): Promise<T>;
|
|
436
477
|
/** Renews the access cookie before a raw `fetch` that bypasses the client (a download). */
|
|
437
478
|
export function ensureFreshAccess(): Promise<void>;
|
|
479
|
+
/**
|
|
480
|
+
* The account's plan, kept live. `null` while loading AND when this DevEye
|
|
481
|
+
* has no plan provider (everything unlimited): never read it as "free".
|
|
482
|
+
*/
|
|
483
|
+
export function useAccountPlan(): AccountPlan | null;
|
|
484
|
+
/** Opens an account view (`manifest.accountEntry`): the given module's, or the first one. No-op without any. */
|
|
485
|
+
export function openAccountView(featureId?: string): void;
|
|
438
486
|
export interface LiveOutlineProps {
|
|
439
487
|
'data-live-peer'?: true;
|
|
440
488
|
style?: CSSProperties;
|
|
@@ -464,6 +512,17 @@ declare module 'deveye-sdk-client' {
|
|
|
464
512
|
export function useFeatureLifecycle(hooks: { onUnmount?: () => void }): void;
|
|
465
513
|
/** The members of the active workspace, as the session lists them (empty before it answers). */
|
|
466
514
|
export function useWorkspaceMembers(): readonly MinimalUser[];
|
|
515
|
+
/**
|
|
516
|
+
* The domains of a feature whose manifest declares `domains`, in the
|
|
517
|
+
* active workspace, kept live. For a form that designates one (filter on
|
|
518
|
+
* `verifiedAt !== null`); declaring and verifying happen in the Domains
|
|
519
|
+
* tab, opened with `<FeatureSettingsButton initialSection='domains' />`.
|
|
520
|
+
*/
|
|
521
|
+
export function useDomains(feature: FeatureId): {
|
|
522
|
+
domains: readonly FeatureDomain[];
|
|
523
|
+
loading: boolean;
|
|
524
|
+
error: string | null;
|
|
525
|
+
};
|
|
467
526
|
/**
|
|
468
527
|
* A member's identity dot: their avatar, or the default picture until they
|
|
469
528
|
* upload one. `user` may be undefined: a deleted account must not break a
|