@deveye/types 0.25.6 → 0.26.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 +20 -1
- package/src/domain/featureRegistry.ts +10 -0
- package/src/domain/home.ts +1 -0
- package/src/domain/live.ts +1 -0
- package/src/domain/workspaceRole.ts +6 -0
- package/src/features/agent.ts +5 -5
- package/src/index.ts +2 -0
- package/src/protocol/agent.ts +18 -6
- package/src/sdk/client-ambient.d.ts +70 -2
- package/src/sdk/client.ts +5 -0
- package/src/sdk/server.ts +6 -0
- package/src/sdk/testing.ts +10 -3
package/package.json
CHANGED
package/src/domain/device.ts
CHANGED
|
@@ -96,7 +96,22 @@ export const deviceSchema = z.object({
|
|
|
96
96
|
* during deletion, so the UI can surface it and the deletion is aborted.
|
|
97
97
|
* Null when there's no pending error.
|
|
98
98
|
*/
|
|
99
|
-
deleteError: z.string().nullable().default(null)
|
|
99
|
+
deleteError: z.string().nullable().default(null),
|
|
100
|
+
/**
|
|
101
|
+
* The agent was paused (from the app, `deveye-agent pause` or the tray
|
|
102
|
+
* icon): it monitors nothing and takes no order until resumed. `until` is
|
|
103
|
+
* the unix second it resumes on its own, null for a pause that waits to be
|
|
104
|
+
* resumed; `reachable` says its control session is connected, so a resume
|
|
105
|
+
* ordered now reaches it. Null when the agent is not paused.
|
|
106
|
+
*/
|
|
107
|
+
pause: z
|
|
108
|
+
.object({
|
|
109
|
+
since: z.number().int().nonnegative(),
|
|
110
|
+
until: z.number().int().nonnegative().nullable(),
|
|
111
|
+
reachable: z.boolean()
|
|
112
|
+
})
|
|
113
|
+
.nullable()
|
|
114
|
+
.default(null)
|
|
100
115
|
});
|
|
101
116
|
|
|
102
117
|
export type Device = z.infer<typeof deviceSchema>;
|
|
@@ -148,6 +163,10 @@ export interface DeviceRow {
|
|
|
148
163
|
status_before_delete: string | null;
|
|
149
164
|
/** Last self-destruct failure message (deletion aborted); null otherwise. */
|
|
150
165
|
delete_error: string | null;
|
|
166
|
+
/** Unix second the agent reported itself paused; null when it is not. */
|
|
167
|
+
paused_at: number | null;
|
|
168
|
+
/** Unix second the pause ends on its own; null while paused without a deadline. */
|
|
169
|
+
paused_until: number | null;
|
|
151
170
|
/** Rang chez lui ; celui des espaces qui ne font que le voir vit dans `item_shares`. */
|
|
152
171
|
sort_order: number;
|
|
153
172
|
}
|
|
@@ -330,6 +330,16 @@ export const FEATURE_REGISTRY: readonly (FeatureDescriptor & { id: WorkspaceFeat
|
|
|
330
330
|
hasItems: false,
|
|
331
331
|
shareTier: 'never'
|
|
332
332
|
},
|
|
333
|
+
{
|
|
334
|
+
id: 'pdf',
|
|
335
|
+
label: 'PDF',
|
|
336
|
+
description:
|
|
337
|
+
'Fusionner, trier, signer, annoter, remplir et protéger des PDF dans le navigateur, et les signatures gardées sur le compte. Rien ne passe par le serveur.',
|
|
338
|
+
icon: 'pdf',
|
|
339
|
+
notifies: false,
|
|
340
|
+
hasItems: false,
|
|
341
|
+
shareTier: 'never'
|
|
342
|
+
},
|
|
333
343
|
{
|
|
334
344
|
id: 'invoicing',
|
|
335
345
|
label: 'Facturation',
|
package/src/domain/home.ts
CHANGED
package/src/domain/live.ts
CHANGED
|
@@ -220,6 +220,7 @@ export const TOPIC_FEATURE: Record<NativeLiveTopic, WorkspaceFeatureId | null> =
|
|
|
220
220
|
cve: 'cve',
|
|
221
221
|
mailserver: 'mailserver',
|
|
222
222
|
convert: 'convert',
|
|
223
|
+
pdf: 'pdf',
|
|
223
224
|
invoicing: 'invoicing',
|
|
224
225
|
shortlinks: 'shortlinks',
|
|
225
226
|
whiteboard: 'whiteboard',
|
|
@@ -102,6 +102,12 @@ export const workspaceFeatureIdSchema = z.enum([
|
|
|
102
102
|
* ne voit les conversions d'un autre membre.
|
|
103
103
|
*/
|
|
104
104
|
'convert',
|
|
105
|
+
/**
|
|
106
|
+
* PDF. `read` = l'atelier, qui travaille dans le navigateur, et ses
|
|
107
|
+
* signatures gardées sur le compte. Rien ne passe par le serveur, il n'y a
|
|
108
|
+
* rien à écrire.
|
|
109
|
+
*/
|
|
110
|
+
'pdf',
|
|
105
111
|
/**
|
|
106
112
|
* Facturation. `read` = consulter les clients, les devis, les factures et
|
|
107
113
|
* les règlements. `write` = tenir le carnet, rédiger et corriger un
|
package/src/features/agent.ts
CHANGED
|
@@ -62,11 +62,11 @@ export const agentPower = {
|
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
66
|
-
* `
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
65
|
+
* Act on the agent process of a device (not the machine): `restart`
|
|
66
|
+
* (exit-and-relaunch), `pause` (monitor nothing and take no order until
|
|
67
|
+
* resumed), `resume`. Needs `devices: write`; the agent must be online, or
|
|
68
|
+
* paused and reachable for `resume`. Fire-and-forget: the outcome is observed
|
|
69
|
+
* through presence and the device's `pause` field.
|
|
70
70
|
*/
|
|
71
71
|
export const agentLifecycle = {
|
|
72
72
|
command: 'agent.lifecycle' as const,
|
package/src/index.ts
CHANGED
package/src/protocol/agent.ts
CHANGED
|
@@ -818,6 +818,16 @@ export type AgentTokenRotatePayload = z.infer<typeof agentTokenRotatePayloadSche
|
|
|
818
818
|
* `CLOSE_PENDING_APPROVAL` in the agent's `runner.rs`.
|
|
819
819
|
*/
|
|
820
820
|
export const AGENT_CLOSE_PENDING_APPROVAL = 4001;
|
|
821
|
+
/**
|
|
822
|
+
* Request headers of an agent connecting *paused* (`agent.lifecycle pause`,
|
|
823
|
+
* `deveye-agent pause`, or the tray icon): `x-deveye-paused: 1`, and the unix
|
|
824
|
+
* second the pause ends in `x-deveye-paused-until` when it has one. Such a
|
|
825
|
+
* session is control only: the server keeps it out of the online fleet, pushes
|
|
826
|
+
* it no work, and only `resume`, `restart`, a token rotation or a destroy
|
|
827
|
+
* reach it.
|
|
828
|
+
*/
|
|
829
|
+
export const AGENT_PAUSED_HEADER = 'x-deveye-paused';
|
|
830
|
+
export const AGENT_PAUSED_UNTIL_HEADER = 'x-deveye-paused-until';
|
|
821
831
|
/** Tell the agent to self-destruct (wipe its local config + binary) and exit. */
|
|
822
832
|
export const AGENT_DESTROY = 'agent.destroy' as const;
|
|
823
833
|
/** Tell the agent to download, verify and swap in a newer signed binary. */
|
|
@@ -840,17 +850,19 @@ export const agentUpdatePayloadSchema = z.object({
|
|
|
840
850
|
export type AgentUpdatePayload = z.infer<typeof agentUpdatePayloadSchema>;
|
|
841
851
|
|
|
842
852
|
/**
|
|
843
|
-
*
|
|
844
|
-
* - `stop` exit now. Supervised (autostart service) → the manager relaunches
|
|
845
|
-
* it; standalone → the device stays offline until a manual relaunch.
|
|
853
|
+
* Act on the agent's own *process* (not the machine):
|
|
846
854
|
* - `restart` exit and come back: the manager relaunches a supervised agent, a
|
|
847
855
|
* standalone one respawns itself first.
|
|
848
|
-
*
|
|
849
|
-
*
|
|
856
|
+
* - `pause` stop monitoring and obeying until resumed: the agent closes its
|
|
857
|
+
* working session and reconnects paused (see `AGENT_PAUSED_HEADER`). The
|
|
858
|
+
* pause survives a restart of the agent and of the machine.
|
|
859
|
+
* - `resume` end the pause; only a paused agent takes it.
|
|
860
|
+
* Fire-and-forget: no reply frame. The outcome is observed through presence
|
|
861
|
+
* (`restart`) or the device's `pause` field.
|
|
850
862
|
*/
|
|
851
863
|
export const AGENT_LIFECYCLE = 'agent.lifecycle' as const;
|
|
852
864
|
|
|
853
|
-
export const agentLifecycleActionSchema = z.enum(['
|
|
865
|
+
export const agentLifecycleActionSchema = z.enum(['restart', 'pause', 'resume']);
|
|
854
866
|
export type AgentLifecycleAction = z.infer<typeof agentLifecycleActionSchema>;
|
|
855
867
|
|
|
856
868
|
export const agentLifecyclePayloadSchema = z.object({ action: agentLifecycleActionSchema });
|
|
@@ -300,6 +300,12 @@ declare module 'deveye-sdk-client' {
|
|
|
300
300
|
step?: number;
|
|
301
301
|
label: string;
|
|
302
302
|
valueLabel?: string;
|
|
303
|
+
/**
|
|
304
|
+
* A number field in place of `valueLabel`: the exact value is typed, at
|
|
305
|
+
* the same step. The slider's bounds are advice only: the field goes
|
|
306
|
+
* from 0 to far beyond.
|
|
307
|
+
*/
|
|
308
|
+
editable?: boolean;
|
|
303
309
|
marks?: readonly string[];
|
|
304
310
|
indicator?: number;
|
|
305
311
|
hint?: string;
|
|
@@ -690,8 +696,11 @@ declare module 'deveye-sdk-client' {
|
|
|
690
696
|
file: File,
|
|
691
697
|
onProgress: (ratio: number) => void
|
|
692
698
|
): UploadHandle;
|
|
693
|
-
/**
|
|
694
|
-
|
|
699
|
+
/**
|
|
700
|
+
* Downloads a URL served as an attachment, without leaving the page.
|
|
701
|
+
* `name` names the file: a `blob:` URL made in the page has none.
|
|
702
|
+
*/
|
|
703
|
+
export function saveFrom(url: string, name?: string): void;
|
|
695
704
|
/** Opens the system picker; `folder` takes a whole folder, relative paths included. Cancelled: empty. */
|
|
696
705
|
export function pickFiles(opts?: {
|
|
697
706
|
multiple?: boolean;
|
|
@@ -847,6 +856,20 @@ declare module 'deveye-sdk-client' {
|
|
|
847
856
|
input: z.input<Extract<M['commands'][number], { command: N }>['input'] & ZodType>,
|
|
848
857
|
opts?: SendOptions
|
|
849
858
|
): Promise<z.output<Extract<M['commands'][number], { command: N }>['output'] & ZodType>>;
|
|
859
|
+
/**
|
|
860
|
+
* The same command, to a given workspace of one of the account's
|
|
861
|
+
* instances: `instanceId: null` for this one, else a remote instance
|
|
862
|
+
* the account is signed in to (`useRemoteTargets`). The targeted
|
|
863
|
+
* server judges the rights, and the application-code prompt, when it
|
|
864
|
+
* asks for one, is that account's. Rejects with `closed` when no
|
|
865
|
+
* session is open there.
|
|
866
|
+
*/
|
|
867
|
+
sendTo<N extends M['commands'][number]['command']>(
|
|
868
|
+
target: { instanceId: number | null; workspaceId: number },
|
|
869
|
+
name: N,
|
|
870
|
+
input: z.input<Extract<M['commands'][number], { command: N }>['input'] & ZodType>,
|
|
871
|
+
opts?: Omit<SendOptions, 'workspaceId'>
|
|
872
|
+
): Promise<z.output<Extract<M['commands'][number], { command: N }>['output'] & ZodType>>;
|
|
850
873
|
/**
|
|
851
874
|
* Fire and forget: no reply, no timeout, no trace entry. For what is
|
|
852
875
|
* re-sent several times a second (a pointer position); silently dropped
|
|
@@ -1148,6 +1171,38 @@ declare module 'deveye-sdk-client' {
|
|
|
1148
1171
|
name: string;
|
|
1149
1172
|
features: readonly string[];
|
|
1150
1173
|
}>;
|
|
1174
|
+
/** A remote instance of the account (another DevEye server it signs in to). */
|
|
1175
|
+
export interface RemoteInstanceSummary {
|
|
1176
|
+
id: number;
|
|
1177
|
+
label: string;
|
|
1178
|
+
origin: string;
|
|
1179
|
+
/** Why nothing can be sent there right now; `null` when it can. */
|
|
1180
|
+
unavailable: string | null;
|
|
1181
|
+
}
|
|
1182
|
+
/** A workspace of a remote instance: the `{ instanceId, workspaceId }` target of `sendTo`. */
|
|
1183
|
+
export interface RemoteWorkspaceTarget {
|
|
1184
|
+
/** Unique across the workspaces of every instance. */
|
|
1185
|
+
key: string;
|
|
1186
|
+
instanceId: number;
|
|
1187
|
+
instanceLabel: string;
|
|
1188
|
+
instanceOrigin: string;
|
|
1189
|
+
workspaceId: number;
|
|
1190
|
+
workspaceName: string;
|
|
1191
|
+
/** Its instance's. */
|
|
1192
|
+
unavailable: string | null;
|
|
1193
|
+
}
|
|
1194
|
+
export interface RemoteTargets {
|
|
1195
|
+
instances: readonly RemoteInstanceSummary[];
|
|
1196
|
+
workspaces: readonly RemoteWorkspaceTarget[];
|
|
1197
|
+
}
|
|
1198
|
+
/**
|
|
1199
|
+
* The account's remote instances and their workspaces, probed while the
|
|
1200
|
+
* component is mounted. The two servers never talk to each other: this
|
|
1201
|
+
* browser carries a `sendTo` command to the instance chosen, on the
|
|
1202
|
+
* socket it holds there. Signed out of one, its workspaces are those last
|
|
1203
|
+
* seen, named but not targetable.
|
|
1204
|
+
*/
|
|
1205
|
+
export function useRemoteTargets(): RemoteTargets;
|
|
1151
1206
|
/**
|
|
1152
1207
|
* The domains of a feature whose manifest declares `domains`, in the
|
|
1153
1208
|
* active workspace, kept live. For a form that designates one (filter on
|
|
@@ -1210,6 +1265,19 @@ declare module 'deveye-sdk-client' {
|
|
|
1210
1265
|
* is the host's; a missing item is ignored after a short grace.
|
|
1211
1266
|
*/
|
|
1212
1267
|
export function openFeature(feature: string, itemId?: number | string): void;
|
|
1268
|
+
/** A file one feature hands to another, with what the recipient should do with it, in its own terms. */
|
|
1269
|
+
export interface HandedFile {
|
|
1270
|
+
file: File;
|
|
1271
|
+
purpose: string | null;
|
|
1272
|
+
}
|
|
1273
|
+
/**
|
|
1274
|
+
* Hands a file to another feature and opens it: the recipient picks it up
|
|
1275
|
+
* through `useHandedFile`. The parcel waits in memory, is taken once, and
|
|
1276
|
+
* never outlives the page.
|
|
1277
|
+
*/
|
|
1278
|
+
export function handFileTo(feature: string, file: File, purpose?: string | null): void;
|
|
1279
|
+
/** Picks up the file handed to `feature`: the one waiting at mount, and those arriving while the view is open. */
|
|
1280
|
+
export function useHandedFile(feature: string, onFile: (parcel: HandedFile) => void): void;
|
|
1213
1281
|
/**
|
|
1214
1282
|
* Ask the feature popup for a wider frame (px) while the calling
|
|
1215
1283
|
* component is mounted, `null` to ask for nothing. Several requests
|
package/src/sdk/client.ts
CHANGED
|
@@ -93,6 +93,11 @@ export interface FeatureClient {
|
|
|
93
93
|
* Panels for the manifest's settings tabs that need one: `'general'`,
|
|
94
94
|
* `'sources'`, `'encryption'`, and any custom tab id. Generic tabs
|
|
95
95
|
* (`'notifications'`, `'permissions'`) need no panel.
|
|
96
|
+
*
|
|
97
|
+
* `'sharing'` is not a tab of yours: the shell draws its own sharing tab
|
|
98
|
+
* for an item, and a panel under this id is appended below it, for a
|
|
99
|
+
* gesture that extends sharing (Devices: enrolling the machine on a
|
|
100
|
+
* remote instance too).
|
|
96
101
|
*/
|
|
97
102
|
settingsPanels?: Readonly<Record<string, ComponentType<SettingsPanelProps>>>;
|
|
98
103
|
/**
|
package/src/sdk/server.ts
CHANGED
|
@@ -419,6 +419,8 @@ export interface DevEyeFacade {
|
|
|
419
419
|
*/
|
|
420
420
|
list(): Promise<readonly SdkDevice[]>;
|
|
421
421
|
isOnline(deviceId: string): boolean;
|
|
422
|
+
/** The agent is paused and its control session is connected: offline for every purpose but a resume. */
|
|
423
|
+
isPaused(deviceId: string): boolean;
|
|
422
424
|
};
|
|
423
425
|
/** Requires capability `'telemetry.read'` (native-id modules only). */
|
|
424
426
|
telemetry: SdkTelemetry;
|
|
@@ -679,6 +681,8 @@ export interface SdkWorkspaceSummary {
|
|
|
679
681
|
*/
|
|
680
682
|
export interface AgentsFacade {
|
|
681
683
|
isOnline(deviceId: string): boolean;
|
|
684
|
+
/** The agent is paused and its control session is connected (never online at the same time). */
|
|
685
|
+
isPaused(deviceId: string): boolean;
|
|
682
686
|
/**
|
|
683
687
|
* The two orders a device's lifecycle gives the hub. `requestDestroy`
|
|
684
688
|
* asks the agent to uninstall itself (deletion path); `disconnectAgent`
|
|
@@ -1183,6 +1187,8 @@ export interface SdkFleetDevices {
|
|
|
1183
1187
|
/** One device by id, whatever its workspace, or null. */
|
|
1184
1188
|
find(deviceId: string): Promise<SdkDevice | null>;
|
|
1185
1189
|
isOnline(deviceId: string): boolean;
|
|
1190
|
+
/** The agent is paused and its control session is connected: offline for every purpose but a resume. */
|
|
1191
|
+
isPaused(deviceId: string): boolean;
|
|
1186
1192
|
}
|
|
1187
1193
|
|
|
1188
1194
|
/**
|
package/src/sdk/testing.ts
CHANGED
|
@@ -230,7 +230,8 @@ function recordingDevices(
|
|
|
230
230
|
: Promise.resolve(devices.find((d) => d.id === id) ?? testDevice({ id })),
|
|
231
231
|
assertControl: () => Promise.resolve(),
|
|
232
232
|
list: () => Promise.resolve([...devices]),
|
|
233
|
-
isOnline: (id) => devices.find((d) => d.id === id)?.online ?? true
|
|
233
|
+
isOnline: (id) => devices.find((d) => d.id === id)?.online ?? true,
|
|
234
|
+
isPaused: () => false
|
|
234
235
|
};
|
|
235
236
|
}
|
|
236
237
|
|
|
@@ -300,6 +301,7 @@ function recordingAgents(recorded: RecordedCalls, docker: TestAgents = {}): DevE
|
|
|
300
301
|
};
|
|
301
302
|
return {
|
|
302
303
|
isOnline: () => true,
|
|
304
|
+
isPaused: () => false,
|
|
303
305
|
requestScan: req('requestScan'),
|
|
304
306
|
pushConfig: (deviceId) => Promise.resolve(req('pushConfig')(deviceId)),
|
|
305
307
|
// The app's rule with the harness's plan: paid unless `paid: false`.
|
|
@@ -925,14 +927,19 @@ export function createTestServiceDeps<Repo = undefined>(
|
|
|
925
927
|
});
|
|
926
928
|
}
|
|
927
929
|
},
|
|
928
|
-
devicesFor: () => ({
|
|
930
|
+
devicesFor: () => ({
|
|
931
|
+
list: devices.list,
|
|
932
|
+
isOnline: devices.isOnline,
|
|
933
|
+
isPaused: devices.isPaused
|
|
934
|
+
}),
|
|
929
935
|
membersFor: (workspaceId) => ({
|
|
930
936
|
list: () => Promise.resolve(overrides.members?.[workspaceId] ?? [])
|
|
931
937
|
}),
|
|
932
938
|
devices: {
|
|
933
939
|
find: (id) =>
|
|
934
940
|
Promise.resolve((overrides.devices ?? []).find((d) => d.id === id) ?? null),
|
|
935
|
-
isOnline: devices.isOnline
|
|
941
|
+
isOnline: devices.isOnline,
|
|
942
|
+
isPaused: devices.isPaused
|
|
936
943
|
},
|
|
937
944
|
telemetry: recordingTelemetry(recorded, overrides.snapshots ?? []),
|
|
938
945
|
geo: {
|