@lazehq/cli 0.1.34 → 0.1.36
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/dist/laze.mjs +466 -295
- package/package.json +1 -1
package/dist/laze.mjs
CHANGED
|
@@ -35708,7 +35708,7 @@ function flagText({
|
|
|
35708
35708
|
}
|
|
35709
35709
|
|
|
35710
35710
|
// src/rules/cli-version.rules.ts
|
|
35711
|
-
var STAMPED = "0.1.
|
|
35711
|
+
var STAMPED = "0.1.36";
|
|
35712
35712
|
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
35713
35713
|
return stamped.startsWith("__") ? "dev" : stamped;
|
|
35714
35714
|
}
|
|
@@ -57825,7 +57825,11 @@ var personPresenceSchemaDefinition = external_exports.object({
|
|
|
57825
57825
|
awayByHand: external_exports.boolean(),
|
|
57826
57826
|
status: customStatusSchemaDefinition.nullable(),
|
|
57827
57827
|
/** Notifications paused or inside their hours; null when they hear of things now. */
|
|
57828
|
-
doNotDisturb: doNotDisturbSchemaDefinition.nullable().optional()
|
|
57828
|
+
doNotDisturb: doNotDisturbSchemaDefinition.nullable().optional(),
|
|
57829
|
+
/** Their picture, an uploaded or Google one; null or absent without one. */
|
|
57830
|
+
image: external_exports.string().nullable().optional(),
|
|
57831
|
+
/** Their IANA time zone, for their local time; null or absent while Laze does not know it. */
|
|
57832
|
+
timeZone: external_exports.string().nullable().optional()
|
|
57829
57833
|
});
|
|
57830
57834
|
var personPresenceSchema = personPresenceSchemaDefinition;
|
|
57831
57835
|
var presenceListSchemaDefinition = external_exports.object({ people: external_exports.array(personPresenceSchemaDefinition) });
|
|
@@ -59486,6 +59490,8 @@ var notificationSettingsSchemaDefinition = external_exports.object({
|
|
|
59486
59490
|
dndStart: clockSchema,
|
|
59487
59491
|
dndEnd: clockSchema,
|
|
59488
59492
|
timeZone: external_exports.string().min(1).max(64),
|
|
59493
|
+
/** The zone follows the browser the person uses; false once they picked one. */
|
|
59494
|
+
timeZoneFromDevice: external_exports.boolean().default(true),
|
|
59489
59495
|
/** Notifications paused until then, whatever the schedule says. */
|
|
59490
59496
|
snoozeUntil: external_exports.iso.datetime().nullable(),
|
|
59491
59497
|
pushEnabled: external_exports.boolean(),
|
|
@@ -59623,6 +59629,7 @@ var desktopPublicationSchemaDefinition = external_exports.object({
|
|
|
59623
59629
|
});
|
|
59624
59630
|
var desktopPublicationSchema = desktopPublicationSchemaDefinition;
|
|
59625
59631
|
var quietReasonSchema = external_exports.enum(["paused", "hours"]);
|
|
59632
|
+
var personTimeZoneSchemaDefinition = external_exports.object({ userId: userIdSchema, timeZone: external_exports.string() });
|
|
59626
59633
|
var quietPersonSchemaDefinition = external_exports.object({
|
|
59627
59634
|
userId: userIdSchema,
|
|
59628
59635
|
reason: quietReasonSchema,
|
|
@@ -59635,7 +59642,7 @@ var NotificationApi = moduleApi()("notification");
|
|
|
59635
59642
|
var workspaceInputSchema2 = external_exports.object({ workspaceId: workspaceIdSchema2 });
|
|
59636
59643
|
var heartbeatInputSchemaDefinition = external_exports.object({
|
|
59637
59644
|
workspaceId: workspaceIdSchema2,
|
|
59638
|
-
/** The browser's IANA time zone; the
|
|
59645
|
+
/** The browser's IANA time zone; the person's zone follows it until they pick one. */
|
|
59639
59646
|
timeZone: external_exports.string().min(1).max(64).optional()
|
|
59640
59647
|
});
|
|
59641
59648
|
var heartbeatInputSchema = heartbeatInputSchemaDefinition;
|
|
@@ -61688,7 +61695,9 @@ var vaultSealedApprovalSchemaDefinition = external_exports.object({
|
|
|
61688
61695
|
command: external_exports.array(external_exports.string()),
|
|
61689
61696
|
/** The run's public key; the opened value is encrypted to it and nothing else. */
|
|
61690
61697
|
runPublicKey: base64Url,
|
|
61691
|
-
material: vaultSealedMaterialSchemaDefinition
|
|
61698
|
+
material: vaultSealedMaterialSchemaDefinition,
|
|
61699
|
+
/** The longest Allow for this agent the card offers; null offers Allow once only. */
|
|
61700
|
+
maxLeaseSeconds: external_exports.number().int().positive().nullable().optional()
|
|
61692
61701
|
});
|
|
61693
61702
|
var vaultSealedApprovalSchema = vaultSealedApprovalSchemaDefinition;
|
|
61694
61703
|
var vaultUi = uiTokens("vault");
|
|
@@ -61699,13 +61708,17 @@ var answerSealedApprovalInputSchemaDefinition = external_exports.object({
|
|
|
61699
61708
|
workspaceId: external_exports.string().min(1),
|
|
61700
61709
|
requestId: external_exports.string().min(1),
|
|
61701
61710
|
release: external_exports.object({ epk: base64Url, ciphertext: base64Url }),
|
|
61702
|
-
via: external_exports.enum(["feed", "channel", "ios", "desktop", "web"]).default("web")
|
|
61711
|
+
via: external_exports.enum(["feed", "channel", "ios", "desktop", "web"]).default("web"),
|
|
61712
|
+
/** Allow for this agent for this long: runs with the same key reuse the release until then. */
|
|
61713
|
+
durationSeconds: external_exports.number().int().positive().optional()
|
|
61703
61714
|
});
|
|
61704
61715
|
var answerSealedApprovalInputSchema = answerSealedApprovalInputSchemaDefinition;
|
|
61705
61716
|
var vaultRunSealedReleaseSchemaDefinition = external_exports.object({
|
|
61706
61717
|
requestId: external_exports.string(),
|
|
61707
61718
|
epk: base64Url,
|
|
61708
|
-
ciphertext: base64Url
|
|
61719
|
+
ciphertext: base64Url,
|
|
61720
|
+
/** A lease holds this release until then: the run keeps its key for the next run. */
|
|
61721
|
+
leaseEndsAt: external_exports.iso.datetime().optional()
|
|
61709
61722
|
});
|
|
61710
61723
|
var vaultRunSealedReleaseSchema = vaultRunSealedReleaseSchemaDefinition;
|
|
61711
61724
|
|
|
@@ -62006,7 +62019,9 @@ var updateVaultConnectionInputSchemaDefinition = external_exports.object({
|
|
|
62006
62019
|
maxLeaseSeconds: external_exports.number().int().positive().max(VAULT_MAX_LEASE_SECONDS).nullable().optional(),
|
|
62007
62020
|
everyUseAsks: external_exports.boolean().optional(),
|
|
62008
62021
|
secret: vaultSecretBundleSchema.optional(),
|
|
62009
|
-
egress: vaultEgressTargetSchema.nullable().optional()
|
|
62022
|
+
egress: vaultEgressTargetSchema.nullable().optional(),
|
|
62023
|
+
/** A fresh passkey or Face ID proof, needed to lower a key from Always ask or Human only. */
|
|
62024
|
+
reauthToken: external_exports.string().min(1).optional()
|
|
62010
62025
|
});
|
|
62011
62026
|
var updateVaultConnectionInputSchema = updateVaultConnectionInputSchemaDefinition;
|
|
62012
62027
|
var vaultGrantSubjectSchemaDefinition = external_exports.object({
|
|
@@ -62023,7 +62038,9 @@ var vaultGrantSchemaDefinition = external_exports.object({
|
|
|
62023
62038
|
lend: external_exports.boolean(),
|
|
62024
62039
|
grantedByUserId: external_exports.string(),
|
|
62025
62040
|
expiresAt: external_exports.iso.datetime().nullable(),
|
|
62026
|
-
createdAt: external_exports.iso.datetime()
|
|
62041
|
+
createdAt: external_exports.iso.datetime(),
|
|
62042
|
+
/** A share asked from the CLI or by an agent: nothing reaches it until the owner's passkey. */
|
|
62043
|
+
awaitingOwner: external_exports.boolean().optional()
|
|
62027
62044
|
});
|
|
62028
62045
|
var vaultGrantSchema = vaultGrantSchemaDefinition;
|
|
62029
62046
|
var grantVaultConnectionInputSchemaDefinition = external_exports.object({
|
|
@@ -62041,6 +62058,39 @@ var lendVaultConnectionInputSchemaDefinition = external_exports.object({
|
|
|
62041
62058
|
durationSeconds: external_exports.number().int().positive().nullable().default(null)
|
|
62042
62059
|
});
|
|
62043
62060
|
var lendVaultConnectionInputSchema = lendVaultConnectionInputSchemaDefinition;
|
|
62061
|
+
var shareVaultConnectionInputSchemaDefinition = external_exports.object({
|
|
62062
|
+
workspaceId: external_exports.string().min(1),
|
|
62063
|
+
connectionId: external_exports.string().min(1),
|
|
62064
|
+
/** The teammate whose own agents may use the key; they never see its value. */
|
|
62065
|
+
userId: external_exports.string().min(1),
|
|
62066
|
+
durationSeconds: external_exports.number().int().positive().nullable().default(null),
|
|
62067
|
+
/** A fresh passkey or Face ID proof makes the share live; without one it waits for the owner. */
|
|
62068
|
+
reauthToken: external_exports.string().min(1).optional()
|
|
62069
|
+
});
|
|
62070
|
+
var shareVaultConnectionInputSchema = shareVaultConnectionInputSchemaDefinition;
|
|
62071
|
+
var approveVaultShareInputSchemaDefinition = external_exports.object({
|
|
62072
|
+
workspaceId: external_exports.string().min(1),
|
|
62073
|
+
grantId: external_exports.string().min(1),
|
|
62074
|
+
reauthToken: external_exports.string().min(1)
|
|
62075
|
+
});
|
|
62076
|
+
var approveVaultShareInputSchema = approveVaultShareInputSchemaDefinition;
|
|
62077
|
+
var sealVaultConnectionInputSchemaDefinition = external_exports.object({
|
|
62078
|
+
workspaceId: external_exports.string().min(1),
|
|
62079
|
+
connectionId: external_exports.string().min(1),
|
|
62080
|
+
reauthToken: external_exports.string().min(1)
|
|
62081
|
+
});
|
|
62082
|
+
var sealVaultConnectionInputSchema = sealVaultConnectionInputSchemaDefinition;
|
|
62083
|
+
var requestVaultShareInputSchemaDefinition = external_exports.object({
|
|
62084
|
+
turnToken: external_exports.string().min(1),
|
|
62085
|
+
connection: external_exports.string().min(1),
|
|
62086
|
+
userId: external_exports.string().min(1),
|
|
62087
|
+
durationSeconds: external_exports.number().int().positive().nullable().default(null)
|
|
62088
|
+
});
|
|
62089
|
+
var setVaultLevelInTurnInputSchemaDefinition = external_exports.object({
|
|
62090
|
+
turnToken: external_exports.string().min(1),
|
|
62091
|
+
connection: external_exports.string().min(1),
|
|
62092
|
+
sensitivity: vaultSensitivitySchema
|
|
62093
|
+
});
|
|
62044
62094
|
var vaultAgentKindSchema = external_exports.enum(["personal", "team"]);
|
|
62045
62095
|
var openVaultTurnInputSchemaDefinition = external_exports.object({
|
|
62046
62096
|
workspaceId: external_exports.string().min(1),
|
|
@@ -62298,7 +62348,14 @@ var vaultConnectionUseSchemaDefinition = external_exports.object({
|
|
|
62298
62348
|
leaseId: external_exports.string().nullable().default(null),
|
|
62299
62349
|
origin: vaultUseOriginSchema.nullable().default(null),
|
|
62300
62350
|
/** How a person's read happened: `page` (Reveal) or `own_secret` (the CLI or Laze for them). */
|
|
62301
|
-
via: external_exports.string().nullable().default(null)
|
|
62351
|
+
via: external_exports.string().nullable().default(null),
|
|
62352
|
+
/** On a share or a tier change: the person it named, the new tier, and the proof used. */
|
|
62353
|
+
change: external_exports.object({
|
|
62354
|
+
subjectUserId: external_exports.string().nullable(),
|
|
62355
|
+
to: vaultSensitivitySchema.nullable(),
|
|
62356
|
+
direction: external_exports.enum(["raised", "lowered"]).nullable(),
|
|
62357
|
+
method: external_exports.string().nullable()
|
|
62358
|
+
}).nullable().optional()
|
|
62302
62359
|
});
|
|
62303
62360
|
var vaultConnectionUseSchema = vaultConnectionUseSchemaDefinition;
|
|
62304
62361
|
var vaultRevokeAtProviderSchema = external_exports.enum(["revoked", "failed", "not_supported"]);
|
|
@@ -62395,7 +62452,7 @@ var vaultTrpc = defineTrpcContract("vault").mutation("createConnection").withInp
|
|
|
62395
62452
|
reason: external_exports.string().trim().min(1).max(200),
|
|
62396
62453
|
reauthToken: external_exports.string().min(1).max(200).optional()
|
|
62397
62454
|
})
|
|
62398
|
-
).withOutput(external_exports.object({ fields: external_exports.record(external_exports.string(), external_exports.string()) })).mutation("beginReauth").withInput(workspaceInput).withOutput(vaultReauthChallengeSchema).mutation("confirmReauth").withInput(confirmVaultReauthInputSchema).withOutput(vaultReauthProofSchema).mutation("grantConnection").withInput(grantVaultConnectionInputSchema).withOutput(vaultGrantSchema).mutation("lendToChannel").withInput(lendVaultConnectionInputSchema).withOutput(vaultGrantSchema).mutation("revokeGrant").withInput(external_exports.object({ workspaceId: external_exports.string().min(1), grantId: external_exports.string().min(1) })).withOutput(external_exports.object({ revoked: external_exports.literal(true) })).query("listGrants").withInput(connectionInput).withOutput(external_exports.array(vaultGrantSchema)).query("listApprovals").withInput(external_exports.object({ ...workspaceInput.shape, state: vaultApprovalStateSchema.optional() })).withOutput(external_exports.array(vaultApprovalRequestSchema)).mutation("answerApproval").withInput(answerVaultApprovalInputSchema).withOutput(vaultApprovalRequestSchema).query("listAudit").withInput(vaultAuditReadInputSchema).withOutput(vaultAuditPageSchema).query("listActivity").withInput(vaultAuditReadInputSchema).withOutput(external_exports.array(vaultAuditEntrySchema)).query("listLeases").withInput(workspaceInput).withOutput(external_exports.array(vaultLeaseSchema)).mutation("endLease").withInput(endVaultLeaseInputSchema).withOutput(external_exports.object({ ended: external_exports.literal(true) })).query("mostAsked").withInput(vaultMostAskedInputSchema).withOutput(vaultMostAskedSchema).query("judgeStatus").withInput(workspaceInput).withOutput(vaultJudgeStatusSchema).query("listLevelLimits").withInput(workspaceInput).withOutput(external_exports.array(vaultLevelLimitSchema)).mutation("setLevelLimit").withInput(setVaultLevelLimitInputSchema).withOutput(external_exports.array(vaultLevelLimitSchema)).query("listDevices").withInput(workspaceInput).withOutput(external_exports.array(vaultDeviceSchema)).mutation("beginDeviceEnrolment").withInput(workspaceInput).withOutput(vaultDeviceEnrolmentSchema).mutation("finishDeviceEnrolment").withInput(finishVaultDeviceEnrolmentInputSchema).withOutput(vaultDeviceSchema).mutation("beginDeviceApproval").withInput(external_exports.object({ ...workspaceInput.shape, deviceId: external_exports.string().min(1) })).withOutput(external_exports.object({ challenge: external_exports.string(), sealed: external_exports.array(vaultSealedMaterialSchema) })).mutation("approveDevice").withInput(approveVaultDeviceInputSchema).withOutput(vaultDeviceSchema).mutation("removeDevice").withInput(external_exports.object({ ...workspaceInput.shape, deviceId: external_exports.string().min(1) })).withOutput(external_exports.object({ removed: external_exports.literal(true) })).mutation("createSealedConnection").withInput(createSealedConnectionInputSchema).withOutput(vaultConnectionSchema).mutation("resealConnection").withInput(resealConnectionInputSchema).withOutput(vaultConnectionSchema).mutation("openSealedConnection").withInput(
|
|
62455
|
+
).withOutput(external_exports.object({ fields: external_exports.record(external_exports.string(), external_exports.string()) })).mutation("beginReauth").withInput(workspaceInput).withOutput(vaultReauthChallengeSchema).mutation("confirmReauth").withInput(confirmVaultReauthInputSchema).withOutput(vaultReauthProofSchema).mutation("grantConnection").withInput(grantVaultConnectionInputSchema).withOutput(vaultGrantSchema).mutation("lendToChannel").withInput(lendVaultConnectionInputSchema).withOutput(vaultGrantSchema).mutation("revokeGrant").withInput(external_exports.object({ workspaceId: external_exports.string().min(1), grantId: external_exports.string().min(1) })).withOutput(external_exports.object({ revoked: external_exports.literal(true) })).query("listGrants").withInput(connectionInput).withOutput(external_exports.array(vaultGrantSchema)).mutation("shareConnection").withInput(shareVaultConnectionInputSchema).withOutput(vaultGrantSchema).mutation("approveShare").withInput(approveVaultShareInputSchema).withOutput(vaultGrantSchema).mutation("sealConnection").withInput(sealVaultConnectionInputSchema).withOutput(vaultConnectionSchema).query("listApprovals").withInput(external_exports.object({ ...workspaceInput.shape, state: vaultApprovalStateSchema.optional() })).withOutput(external_exports.array(vaultApprovalRequestSchema)).mutation("answerApproval").withInput(answerVaultApprovalInputSchema).withOutput(vaultApprovalRequestSchema).query("listAudit").withInput(vaultAuditReadInputSchema).withOutput(vaultAuditPageSchema).query("listActivity").withInput(vaultAuditReadInputSchema).withOutput(external_exports.array(vaultAuditEntrySchema)).query("listLeases").withInput(workspaceInput).withOutput(external_exports.array(vaultLeaseSchema)).mutation("endLease").withInput(endVaultLeaseInputSchema).withOutput(external_exports.object({ ended: external_exports.literal(true) })).query("mostAsked").withInput(vaultMostAskedInputSchema).withOutput(vaultMostAskedSchema).query("judgeStatus").withInput(workspaceInput).withOutput(vaultJudgeStatusSchema).query("listLevelLimits").withInput(workspaceInput).withOutput(external_exports.array(vaultLevelLimitSchema)).mutation("setLevelLimit").withInput(setVaultLevelLimitInputSchema).withOutput(external_exports.array(vaultLevelLimitSchema)).query("listDevices").withInput(workspaceInput).withOutput(external_exports.array(vaultDeviceSchema)).mutation("beginDeviceEnrolment").withInput(workspaceInput).withOutput(vaultDeviceEnrolmentSchema).mutation("finishDeviceEnrolment").withInput(finishVaultDeviceEnrolmentInputSchema).withOutput(vaultDeviceSchema).mutation("beginDeviceApproval").withInput(external_exports.object({ ...workspaceInput.shape, deviceId: external_exports.string().min(1) })).withOutput(external_exports.object({ challenge: external_exports.string(), sealed: external_exports.array(vaultSealedMaterialSchema) })).mutation("approveDevice").withInput(approveVaultDeviceInputSchema).withOutput(vaultDeviceSchema).mutation("removeDevice").withInput(external_exports.object({ ...workspaceInput.shape, deviceId: external_exports.string().min(1) })).withOutput(external_exports.object({ removed: external_exports.literal(true) })).mutation("createSealedConnection").withInput(createSealedConnectionInputSchema).withOutput(vaultConnectionSchema).mutation("resealConnection").withInput(resealConnectionInputSchema).withOutput(vaultConnectionSchema).mutation("openSealedConnection").withInput(
|
|
62399
62456
|
external_exports.object({
|
|
62400
62457
|
...connectionInput.shape,
|
|
62401
62458
|
reason: external_exports.string().trim().min(1).max(200),
|
|
@@ -62430,7 +62487,11 @@ var vaultConfig = Config.define((c) => ({
|
|
|
62430
62487
|
/** The origin passkeys are made on; unset accepts any localhost origin, for development. */
|
|
62431
62488
|
publicBaseUrl,
|
|
62432
62489
|
/** A file each audit chain head is appended to as a JSON line; unset only logs the heads. */
|
|
62433
|
-
auditHeadFile: c.env("VAULT_AUDIT_HEAD_FILE", external_exports.string().min(1).optional())
|
|
62490
|
+
auditHeadFile: c.env("VAULT_AUDIT_HEAD_FILE", external_exports.string().min(1).optional()),
|
|
62491
|
+
/** vaultd's socket; set, the master key and data keys stay in vaultd, unset keeps them here. */
|
|
62492
|
+
vaultdSocket: c.env("LAZE_VAULTD_SOCKET", external_exports.string().min(1).optional()),
|
|
62493
|
+
/** The workspace whose admins get vault alert cards; unset only logs the alerts. */
|
|
62494
|
+
alertWorkspaceId: c.env("VAULT_ALERT_WORKSPACE_ID", external_exports.string().min(1).optional())
|
|
62434
62495
|
}));
|
|
62435
62496
|
|
|
62436
62497
|
// ../../modules/vault/contract/src/vault-levels.ts
|
|
@@ -62771,6 +62832,26 @@ var vaultPasskeySetUpPayloadSchemaDefinition = external_exports.object({
|
|
|
62771
62832
|
deviceId: external_exports.string().min(1),
|
|
62772
62833
|
at: external_exports.iso.datetime()
|
|
62773
62834
|
});
|
|
62835
|
+
var vaultAlertDetailSchemaDefinition = external_exports.record(
|
|
62836
|
+
external_exports.string(),
|
|
62837
|
+
external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean(), external_exports.null()])
|
|
62838
|
+
);
|
|
62839
|
+
var vaultAlertDetailSchema = vaultAlertDetailSchemaDefinition;
|
|
62840
|
+
var vaultAlertRaisedPayloadSchemaDefinition = external_exports.object({
|
|
62841
|
+
/** The alert workspace, where the card lands; not the workspace the alert is about. */
|
|
62842
|
+
workspaceId: external_exports.string().min(1),
|
|
62843
|
+
/** One per alert: `vaultd:<seq>:<at>` from vaultd, `audit:<workspace>:<seq>` from the chain. */
|
|
62844
|
+
alertId: external_exports.string().min(1),
|
|
62845
|
+
/** vaultd's sequence number, the worker's cursor; null for an alert the vault raised itself. */
|
|
62846
|
+
seq: external_exports.number().int().nonnegative().nullable(),
|
|
62847
|
+
/** `unexpected_caller`, `decrypt_burst`, `audit_chain_broken`, `test`, or a newer kind. */
|
|
62848
|
+
kind: external_exports.string().min(1),
|
|
62849
|
+
subjectWorkspaceId: external_exports.string().min(1).nullable(),
|
|
62850
|
+
subjectWorkspaceName: external_exports.string().min(1).nullable(),
|
|
62851
|
+
detail: vaultAlertDetailSchema,
|
|
62852
|
+
recipientUserIds: external_exports.array(external_exports.string().min(1)),
|
|
62853
|
+
at: external_exports.iso.datetime()
|
|
62854
|
+
});
|
|
62774
62855
|
|
|
62775
62856
|
// ../../modules/vault/contract/src/vault-reference-chip.ts
|
|
62776
62857
|
var VaultReferenceChipSlot = uiTokens("vault").component("referenceChip");
|
|
@@ -64302,6 +64383,15 @@ var agentPermissionPromptSchemaDefinition = external_exports.object({
|
|
|
64302
64383
|
});
|
|
64303
64384
|
var agentPermissionPromptSchema = agentPermissionPromptSchemaDefinition;
|
|
64304
64385
|
|
|
64386
|
+
// ../../modules/agent/contract/src/agent-working.ts
|
|
64387
|
+
var agentWorkingInputSchemaDefinition = external_exports.object({
|
|
64388
|
+
workspaceId: external_exports.string().min(1),
|
|
64389
|
+
agentId: external_exports.string().min(1)
|
|
64390
|
+
});
|
|
64391
|
+
var agentWorkingInputSchema = agentWorkingInputSchemaDefinition;
|
|
64392
|
+
var agentWorkingSchemaDefinition = external_exports.object({ working: external_exports.boolean() });
|
|
64393
|
+
var agentWorkingSchema = agentWorkingSchemaDefinition;
|
|
64394
|
+
|
|
64305
64395
|
// ../../modules/agent/contract/src/agent-workspace-default.ts
|
|
64306
64396
|
var workspaceIdSchema9 = external_exports.string().min(1);
|
|
64307
64397
|
var idSchema13 = external_exports.string().min(1).max(200);
|
|
@@ -64782,7 +64872,7 @@ var codexLoginRefreshInputSchemaDefinition = external_exports.object({
|
|
|
64782
64872
|
});
|
|
64783
64873
|
var AgentApi = moduleApi()("agent");
|
|
64784
64874
|
var agentCoreTrpc = defineTrpcContract("agents").query("list").withInput(external_exports.object({ workspaceId: workspaceIdSchema10 })).withOutput(external_exports.array(agentListEntrySchema)).mutation("create").withInput(createAgentInputSchema).withOutput(agentSchema).mutation("update").withInput(updateAgentInputSchema).withOutput(agentSchema).mutation("remove").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14 })).withOutput(external_exports.object({ removed: external_exports.literal(true) })).mutation("transfer").withInput(transferAgentInputSchema).withOutput(agentSchema).mutation("resetSession").withInput(resetAgentSessionInputSchema).withOutput(agentSchema).query("faces").withInput(external_exports.object({ workspaceId: workspaceIdSchema10 })).withOutput(external_exports.array(agentFaceSchema)).query("presence").withInput(external_exports.object({ workspaceId: workspaceIdSchema10 })).withOutput(external_exports.array(agentPresenceSchema)).mutation("uploadAvatar").withInput(uploadAgentAvatarInputSchema).withOutput(uploadedAgentAvatarSchema).query("access").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14 })).withOutput(agentAccessSchema).query("loginActivity").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14 })).withOutput(loginActivitySchema).mutation("raiseBudget").withInput(raiseBudgetInputSchema).withOutput(external_exports.object({ limitUsd: external_exports.number() })).query("permissionPrompts").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14 })).withOutput(external_exports.array(agentPermissionPromptSchema)).mutation("share").withInput(shareAgentInputSchema).withOutput(agentAccessSchema).mutation("unshare").withInput(shareAgentInputSchema).withOutput(agentAccessSchema).query("harnessLogins").withInput(external_exports.object({ workspaceId: workspaceIdSchema10 })).withOutput(harnessLoginsSchema).mutation("saveHarnessLogin").withInput(saveHarnessLoginInputSchema).withOutput(harnessLoginsSchema).mutation("removeHarnessLogin").withInput(removeHarnessLoginInputSchema).withOutput(harnessLoginsSchema).query("listHarnessLogins").withInput(external_exports.object({ workspaceId: workspaceIdSchema10 })).withOutput(harnessLoginListSchema).mutation("addHarnessLogin").withInput(addHarnessLoginInputSchema).withOutput(harnessLoginListSchema).mutation("renameHarnessLogin").withInput(renameHarnessLoginInputSchema).withOutput(harnessLoginListSchema).mutation("deleteHarnessLogin").withInput(deleteHarnessLoginInputSchema).withOutput(harnessLoginListSchema).mutation("checkLoginUsage").withInput(checkLoginUsageInputSchema).withOutput(loginUsageCheckSchema).query("loginPools").withInput(external_exports.object({ workspaceId: workspaceIdSchema10 })).withOutput(loginPoolsSchema).mutation("createLoginPool").withInput(createLoginPoolInputSchema).withOutput(loginPoolsSchema).mutation("renameLoginPool").withInput(renameLoginPoolInputSchema).withOutput(loginPoolsSchema).mutation("deleteLoginPool").withInput(loginPoolRefInputSchema).withOutput(loginPoolsSchema).mutation("addPoolLogin").withInput(addPoolLoginInputSchema).withOutput(loginPoolsSchema).mutation("removePoolLogin").withInput(removePoolLoginInputSchema).withOutput(loginPoolsSchema).mutation("setPoolMember").withInput(setPoolMemberInputSchema).withOutput(loginPoolsSchema).mutation("removePoolMember").withInput(removePoolMemberInputSchema).withOutput(loginPoolsSchema).mutation("setAgentPool").withInput(setAgentPoolInputSchema).withOutput(agentSchema).mutation("openDirect").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14 })).withOutput(external_exports.object({ channelId: idSchema14 })).mutation("startConversation").withInput(startConversationInputSchema).withOutput(startedConversationSchema).query("conversations").withInput(listConversationsInputSchema).withOutput(external_exports.array(conversationSummarySchema2)).mutation("joinConversation").withInput(conversationInputSchema).withOutput(conversationSummarySchema2).mutation("renameConversation").withInput(renameConversationInputSchema).withOutput(conversationSummarySchema2).mutation("leaveConversation").withInput(conversationInputSchema).withOutput(external_exports.object({ left: external_exports.literal(true) })).mutation("deleteConversation").withInput(conversationInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).mutation("mintLink").withInput(mintLinkInputSchema).withOutput(mintedLinkSchema).query("linkRedemption").withInput(linkRedemptionInputSchema).withOutput(linkRedemptionSchema).query("oauthRequest").withInput(oauthRequestInputSchema).withOutput(oauthRequestViewSchema).mutation("oauthApprove").withInput(approveOAuthInputSchema).withOutput(oauthRedirectSchema).mutation("oauthDeny").withInput(oauthRequestInputSchema).withOutput(oauthRedirectSchema).mutation("disconnect").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14 })).withOutput(external_exports.object({ disconnected: external_exports.literal(true) })).mutation("setGithub").withInput(setAgentGithubInputSchema).withOutput(agentSchema).query("githubWatches").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14 })).withOutput(external_exports.array(agentGithubWatchSchema)).mutation("watchGithub").withInput(watchGithubInputSchema).withOutput(agentGithubWatchSchema).mutation("unwatchGithub").withInput(unwatchGithubInputSchema).withOutput(external_exports.object({ removed: external_exports.literal(true) })).build();
|
|
64785
|
-
var agentTurnTrpc = defineTrpcContract("agents").mutation("answerAttention").withInput(answerAttentionInputSchema).withOutput(external_exports.object({ answered: external_exports.literal(true) })).mutation("stopTurn").withInput(stopAgentTurnInputSchema).withOutput(external_exports.object({ stopped: external_exports.literal(true) })).query("mayStopTurn").withInput(stopAgentTurnInputSchema).withOutput(external_exports.object({ allowed: external_exports.boolean() })).query("liveSteps").withInput(liveStepsInputSchema).withOutput(liveStepsSchema).query("replySteps").withInput(replyStepsInputSchema).withOutput(replyStepsSchema).mutation("compactSession").withInput(compactAgentSessionInputSchema).withOutput(external_exports.object({ requested: external_exports.literal(true) })).mutation("restartComputer").withInput(restartAgentComputerInputSchema).withOutput(external_exports.object({ restarted: external_exports.boolean() })).build();
|
|
64875
|
+
var agentTurnTrpc = defineTrpcContract("agents").mutation("answerAttention").withInput(answerAttentionInputSchema).withOutput(external_exports.object({ answered: external_exports.literal(true) })).mutation("stopTurn").withInput(stopAgentTurnInputSchema).withOutput(external_exports.object({ stopped: external_exports.literal(true) })).query("mayStopTurn").withInput(stopAgentTurnInputSchema).withOutput(external_exports.object({ allowed: external_exports.boolean() })).query("liveSteps").withInput(liveStepsInputSchema).withOutput(liveStepsSchema).query("workingNow").withInput(agentWorkingInputSchema).withOutput(agentWorkingSchema).query("replySteps").withInput(replyStepsInputSchema).withOutput(replyStepsSchema).mutation("compactSession").withInput(compactAgentSessionInputSchema).withOutput(external_exports.object({ requested: external_exports.literal(true) })).mutation("restartComputer").withInput(restartAgentComputerInputSchema).withOutput(external_exports.object({ restarted: external_exports.boolean() })).build();
|
|
64786
64876
|
var agentChannelSettingsTrpc = defineTrpcContract("agents").query("monitors").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14 })).withOutput(external_exports.array(agentMonitorSchema)).query("channelLevel").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14, channelId: idSchema14 })).withOutput(channelLevelSchema).mutation("setChannelLevel").withInput(setChannelLevelInputSchema).withOutput(channelLevelSchema).mutation("unmuteChannel").withInput(unmuteAgentChannelInputSchema).withOutput(channelLevelSchema).mutation("cancelHeld").withInput(cancelHeldInputSchema).withOutput(cancelHeldResultSchema).build();
|
|
64787
64877
|
var agentJoinTrpc = defineTrpcContract("agents").query("joinRequest").withInput(joinRequestInputSchema).withOutput(joinRequestViewSchema).mutation("approveJoinRequest").withInput(approveJoinRequestInputSchema).withOutput(joinRequestViewSchema).mutation("denyJoinRequest").withInput(joinRequestInputSchema).withOutput(joinRequestViewSchema).build();
|
|
64788
64878
|
var agentLoginTroubleTrpc = defineTrpcContract("agents").mutation("replaceHarnessLogin").withInput(replaceHarnessLoginInputSchema).withOutput(harnessLoginListSchema).mutation("startHarnessSignIn").withInput(startHarnessSignInInputSchema).withOutput(harnessSignInSchema).mutation("pollHarnessSignIn").withInput(pollHarnessSignInInputSchema).withOutput(harnessSignInPollSchema).mutation("waitForLogins").withInput(loginCardActionInputSchema).withOutput(external_exports.object({ waiting: external_exports.boolean() })).mutation("useAnotherLogin").withInput(loginCardActionInputSchema).withOutput(external_exports.object({ loginName: external_exports.string() })).build();
|
|
@@ -74504,10 +74594,15 @@ var appPull = async ({ context, args }) => {
|
|
|
74504
74594
|
args,
|
|
74505
74595
|
value: { ...pulled, folder },
|
|
74506
74596
|
text: `Pulled ${pulled.files.length} files of ${pulled.app.name} (${site} version ${pulled.version.slice(0, 7)}) into ${where}
|
|
74507
|
-
` + (names
|
|
74508
|
-
` : "It keeps no records.\n")
|
|
74597
|
+
` + recordsHint({ names, slug: pulled.app.slug })
|
|
74509
74598
|
});
|
|
74510
74599
|
};
|
|
74600
|
+
function recordsHint({ names, slug }) {
|
|
74601
|
+
if (names.length === 0) return "It keeps no records.\n";
|
|
74602
|
+
const which = names.length === 1 ? names[0] : `<${names.join("|")}>`;
|
|
74603
|
+
return `Its data: laze app records list ${which} --app ${slug}
|
|
74604
|
+
`;
|
|
74605
|
+
}
|
|
74511
74606
|
var appPublish = async ({ context, args }) => {
|
|
74512
74607
|
const client = await appClient({ context, args });
|
|
74513
74608
|
const appId = await appIdOf({ client, args, folder: folderOf({ context, word: void 0 }) });
|
|
@@ -79169,11 +79264,11 @@ async function connect({
|
|
|
79169
79264
|
}
|
|
79170
79265
|
|
|
79171
79266
|
// src/services/connector-commands.service.ts
|
|
79172
|
-
import { readFile as
|
|
79267
|
+
import { readFile as readFile24 } from "node:fs/promises";
|
|
79173
79268
|
import { resolve as resolve8 } from "node:path";
|
|
79174
79269
|
|
|
79175
79270
|
// src/services/vault-keychain-commands.service.ts
|
|
79176
|
-
import { readFile as
|
|
79271
|
+
import { readFile as readFile23 } from "node:fs/promises";
|
|
79177
79272
|
|
|
79178
79273
|
// src/rules/vault-input.rules.ts
|
|
79179
79274
|
function secondsOf(text2) {
|
|
@@ -79444,6 +79539,305 @@ var listDevices = async ({ context, args }) => {
|
|
|
79444
79539
|
}
|
|
79445
79540
|
};
|
|
79446
79541
|
|
|
79542
|
+
// src/services/vault-commands.service.ts
|
|
79543
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
79544
|
+
import { mkdir as mkdir17, readFile as readFile22, rm as rm10, writeFile as writeFile18 } from "node:fs/promises";
|
|
79545
|
+
import { tmpdir as tmpdir2 } from "node:os";
|
|
79546
|
+
import { dirname as dirname17, join as join19 } from "node:path";
|
|
79547
|
+
var USAGE8 = `Usage: laze vault run <connection> --reason "<one plain sentence>" [--wait <s>] -- <command> [args...]
|
|
79548
|
+
Runs the command with the connection's values in its environment, on a Laze agent's computer
|
|
79549
|
+
or on a machine it runs on.`;
|
|
79550
|
+
var POLL_MS2 = 3e3;
|
|
79551
|
+
var RESTART_WAIT_MS = 12e4;
|
|
79552
|
+
var RESTART_BACKOFF_MS = [1e3, 2e3, 4e3, 8e3, 1e4];
|
|
79553
|
+
var P2562 = { name: "ECDH", namedCurve: "P-256" };
|
|
79554
|
+
var ServerGoneError = class extends Error {
|
|
79555
|
+
};
|
|
79556
|
+
function proxyOf({ env }) {
|
|
79557
|
+
const raw = env.LAZE_VAULT_PROXY || env.HTTP_PROXY || env.http_proxy;
|
|
79558
|
+
if (!raw) {
|
|
79559
|
+
throw new CliUsageError(
|
|
79560
|
+
"laze vault run works only on a Laze agent's computer or on a machine it runs on"
|
|
79561
|
+
);
|
|
79562
|
+
}
|
|
79563
|
+
const url2 = new URL(raw);
|
|
79564
|
+
const user = decodeURIComponent(url2.username);
|
|
79565
|
+
const password = decodeURIComponent(url2.password);
|
|
79566
|
+
return {
|
|
79567
|
+
origin: url2.origin,
|
|
79568
|
+
authorization: `Basic ${Buffer.from(`${user}:${password}`).toString("base64")}`
|
|
79569
|
+
};
|
|
79570
|
+
}
|
|
79571
|
+
function turnFileOf({
|
|
79572
|
+
env
|
|
79573
|
+
}) {
|
|
79574
|
+
return env.LAZE_TURN_FILE || void 0;
|
|
79575
|
+
}
|
|
79576
|
+
async function turnTokenOf3({
|
|
79577
|
+
env,
|
|
79578
|
+
turnFile,
|
|
79579
|
+
command = "laze vault run"
|
|
79580
|
+
}) {
|
|
79581
|
+
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
79582
|
+
if (pinned) return pinned;
|
|
79583
|
+
if (!turnFile) throw new CliUsageError(`${command} works only during an agent's turn`);
|
|
79584
|
+
try {
|
|
79585
|
+
return (await readFile22(turnFile, "utf8")).trim();
|
|
79586
|
+
} catch {
|
|
79587
|
+
throw new CliUsageError(`${command} works only during an agent's turn`);
|
|
79588
|
+
}
|
|
79589
|
+
}
|
|
79590
|
+
function runKeyPathOf({
|
|
79591
|
+
turnFile,
|
|
79592
|
+
connection
|
|
79593
|
+
}) {
|
|
79594
|
+
const name2 = createHash2("sha256").update(connection).digest("hex");
|
|
79595
|
+
const base = turnFile ? dirname17(turnFile) : join19(tmpdir2(), "laze-vault");
|
|
79596
|
+
return join19(base, "vault-run-keys", `${name2}.json`);
|
|
79597
|
+
}
|
|
79598
|
+
async function runKeyAt({ path }) {
|
|
79599
|
+
const saved3 = await readFile22(path, "utf8").then(
|
|
79600
|
+
(text2) => JSON.parse(text2),
|
|
79601
|
+
() => void 0
|
|
79602
|
+
);
|
|
79603
|
+
if (saved3 && typeof saved3.publicKey === "string" && saved3.privateKey) {
|
|
79604
|
+
const privateKey = await globalThis.crypto.subtle.importKey("jwk", saved3.privateKey, P2562, false, ["deriveBits"]).catch(() => void 0);
|
|
79605
|
+
if (privateKey) return { privateKey, publicKey: saved3.publicKey };
|
|
79606
|
+
}
|
|
79607
|
+
const fresh = await generateEcdhKeys();
|
|
79608
|
+
const jwk = await globalThis.crypto.subtle.exportKey("jwk", fresh.privateKey);
|
|
79609
|
+
await mkdir17(dirname17(path), { recursive: true, mode: 448 });
|
|
79610
|
+
await writeFile18(path, JSON.stringify({ publicKey: fresh.publicKey, privateKey: jwk }), {
|
|
79611
|
+
mode: 384
|
|
79612
|
+
});
|
|
79613
|
+
return fresh;
|
|
79614
|
+
}
|
|
79615
|
+
function connectionRefused(error62) {
|
|
79616
|
+
const cause = error62.cause;
|
|
79617
|
+
if (cause?.code === "ECONNREFUSED") return true;
|
|
79618
|
+
return cause?.errors?.some((inner) => inner.code === "ECONNREFUSED") ?? false;
|
|
79619
|
+
}
|
|
79620
|
+
async function sendOnce({
|
|
79621
|
+
context,
|
|
79622
|
+
url: url2,
|
|
79623
|
+
init
|
|
79624
|
+
}) {
|
|
79625
|
+
let response;
|
|
79626
|
+
try {
|
|
79627
|
+
response = await context.fetcher(url2, init);
|
|
79628
|
+
} catch (error62) {
|
|
79629
|
+
const wasRefused = connectionRefused(error62);
|
|
79630
|
+
if (init.method === "POST" && !wasRefused) throw error62;
|
|
79631
|
+
return { restarting: wasRefused ? "connection refused" : String(error62) };
|
|
79632
|
+
}
|
|
79633
|
+
if (response.status !== 502 && response.status !== 503) return { response };
|
|
79634
|
+
const code = codeOf(await response.clone().text());
|
|
79635
|
+
const neverReached = response.status === 503 && code === "vault_not_answering";
|
|
79636
|
+
if (init.method === "POST" && !neverReached) return { response };
|
|
79637
|
+
return { restarting: `status ${response.status}${code ? ` ${code}` : ""}` };
|
|
79638
|
+
}
|
|
79639
|
+
async function reach(input2) {
|
|
79640
|
+
const { context } = input2;
|
|
79641
|
+
const started = context.nowMs();
|
|
79642
|
+
for (let attempt = 0; ; attempt += 1) {
|
|
79643
|
+
const sent = await sendOnce(input2);
|
|
79644
|
+
if ("response" in sent) return sent.response;
|
|
79645
|
+
if (context.nowMs() - started >= RESTART_WAIT_MS) {
|
|
79646
|
+
throw new ServerGoneError(
|
|
79647
|
+
`laze vault: the Laze server did not come back (${sent.restarting})`
|
|
79648
|
+
);
|
|
79649
|
+
}
|
|
79650
|
+
if (attempt === 0) {
|
|
79651
|
+
context.err(
|
|
79652
|
+
`laze vault: the Laze server is not answering (${sent.restarting}), probably restarting; waiting up to 2 min...
|
|
79653
|
+
`
|
|
79654
|
+
);
|
|
79655
|
+
}
|
|
79656
|
+
await context.sleep(RESTART_BACKOFF_MS[Math.min(attempt, RESTART_BACKOFF_MS.length - 1)] ?? 0);
|
|
79657
|
+
}
|
|
79658
|
+
}
|
|
79659
|
+
function codeOf(text2) {
|
|
79660
|
+
return /"code"\s*:\s*"([^"]+)"/.exec(text2)?.[1];
|
|
79661
|
+
}
|
|
79662
|
+
async function releaseOf({ response }) {
|
|
79663
|
+
const text2 = await response.text();
|
|
79664
|
+
if (!response.ok) {
|
|
79665
|
+
return {
|
|
79666
|
+
outcome: "deny",
|
|
79667
|
+
exitCode: 1,
|
|
79668
|
+
message: `laze vault: the release was refused (${codeOf(text2) ?? `status ${response.status}`})`
|
|
79669
|
+
};
|
|
79670
|
+
}
|
|
79671
|
+
return JSON.parse(text2);
|
|
79672
|
+
}
|
|
79673
|
+
async function envOf({
|
|
79674
|
+
release: release2,
|
|
79675
|
+
run: run4
|
|
79676
|
+
}) {
|
|
79677
|
+
if (!release2.sealed) return release2.env;
|
|
79678
|
+
const sealed = await openRunRelease({
|
|
79679
|
+
release: release2.sealed,
|
|
79680
|
+
runPrivateKey: run4.privateKey,
|
|
79681
|
+
runPublicKey: run4.publicKey,
|
|
79682
|
+
requestId: release2.sealed.requestId
|
|
79683
|
+
});
|
|
79684
|
+
return { ...release2.env, ...sealed };
|
|
79685
|
+
}
|
|
79686
|
+
function deadlineOf({ args, nowMs }) {
|
|
79687
|
+
const wait = flagText({ args, name: "wait" }) || (args.flags.wait === true ? args.words[3] : "");
|
|
79688
|
+
if (!wait) return Infinity;
|
|
79689
|
+
if (!(Number(wait) >= 0)) throw new CliUsageError(`--wait takes a number of seconds
|
|
79690
|
+
${USAGE8}`);
|
|
79691
|
+
return nowMs + Number(wait) * 1e3;
|
|
79692
|
+
}
|
|
79693
|
+
async function untilAnswered({
|
|
79694
|
+
context,
|
|
79695
|
+
first,
|
|
79696
|
+
origin,
|
|
79697
|
+
headers,
|
|
79698
|
+
deadline
|
|
79699
|
+
}) {
|
|
79700
|
+
let release2 = first;
|
|
79701
|
+
while (release2.outcome === "ask") {
|
|
79702
|
+
if (context.nowMs() + POLL_MS2 > deadline) {
|
|
79703
|
+
context.err(`${release2.message}. Not approved yet; ask again later.
|
|
79704
|
+
`);
|
|
79705
|
+
return "capped";
|
|
79706
|
+
}
|
|
79707
|
+
if (release2 === first) {
|
|
79708
|
+
context.err(`${release2.message}. Waiting for an answer (cards expire after 12 hours)...
|
|
79709
|
+
`);
|
|
79710
|
+
}
|
|
79711
|
+
await context.sleep(POLL_MS2);
|
|
79712
|
+
const url2 = `${origin}/vault/release/${encodeURIComponent(release2.requestId)}`;
|
|
79713
|
+
release2 = await releaseOf({
|
|
79714
|
+
response: await reach({ context, url: url2, init: { method: "GET", headers } })
|
|
79715
|
+
});
|
|
79716
|
+
}
|
|
79717
|
+
return release2;
|
|
79718
|
+
}
|
|
79719
|
+
function leaseHolds({
|
|
79720
|
+
release: release2,
|
|
79721
|
+
nowMs
|
|
79722
|
+
}) {
|
|
79723
|
+
const ends = release2.sealed?.leaseEndsAt;
|
|
79724
|
+
return ends !== void 0 && Temporal3.Instant.from(ends).epochMilliseconds > nowMs;
|
|
79725
|
+
}
|
|
79726
|
+
async function vaultRelease({
|
|
79727
|
+
context,
|
|
79728
|
+
args,
|
|
79729
|
+
connection,
|
|
79730
|
+
reason,
|
|
79731
|
+
command
|
|
79732
|
+
}) {
|
|
79733
|
+
const deadline = deadlineOf({ args, nowMs: context.nowMs() });
|
|
79734
|
+
const env = context.environment.inherited;
|
|
79735
|
+
const proxy = proxyOf({ env });
|
|
79736
|
+
const turnFile = turnFileOf({ env });
|
|
79737
|
+
const headers = {
|
|
79738
|
+
"proxy-authorization": proxy.authorization,
|
|
79739
|
+
"x-laze-turn": await turnTokenOf3({ env, turnFile })
|
|
79740
|
+
};
|
|
79741
|
+
const keyPath = runKeyPathOf({ turnFile, connection });
|
|
79742
|
+
const run4 = await runKeyAt({ path: keyPath });
|
|
79743
|
+
const body = JSON.stringify({ connection, reason, command, recipient: run4.publicKey });
|
|
79744
|
+
let release2;
|
|
79745
|
+
try {
|
|
79746
|
+
const first = await releaseOf({
|
|
79747
|
+
response: await reach({
|
|
79748
|
+
context,
|
|
79749
|
+
url: `${proxy.origin}/vault/release`,
|
|
79750
|
+
init: { method: "POST", headers: { ...headers, "content-type": "application/json" }, body }
|
|
79751
|
+
})
|
|
79752
|
+
});
|
|
79753
|
+
release2 = await untilAnswered({ context, first, origin: proxy.origin, headers, deadline });
|
|
79754
|
+
} catch (error62) {
|
|
79755
|
+
if (!(error62 instanceof ServerGoneError)) throw error62;
|
|
79756
|
+
context.err(`${error62.message}. Run the command again to keep waiting.
|
|
79757
|
+
`);
|
|
79758
|
+
return { exitCode: 75 };
|
|
79759
|
+
}
|
|
79760
|
+
if (release2 === "capped") return { exitCode: 75 };
|
|
79761
|
+
if (release2.outcome === "deny") {
|
|
79762
|
+
await rm10(keyPath, { force: true });
|
|
79763
|
+
context.err(`${release2.message}
|
|
79764
|
+
`);
|
|
79765
|
+
return { exitCode: release2.exitCode || 1 };
|
|
79766
|
+
}
|
|
79767
|
+
const values = await envOf({ release: release2, run: run4 });
|
|
79768
|
+
if (!leaseHolds({ release: release2, nowMs: context.nowMs() })) await rm10(keyPath, { force: true });
|
|
79769
|
+
if (release2.message) context.err(`${release2.message}
|
|
79770
|
+
`);
|
|
79771
|
+
return { env: values };
|
|
79772
|
+
}
|
|
79773
|
+
async function vaultRun({
|
|
79774
|
+
context,
|
|
79775
|
+
args
|
|
79776
|
+
}) {
|
|
79777
|
+
const connection = args.words[2];
|
|
79778
|
+
const reason = flagText({ args, name: "reason" });
|
|
79779
|
+
if (!connection || args.rest.length === 0) throw new CliUsageError(USAGE8);
|
|
79780
|
+
if (!reason) throw new CliUsageError(`Say why with --reason "<one plain sentence>"
|
|
79781
|
+
${USAGE8}`);
|
|
79782
|
+
const released = await vaultRelease({ context, args, connection, reason, command: args.rest });
|
|
79783
|
+
if ("exitCode" in released) return released.exitCode;
|
|
79784
|
+
return context.runCommand({ command: args.rest, env: released.env });
|
|
79785
|
+
}
|
|
79786
|
+
|
|
79787
|
+
// src/services/vault-share-commands.service.ts
|
|
79788
|
+
var SHARE_USAGE2 = "Usage: laze vault share <connection> --with <email|userId> [--for 1h]";
|
|
79789
|
+
var WAITING_LINE = "It waits for the owner's approval with a passkey or Face ID, in Settings > Vault.";
|
|
79790
|
+
async function personOf({ client, who }) {
|
|
79791
|
+
const members3 = await client.get("/api/workspaces/current/members");
|
|
79792
|
+
const wanted = who.toLowerCase();
|
|
79793
|
+
const found = members3.find(
|
|
79794
|
+
(member) => member.userId === who || member.email.toLowerCase() === wanted
|
|
79795
|
+
);
|
|
79796
|
+
if (!found) throw new CliUsageError(`No one in this workspace is ${who}.`);
|
|
79797
|
+
return found.userId;
|
|
79798
|
+
}
|
|
79799
|
+
async function inTurn({
|
|
79800
|
+
context,
|
|
79801
|
+
client,
|
|
79802
|
+
command
|
|
79803
|
+
}) {
|
|
79804
|
+
const env = context.environment.inherited;
|
|
79805
|
+
const turn = await turnTokenOf3({ env, turnFile: turnFileOf({ env }), command });
|
|
79806
|
+
return client.withHeaders({ "x-laze-turn": turn });
|
|
79807
|
+
}
|
|
79808
|
+
function printShare({ context, grant }) {
|
|
79809
|
+
printGrant({ context, grant });
|
|
79810
|
+
if (grant.awaitingOwner) context.out(`${WAITING_LINE}
|
|
79811
|
+
`);
|
|
79812
|
+
}
|
|
79813
|
+
var shareWith = async ({ context, args }) => {
|
|
79814
|
+
const word3 = args.words[2];
|
|
79815
|
+
const who = flagText({ args, name: "with" });
|
|
79816
|
+
if (!word3 || !who) throw new CliUsageError(SHARE_USAGE2);
|
|
79817
|
+
const { client, profile } = await signedIn({ context, args });
|
|
79818
|
+
const userId = await personOf({ client, who });
|
|
79819
|
+
const grant = profile.kind === "agent" ? await (await inTurn({ context, client, command: "laze vault share" })).post("/api/vault/turn/share", {
|
|
79820
|
+
connection: word3,
|
|
79821
|
+
userId,
|
|
79822
|
+
...durationOf(args)
|
|
79823
|
+
}) : await client.post("/api/vault/shares", {
|
|
79824
|
+
connectionId: (await connectionOf({ client, args, word: word3 })).id,
|
|
79825
|
+
userId,
|
|
79826
|
+
...durationOf(args)
|
|
79827
|
+
});
|
|
79828
|
+
if (args.flags.json) return printJson4({ context, data: grant });
|
|
79829
|
+
printShare({ context, grant });
|
|
79830
|
+
};
|
|
79831
|
+
async function setLevelInTurn({
|
|
79832
|
+
context,
|
|
79833
|
+
client,
|
|
79834
|
+
connection,
|
|
79835
|
+
sensitivity
|
|
79836
|
+
}) {
|
|
79837
|
+
const turned = await inTurn({ context, client, command: "laze vault update --level" });
|
|
79838
|
+
return turned.post("/api/vault/turn/level", { connection, sensitivity });
|
|
79839
|
+
}
|
|
79840
|
+
|
|
79447
79841
|
// src/services/vault-keychain-commands.service.ts
|
|
79448
79842
|
var VAULT_USAGE = `Usage (your own key; an agent's key is refused, values are never printed):
|
|
79449
79843
|
laze vault list [--json] connections you manage or see: names, fields, levels
|
|
@@ -79462,6 +79856,9 @@ var VAULT_USAGE = `Usage (your own key; an agent's key is refused, values are ne
|
|
|
79462
79856
|
laze vault rm|revoke <connection> delete it; revoke also takes it back at the provider
|
|
79463
79857
|
laze vault uses <connection> [--limit <n>] who used it, how, where, under which approval
|
|
79464
79858
|
laze vault grant <connection> --to person|group|channel|agent:<id> [--for 1h]
|
|
79859
|
+
laze vault share <connection> --with <email|userId> [--for 1h] your own key, with one teammate:
|
|
79860
|
+
it waits for your passkey in Settings > Vault; Always ask and Human only keys are shared
|
|
79861
|
+
only from there. Lowering a key's level is done only there too; raising works anywhere
|
|
79465
79862
|
laze vault lend <connection> --channel <channelId> [--for 1h]
|
|
79466
79863
|
laze vault grants <connection> | laze vault ungrant <grantId>
|
|
79467
79864
|
laze vault leases | laze vault end-lease <leaseId>
|
|
@@ -79495,7 +79892,7 @@ async function secretText({ context, args }) {
|
|
|
79495
79892
|
);
|
|
79496
79893
|
}
|
|
79497
79894
|
const file3 = flagText({ args, name: "from-file" });
|
|
79498
|
-
const text2 = file3 ? await
|
|
79895
|
+
const text2 = file3 ? await readFile23(file3, "utf8") : await context.readStdin();
|
|
79499
79896
|
const trimmed = text2.replace(/\r?\n$/, "");
|
|
79500
79897
|
if (!trimmed.trim()) throw new CliUsageError("No value: pipe it on stdin or use --from-file.");
|
|
79501
79898
|
return trimmed;
|
|
@@ -79554,10 +79951,21 @@ var add3 = async ({ context, args }) => {
|
|
|
79554
79951
|
);
|
|
79555
79952
|
};
|
|
79556
79953
|
var update = async ({ context, args }) => {
|
|
79557
|
-
const { client } = await signedIn({ context, args });
|
|
79558
|
-
const target = await connectionOf({ client, args, word: args.words[2] });
|
|
79954
|
+
const { client, profile } = await signedIn({ context, args });
|
|
79559
79955
|
const settings2 = settingsOf(args);
|
|
79560
79956
|
if (Object.keys(settings2).length === 0) throw new CliUsageError(VAULT_USAGE);
|
|
79957
|
+
const word3 = args.words[2];
|
|
79958
|
+
if (profile.kind === "agent" && word3 && settings2.sensitivity && Object.keys(settings2).length === 1) {
|
|
79959
|
+
const raised = await setLevelInTurn({
|
|
79960
|
+
context,
|
|
79961
|
+
client,
|
|
79962
|
+
connection: word3,
|
|
79963
|
+
sensitivity: settings2.sensitivity
|
|
79964
|
+
});
|
|
79965
|
+
if (args.flags.json) return printJson4({ context, data: raised });
|
|
79966
|
+
return printConnection({ context, row: raised });
|
|
79967
|
+
}
|
|
79968
|
+
const target = await connectionOf({ client, args, word: word3 });
|
|
79561
79969
|
const updated = await client.post("/api/vault/connections/update", {
|
|
79562
79970
|
connectionId: target.id,
|
|
79563
79971
|
...settings2
|
|
@@ -79649,6 +80057,7 @@ var VAULT_COMMANDS = {
|
|
|
79649
80057
|
revoke: removal("revoke"),
|
|
79650
80058
|
uses,
|
|
79651
80059
|
grant: grantTo,
|
|
80060
|
+
share: shareWith,
|
|
79652
80061
|
lend: lendTo,
|
|
79653
80062
|
grants: grantsOf,
|
|
79654
80063
|
ungrant: revokeGrant,
|
|
@@ -79705,7 +80114,7 @@ async function keyText({ context, args }) {
|
|
|
79705
80114
|
throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
|
|
79706
80115
|
}
|
|
79707
80116
|
const file3 = flagText({ args, name: "from-file" });
|
|
79708
|
-
const text2 = file3 ? await
|
|
80117
|
+
const text2 = file3 ? await readFile24(resolve8(context.cwd, file3), "utf8") : await context.readStdin();
|
|
79709
80118
|
const trimmed = text2.trim();
|
|
79710
80119
|
if (!trimmed) throw new CliUsageError("No key: pipe it on stdin or use --from-file.");
|
|
79711
80120
|
return trimmed;
|
|
@@ -80069,16 +80478,16 @@ function dndLine({ pausedUntil }) {
|
|
|
80069
80478
|
}
|
|
80070
80479
|
|
|
80071
80480
|
// src/services/dnd-commands.service.ts
|
|
80072
|
-
var
|
|
80481
|
+
var USAGE9 = "Usage: laze dnd 30m|1h|2h|until <HH:mm|ISO time> [--tz <zone>], laze dnd off";
|
|
80073
80482
|
async function dnd({ context, args }) {
|
|
80074
80483
|
const timeZone = flagText({ args, name: "tz" }) || Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
80075
80484
|
let input2;
|
|
80076
80485
|
try {
|
|
80077
80486
|
input2 = dndInputOf({ words: args.words.slice(1), now: nowInstant(), timeZone });
|
|
80078
80487
|
} catch {
|
|
80079
|
-
throw new CliUsageError(
|
|
80488
|
+
throw new CliUsageError(USAGE9);
|
|
80080
80489
|
}
|
|
80081
|
-
if (!input2) throw new CliUsageError(
|
|
80490
|
+
if (!input2) throw new CliUsageError(USAGE9);
|
|
80082
80491
|
const { client } = await signedIn({ context, args });
|
|
80083
80492
|
const settings2 = await client.post(
|
|
80084
80493
|
"/api/agents/me/notifications/snooze",
|
|
@@ -80130,7 +80539,7 @@ async function domains({ context, args }) {
|
|
|
80130
80539
|
}
|
|
80131
80540
|
|
|
80132
80541
|
// src/services/feed-commands.service.ts
|
|
80133
|
-
import { readFile as
|
|
80542
|
+
import { readFile as readFile26 } from "node:fs/promises";
|
|
80134
80543
|
import { resolve as resolve10 } from "node:path";
|
|
80135
80544
|
|
|
80136
80545
|
// src/rules/feed-input.rules.ts
|
|
@@ -80255,7 +80664,7 @@ function feedFlagsOf({ args }) {
|
|
|
80255
80664
|
}
|
|
80256
80665
|
|
|
80257
80666
|
// src/services/feed-files.service.ts
|
|
80258
|
-
import { readFile as
|
|
80667
|
+
import { readFile as readFile25 } from "node:fs/promises";
|
|
80259
80668
|
import { basename as basename4, resolve as resolve9 } from "node:path";
|
|
80260
80669
|
|
|
80261
80670
|
// ../../modules/feed/contract/src/feed.ts
|
|
@@ -80830,7 +81239,7 @@ async function local({ context, path }) {
|
|
|
80830
81239
|
return {
|
|
80831
81240
|
fileName,
|
|
80832
81241
|
contentType: contentTypeOf(fileName),
|
|
80833
|
-
bytes: new Uint8Array(await
|
|
81242
|
+
bytes: new Uint8Array(await readFile25(full))
|
|
80834
81243
|
};
|
|
80835
81244
|
}
|
|
80836
81245
|
async function directWith({ client, to }) {
|
|
@@ -80868,7 +81277,7 @@ async function feedAttachmentIdsOf({
|
|
|
80868
81277
|
}
|
|
80869
81278
|
|
|
80870
81279
|
// src/services/feed-commands.service.ts
|
|
80871
|
-
var
|
|
81280
|
+
var USAGE10 = `Usage:
|
|
80872
81281
|
laze feed post <title> [--channel <channel>] [--tag <tag>] [--summary <line>]
|
|
80873
81282
|
[--draft <text|@file>] [--draft-header "To: ...\\nRe: ..."]
|
|
80874
81283
|
[--metric <json|@file.json> | --table <csv|@file.csv>]
|
|
@@ -80908,7 +81317,7 @@ async function bodyOf2({
|
|
|
80908
81317
|
flags: flags2
|
|
80909
81318
|
}) {
|
|
80910
81319
|
const body = { ...flags2.fields };
|
|
80911
|
-
const read3 = (source) => "file" in source ?
|
|
81320
|
+
const read3 = (source) => "file" in source ? readFile26(resolve10(context.cwd, source.file), "utf8") : source.text;
|
|
80912
81321
|
for (const [field, source] of Object.entries(flags2.texts)) body[field] = await read3(source);
|
|
80913
81322
|
if (flags2.rich) {
|
|
80914
81323
|
const text2 = await read3(flags2.rich.source);
|
|
@@ -80937,7 +81346,7 @@ function printItem({
|
|
|
80937
81346
|
}
|
|
80938
81347
|
async function feedPost({ context, args }) {
|
|
80939
81348
|
const title = args.words.slice(2).join(" ").trim();
|
|
80940
|
-
if (!title) throw new CliUsageError(
|
|
81349
|
+
if (!title) throw new CliUsageError(USAGE10);
|
|
80941
81350
|
const flags2 = flagsOf(args);
|
|
80942
81351
|
const { client } = await signedIn({ context, args });
|
|
80943
81352
|
const channel = flagText({ args, name: "channel" });
|
|
@@ -80959,7 +81368,7 @@ async function feedPost({ context, args }) {
|
|
|
80959
81368
|
}
|
|
80960
81369
|
async function feedUpdate({ context, args }) {
|
|
80961
81370
|
const itemId = args.words[2];
|
|
80962
|
-
if (!itemId) throw new CliUsageError(
|
|
81371
|
+
if (!itemId) throw new CliUsageError(USAGE10);
|
|
80963
81372
|
const flags2 = flagsOf(args);
|
|
80964
81373
|
const { client } = await signedIn({ context, args });
|
|
80965
81374
|
const body = await bodyOf2({ context, flags: flags2 });
|
|
@@ -80975,7 +81384,7 @@ async function feedUpdate({ context, args }) {
|
|
|
80975
81384
|
async function feedReply({ context, args }) {
|
|
80976
81385
|
const itemId = args.words[2];
|
|
80977
81386
|
const text2 = args.words.slice(3).join(" ").trim();
|
|
80978
|
-
if (!itemId || !text2) throw new CliUsageError(
|
|
81387
|
+
if (!itemId || !text2) throw new CliUsageError(USAGE10);
|
|
80979
81388
|
const { client } = await signedIn({ context, args });
|
|
80980
81389
|
const replied = await client.post("/api/feed/items/reply", {
|
|
80981
81390
|
itemId,
|
|
@@ -80987,7 +81396,7 @@ async function feedReply({ context, args }) {
|
|
|
80987
81396
|
}
|
|
80988
81397
|
async function feedRead({ context, args }) {
|
|
80989
81398
|
const itemId = args.words[2];
|
|
80990
|
-
if (!itemId) throw new CliUsageError(
|
|
81399
|
+
if (!itemId) throw new CliUsageError(USAGE10);
|
|
80991
81400
|
const { client } = await signedIn({ context, args });
|
|
80992
81401
|
const read3 = await client.post("/api/feed/items/read", { itemId });
|
|
80993
81402
|
printItem({ context, args, item: read3 });
|
|
@@ -81006,7 +81415,7 @@ async function feedClose({ context, args }) {
|
|
|
81006
81415
|
const itemId = args.words[2];
|
|
81007
81416
|
const loop = flagText({ args, name: "loop" });
|
|
81008
81417
|
const note = flagText({ args, name: "note" });
|
|
81009
|
-
if (!note || Boolean(itemId) === Boolean(loop)) throw new CliUsageError(
|
|
81418
|
+
if (!note || Boolean(itemId) === Boolean(loop)) throw new CliUsageError(USAGE10);
|
|
81010
81419
|
const { client } = await signedIn({ context, args });
|
|
81011
81420
|
const closed = await client.post("/api/feed/items/close", {
|
|
81012
81421
|
...itemId ? { itemId } : { loop },
|
|
@@ -81032,7 +81441,7 @@ async function feedLoops({ context, args }) {
|
|
|
81032
81441
|
}
|
|
81033
81442
|
async function feedGroupSummary({ context, args }) {
|
|
81034
81443
|
const group = args.words.slice(2).join(" ").trim();
|
|
81035
|
-
if (!group) throw new CliUsageError(
|
|
81444
|
+
if (!group) throw new CliUsageError(USAGE10);
|
|
81036
81445
|
const { client } = await signedIn({ context, args });
|
|
81037
81446
|
const pointer = await client.post("/api/feed/group-summary", { group });
|
|
81038
81447
|
if (args.flags.json) return context.out(`${JSON.stringify(pointer, null, 2)}
|
|
@@ -81070,7 +81479,7 @@ async function textFlag({
|
|
|
81070
81479
|
}) {
|
|
81071
81480
|
const value = flagText({ args, name: name2 });
|
|
81072
81481
|
if (!value.startsWith("@")) return value;
|
|
81073
|
-
return
|
|
81482
|
+
return readFile26(resolve10(context.cwd, value.slice(1)), "utf8");
|
|
81074
81483
|
}
|
|
81075
81484
|
async function feedList({ context, args }) {
|
|
81076
81485
|
const { client } = await signedIn({ context, args });
|
|
@@ -81102,7 +81511,7 @@ async function feedCount({ context, args }) {
|
|
|
81102
81511
|
}
|
|
81103
81512
|
async function feedAct({ context, args }) {
|
|
81104
81513
|
const [itemId, actionId] = [args.words[2], args.words[3]];
|
|
81105
|
-
if (!itemId || !actionId) throw new CliUsageError(
|
|
81514
|
+
if (!itemId || !actionId) throw new CliUsageError(USAGE10);
|
|
81106
81515
|
const draft = await textFlag({ context, args, name: "draft" });
|
|
81107
81516
|
const { client } = await signedIn({ context, args });
|
|
81108
81517
|
const item = await client.post("/api/feed/mine/act", {
|
|
@@ -81115,7 +81524,7 @@ async function feedAct({ context, args }) {
|
|
|
81115
81524
|
async function feedComment({ context, args }) {
|
|
81116
81525
|
const itemId = args.words[2];
|
|
81117
81526
|
const text2 = args.words.slice(3).join(" ").trim();
|
|
81118
|
-
if (!itemId || !text2) throw new CliUsageError(
|
|
81527
|
+
if (!itemId || !text2) throw new CliUsageError(USAGE10);
|
|
81119
81528
|
const draft = await textFlag({ context, args, name: "draft" });
|
|
81120
81529
|
const { client } = await signedIn({ context, args });
|
|
81121
81530
|
const item = await client.post("/api/feed/mine/comment", {
|
|
@@ -81129,7 +81538,7 @@ async function feedComment({ context, args }) {
|
|
|
81129
81538
|
function moveItem(path) {
|
|
81130
81539
|
return async ({ context, args }) => {
|
|
81131
81540
|
const itemId = args.words[2];
|
|
81132
|
-
if (!itemId) throw new CliUsageError(
|
|
81541
|
+
if (!itemId) throw new CliUsageError(USAGE10);
|
|
81133
81542
|
const { client } = await signedIn({ context, args });
|
|
81134
81543
|
const item = await client.post(`/api/feed/mine/${path}`, { itemId });
|
|
81135
81544
|
printMoved({ context, args, item });
|
|
@@ -81138,14 +81547,14 @@ function moveItem(path) {
|
|
|
81138
81547
|
async function feedSnooze({ context, args }) {
|
|
81139
81548
|
const itemId = args.words[2];
|
|
81140
81549
|
const until = flagText({ args, name: "until" });
|
|
81141
|
-
if (!itemId || !until) throw new CliUsageError(
|
|
81550
|
+
if (!itemId || !until) throw new CliUsageError(USAGE10);
|
|
81142
81551
|
const { client } = await signedIn({ context, args });
|
|
81143
81552
|
const item = await client.post("/api/feed/mine/snooze", { itemId, until });
|
|
81144
81553
|
printMoved({ context, args, item });
|
|
81145
81554
|
}
|
|
81146
81555
|
async function feedChannel({ context, args }) {
|
|
81147
81556
|
const channelId = args.words[2];
|
|
81148
|
-
if (!channelId) throw new CliUsageError(
|
|
81557
|
+
if (!channelId) throw new CliUsageError(USAGE10);
|
|
81149
81558
|
const { client } = await signedIn({ context, args });
|
|
81150
81559
|
const items = await client.post("/api/feed/channel", { channelId });
|
|
81151
81560
|
if (args.flags.json) return context.out(`${JSON.stringify(items, null, 2)}
|
|
@@ -81175,12 +81584,12 @@ var FEED_COMMANDS = {
|
|
|
81175
81584
|
async function feed({ context, args }) {
|
|
81176
81585
|
const name2 = args.words[1] ?? "";
|
|
81177
81586
|
const command = Object.hasOwn(FEED_COMMANDS, name2) ? FEED_COMMANDS[name2] : void 0;
|
|
81178
|
-
if (!command) throw new CliUsageError(
|
|
81587
|
+
if (!command) throw new CliUsageError(USAGE10);
|
|
81179
81588
|
await command({ context, args });
|
|
81180
81589
|
}
|
|
81181
81590
|
|
|
81182
81591
|
// src/services/github-commands.service.ts
|
|
81183
|
-
import { readFile as
|
|
81592
|
+
import { readFile as readFile27 } from "node:fs/promises";
|
|
81184
81593
|
|
|
81185
81594
|
// src/rules/github-signature.rules.ts
|
|
81186
81595
|
var TURN_SEPARATOR = "~";
|
|
@@ -81250,7 +81659,7 @@ var REAL_GH = "/usr/bin/gh";
|
|
|
81250
81659
|
var NOT_SET = "laze: agent_github_not_set: this agent has no GitHub connection. Its owner sets one on the agent's settings page or with `laze agent set-github <agent> <connection>`.";
|
|
81251
81660
|
async function turnFileToken({ env }) {
|
|
81252
81661
|
if (!env.LAZE_TURN_FILE) return "";
|
|
81253
|
-
return
|
|
81662
|
+
return readFile27(env.LAZE_TURN_FILE, "utf8").then(
|
|
81254
81663
|
(text2) => text2.trim(),
|
|
81255
81664
|
() => ""
|
|
81256
81665
|
);
|
|
@@ -81284,7 +81693,7 @@ async function githubGh({
|
|
|
81284
81693
|
args: args.rest,
|
|
81285
81694
|
agentName: profile.name ?? "An agent",
|
|
81286
81695
|
threadUrl: threadUrlOf({ env, workspaceId: profile.workspaceId }),
|
|
81287
|
-
readBodyFile: (path) => path === "-" ? context.readStdin() :
|
|
81696
|
+
readBodyFile: (path) => path === "-" ? context.readStdin() : readFile27(path, "utf8")
|
|
81288
81697
|
});
|
|
81289
81698
|
return context.runCommand({
|
|
81290
81699
|
command: [REAL_GH, ...ghArgs],
|
|
@@ -81383,7 +81792,7 @@ async function setAgentGithub({
|
|
|
81383
81792
|
}
|
|
81384
81793
|
|
|
81385
81794
|
// src/services/history-commands.service.ts
|
|
81386
|
-
import { readFile as
|
|
81795
|
+
import { readFile as readFile28 } from "node:fs/promises";
|
|
81387
81796
|
|
|
81388
81797
|
// src/rules/history-format.rules.ts
|
|
81389
81798
|
function timeOf2(iso) {
|
|
@@ -81474,12 +81883,12 @@ function beforeOf({ args }) {
|
|
|
81474
81883
|
throw new CliUsageError(HISTORY_USAGE);
|
|
81475
81884
|
}
|
|
81476
81885
|
}
|
|
81477
|
-
async function
|
|
81886
|
+
async function turnTokenOf4({ context }) {
|
|
81478
81887
|
const env = context.environment.inherited;
|
|
81479
81888
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
81480
81889
|
if (pinned) return pinned;
|
|
81481
81890
|
if (!env.LAZE_TURN_FILE) return "";
|
|
81482
|
-
return
|
|
81891
|
+
return readFile28(env.LAZE_TURN_FILE, "utf8").then(
|
|
81483
81892
|
(text2) => text2.trim(),
|
|
81484
81893
|
() => ""
|
|
81485
81894
|
);
|
|
@@ -81493,7 +81902,7 @@ async function history({
|
|
|
81493
81902
|
const limit = limitOf3({ args });
|
|
81494
81903
|
const before = beforeOf({ args });
|
|
81495
81904
|
const { client: signed2 } = await signedIn({ context, args });
|
|
81496
|
-
const turn = await
|
|
81905
|
+
const turn = await turnTokenOf4({ context });
|
|
81497
81906
|
const client = turn ? signed2.withHeaders({ "x-laze-turn": turn }) : signed2;
|
|
81498
81907
|
const laze = await client.post("/api/agents/me/history", {
|
|
81499
81908
|
channel,
|
|
@@ -81671,19 +82080,19 @@ async function ip({ context, args }) {
|
|
|
81671
82080
|
}
|
|
81672
82081
|
|
|
81673
82082
|
// src/services/join-commands.service.ts
|
|
81674
|
-
import { mkdir as
|
|
81675
|
-
import { dirname as
|
|
82083
|
+
import { mkdir as mkdir18, readFile as readFile29, rename as rename5, rm as rm11, writeFile as writeFile19 } from "node:fs/promises";
|
|
82084
|
+
import { dirname as dirname18, join as join20 } from "node:path";
|
|
81676
82085
|
var DEFAULT_WAIT_SECONDS2 = 100;
|
|
81677
82086
|
var JOIN_USAGE = "Usage: laze join [--workspace <name|id|invite link>] [--for <email>] [--name <name>] [--note <text>] [--timeout <seconds>] [--project <folder>]";
|
|
81678
82087
|
function pendingPathOf({ context }) {
|
|
81679
|
-
return
|
|
82088
|
+
return join20(dirname18(context.environment.configPath), "join", "pending.json");
|
|
81680
82089
|
}
|
|
81681
82090
|
async function readPending({
|
|
81682
82091
|
context,
|
|
81683
82092
|
url: url2,
|
|
81684
82093
|
args
|
|
81685
82094
|
}) {
|
|
81686
|
-
const pending = await
|
|
82095
|
+
const pending = await readFile29(pendingPathOf({ context }), "utf8").then(
|
|
81687
82096
|
(text2) => JSON.parse(text2),
|
|
81688
82097
|
() => void 0
|
|
81689
82098
|
);
|
|
@@ -81693,13 +82102,13 @@ async function readPending({
|
|
|
81693
82102
|
}
|
|
81694
82103
|
async function keepPending({ context, pending }) {
|
|
81695
82104
|
const path = pendingPathOf({ context });
|
|
81696
|
-
await
|
|
82105
|
+
await mkdir18(dirname18(path), { recursive: true, mode: 448 });
|
|
81697
82106
|
const temporary = `${path}.${process.pid}.tmp`;
|
|
81698
|
-
await
|
|
82107
|
+
await writeFile19(temporary, JSON.stringify(pending), { mode: 384 });
|
|
81699
82108
|
await rename5(temporary, path);
|
|
81700
82109
|
}
|
|
81701
82110
|
async function dropPending({ context }) {
|
|
81702
|
-
await
|
|
82111
|
+
await rm11(pendingPathOf({ context }), { force: true });
|
|
81703
82112
|
}
|
|
81704
82113
|
function waitSecondsOf3({ args }) {
|
|
81705
82114
|
const raw = flagText({ args, name: "timeout" });
|
|
@@ -82011,244 +82420,6 @@ function machineAccessCommand(name2) {
|
|
|
82011
82420
|
return name2 && Object.hasOwn(COMMANDS, name2) ? COMMANDS[name2] : void 0;
|
|
82012
82421
|
}
|
|
82013
82422
|
|
|
82014
|
-
// src/services/vault-commands.service.ts
|
|
82015
|
-
import { createHash as createHash2 } from "node:crypto";
|
|
82016
|
-
import { mkdir as mkdir18, readFile as readFile29, rm as rm11, writeFile as writeFile19 } from "node:fs/promises";
|
|
82017
|
-
import { tmpdir as tmpdir2 } from "node:os";
|
|
82018
|
-
import { dirname as dirname18, join as join20 } from "node:path";
|
|
82019
|
-
var USAGE10 = `Usage: laze vault run <connection> --reason "<one plain sentence>" [--wait <s>] -- <command> [args...]
|
|
82020
|
-
Runs the command with the connection's values in its environment, on a Laze agent's computer
|
|
82021
|
-
or on a machine it runs on.`;
|
|
82022
|
-
var POLL_MS2 = 3e3;
|
|
82023
|
-
var RESTART_WAIT_MS = 12e4;
|
|
82024
|
-
var RESTART_BACKOFF_MS = [1e3, 2e3, 4e3, 8e3, 1e4];
|
|
82025
|
-
var P2562 = { name: "ECDH", namedCurve: "P-256" };
|
|
82026
|
-
var ServerGoneError = class extends Error {
|
|
82027
|
-
};
|
|
82028
|
-
function proxyOf({ env }) {
|
|
82029
|
-
const raw = env.LAZE_VAULT_PROXY || env.HTTP_PROXY || env.http_proxy;
|
|
82030
|
-
if (!raw) {
|
|
82031
|
-
throw new CliUsageError(
|
|
82032
|
-
"laze vault run works only on a Laze agent's computer or on a machine it runs on"
|
|
82033
|
-
);
|
|
82034
|
-
}
|
|
82035
|
-
const url2 = new URL(raw);
|
|
82036
|
-
const user = decodeURIComponent(url2.username);
|
|
82037
|
-
const password = decodeURIComponent(url2.password);
|
|
82038
|
-
return {
|
|
82039
|
-
origin: url2.origin,
|
|
82040
|
-
authorization: `Basic ${Buffer.from(`${user}:${password}`).toString("base64")}`
|
|
82041
|
-
};
|
|
82042
|
-
}
|
|
82043
|
-
function turnFileOf({
|
|
82044
|
-
env
|
|
82045
|
-
}) {
|
|
82046
|
-
return env.LAZE_TURN_FILE || void 0;
|
|
82047
|
-
}
|
|
82048
|
-
async function turnTokenOf4({
|
|
82049
|
-
env,
|
|
82050
|
-
turnFile,
|
|
82051
|
-
command = "laze vault run"
|
|
82052
|
-
}) {
|
|
82053
|
-
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
82054
|
-
if (pinned) return pinned;
|
|
82055
|
-
if (!turnFile) throw new CliUsageError(`${command} works only during an agent's turn`);
|
|
82056
|
-
try {
|
|
82057
|
-
return (await readFile29(turnFile, "utf8")).trim();
|
|
82058
|
-
} catch {
|
|
82059
|
-
throw new CliUsageError(`${command} works only during an agent's turn`);
|
|
82060
|
-
}
|
|
82061
|
-
}
|
|
82062
|
-
function runKeyPathOf({
|
|
82063
|
-
turnFile,
|
|
82064
|
-
connection
|
|
82065
|
-
}) {
|
|
82066
|
-
const name2 = createHash2("sha256").update(connection).digest("hex");
|
|
82067
|
-
const base = turnFile ? dirname18(turnFile) : join20(tmpdir2(), "laze-vault");
|
|
82068
|
-
return join20(base, "vault-run-keys", `${name2}.json`);
|
|
82069
|
-
}
|
|
82070
|
-
async function runKeyAt({ path }) {
|
|
82071
|
-
const saved3 = await readFile29(path, "utf8").then(
|
|
82072
|
-
(text2) => JSON.parse(text2),
|
|
82073
|
-
() => void 0
|
|
82074
|
-
);
|
|
82075
|
-
if (saved3 && typeof saved3.publicKey === "string" && saved3.privateKey) {
|
|
82076
|
-
const privateKey = await globalThis.crypto.subtle.importKey("jwk", saved3.privateKey, P2562, false, ["deriveBits"]).catch(() => void 0);
|
|
82077
|
-
if (privateKey) return { privateKey, publicKey: saved3.publicKey };
|
|
82078
|
-
}
|
|
82079
|
-
const fresh = await generateEcdhKeys();
|
|
82080
|
-
const jwk = await globalThis.crypto.subtle.exportKey("jwk", fresh.privateKey);
|
|
82081
|
-
await mkdir18(dirname18(path), { recursive: true, mode: 448 });
|
|
82082
|
-
await writeFile19(path, JSON.stringify({ publicKey: fresh.publicKey, privateKey: jwk }), {
|
|
82083
|
-
mode: 384
|
|
82084
|
-
});
|
|
82085
|
-
return fresh;
|
|
82086
|
-
}
|
|
82087
|
-
function connectionRefused(error62) {
|
|
82088
|
-
const cause = error62.cause;
|
|
82089
|
-
if (cause?.code === "ECONNREFUSED") return true;
|
|
82090
|
-
return cause?.errors?.some((inner) => inner.code === "ECONNREFUSED") ?? false;
|
|
82091
|
-
}
|
|
82092
|
-
async function sendOnce({
|
|
82093
|
-
context,
|
|
82094
|
-
url: url2,
|
|
82095
|
-
init
|
|
82096
|
-
}) {
|
|
82097
|
-
let response;
|
|
82098
|
-
try {
|
|
82099
|
-
response = await context.fetcher(url2, init);
|
|
82100
|
-
} catch (error62) {
|
|
82101
|
-
const wasRefused = connectionRefused(error62);
|
|
82102
|
-
if (init.method === "POST" && !wasRefused) throw error62;
|
|
82103
|
-
return { restarting: wasRefused ? "connection refused" : String(error62) };
|
|
82104
|
-
}
|
|
82105
|
-
if (response.status !== 502 && response.status !== 503) return { response };
|
|
82106
|
-
const code = codeOf(await response.clone().text());
|
|
82107
|
-
const neverReached = response.status === 503 && code === "vault_not_answering";
|
|
82108
|
-
if (init.method === "POST" && !neverReached) return { response };
|
|
82109
|
-
return { restarting: `status ${response.status}${code ? ` ${code}` : ""}` };
|
|
82110
|
-
}
|
|
82111
|
-
async function reach(input2) {
|
|
82112
|
-
const { context } = input2;
|
|
82113
|
-
const started = context.nowMs();
|
|
82114
|
-
for (let attempt = 0; ; attempt += 1) {
|
|
82115
|
-
const sent = await sendOnce(input2);
|
|
82116
|
-
if ("response" in sent) return sent.response;
|
|
82117
|
-
if (context.nowMs() - started >= RESTART_WAIT_MS) {
|
|
82118
|
-
throw new ServerGoneError(
|
|
82119
|
-
`laze vault: the Laze server did not come back (${sent.restarting})`
|
|
82120
|
-
);
|
|
82121
|
-
}
|
|
82122
|
-
if (attempt === 0) {
|
|
82123
|
-
context.err(
|
|
82124
|
-
`laze vault: the Laze server is not answering (${sent.restarting}), probably restarting; waiting up to 2 min...
|
|
82125
|
-
`
|
|
82126
|
-
);
|
|
82127
|
-
}
|
|
82128
|
-
await context.sleep(RESTART_BACKOFF_MS[Math.min(attempt, RESTART_BACKOFF_MS.length - 1)] ?? 0);
|
|
82129
|
-
}
|
|
82130
|
-
}
|
|
82131
|
-
function codeOf(text2) {
|
|
82132
|
-
return /"code"\s*:\s*"([^"]+)"/.exec(text2)?.[1];
|
|
82133
|
-
}
|
|
82134
|
-
async function releaseOf({ response }) {
|
|
82135
|
-
const text2 = await response.text();
|
|
82136
|
-
if (!response.ok) {
|
|
82137
|
-
return {
|
|
82138
|
-
outcome: "deny",
|
|
82139
|
-
exitCode: 1,
|
|
82140
|
-
message: `laze vault: the release was refused (${codeOf(text2) ?? `status ${response.status}`})`
|
|
82141
|
-
};
|
|
82142
|
-
}
|
|
82143
|
-
return JSON.parse(text2);
|
|
82144
|
-
}
|
|
82145
|
-
async function envOf({
|
|
82146
|
-
release: release2,
|
|
82147
|
-
run: run4
|
|
82148
|
-
}) {
|
|
82149
|
-
if (!release2.sealed) return release2.env;
|
|
82150
|
-
const sealed = await openRunRelease({
|
|
82151
|
-
release: release2.sealed,
|
|
82152
|
-
runPrivateKey: run4.privateKey,
|
|
82153
|
-
runPublicKey: run4.publicKey,
|
|
82154
|
-
requestId: release2.sealed.requestId
|
|
82155
|
-
});
|
|
82156
|
-
return { ...release2.env, ...sealed };
|
|
82157
|
-
}
|
|
82158
|
-
function deadlineOf({ args, nowMs }) {
|
|
82159
|
-
const wait = flagText({ args, name: "wait" }) || (args.flags.wait === true ? args.words[3] : "");
|
|
82160
|
-
if (!wait) return Infinity;
|
|
82161
|
-
if (!(Number(wait) >= 0)) throw new CliUsageError(`--wait takes a number of seconds
|
|
82162
|
-
${USAGE10}`);
|
|
82163
|
-
return nowMs + Number(wait) * 1e3;
|
|
82164
|
-
}
|
|
82165
|
-
async function untilAnswered({
|
|
82166
|
-
context,
|
|
82167
|
-
first,
|
|
82168
|
-
origin,
|
|
82169
|
-
headers,
|
|
82170
|
-
deadline
|
|
82171
|
-
}) {
|
|
82172
|
-
let release2 = first;
|
|
82173
|
-
while (release2.outcome === "ask") {
|
|
82174
|
-
if (context.nowMs() + POLL_MS2 > deadline) {
|
|
82175
|
-
context.err(`${release2.message}. Not approved yet; ask again later.
|
|
82176
|
-
`);
|
|
82177
|
-
return "capped";
|
|
82178
|
-
}
|
|
82179
|
-
if (release2 === first) {
|
|
82180
|
-
context.err(`${release2.message}. Waiting for an answer (cards expire after 12 hours)...
|
|
82181
|
-
`);
|
|
82182
|
-
}
|
|
82183
|
-
await context.sleep(POLL_MS2);
|
|
82184
|
-
const url2 = `${origin}/vault/release/${encodeURIComponent(release2.requestId)}`;
|
|
82185
|
-
release2 = await releaseOf({
|
|
82186
|
-
response: await reach({ context, url: url2, init: { method: "GET", headers } })
|
|
82187
|
-
});
|
|
82188
|
-
}
|
|
82189
|
-
return release2;
|
|
82190
|
-
}
|
|
82191
|
-
async function vaultRelease({
|
|
82192
|
-
context,
|
|
82193
|
-
args,
|
|
82194
|
-
connection,
|
|
82195
|
-
reason,
|
|
82196
|
-
command
|
|
82197
|
-
}) {
|
|
82198
|
-
const deadline = deadlineOf({ args, nowMs: context.nowMs() });
|
|
82199
|
-
const env = context.environment.inherited;
|
|
82200
|
-
const proxy = proxyOf({ env });
|
|
82201
|
-
const turnFile = turnFileOf({ env });
|
|
82202
|
-
const headers = {
|
|
82203
|
-
"proxy-authorization": proxy.authorization,
|
|
82204
|
-
"x-laze-turn": await turnTokenOf4({ env, turnFile })
|
|
82205
|
-
};
|
|
82206
|
-
const keyPath = runKeyPathOf({ turnFile, connection });
|
|
82207
|
-
const run4 = await runKeyAt({ path: keyPath });
|
|
82208
|
-
const body = JSON.stringify({ connection, reason, command, recipient: run4.publicKey });
|
|
82209
|
-
let release2;
|
|
82210
|
-
try {
|
|
82211
|
-
const first = await releaseOf({
|
|
82212
|
-
response: await reach({
|
|
82213
|
-
context,
|
|
82214
|
-
url: `${proxy.origin}/vault/release`,
|
|
82215
|
-
init: { method: "POST", headers: { ...headers, "content-type": "application/json" }, body }
|
|
82216
|
-
})
|
|
82217
|
-
});
|
|
82218
|
-
release2 = await untilAnswered({ context, first, origin: proxy.origin, headers, deadline });
|
|
82219
|
-
} catch (error62) {
|
|
82220
|
-
if (!(error62 instanceof ServerGoneError)) throw error62;
|
|
82221
|
-
context.err(`${error62.message}. Run the command again to keep waiting.
|
|
82222
|
-
`);
|
|
82223
|
-
return { exitCode: 75 };
|
|
82224
|
-
}
|
|
82225
|
-
if (release2 === "capped") return { exitCode: 75 };
|
|
82226
|
-
if (release2.outcome === "deny") {
|
|
82227
|
-
await rm11(keyPath, { force: true });
|
|
82228
|
-
context.err(`${release2.message}
|
|
82229
|
-
`);
|
|
82230
|
-
return { exitCode: release2.exitCode || 1 };
|
|
82231
|
-
}
|
|
82232
|
-
const values = await envOf({ release: release2, run: run4 });
|
|
82233
|
-
await rm11(keyPath, { force: true });
|
|
82234
|
-
if (release2.message) context.err(`${release2.message}
|
|
82235
|
-
`);
|
|
82236
|
-
return { env: values };
|
|
82237
|
-
}
|
|
82238
|
-
async function vaultRun({
|
|
82239
|
-
context,
|
|
82240
|
-
args
|
|
82241
|
-
}) {
|
|
82242
|
-
const connection = args.words[2];
|
|
82243
|
-
const reason = flagText({ args, name: "reason" });
|
|
82244
|
-
if (!connection || args.rest.length === 0) throw new CliUsageError(USAGE10);
|
|
82245
|
-
if (!reason) throw new CliUsageError(`Say why with --reason "<one plain sentence>"
|
|
82246
|
-
${USAGE10}`);
|
|
82247
|
-
const released = await vaultRelease({ context, args, connection, reason, command: args.rest });
|
|
82248
|
-
if ("exitCode" in released) return released.exitCode;
|
|
82249
|
-
return context.runCommand({ command: args.rest, env: released.env });
|
|
82250
|
-
}
|
|
82251
|
-
|
|
82252
82423
|
// src/services/machine-commands.service.ts
|
|
82253
82424
|
var USAGE11 = [
|
|
82254
82425
|
"Usage: laze machine connect <name> the command to run on your own machine (people)",
|
|
@@ -84665,7 +84836,7 @@ async function postInTurn({
|
|
|
84665
84836
|
body
|
|
84666
84837
|
}) {
|
|
84667
84838
|
const env = context.environment.inherited;
|
|
84668
|
-
const turn = await
|
|
84839
|
+
const turn = await turnTokenOf3({
|
|
84669
84840
|
env,
|
|
84670
84841
|
turnFile: turnFileOf({ env }),
|
|
84671
84842
|
command: "laze vault save"
|
|
@@ -86301,7 +86472,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
86301
86472
|
laze vault scrub [--dry-run] move secrets found in messages to the vault now (admins)
|
|
86302
86473
|
laze vault list|add|update|replace|compare|rm|revoke|uses your keychains with your own key
|
|
86303
86474
|
a value comes from stdin or --from-file, never a flag; no command prints a value
|
|
86304
|
-
laze vault grant|lend|grants|ungrant|leases|end-lease|limits|set-limit sharing, leases, limits
|
|
86475
|
+
laze vault grant|share|lend|grants|ungrant|leases|end-lease|limits|set-limit sharing, leases, limits
|
|
86305
86476
|
laze vault audit|activity|most-asked|approvals|judge|devices what happened (audit: admins)
|
|
86306
86477
|
laze vault every laze vault command, with its flags
|
|
86307
86478
|
laze connect suggest <service> --reason "<why>" a connect card for whoever asked (agents)
|
package/package.json
CHANGED