@lazehq/cli 0.1.33 → 0.1.35
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 +756 -307
- 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.35";
|
|
35712
35712
|
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
35713
35713
|
return stamped.startsWith("__") ? "dev" : stamped;
|
|
35714
35714
|
}
|
|
@@ -59189,6 +59189,18 @@ var saveDraftInputSchemaDefinition = external_exports.object({
|
|
|
59189
59189
|
var saveDraftInputSchema = saveDraftInputSchemaDefinition;
|
|
59190
59190
|
var draftSavedSchemaDefinition = external_exports.object({ saved: external_exports.boolean() });
|
|
59191
59191
|
var draftSavedSchema = draftSavedSchemaDefinition;
|
|
59192
|
+
var draftsParamsSchemaDefinition = external_exports.object({ workspaceId: workspaceIdSchema });
|
|
59193
|
+
var draftPlaceParamsSchemaDefinition = external_exports.object({
|
|
59194
|
+
workspaceId: workspaceIdSchema,
|
|
59195
|
+
channelId: idSchema4
|
|
59196
|
+
});
|
|
59197
|
+
var draftThreadQuerySchemaDefinition = external_exports.object({ threadRootId: idSchema4.optional() });
|
|
59198
|
+
var draftBodySchemaDefinition = saveDraftInputSchemaDefinition.pick({
|
|
59199
|
+
text: true,
|
|
59200
|
+
picks: true,
|
|
59201
|
+
files: true,
|
|
59202
|
+
savedAt: true
|
|
59203
|
+
});
|
|
59192
59204
|
var SIDEBAR_SECTIONS_MAX = 50;
|
|
59193
59205
|
var SIDEBAR_STARRED_MAX = 200;
|
|
59194
59206
|
var sidebarFilterSchemaDefinition = external_exports.enum(["active", "unreads", "mentions", "all"]);
|
|
@@ -60370,12 +60382,27 @@ var liveStepSchemaDefinition = external_exports.object({
|
|
|
60370
60382
|
steps: external_exports.number().int().nonnegative().optional()
|
|
60371
60383
|
});
|
|
60372
60384
|
var liveStepSchema = liveStepSchemaDefinition;
|
|
60385
|
+
var harnessModelSchemaDefinition = external_exports.object({
|
|
60386
|
+
/** What the harness's `--model` takes, such as `gpt-6-sol` or `opus`. */
|
|
60387
|
+
id: external_exports.string().min(1).max(200),
|
|
60388
|
+
name: external_exports.string().max(200),
|
|
60389
|
+
description: external_exports.string().max(500).default(""),
|
|
60390
|
+
/** The model's own window in tokens, when the harness says it. */
|
|
60391
|
+
contextWindow: external_exports.number().int().positive().nullable().default(null),
|
|
60392
|
+
/** The thinking levels the model takes, lowest first; empty when it takes none. */
|
|
60393
|
+
efforts: external_exports.array(external_exports.string().min(1).max(40)).max(20).default([]),
|
|
60394
|
+
defaultEffort: external_exports.string().max(40).nullable().default(null)
|
|
60395
|
+
});
|
|
60396
|
+
var harnessModelSchema = harnessModelSchemaDefinition;
|
|
60373
60397
|
var lazeAgentEventSchemaDefinition = external_exports.discriminatedUnion("type", [
|
|
60374
60398
|
external_exports.object({
|
|
60375
60399
|
type: external_exports.literal("harness_started"),
|
|
60376
60400
|
harness: harnessKindSchema,
|
|
60377
60401
|
resumed: external_exports.boolean(),
|
|
60378
|
-
sessionRef: external_exports.string().optional()
|
|
60402
|
+
sessionRef: external_exports.string().optional(),
|
|
60403
|
+
/** The model and thinking effort the session runs on, when the supervisor knows them. */
|
|
60404
|
+
model: external_exports.string().max(200).optional(),
|
|
60405
|
+
effort: external_exports.string().max(40).optional()
|
|
60379
60406
|
}),
|
|
60380
60407
|
external_exports.object({
|
|
60381
60408
|
type: external_exports.literal("turn_started"),
|
|
@@ -60463,6 +60490,17 @@ var lazeAgentEventSchemaDefinition = external_exports.discriminatedUnion("type",
|
|
|
60463
60490
|
message: external_exports.string(),
|
|
60464
60491
|
retryable: external_exports.boolean()
|
|
60465
60492
|
}),
|
|
60493
|
+
/** What the harness lists for its login, read as it starts: its default model first. */
|
|
60494
|
+
external_exports.object({
|
|
60495
|
+
type: external_exports.literal("harness_models"),
|
|
60496
|
+
models: external_exports.array(harnessModelSchemaDefinition).max(100),
|
|
60497
|
+
defaultModel: external_exports.string().max(200).nullable()
|
|
60498
|
+
}),
|
|
60499
|
+
/** The login no longer lists the agent's chosen model: the harness started on its default. */
|
|
60500
|
+
external_exports.object({
|
|
60501
|
+
type: external_exports.literal("model_gone"),
|
|
60502
|
+
model: external_exports.string().min(1).max(200)
|
|
60503
|
+
}),
|
|
60466
60504
|
external_exports.object({ type: external_exports.literal("idle_stopping"), idleMs: external_exports.number().int().nonnegative() }),
|
|
60467
60505
|
/** A running turn has said nothing, with no tool running, for `silentMs`. */
|
|
60468
60506
|
external_exports.object({ type: external_exports.literal("stalled"), silentMs: external_exports.number().int().nonnegative() }),
|
|
@@ -60552,6 +60590,8 @@ var agentSandboxSpecSchemaDefinition = external_exports.object({
|
|
|
60552
60590
|
harness: harnessKindSchema,
|
|
60553
60591
|
/** Claude Code or Codex model name. */
|
|
60554
60592
|
model: external_exports.string().min(1).optional(),
|
|
60593
|
+
/** The thinking effort the harness runs at, such as `high`; absent for the model's default. */
|
|
60594
|
+
effort: external_exports.string().min(1).max(40).optional(),
|
|
60555
60595
|
/** Claude Code on a Laze model: the gateway through the relay connection, and its models. */
|
|
60556
60596
|
claudeGateway: external_exports.object({ connectionId: external_exports.string().min(1), models: claudeGatewayModelsSchema }).optional(),
|
|
60557
60597
|
/** The harness model's context window, when Laze knows it: compaction is set against it. */
|
|
@@ -60739,6 +60779,8 @@ var supervisorLaunchSchemaDefinition = external_exports.object({
|
|
|
60739
60779
|
marginTokens: external_exports.number().int().nonnegative()
|
|
60740
60780
|
}),
|
|
60741
60781
|
model: external_exports.string().optional(),
|
|
60782
|
+
/** The thinking effort the harness runs at; absent for the model's default. */
|
|
60783
|
+
effort: external_exports.string().optional(),
|
|
60742
60784
|
/** The harness model's context window, when Laze knows it: compaction is set against it. */
|
|
60743
60785
|
contextWindow: external_exports.number().int().positive().optional(),
|
|
60744
60786
|
/** Claude Code on a Laze model: the relay as its API, a placeholder as its token. */
|
|
@@ -61964,7 +62006,9 @@ var updateVaultConnectionInputSchemaDefinition = external_exports.object({
|
|
|
61964
62006
|
maxLeaseSeconds: external_exports.number().int().positive().max(VAULT_MAX_LEASE_SECONDS).nullable().optional(),
|
|
61965
62007
|
everyUseAsks: external_exports.boolean().optional(),
|
|
61966
62008
|
secret: vaultSecretBundleSchema.optional(),
|
|
61967
|
-
egress: vaultEgressTargetSchema.nullable().optional()
|
|
62009
|
+
egress: vaultEgressTargetSchema.nullable().optional(),
|
|
62010
|
+
/** A fresh passkey or Face ID proof, needed to lower a key from Always ask or Human only. */
|
|
62011
|
+
reauthToken: external_exports.string().min(1).optional()
|
|
61968
62012
|
});
|
|
61969
62013
|
var updateVaultConnectionInputSchema = updateVaultConnectionInputSchemaDefinition;
|
|
61970
62014
|
var vaultGrantSubjectSchemaDefinition = external_exports.object({
|
|
@@ -61981,7 +62025,9 @@ var vaultGrantSchemaDefinition = external_exports.object({
|
|
|
61981
62025
|
lend: external_exports.boolean(),
|
|
61982
62026
|
grantedByUserId: external_exports.string(),
|
|
61983
62027
|
expiresAt: external_exports.iso.datetime().nullable(),
|
|
61984
|
-
createdAt: external_exports.iso.datetime()
|
|
62028
|
+
createdAt: external_exports.iso.datetime(),
|
|
62029
|
+
/** A share asked from the CLI or by an agent: nothing reaches it until the owner's passkey. */
|
|
62030
|
+
awaitingOwner: external_exports.boolean().optional()
|
|
61985
62031
|
});
|
|
61986
62032
|
var vaultGrantSchema = vaultGrantSchemaDefinition;
|
|
61987
62033
|
var grantVaultConnectionInputSchemaDefinition = external_exports.object({
|
|
@@ -61999,6 +62045,33 @@ var lendVaultConnectionInputSchemaDefinition = external_exports.object({
|
|
|
61999
62045
|
durationSeconds: external_exports.number().int().positive().nullable().default(null)
|
|
62000
62046
|
});
|
|
62001
62047
|
var lendVaultConnectionInputSchema = lendVaultConnectionInputSchemaDefinition;
|
|
62048
|
+
var shareVaultConnectionInputSchemaDefinition = external_exports.object({
|
|
62049
|
+
workspaceId: external_exports.string().min(1),
|
|
62050
|
+
connectionId: external_exports.string().min(1),
|
|
62051
|
+
/** The teammate whose own agents may use the key; they never see its value. */
|
|
62052
|
+
userId: external_exports.string().min(1),
|
|
62053
|
+
durationSeconds: external_exports.number().int().positive().nullable().default(null),
|
|
62054
|
+
/** A fresh passkey or Face ID proof makes the share live; without one it waits for the owner. */
|
|
62055
|
+
reauthToken: external_exports.string().min(1).optional()
|
|
62056
|
+
});
|
|
62057
|
+
var shareVaultConnectionInputSchema = shareVaultConnectionInputSchemaDefinition;
|
|
62058
|
+
var approveVaultShareInputSchemaDefinition = external_exports.object({
|
|
62059
|
+
workspaceId: external_exports.string().min(1),
|
|
62060
|
+
grantId: external_exports.string().min(1),
|
|
62061
|
+
reauthToken: external_exports.string().min(1)
|
|
62062
|
+
});
|
|
62063
|
+
var approveVaultShareInputSchema = approveVaultShareInputSchemaDefinition;
|
|
62064
|
+
var requestVaultShareInputSchemaDefinition = external_exports.object({
|
|
62065
|
+
turnToken: external_exports.string().min(1),
|
|
62066
|
+
connection: external_exports.string().min(1),
|
|
62067
|
+
userId: external_exports.string().min(1),
|
|
62068
|
+
durationSeconds: external_exports.number().int().positive().nullable().default(null)
|
|
62069
|
+
});
|
|
62070
|
+
var setVaultLevelInTurnInputSchemaDefinition = external_exports.object({
|
|
62071
|
+
turnToken: external_exports.string().min(1),
|
|
62072
|
+
connection: external_exports.string().min(1),
|
|
62073
|
+
sensitivity: vaultSensitivitySchema
|
|
62074
|
+
});
|
|
62002
62075
|
var vaultAgentKindSchema = external_exports.enum(["personal", "team"]);
|
|
62003
62076
|
var openVaultTurnInputSchemaDefinition = external_exports.object({
|
|
62004
62077
|
workspaceId: external_exports.string().min(1),
|
|
@@ -62256,7 +62329,14 @@ var vaultConnectionUseSchemaDefinition = external_exports.object({
|
|
|
62256
62329
|
leaseId: external_exports.string().nullable().default(null),
|
|
62257
62330
|
origin: vaultUseOriginSchema.nullable().default(null),
|
|
62258
62331
|
/** How a person's read happened: `page` (Reveal) or `own_secret` (the CLI or Laze for them). */
|
|
62259
|
-
via: external_exports.string().nullable().default(null)
|
|
62332
|
+
via: external_exports.string().nullable().default(null),
|
|
62333
|
+
/** On a share or a tier change: the person it named, the new tier, and the proof used. */
|
|
62334
|
+
change: external_exports.object({
|
|
62335
|
+
subjectUserId: external_exports.string().nullable(),
|
|
62336
|
+
to: vaultSensitivitySchema.nullable(),
|
|
62337
|
+
direction: external_exports.enum(["raised", "lowered"]).nullable(),
|
|
62338
|
+
method: external_exports.string().nullable()
|
|
62339
|
+
}).nullable().optional()
|
|
62260
62340
|
});
|
|
62261
62341
|
var vaultConnectionUseSchema = vaultConnectionUseSchemaDefinition;
|
|
62262
62342
|
var vaultRevokeAtProviderSchema = external_exports.enum(["revoked", "failed", "not_supported"]);
|
|
@@ -62353,7 +62433,7 @@ var vaultTrpc = defineTrpcContract("vault").mutation("createConnection").withInp
|
|
|
62353
62433
|
reason: external_exports.string().trim().min(1).max(200),
|
|
62354
62434
|
reauthToken: external_exports.string().min(1).max(200).optional()
|
|
62355
62435
|
})
|
|
62356
|
-
).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(
|
|
62436
|
+
).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).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(
|
|
62357
62437
|
external_exports.object({
|
|
62358
62438
|
...connectionInput.shape,
|
|
62359
62439
|
reason: external_exports.string().trim().min(1).max(200),
|
|
@@ -64019,6 +64099,79 @@ var harnessSignInPollSchemaDefinition = external_exports.discriminatedUnion("sta
|
|
|
64019
64099
|
]);
|
|
64020
64100
|
var harnessSignInPollSchema = harnessSignInPollSchemaDefinition;
|
|
64021
64101
|
|
|
64102
|
+
// ../../modules/agent/contract/src/agent-run-config.ts
|
|
64103
|
+
var harnessModelsSchemaDefinition = external_exports.object({
|
|
64104
|
+
models: external_exports.array(harnessModelSchema).max(100),
|
|
64105
|
+
/** The model the harness runs when Laze names none; null when it did not say. */
|
|
64106
|
+
defaultModel: external_exports.string().max(200).nullable(),
|
|
64107
|
+
readAt: external_exports.iso.datetime()
|
|
64108
|
+
});
|
|
64109
|
+
var harnessModelsSchema = harnessModelsSchemaDefinition;
|
|
64110
|
+
var runModelInputSchema = external_exports.string().trim().min(1).max(200).nullable();
|
|
64111
|
+
var runEffortInputSchema = external_exports.string().trim().min(1).max(40).regex(/^[a-z]+$/).nullable();
|
|
64112
|
+
var EFFORT_LABELS = {
|
|
64113
|
+
minimal: "Minimal",
|
|
64114
|
+
low: "Low",
|
|
64115
|
+
medium: "Medium",
|
|
64116
|
+
high: "High",
|
|
64117
|
+
xhigh: "Extra high",
|
|
64118
|
+
max: "Max",
|
|
64119
|
+
ultra: "Ultra"
|
|
64120
|
+
};
|
|
64121
|
+
function effortLabelOf({ effort }) {
|
|
64122
|
+
return EFFORT_LABELS[effort] ?? `${effort.charAt(0).toUpperCase()}${effort.slice(1)}`;
|
|
64123
|
+
}
|
|
64124
|
+
function tokensLabelOf({ tokens }) {
|
|
64125
|
+
if (tokens >= 1e6) return `${Math.round(tokens / 1e5) / 10}M`;
|
|
64126
|
+
return `${Math.round(tokens / 1e3)}k`;
|
|
64127
|
+
}
|
|
64128
|
+
function pickRunningModel({ agent: agent2 }) {
|
|
64129
|
+
if (agent2.harness === "laze-models") return null;
|
|
64130
|
+
const listed = agent2.harnessModels?.models ?? [];
|
|
64131
|
+
const wanted = agent2.model ?? agent2.harnessModels?.defaultModel ?? null;
|
|
64132
|
+
return listed.find((one) => one.id === wanted) ?? (agent2.model ? null : listed[0] ?? null);
|
|
64133
|
+
}
|
|
64134
|
+
function contextCapOf({ agent: agent2 }) {
|
|
64135
|
+
if (agent2.harness === "laze-models") return { tokens: AGENT_CONTEXT_WINDOW.max, known: true };
|
|
64136
|
+
const window2 = pickRunningModel({ agent: agent2 })?.contextWindow ?? null;
|
|
64137
|
+
return window2 ? { tokens: window2, known: true } : { tokens: AGENT_CONTEXT_WINDOW.max, known: false };
|
|
64138
|
+
}
|
|
64139
|
+
var LEVEL_NAMES = { fast: "Laze Fast", frontier: "Laze Frontier" };
|
|
64140
|
+
function modelLineOf({ agent: agent2 }) {
|
|
64141
|
+
if (agent2.harness === "laze-models") return LEVEL_NAMES[agent2.modelLevel ?? "fast"];
|
|
64142
|
+
const running = pickRunningModel({ agent: agent2 });
|
|
64143
|
+
if (agent2.model) return running?.name || agent2.model;
|
|
64144
|
+
return running ? `Default (${running.name || running.id})` : "Default";
|
|
64145
|
+
}
|
|
64146
|
+
function describeEffort({ agent: agent2 }) {
|
|
64147
|
+
const running = pickRunningModel({ agent: agent2 });
|
|
64148
|
+
if (agent2.effort) return effortLabelOf({ effort: agent2.effort });
|
|
64149
|
+
if (running && running.efforts.length === 0) return null;
|
|
64150
|
+
const fallback = running?.defaultEffort;
|
|
64151
|
+
return fallback ? `Default (${effortLabelOf({ effort: fallback })})` : "Default";
|
|
64152
|
+
}
|
|
64153
|
+
function contextLineOf({ agent: agent2 }) {
|
|
64154
|
+
const cap = contextCapOf({ agent: agent2 });
|
|
64155
|
+
if (agent2.harness === "laze-models") {
|
|
64156
|
+
const tokens = agent2.contextWindow ?? AGENT_CONTEXT_WINDOW.default;
|
|
64157
|
+
return `${tokensLabelOf({ tokens })}, up to ${tokensLabelOf({ tokens: cap.tokens })}`;
|
|
64158
|
+
}
|
|
64159
|
+
if (!cap.known) {
|
|
64160
|
+
return agent2.contextWindow ? `${tokensLabelOf({ tokens: agent2.contextWindow })}, or the model's window if smaller` : "The model's own window";
|
|
64161
|
+
}
|
|
64162
|
+
const set2 = agent2.contextWindow ? Math.min(agent2.contextWindow, cap.tokens) : null;
|
|
64163
|
+
if (!set2 || set2 === cap.tokens)
|
|
64164
|
+
return `${tokensLabelOf({ tokens: cap.tokens })}, the most this model takes`;
|
|
64165
|
+
return `${tokensLabelOf({ tokens: set2 })} of the ${tokensLabelOf({ tokens: cap.tokens })} this model takes`;
|
|
64166
|
+
}
|
|
64167
|
+
function agentRunSummaryOf({ agent: agent2 }) {
|
|
64168
|
+
return {
|
|
64169
|
+
model: modelLineOf({ agent: agent2 }),
|
|
64170
|
+
effort: describeEffort({ agent: agent2 }),
|
|
64171
|
+
context: contextLineOf({ agent: agent2 })
|
|
64172
|
+
};
|
|
64173
|
+
}
|
|
64174
|
+
|
|
64022
64175
|
// ../../modules/agent/contract/src/agent-manage.ts
|
|
64023
64176
|
var hostedHarnessSchema = external_exports.enum(["laze-models", "claude-code", "codex"]);
|
|
64024
64177
|
var nameSchema = external_exports.string().trim().min(1).max(80);
|
|
@@ -64048,8 +64201,12 @@ var updateAgentAsCallerInputSchemaDefinition = external_exports.object({
|
|
|
64048
64201
|
name: nameSchema.optional(),
|
|
64049
64202
|
description: descriptionSchema.optional(),
|
|
64050
64203
|
avatar: agentAvatarInputSchema.optional(),
|
|
64051
|
-
/** The context
|
|
64052
|
-
contextWindow: contextWindowInputSchema.optional(),
|
|
64204
|
+
/** The max context of an agent Laze runs, in tokens, 100k to 1M; null for its default. */
|
|
64205
|
+
contextWindow: contextWindowInputSchema.nullable().optional(),
|
|
64206
|
+
/** The model its login lists, or null for the harness's default. */
|
|
64207
|
+
model: runModelInputSchema.optional(),
|
|
64208
|
+
/** The thinking level its model lists, or null for the model's default. */
|
|
64209
|
+
effort: runEffortInputSchema.optional(),
|
|
64053
64210
|
/** Pauses or resumes an agent Laze runs. */
|
|
64054
64211
|
paused: external_exports.boolean().optional(),
|
|
64055
64212
|
pauseReason: external_exports.string().trim().max(200).optional()
|
|
@@ -64278,8 +64435,14 @@ var agentSchemaDefinition = external_exports.object({
|
|
|
64278
64435
|
/** A Laze agent's SOUL.md. */
|
|
64279
64436
|
instructions: external_exports.string().default(""),
|
|
64280
64437
|
modelLevel: agentModelLevelSchema.nullable().default(null),
|
|
64281
|
-
/** The context
|
|
64438
|
+
/** The max context of an agent Laze runs, in tokens; null for its default or a connected one. */
|
|
64282
64439
|
contextWindow: external_exports.number().int().positive().nullable().default(null),
|
|
64440
|
+
/** The model a Claude Code or Codex agent runs; null for its harness's default. */
|
|
64441
|
+
model: external_exports.string().nullable().default(null),
|
|
64442
|
+
/** The thinking effort it runs at; null for its model's default. */
|
|
64443
|
+
effort: external_exports.string().nullable().default(null),
|
|
64444
|
+
/** The models its harness listed for its login when it last started; null before then. */
|
|
64445
|
+
harnessModels: harnessModelsSchema.nullable().default(null),
|
|
64283
64446
|
/** The GitHub identity a Laze agent works as; null when it has none. */
|
|
64284
64447
|
github: agentGithubSchema.nullable().default(null),
|
|
64285
64448
|
/** Out of usage (its login or its Laze models budget) until this time; null when it can work. */
|
|
@@ -64336,8 +64499,12 @@ var updateAgentInputSchemaDefinition = external_exports.object({
|
|
|
64336
64499
|
name: agentNameSchema.optional(),
|
|
64337
64500
|
avatar: agentAvatarInputSchema.optional(),
|
|
64338
64501
|
modelLevel: agentModelLevelSchema.optional(),
|
|
64339
|
-
/** Agents Laze runs only; a connected agent refuses it. */
|
|
64340
|
-
contextWindow: contextWindowInputSchema.optional(),
|
|
64502
|
+
/** Agents Laze runs only; a connected agent refuses it. Null puts back the default. */
|
|
64503
|
+
contextWindow: contextWindowInputSchema.nullable().optional(),
|
|
64504
|
+
/** A model its login lists, or null for the harness's default; Claude Code and Codex only. */
|
|
64505
|
+
model: runModelInputSchema.optional(),
|
|
64506
|
+
/** A thinking level its model lists, or null for the model's default. */
|
|
64507
|
+
effort: runEffortInputSchema.optional(),
|
|
64341
64508
|
instructions: instructionsSchema.optional(),
|
|
64342
64509
|
/** The whole set: channels left out are left. */
|
|
64343
64510
|
channelIds: external_exports.array(idSchema14).max(50).optional(),
|
|
@@ -64718,8 +64885,6 @@ var agentConfig = Config.define((c) => ({
|
|
|
64718
64885
|
"AGENT_CLAUDE_GATEWAY_THINKING",
|
|
64719
64886
|
external_exports.enum(["on", "off"]).default("on")
|
|
64720
64887
|
),
|
|
64721
|
-
/** The Codex model's window, which caps a Codex agent's context window setting. */
|
|
64722
|
-
codexContextWindow: c.env("AGENT_CODEX_CONTEXT", positiveInt3.default(4e5)),
|
|
64723
64888
|
/** A harness prompt or question no one answers is denied or dismissed after this long. */
|
|
64724
64889
|
attentionTimeoutMinutes: c.env("AGENT_ATTENTION_TIMEOUT_MINUTES", positiveInt3.default(30)),
|
|
64725
64890
|
/** Where a GitHub signature links back; the origin the connect command fetches the CLI from. */
|
|
@@ -65357,6 +65522,11 @@ var requestConnectionInputSchemaDefinition = external_exports.object({
|
|
|
65357
65522
|
name: external_exports.string().trim().max(80).optional()
|
|
65358
65523
|
});
|
|
65359
65524
|
|
|
65525
|
+
// ../../modules/agent/contract/src/agent-profile.ui.ts
|
|
65526
|
+
var agentProfileUi = uiTokens("agent");
|
|
65527
|
+
var AgentProfileSlot = agentProfileUi.component("profile");
|
|
65528
|
+
var AgentOwnedListSlot = agentProfileUi.component("ownedList");
|
|
65529
|
+
|
|
65360
65530
|
// src/services/laze-client.service.ts
|
|
65361
65531
|
var CLI_VERSION_HEADER = "x-laze-cli-version";
|
|
65362
65532
|
var LazeApiError = class extends Error {
|
|
@@ -65727,6 +65897,7 @@ function agentProfileOf({
|
|
|
65727
65897
|
baseUrl
|
|
65728
65898
|
}) {
|
|
65729
65899
|
const owner = ownerName || "its owner";
|
|
65900
|
+
const run4 = agent2.hosting === "laze" ? agentRunSummaryOf({ agent: agent2 }) : null;
|
|
65730
65901
|
return {
|
|
65731
65902
|
id: agent2.id,
|
|
65732
65903
|
name: agent2.name,
|
|
@@ -65735,6 +65906,9 @@ function agentProfileOf({
|
|
|
65735
65906
|
intelligence: intelligenceOf({ agent: agent2, owner }),
|
|
65736
65907
|
status: statusOf({ agent: agent2 }),
|
|
65737
65908
|
login: loginOf({ agent: agent2 }),
|
|
65909
|
+
model: run4?.model ?? null,
|
|
65910
|
+
effort: run4?.effort ?? null,
|
|
65911
|
+
maxContext: run4?.context ?? null,
|
|
65738
65912
|
createdAt: agent2.createdAt.slice(0, 10),
|
|
65739
65913
|
channels: agent2.channels.filter((channel) => channel.kind === "public" || channel.kind === "private").map((channel) => `#${channel.name}`),
|
|
65740
65914
|
link: `${baseUrl.replace(/\/$/, "")}/workspaces/${agent2.workspaceId}/agents`
|
|
@@ -65747,6 +65921,9 @@ function formatAgentProfile({ profile }) {
|
|
|
65747
65921
|
["Intelligence", profile.intelligence],
|
|
65748
65922
|
["Status", profile.status],
|
|
65749
65923
|
["Login", profile.login],
|
|
65924
|
+
["Model", profile.model],
|
|
65925
|
+
["Thinking effort", profile.effort],
|
|
65926
|
+
["Max context", profile.maxContext],
|
|
65750
65927
|
["Created", profile.createdAt],
|
|
65751
65928
|
["Channels", profile.channels.length > 0 ? profile.channels.join(", ") : "none"],
|
|
65752
65929
|
["Profile", profile.link]
|
|
@@ -66015,7 +66192,7 @@ var slackBookmarksSchema = slackBookmarksSchemaDefinition;
|
|
|
66015
66192
|
// ../../modules/slack/contract/src/slack-direct.ts
|
|
66016
66193
|
var slackPeopleInputSchemaDefinition = external_exports.object({
|
|
66017
66194
|
workspaceId: external_exports.string().min(1),
|
|
66018
|
-
/** Part of a name; empty lists the first people. */
|
|
66195
|
+
/** Part of a Slack name, full name or email; empty lists the first people. */
|
|
66019
66196
|
query: external_exports.string().trim().max(80).default("")
|
|
66020
66197
|
});
|
|
66021
66198
|
var slackPeopleInputSchema = slackPeopleInputSchemaDefinition;
|
|
@@ -66024,6 +66201,10 @@ var slackPersonSchemaDefinition = external_exports.object({
|
|
|
66024
66201
|
teamName: external_exports.string(),
|
|
66025
66202
|
slackUserId: external_exports.string(),
|
|
66026
66203
|
name: external_exports.string(),
|
|
66204
|
+
/** Their full name in Slack, empty when it is the same as `name` or Slack gave none. */
|
|
66205
|
+
realName: external_exports.string().default(""),
|
|
66206
|
+
/** Their Slack profile email; null when Slack does not share it. */
|
|
66207
|
+
email: external_exports.string().nullable().default(null),
|
|
66027
66208
|
avatarUrl: external_exports.string().nullable()
|
|
66028
66209
|
});
|
|
66029
66210
|
var slackPeopleSchemaDefinition = external_exports.object({ people: external_exports.array(slackPersonSchemaDefinition) });
|
|
@@ -69831,6 +70012,9 @@ are waiting, if you think one was missed.
|
|
|
69831
70012
|
- \`laze history <channel>\` and \`laze thread <id>\` read a conversation.
|
|
69832
70013
|
- \`laze search "words"\` searches messages.
|
|
69833
70014
|
- \`laze channels list\` lists the conversations you are in.
|
|
70015
|
+
- \`laze channel info <channel>\` shows its members and the apps pinned there. Read a pinned app
|
|
70016
|
+
with \`laze app pull --app <app>\` (its files: page, plan, code) and
|
|
70017
|
+
\`laze app records list <collection> --app <app>\` (its data).
|
|
69834
70018
|
|
|
69835
70019
|
If \`laze\` is not on the PATH, run the same commands through \`npx -y @lazehq/cli@latest\`.
|
|
69836
70020
|
Never print or repeat your Laze key.
|
|
@@ -70652,7 +70836,7 @@ function formatLoginActivity({ activity: activity2 }) {
|
|
|
70652
70836
|
|
|
70653
70837
|
// src/services/agent-manage-commands.service.ts
|
|
70654
70838
|
var CREATE_USAGE = "Usage: laze agent create --name <name> [--description <text>] [--harness laze-models|claude-code|codex] [--team] [--pool <pool>] [--avatar <file>]";
|
|
70655
|
-
var UPDATE_USAGE = "Usage: laze agent update <agent> [--name <name>] [--description <text>] [--avatar <file>] [--context
|
|
70839
|
+
var UPDATE_USAGE = "Usage: laze agent update <agent> [--name <name>] [--description <text>] [--avatar <file>] [--model <model>|default] [--effort <level>|default] [--max-context <tokens, such as 200k>|default]";
|
|
70656
70840
|
var ARCHIVE_USAGE = "Usage: laze agent archive <agent>";
|
|
70657
70841
|
var PAUSE_USAGE = 'Usage: laze agent pause <agent> [--reason "<why>"] | laze agent resume <agent>';
|
|
70658
70842
|
var TRANSFER_USAGE = "Usage: laze agent transfer <agent> <member: user id, email or name>";
|
|
@@ -70685,13 +70869,40 @@ async function avatarOf({
|
|
|
70685
70869
|
return uploaded.avatar;
|
|
70686
70870
|
}
|
|
70687
70871
|
function contextWindowOf2({ args }) {
|
|
70688
|
-
const value = args.flags["context-window"];
|
|
70872
|
+
const value = args.flags["max-context"] ?? args.flags["context-window"];
|
|
70689
70873
|
if (value === void 0) return void 0;
|
|
70874
|
+
if (value === "default") return null;
|
|
70690
70875
|
const match = typeof value === "string" ? /^(\d+(?:\.\d+)?)([kKmM]?)$/.exec(value.trim()) : null;
|
|
70691
70876
|
if (!match) throw new CliUsageError(UPDATE_USAGE);
|
|
70692
70877
|
const unit = { k: 1e3, m: 1e6 }[match[2]?.toLowerCase() ?? ""] ?? 1;
|
|
70693
70878
|
return Math.round(Number(match[1]) * unit);
|
|
70694
70879
|
}
|
|
70880
|
+
function runFlagOf({ args, name: name2 }) {
|
|
70881
|
+
const value = args.flags[name2];
|
|
70882
|
+
if (value === void 0) return void 0;
|
|
70883
|
+
if (typeof value !== "string" || !value.trim()) throw new CliUsageError(UPDATE_USAGE);
|
|
70884
|
+
return value.trim() === "default" ? null : value.trim();
|
|
70885
|
+
}
|
|
70886
|
+
function runChangesOf({ args }) {
|
|
70887
|
+
const contextWindow = contextWindowOf2({ args });
|
|
70888
|
+
const model = runFlagOf({ args, name: "model" });
|
|
70889
|
+
const effort = runFlagOf({ args, name: "effort" });
|
|
70890
|
+
return {
|
|
70891
|
+
...contextWindow !== void 0 && { contextWindow },
|
|
70892
|
+
...model !== void 0 && { model },
|
|
70893
|
+
...effort !== void 0 && { effort }
|
|
70894
|
+
};
|
|
70895
|
+
}
|
|
70896
|
+
function runLinesOf({ agent: agent2 }) {
|
|
70897
|
+
if (agent2.hosting !== "laze") return [];
|
|
70898
|
+
const summary = agentRunSummaryOf({ agent: agent2 });
|
|
70899
|
+
return [
|
|
70900
|
+
`Model: ${summary.model}.`,
|
|
70901
|
+
...summary.effort ? [`Thinking effort: ${summary.effort}.`] : [],
|
|
70902
|
+
`Max context: ${summary.context}.`,
|
|
70903
|
+
"It takes effect on its next turn."
|
|
70904
|
+
];
|
|
70905
|
+
}
|
|
70695
70906
|
function descriptionOf({ args }) {
|
|
70696
70907
|
const value = args.flags.description;
|
|
70697
70908
|
return typeof value === "string" ? value : void 0;
|
|
@@ -70773,9 +70984,9 @@ async function updateAgent({
|
|
|
70773
70984
|
const agent2 = args.words[2];
|
|
70774
70985
|
const name2 = flagText({ args, name: "name" }).trim();
|
|
70775
70986
|
const description = descriptionOf({ args });
|
|
70776
|
-
const
|
|
70987
|
+
const run4 = runChangesOf({ args });
|
|
70777
70988
|
const nothing = !name2 && description === void 0 && !args.flags.avatar;
|
|
70778
|
-
if (!agent2 || nothing &&
|
|
70989
|
+
if (!agent2 || nothing && Object.keys(run4).length === 0) throw new CliUsageError(UPDATE_USAGE);
|
|
70779
70990
|
const { client } = await signedIn({ context, args });
|
|
70780
70991
|
const avatar = await avatarOf({ context, args, client });
|
|
70781
70992
|
const updated = await client.post("/api/agents/update", {
|
|
@@ -70783,14 +70994,14 @@ async function updateAgent({
|
|
|
70783
70994
|
...name2 && { name: name2 },
|
|
70784
70995
|
...description !== void 0 && { description },
|
|
70785
70996
|
...avatar !== void 0 && { avatar },
|
|
70786
|
-
...
|
|
70997
|
+
...run4
|
|
70787
70998
|
});
|
|
70788
70999
|
if (args.flags.json) return context.out(`${JSON.stringify(updated, null, 2)}
|
|
70789
71000
|
`);
|
|
70790
71001
|
context.out(
|
|
70791
71002
|
[
|
|
70792
71003
|
`Updated ${updated.name}.`,
|
|
70793
|
-
...
|
|
71004
|
+
...runLinesOf({ agent: updated }),
|
|
70794
71005
|
...mentionLinesOf({ agentId: updated.id, name: updated.name }),
|
|
70795
71006
|
""
|
|
70796
71007
|
].join("\n")
|
|
@@ -71783,6 +71994,13 @@ var appPreviewSchemaDefinition = external_exports.object({
|
|
|
71783
71994
|
/** The site's own origin; opening it signs the person in through Laze. */
|
|
71784
71995
|
url: external_exports.string()
|
|
71785
71996
|
});
|
|
71997
|
+
var appPullSchemaDefinition = external_exports.object({
|
|
71998
|
+
app: external_exports.object({ id: external_exports.string(), name: external_exports.string(), slug: external_exports.string() }),
|
|
71999
|
+
site: appSiteSchema,
|
|
72000
|
+
version: appVersionIdSchema,
|
|
72001
|
+
files: external_exports.array(appFileSchema),
|
|
72002
|
+
collections: external_exports.array(collectionSchema)
|
|
72003
|
+
});
|
|
71786
72004
|
var exportRecordsInputSchemaDefinition = external_exports.object({
|
|
71787
72005
|
...siteRefSchemaDefinition.shape,
|
|
71788
72006
|
collection: collectionNameSchema,
|
|
@@ -72031,6 +72249,27 @@ var appAccessRequestSchemaDefinition = external_exports.object({
|
|
|
72031
72249
|
decidedAt: external_exports.iso.datetime().nullable()
|
|
72032
72250
|
});
|
|
72033
72251
|
var appAccessRequestSchema = appAccessRequestSchemaDefinition;
|
|
72252
|
+
var appMemberSourceSchemaDefinition = external_exports.object({
|
|
72253
|
+
kind: external_exports.enum(["owner", "admin", "direct", "channel", "workspace", "agent-owner"]),
|
|
72254
|
+
/** The channel, for `channel`: a pin there, a share with it, or the app's own channel. */
|
|
72255
|
+
channelId: external_exports.string().nullable(),
|
|
72256
|
+
channelName: external_exports.string().nullable(),
|
|
72257
|
+
/** The person an agent holds the app through, for `agent-owner`. */
|
|
72258
|
+
ownerName: external_exports.string().nullable()
|
|
72259
|
+
});
|
|
72260
|
+
var appMemberSchemaDefinition = external_exports.object({
|
|
72261
|
+
member: external_exports.object({ type: external_exports.enum(["user", "agent"]), id: external_exports.string().min(1) }),
|
|
72262
|
+
name: external_exports.string(),
|
|
72263
|
+
role: appRoleSchema,
|
|
72264
|
+
sources: external_exports.array(appMemberSourceSchemaDefinition).min(1),
|
|
72265
|
+
/** Whether a Builder can take this access away here: only a direct share is removable. */
|
|
72266
|
+
removable: external_exports.boolean()
|
|
72267
|
+
});
|
|
72268
|
+
var appMembersSchemaDefinition = external_exports.object({
|
|
72269
|
+
appId: external_exports.string().min(1),
|
|
72270
|
+
members: external_exports.array(appMemberSchemaDefinition)
|
|
72271
|
+
});
|
|
72272
|
+
var appMembersSchema = appMembersSchemaDefinition;
|
|
72034
72273
|
var appAccessSchemaDefinition = external_exports.object({
|
|
72035
72274
|
appId: external_exports.string().min(1),
|
|
72036
72275
|
visibility: appVisibilitySchema,
|
|
@@ -72510,7 +72749,7 @@ var appBackupCheckAlertsSchemaDefinition = external_exports.object({
|
|
|
72510
72749
|
});
|
|
72511
72750
|
|
|
72512
72751
|
// ../../modules/app/contract/src/app.trpc.ts
|
|
72513
|
-
var appMainTrpc = defineTrpcContract("app").query("list").withInput(listAppsInputSchema).withOutput(external_exports.array(appSchema)).query("get").withInput(appRefSchema).withOutput(appSchema).mutation("create").withInput(createAppInputSchema).withOutput(appSchema).mutation("rename").withInput(renameAppInputSchema).withOutput(appSchema).mutation("archive").withInput(appRefSchema).withOutput(appSchema).mutation("unarchive").withInput(appRefSchema).withOutput(appSchema).mutation("delete").withInput(deleteAppInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).query("versions").withInput(appRefSchema).withOutput(external_exports.array(appVersionSchema)).mutation("revert").withInput(revertInputSchema).withOutput(appVersionSchema).mutation("publish").withInput(publishInputSchema).withOutput(publishOutcomeSchema).query("collections").withInput(siteRefSchema).withOutput(external_exports.array(collectionSchema)).query("records").withInput(listRecordsInputSchema).withOutput(recordPageSchema).mutation("writeRecord").withInput(writeRecordInputSchema).withOutput(appRecordSchema).mutation("deleteRecord").withInput(deleteRecordInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).query("views").withInput(siteRefSchema).withOutput(external_exports.array(appViewSchema)).mutation("saveView").withInput(saveViewInputSchema).withOutput(appViewSchema).mutation("deleteView").withInput(deleteViewInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).mutation("chooseCardRows").withInput(chooseCardRowsInputSchema).withOutput(appCardChoiceSchema).query("exportRecords").withInput(exportRecordsInputSchema).withOutput(recordExportSchema).mutation("importRecords").withInput(importRecordsInputSchema).withOutput(recordImportSchema).mutation("decidePublish").withInput(decidePublishInputSchema).withOutput(publishOutcomeSchema).mutation("nameVersion").withInput(nameVersionInputSchema).withOutput(appVersionSchema).mutation("makeInternal").withInput(appRefSchema).withOutput(appSchema).mutation("revokePublishLease").withInput(appRefSchema).withOutput(appSchema).mutation("signInHandoff").withInput(signInHandoffInputSchema).withOutput(signInHandoffSchema).query("functionLogs").withInput(listFunctionLogsInputSchema).withOutput(external_exports.array(appFunctionLogEntrySchema)).query("functionSettings").withInput(appWorkspaceRefSchema).withOutput(appFunctionSettingsSchema).query("access").withInput(appRefSchema).withOutput(appAccessSchema).mutation("grantAccess").withInput(grantAppAccessInputSchema).withOutput(appAccessSchema).mutation("revokeAccess").withInput(revokeAppAccessInputSchema).withOutput(appAccessSchema).mutation("setVisibility").withInput(setAppVisibilityInputSchema).withOutput(visibilityOutcomeSchema).mutation("setMemberRole").withInput(setMemberRoleInputSchema).withOutput(appAccessSchema).mutation("unpublish").withInput(appRefSchema).withOutput(appSchema).query("door").withInput(appRefSchema).withOutput(appDoorSchema).mutation("requestAccess").withInput(appRefSchema).withOutput(appDoorSchema).mutation("decideAccess").withInput(decideAppAccessInputSchema).withOutput(appAccessRequestSchema).query("users").withInput(appRefSchema).withOutput(appUsersSchema).mutation("blockUser").withInput(blockAppUserInputSchema).withOutput(appUsersSchema).mutation("deleteUser").withInput(deleteAppUserInputSchema).withOutput(deletedAppUserSchema).mutation("setFunctionsEnabled").withInput(setFunctionsEnabledInputSchema).withOutput(appFunctionSettingsSchema).query("backups").withInput(appRefSchema).withOutput(appBackupStatusSchema).mutation("restoreData").withInput(restoreAppDataInputSchema).withOutput(appRestoreSchema).query("cost").withInput(appRefSchema).withOutput(appCostSchema).mutation("setBudget").withInput(setAppBudgetInputSchema).withOutput(appCostSchema).query("triggers").withInput(appRefSchema).withOutput(appTriggersSchema).mutation("setTriggerPaused").withInput(setAppTriggerPausedInputSchema).withOutput(appTriggerSchema).mutation("removeTrigger").withInput(appTriggerRefSchema).withOutput(external_exports.object({ removed: external_exports.literal(true) })).build();
|
|
72752
|
+
var appMainTrpc = defineTrpcContract("app").query("list").withInput(listAppsInputSchema).withOutput(external_exports.array(appSchema)).query("get").withInput(appRefSchema).withOutput(appSchema).mutation("create").withInput(createAppInputSchema).withOutput(appSchema).mutation("rename").withInput(renameAppInputSchema).withOutput(appSchema).mutation("archive").withInput(appRefSchema).withOutput(appSchema).mutation("unarchive").withInput(appRefSchema).withOutput(appSchema).mutation("delete").withInput(deleteAppInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).query("versions").withInput(appRefSchema).withOutput(external_exports.array(appVersionSchema)).mutation("revert").withInput(revertInputSchema).withOutput(appVersionSchema).mutation("publish").withInput(publishInputSchema).withOutput(publishOutcomeSchema).query("collections").withInput(siteRefSchema).withOutput(external_exports.array(collectionSchema)).query("records").withInput(listRecordsInputSchema).withOutput(recordPageSchema).mutation("writeRecord").withInput(writeRecordInputSchema).withOutput(appRecordSchema).mutation("deleteRecord").withInput(deleteRecordInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).query("views").withInput(siteRefSchema).withOutput(external_exports.array(appViewSchema)).mutation("saveView").withInput(saveViewInputSchema).withOutput(appViewSchema).mutation("deleteView").withInput(deleteViewInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).mutation("chooseCardRows").withInput(chooseCardRowsInputSchema).withOutput(appCardChoiceSchema).query("exportRecords").withInput(exportRecordsInputSchema).withOutput(recordExportSchema).mutation("importRecords").withInput(importRecordsInputSchema).withOutput(recordImportSchema).mutation("decidePublish").withInput(decidePublishInputSchema).withOutput(publishOutcomeSchema).mutation("nameVersion").withInput(nameVersionInputSchema).withOutput(appVersionSchema).mutation("makeInternal").withInput(appRefSchema).withOutput(appSchema).mutation("revokePublishLease").withInput(appRefSchema).withOutput(appSchema).mutation("signInHandoff").withInput(signInHandoffInputSchema).withOutput(signInHandoffSchema).query("functionLogs").withInput(listFunctionLogsInputSchema).withOutput(external_exports.array(appFunctionLogEntrySchema)).query("functionSettings").withInput(appWorkspaceRefSchema).withOutput(appFunctionSettingsSchema).query("access").withInput(appRefSchema).withOutput(appAccessSchema).query("members").withInput(appRefSchema).withOutput(appMembersSchema).mutation("grantAccess").withInput(grantAppAccessInputSchema).withOutput(appAccessSchema).mutation("revokeAccess").withInput(revokeAppAccessInputSchema).withOutput(appAccessSchema).mutation("setVisibility").withInput(setAppVisibilityInputSchema).withOutput(visibilityOutcomeSchema).mutation("setMemberRole").withInput(setMemberRoleInputSchema).withOutput(appAccessSchema).mutation("unpublish").withInput(appRefSchema).withOutput(appSchema).query("door").withInput(appRefSchema).withOutput(appDoorSchema).mutation("requestAccess").withInput(appRefSchema).withOutput(appDoorSchema).mutation("decideAccess").withInput(decideAppAccessInputSchema).withOutput(appAccessRequestSchema).query("users").withInput(appRefSchema).withOutput(appUsersSchema).mutation("blockUser").withInput(blockAppUserInputSchema).withOutput(appUsersSchema).mutation("deleteUser").withInput(deleteAppUserInputSchema).withOutput(deletedAppUserSchema).mutation("setFunctionsEnabled").withInput(setFunctionsEnabledInputSchema).withOutput(appFunctionSettingsSchema).query("backups").withInput(appRefSchema).withOutput(appBackupStatusSchema).mutation("restoreData").withInput(restoreAppDataInputSchema).withOutput(appRestoreSchema).query("cost").withInput(appRefSchema).withOutput(appCostSchema).mutation("setBudget").withInput(setAppBudgetInputSchema).withOutput(appCostSchema).query("triggers").withInput(appRefSchema).withOutput(appTriggersSchema).mutation("setTriggerPaused").withInput(setAppTriggerPausedInputSchema).withOutput(appTriggerSchema).mutation("removeTrigger").withInput(appTriggerRefSchema).withOutput(external_exports.object({ removed: external_exports.literal(true) })).build();
|
|
72514
72753
|
var appConnectionsTrpc = defineTrpcContract("app").query("connections").withInput(appRefSchema).withOutput(appConnectionsSchema).mutation("allowConnection").withInput(appConnectionRefSchema).withOutput(appConnectionsSchema).mutation("revokeConnection").withInput(appConnectionRefSchema).withOutput(appConnectionsSchema).build();
|
|
72515
72754
|
var appPinsTrpc = defineTrpcContract("app").query("pins").withInput(channelPinsInputSchema).withOutput(channelAppPinsSchema).mutation("pin").withInput(pinAppInputSchema).withOutput(channelAppPinsSchema).mutation("unpin").withInput(pinAppInputSchema).withOutput(channelAppPinsSchema).mutation("setPinView").withInput(setPinViewInputSchema).withOutput(channelAppPinsSchema).mutation("reorderPins").withInput(reorderPinsInputSchema).withOutput(channelAppPinsSchema).build();
|
|
72516
72755
|
var appTrpc = joinTrpcContracts("app", appMainTrpc, appConnectionsTrpc, appPinsTrpc);
|
|
@@ -72624,6 +72863,12 @@ var appCliCommands = [
|
|
|
72624
72863
|
arguments: ["--site draft|published"],
|
|
72625
72864
|
summary: "Print the address of the draft preview (or the published app)"
|
|
72626
72865
|
},
|
|
72866
|
+
{
|
|
72867
|
+
command: "laze app pull",
|
|
72868
|
+
operation: "pullFiles",
|
|
72869
|
+
arguments: ["[dir]", "--site published|draft"],
|
|
72870
|
+
summary: "Download the app's files and a laze.app.json into a folder (default ./<slug>), to read its page, plan or code; anyone who may open the app can pull it"
|
|
72871
|
+
},
|
|
72627
72872
|
{
|
|
72628
72873
|
command: "laze app publish",
|
|
72629
72874
|
operation: "requestPublish",
|
|
@@ -72642,6 +72887,12 @@ var appCliCommands = [
|
|
|
72642
72887
|
arguments: [],
|
|
72643
72888
|
summary: "Take the published address offline at once; the data stays"
|
|
72644
72889
|
},
|
|
72890
|
+
{
|
|
72891
|
+
command: "laze app members",
|
|
72892
|
+
operation: "listMembers",
|
|
72893
|
+
arguments: ["[app]"],
|
|
72894
|
+
summary: "Everyone who can open the app, people and agents, each with how: Owner, Shared directly, via #channel or the workspace"
|
|
72895
|
+
},
|
|
72645
72896
|
{
|
|
72646
72897
|
command: "laze app access",
|
|
72647
72898
|
operation: "getAccess",
|
|
@@ -73722,6 +73973,16 @@ function print3({
|
|
|
73722
73973
|
context.out(args.flags.json ? `${JSON.stringify(value, null, 2)}
|
|
73723
73974
|
` : text2);
|
|
73724
73975
|
}
|
|
73976
|
+
function readLineOf(pin) {
|
|
73977
|
+
if (pin.kind === "browser") return ` read it: laze browser read ${pin.appId}
|
|
73978
|
+
`;
|
|
73979
|
+
if (pin.role === null) {
|
|
73980
|
+
return ` you cannot open it: ask ${pin.pinnedByName ?? "whoever pinned it"} to give you access
|
|
73981
|
+
`;
|
|
73982
|
+
}
|
|
73983
|
+
return ` read it: laze app pull --app ${pin.appId} (its files), laze app records list <collection> --app ${pin.appId} (its data)
|
|
73984
|
+
`;
|
|
73985
|
+
}
|
|
73725
73986
|
function pinsText({ channel, listed }) {
|
|
73726
73987
|
if (listed.pins.length === 0) {
|
|
73727
73988
|
return `No apps are pinned to ${channel}. laze app pin --channel ${channel} pins one.
|
|
@@ -73729,7 +73990,7 @@ function pinsText({ channel, listed }) {
|
|
|
73729
73990
|
}
|
|
73730
73991
|
const lines = listed.pins.map(
|
|
73731
73992
|
(pin) => `${pin.name} ${pin.appId} pinned by ${pin.pinnedByName ?? pin.pinnedBy.id} ${pin.pinnedAt.slice(0, 10)}
|
|
73732
|
-
`
|
|
73993
|
+
` + readLineOf(pin)
|
|
73733
73994
|
);
|
|
73734
73995
|
return `Pinned to ${channel}:
|
|
73735
73996
|
${lines.join("")}`;
|
|
@@ -74211,6 +74472,85 @@ var appPreview = async ({ context, args }) => {
|
|
|
74211
74472
|
print5({ context, args, value: preview, text: `${preview.url}
|
|
74212
74473
|
` });
|
|
74213
74474
|
};
|
|
74475
|
+
async function folderClaim({
|
|
74476
|
+
folder,
|
|
74477
|
+
appId
|
|
74478
|
+
}) {
|
|
74479
|
+
const entries = await readdir6(folder).catch(() => []);
|
|
74480
|
+
if (entries.length === 0) return "empty";
|
|
74481
|
+
const manifest = await readManifest(folder).catch(() => void 0);
|
|
74482
|
+
if (!manifest) return "other-files";
|
|
74483
|
+
return manifest.app.id === appId ? "same" : "other-app";
|
|
74484
|
+
}
|
|
74485
|
+
var appPull = async ({ context, args }) => {
|
|
74486
|
+
const client = await appClient({ context, args });
|
|
74487
|
+
const word3 = args.words[2];
|
|
74488
|
+
const appId = await appIdOf({ client, args, folder: folderOf({ context, word: word3 }) });
|
|
74489
|
+
const site = siteOf(args, "published");
|
|
74490
|
+
let pulled;
|
|
74491
|
+
try {
|
|
74492
|
+
pulled = await client.post("/api/apps/pull", { appId, site });
|
|
74493
|
+
} catch (error62) {
|
|
74494
|
+
if (error62 instanceof LazeApiError && error62.code === "app_has_no_version") {
|
|
74495
|
+
throw new CliUsageError(
|
|
74496
|
+
"Nothing is published yet; `laze app pull --site draft` pulls the draft preview (app_has_no_version)"
|
|
74497
|
+
);
|
|
74498
|
+
}
|
|
74499
|
+
throw error62;
|
|
74500
|
+
}
|
|
74501
|
+
const folder = folderOf({
|
|
74502
|
+
context,
|
|
74503
|
+
word: word3 ?? (flagText({ args, name: "app" }) ? pulled.app.slug : void 0)
|
|
74504
|
+
});
|
|
74505
|
+
const claim3 = await folderClaim({ folder, appId: pulled.app.id });
|
|
74506
|
+
if (claim3 === "other-app") {
|
|
74507
|
+
throw new CliUsageError(
|
|
74508
|
+
`${folder} holds another app's ${APP_MANIFEST_FILE}; pull into an empty folder. Nothing was written.`
|
|
74509
|
+
);
|
|
74510
|
+
}
|
|
74511
|
+
if (claim3 === "other-files" && !args.flags.force) {
|
|
74512
|
+
throw new CliUsageError(
|
|
74513
|
+
`${folder} already holds files that are not this app's; pull into an empty folder, or pass --force. Nothing was written.`
|
|
74514
|
+
);
|
|
74515
|
+
}
|
|
74516
|
+
for (const file3 of pulled.files) {
|
|
74517
|
+
const target = join17(folder, ...file3.path.split("/"));
|
|
74518
|
+
await mkdir15(dirname15(target), { recursive: true });
|
|
74519
|
+
await writeFile16(
|
|
74520
|
+
target,
|
|
74521
|
+
file3.encoding === "base64" ? Buffer.from(file3.content, "base64") : file3.content
|
|
74522
|
+
);
|
|
74523
|
+
}
|
|
74524
|
+
const manifest = {
|
|
74525
|
+
app: pulled.app,
|
|
74526
|
+
collections: Object.fromEntries(
|
|
74527
|
+
pulled.collections.map((collection) => [
|
|
74528
|
+
collection.name,
|
|
74529
|
+
{
|
|
74530
|
+
fields: collection.schema.fields,
|
|
74531
|
+
...collection.schema.rules ? { rules: collection.schema.rules } : {}
|
|
74532
|
+
}
|
|
74533
|
+
])
|
|
74534
|
+
)
|
|
74535
|
+
};
|
|
74536
|
+
await writeFile16(join17(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
|
|
74537
|
+
`);
|
|
74538
|
+
const names = pulled.collections.map((collection) => collection.name);
|
|
74539
|
+
const where = relative3(context.cwd, folder) || ".";
|
|
74540
|
+
print5({
|
|
74541
|
+
context,
|
|
74542
|
+
args,
|
|
74543
|
+
value: { ...pulled, folder },
|
|
74544
|
+
text: `Pulled ${pulled.files.length} files of ${pulled.app.name} (${site} version ${pulled.version.slice(0, 7)}) into ${where}
|
|
74545
|
+
` + recordsHint({ names, slug: pulled.app.slug })
|
|
74546
|
+
});
|
|
74547
|
+
};
|
|
74548
|
+
function recordsHint({ names, slug }) {
|
|
74549
|
+
if (names.length === 0) return "It keeps no records.\n";
|
|
74550
|
+
const which = names.length === 1 ? names[0] : `<${names.join("|")}>`;
|
|
74551
|
+
return `Its data: laze app records list ${which} --app ${slug}
|
|
74552
|
+
`;
|
|
74553
|
+
}
|
|
74214
74554
|
var appPublish = async ({ context, args }) => {
|
|
74215
74555
|
const client = await appClient({ context, args });
|
|
74216
74556
|
const appId = await appIdOf({ client, args, folder: folderOf({ context, word: void 0 }) });
|
|
@@ -74661,6 +75001,40 @@ var ACCESS_ACTIONS = {
|
|
|
74661
75001
|
approve: ({ client, appId, first, second }) => decideAsk({ client, appId, requestId: first, decision: "granted", role: second }),
|
|
74662
75002
|
decline: ({ client, appId, first }) => decideAsk({ client, appId, requestId: first, decision: "declined", role: void 0 })
|
|
74663
75003
|
};
|
|
75004
|
+
function sourceText(source) {
|
|
75005
|
+
switch (source.kind) {
|
|
75006
|
+
case "owner":
|
|
75007
|
+
return "Owner";
|
|
75008
|
+
case "admin":
|
|
75009
|
+
return "Workspace admin";
|
|
75010
|
+
case "direct":
|
|
75011
|
+
return "Shared directly";
|
|
75012
|
+
case "channel":
|
|
75013
|
+
return `via #${source.channelName ?? source.channelId}`;
|
|
75014
|
+
case "workspace":
|
|
75015
|
+
return "Everyone in the workspace";
|
|
75016
|
+
case "agent-owner":
|
|
75017
|
+
return `through its owner ${source.ownerName ?? ""}`.trim();
|
|
75018
|
+
}
|
|
75019
|
+
}
|
|
75020
|
+
var appMembers = async ({ context, args }) => {
|
|
75021
|
+
const { client, appId, name: name2 } = await appOfWord({ context, args, word: args.words[2] });
|
|
75022
|
+
const listed = await client.post("/api/apps/members", { appId });
|
|
75023
|
+
const lines = listed.members.map(
|
|
75024
|
+
(member) => `${member.name} ${member.member.type === "user" ? "person" : "agent"} ${member.role} ${member.sources.map(sourceText).join(", ")}
|
|
75025
|
+
`
|
|
75026
|
+
);
|
|
75027
|
+
const viaChannel = listed.members.some(
|
|
75028
|
+
(member) => !member.removable && member.sources.some((source) => source.kind === "channel")
|
|
75029
|
+
);
|
|
75030
|
+
print5({
|
|
75031
|
+
context,
|
|
75032
|
+
args,
|
|
75033
|
+
value: listed,
|
|
75034
|
+
text: `${name2}: ${listed.members.length} with access
|
|
75035
|
+
${lines.join("")}` + (viaChannel ? "Access via a channel follows the channel: unpin the app there (laze app unpin --channel <c>) to take it away.\n" : "")
|
|
75036
|
+
});
|
|
75037
|
+
};
|
|
74664
75038
|
var appAccess = async ({ context, args }) => {
|
|
74665
75039
|
const client = await appClient({ context, args });
|
|
74666
75040
|
const appId = await appIdOf({ client, args, folder: folderOf({ context, word: void 0 }) });
|
|
@@ -74753,10 +75127,12 @@ var APP_COMMANDS = {
|
|
|
74753
75127
|
list: appList,
|
|
74754
75128
|
push: appPush,
|
|
74755
75129
|
preview: appPreview,
|
|
75130
|
+
pull: appPull,
|
|
74756
75131
|
publish: appPublish,
|
|
74757
75132
|
"make-internal": appMakeInternal,
|
|
74758
75133
|
unpublish: appUnpublish,
|
|
74759
75134
|
access: appAccess,
|
|
75135
|
+
members: appMembers,
|
|
74760
75136
|
name: appName,
|
|
74761
75137
|
versions: appVersions,
|
|
74762
75138
|
log: appVersions,
|
|
@@ -75969,15 +76345,19 @@ async function channelInfo({ context, args }) {
|
|
|
75969
76345
|
const own2 = profile.kind === "agent" ? (await client.get("/api/agents/me/channels")).find(
|
|
75970
76346
|
(each) => each.id === detail.id
|
|
75971
76347
|
) ?? null : null;
|
|
76348
|
+
const pinned = await client.post("/api/apps/pins", { channel: detail.id }).catch(() => null);
|
|
75972
76349
|
if (args.flags.json) {
|
|
75973
|
-
return context.out(
|
|
75974
|
-
|
|
76350
|
+
return context.out(
|
|
76351
|
+
`${JSON.stringify({ ...detail, setting: own2, pins: pinned?.pins ?? [] }, null, 2)}
|
|
76352
|
+
`
|
|
76353
|
+
);
|
|
75975
76354
|
}
|
|
75976
76355
|
const topic = detail.topic ? `Topic: ${detail.topic}
|
|
75977
76356
|
` : "";
|
|
75978
76357
|
const setting = own2 ? `Your setting here: ${settingTextOf({ channel: own2 })}
|
|
75979
76358
|
` : "";
|
|
75980
|
-
|
|
76359
|
+
const tabs = pinned?.pins.length ? pinsText({ channel, listed: pinned }) : "";
|
|
76360
|
+
context.out(`${topic}${formatMembers({ detail })}${setting}${tabs}`);
|
|
75981
76361
|
}
|
|
75982
76362
|
async function channelRole({
|
|
75983
76363
|
context,
|
|
@@ -78832,11 +79212,11 @@ async function connect({
|
|
|
78832
79212
|
}
|
|
78833
79213
|
|
|
78834
79214
|
// src/services/connector-commands.service.ts
|
|
78835
|
-
import { readFile as
|
|
79215
|
+
import { readFile as readFile24 } from "node:fs/promises";
|
|
78836
79216
|
import { resolve as resolve8 } from "node:path";
|
|
78837
79217
|
|
|
78838
79218
|
// src/services/vault-keychain-commands.service.ts
|
|
78839
|
-
import { readFile as
|
|
79219
|
+
import { readFile as readFile23 } from "node:fs/promises";
|
|
78840
79220
|
|
|
78841
79221
|
// src/rules/vault-input.rules.ts
|
|
78842
79222
|
function secondsOf(text2) {
|
|
@@ -79107,6 +79487,298 @@ var listDevices = async ({ context, args }) => {
|
|
|
79107
79487
|
}
|
|
79108
79488
|
};
|
|
79109
79489
|
|
|
79490
|
+
// src/services/vault-commands.service.ts
|
|
79491
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
79492
|
+
import { mkdir as mkdir17, readFile as readFile22, rm as rm10, writeFile as writeFile18 } from "node:fs/promises";
|
|
79493
|
+
import { tmpdir as tmpdir2 } from "node:os";
|
|
79494
|
+
import { dirname as dirname17, join as join19 } from "node:path";
|
|
79495
|
+
var USAGE8 = `Usage: laze vault run <connection> --reason "<one plain sentence>" [--wait <s>] -- <command> [args...]
|
|
79496
|
+
Runs the command with the connection's values in its environment, on a Laze agent's computer
|
|
79497
|
+
or on a machine it runs on.`;
|
|
79498
|
+
var POLL_MS2 = 3e3;
|
|
79499
|
+
var RESTART_WAIT_MS = 12e4;
|
|
79500
|
+
var RESTART_BACKOFF_MS = [1e3, 2e3, 4e3, 8e3, 1e4];
|
|
79501
|
+
var P2562 = { name: "ECDH", namedCurve: "P-256" };
|
|
79502
|
+
var ServerGoneError = class extends Error {
|
|
79503
|
+
};
|
|
79504
|
+
function proxyOf({ env }) {
|
|
79505
|
+
const raw = env.LAZE_VAULT_PROXY || env.HTTP_PROXY || env.http_proxy;
|
|
79506
|
+
if (!raw) {
|
|
79507
|
+
throw new CliUsageError(
|
|
79508
|
+
"laze vault run works only on a Laze agent's computer or on a machine it runs on"
|
|
79509
|
+
);
|
|
79510
|
+
}
|
|
79511
|
+
const url2 = new URL(raw);
|
|
79512
|
+
const user = decodeURIComponent(url2.username);
|
|
79513
|
+
const password = decodeURIComponent(url2.password);
|
|
79514
|
+
return {
|
|
79515
|
+
origin: url2.origin,
|
|
79516
|
+
authorization: `Basic ${Buffer.from(`${user}:${password}`).toString("base64")}`
|
|
79517
|
+
};
|
|
79518
|
+
}
|
|
79519
|
+
function turnFileOf({
|
|
79520
|
+
env
|
|
79521
|
+
}) {
|
|
79522
|
+
return env.LAZE_TURN_FILE || void 0;
|
|
79523
|
+
}
|
|
79524
|
+
async function turnTokenOf3({
|
|
79525
|
+
env,
|
|
79526
|
+
turnFile,
|
|
79527
|
+
command = "laze vault run"
|
|
79528
|
+
}) {
|
|
79529
|
+
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
79530
|
+
if (pinned) return pinned;
|
|
79531
|
+
if (!turnFile) throw new CliUsageError(`${command} works only during an agent's turn`);
|
|
79532
|
+
try {
|
|
79533
|
+
return (await readFile22(turnFile, "utf8")).trim();
|
|
79534
|
+
} catch {
|
|
79535
|
+
throw new CliUsageError(`${command} works only during an agent's turn`);
|
|
79536
|
+
}
|
|
79537
|
+
}
|
|
79538
|
+
function runKeyPathOf({
|
|
79539
|
+
turnFile,
|
|
79540
|
+
connection
|
|
79541
|
+
}) {
|
|
79542
|
+
const name2 = createHash2("sha256").update(connection).digest("hex");
|
|
79543
|
+
const base = turnFile ? dirname17(turnFile) : join19(tmpdir2(), "laze-vault");
|
|
79544
|
+
return join19(base, "vault-run-keys", `${name2}.json`);
|
|
79545
|
+
}
|
|
79546
|
+
async function runKeyAt({ path }) {
|
|
79547
|
+
const saved3 = await readFile22(path, "utf8").then(
|
|
79548
|
+
(text2) => JSON.parse(text2),
|
|
79549
|
+
() => void 0
|
|
79550
|
+
);
|
|
79551
|
+
if (saved3 && typeof saved3.publicKey === "string" && saved3.privateKey) {
|
|
79552
|
+
const privateKey = await globalThis.crypto.subtle.importKey("jwk", saved3.privateKey, P2562, false, ["deriveBits"]).catch(() => void 0);
|
|
79553
|
+
if (privateKey) return { privateKey, publicKey: saved3.publicKey };
|
|
79554
|
+
}
|
|
79555
|
+
const fresh = await generateEcdhKeys();
|
|
79556
|
+
const jwk = await globalThis.crypto.subtle.exportKey("jwk", fresh.privateKey);
|
|
79557
|
+
await mkdir17(dirname17(path), { recursive: true, mode: 448 });
|
|
79558
|
+
await writeFile18(path, JSON.stringify({ publicKey: fresh.publicKey, privateKey: jwk }), {
|
|
79559
|
+
mode: 384
|
|
79560
|
+
});
|
|
79561
|
+
return fresh;
|
|
79562
|
+
}
|
|
79563
|
+
function connectionRefused(error62) {
|
|
79564
|
+
const cause = error62.cause;
|
|
79565
|
+
if (cause?.code === "ECONNREFUSED") return true;
|
|
79566
|
+
return cause?.errors?.some((inner) => inner.code === "ECONNREFUSED") ?? false;
|
|
79567
|
+
}
|
|
79568
|
+
async function sendOnce({
|
|
79569
|
+
context,
|
|
79570
|
+
url: url2,
|
|
79571
|
+
init
|
|
79572
|
+
}) {
|
|
79573
|
+
let response;
|
|
79574
|
+
try {
|
|
79575
|
+
response = await context.fetcher(url2, init);
|
|
79576
|
+
} catch (error62) {
|
|
79577
|
+
const wasRefused = connectionRefused(error62);
|
|
79578
|
+
if (init.method === "POST" && !wasRefused) throw error62;
|
|
79579
|
+
return { restarting: wasRefused ? "connection refused" : String(error62) };
|
|
79580
|
+
}
|
|
79581
|
+
if (response.status !== 502 && response.status !== 503) return { response };
|
|
79582
|
+
const code = codeOf(await response.clone().text());
|
|
79583
|
+
const neverReached = response.status === 503 && code === "vault_not_answering";
|
|
79584
|
+
if (init.method === "POST" && !neverReached) return { response };
|
|
79585
|
+
return { restarting: `status ${response.status}${code ? ` ${code}` : ""}` };
|
|
79586
|
+
}
|
|
79587
|
+
async function reach(input2) {
|
|
79588
|
+
const { context } = input2;
|
|
79589
|
+
const started = context.nowMs();
|
|
79590
|
+
for (let attempt = 0; ; attempt += 1) {
|
|
79591
|
+
const sent = await sendOnce(input2);
|
|
79592
|
+
if ("response" in sent) return sent.response;
|
|
79593
|
+
if (context.nowMs() - started >= RESTART_WAIT_MS) {
|
|
79594
|
+
throw new ServerGoneError(
|
|
79595
|
+
`laze vault: the Laze server did not come back (${sent.restarting})`
|
|
79596
|
+
);
|
|
79597
|
+
}
|
|
79598
|
+
if (attempt === 0) {
|
|
79599
|
+
context.err(
|
|
79600
|
+
`laze vault: the Laze server is not answering (${sent.restarting}), probably restarting; waiting up to 2 min...
|
|
79601
|
+
`
|
|
79602
|
+
);
|
|
79603
|
+
}
|
|
79604
|
+
await context.sleep(RESTART_BACKOFF_MS[Math.min(attempt, RESTART_BACKOFF_MS.length - 1)] ?? 0);
|
|
79605
|
+
}
|
|
79606
|
+
}
|
|
79607
|
+
function codeOf(text2) {
|
|
79608
|
+
return /"code"\s*:\s*"([^"]+)"/.exec(text2)?.[1];
|
|
79609
|
+
}
|
|
79610
|
+
async function releaseOf({ response }) {
|
|
79611
|
+
const text2 = await response.text();
|
|
79612
|
+
if (!response.ok) {
|
|
79613
|
+
return {
|
|
79614
|
+
outcome: "deny",
|
|
79615
|
+
exitCode: 1,
|
|
79616
|
+
message: `laze vault: the release was refused (${codeOf(text2) ?? `status ${response.status}`})`
|
|
79617
|
+
};
|
|
79618
|
+
}
|
|
79619
|
+
return JSON.parse(text2);
|
|
79620
|
+
}
|
|
79621
|
+
async function envOf({
|
|
79622
|
+
release: release2,
|
|
79623
|
+
run: run4
|
|
79624
|
+
}) {
|
|
79625
|
+
if (!release2.sealed) return release2.env;
|
|
79626
|
+
const sealed = await openRunRelease({
|
|
79627
|
+
release: release2.sealed,
|
|
79628
|
+
runPrivateKey: run4.privateKey,
|
|
79629
|
+
runPublicKey: run4.publicKey,
|
|
79630
|
+
requestId: release2.sealed.requestId
|
|
79631
|
+
});
|
|
79632
|
+
return { ...release2.env, ...sealed };
|
|
79633
|
+
}
|
|
79634
|
+
function deadlineOf({ args, nowMs }) {
|
|
79635
|
+
const wait = flagText({ args, name: "wait" }) || (args.flags.wait === true ? args.words[3] : "");
|
|
79636
|
+
if (!wait) return Infinity;
|
|
79637
|
+
if (!(Number(wait) >= 0)) throw new CliUsageError(`--wait takes a number of seconds
|
|
79638
|
+
${USAGE8}`);
|
|
79639
|
+
return nowMs + Number(wait) * 1e3;
|
|
79640
|
+
}
|
|
79641
|
+
async function untilAnswered({
|
|
79642
|
+
context,
|
|
79643
|
+
first,
|
|
79644
|
+
origin,
|
|
79645
|
+
headers,
|
|
79646
|
+
deadline
|
|
79647
|
+
}) {
|
|
79648
|
+
let release2 = first;
|
|
79649
|
+
while (release2.outcome === "ask") {
|
|
79650
|
+
if (context.nowMs() + POLL_MS2 > deadline) {
|
|
79651
|
+
context.err(`${release2.message}. Not approved yet; ask again later.
|
|
79652
|
+
`);
|
|
79653
|
+
return "capped";
|
|
79654
|
+
}
|
|
79655
|
+
if (release2 === first) {
|
|
79656
|
+
context.err(`${release2.message}. Waiting for an answer (cards expire after 12 hours)...
|
|
79657
|
+
`);
|
|
79658
|
+
}
|
|
79659
|
+
await context.sleep(POLL_MS2);
|
|
79660
|
+
const url2 = `${origin}/vault/release/${encodeURIComponent(release2.requestId)}`;
|
|
79661
|
+
release2 = await releaseOf({
|
|
79662
|
+
response: await reach({ context, url: url2, init: { method: "GET", headers } })
|
|
79663
|
+
});
|
|
79664
|
+
}
|
|
79665
|
+
return release2;
|
|
79666
|
+
}
|
|
79667
|
+
async function vaultRelease({
|
|
79668
|
+
context,
|
|
79669
|
+
args,
|
|
79670
|
+
connection,
|
|
79671
|
+
reason,
|
|
79672
|
+
command
|
|
79673
|
+
}) {
|
|
79674
|
+
const deadline = deadlineOf({ args, nowMs: context.nowMs() });
|
|
79675
|
+
const env = context.environment.inherited;
|
|
79676
|
+
const proxy = proxyOf({ env });
|
|
79677
|
+
const turnFile = turnFileOf({ env });
|
|
79678
|
+
const headers = {
|
|
79679
|
+
"proxy-authorization": proxy.authorization,
|
|
79680
|
+
"x-laze-turn": await turnTokenOf3({ env, turnFile })
|
|
79681
|
+
};
|
|
79682
|
+
const keyPath = runKeyPathOf({ turnFile, connection });
|
|
79683
|
+
const run4 = await runKeyAt({ path: keyPath });
|
|
79684
|
+
const body = JSON.stringify({ connection, reason, command, recipient: run4.publicKey });
|
|
79685
|
+
let release2;
|
|
79686
|
+
try {
|
|
79687
|
+
const first = await releaseOf({
|
|
79688
|
+
response: await reach({
|
|
79689
|
+
context,
|
|
79690
|
+
url: `${proxy.origin}/vault/release`,
|
|
79691
|
+
init: { method: "POST", headers: { ...headers, "content-type": "application/json" }, body }
|
|
79692
|
+
})
|
|
79693
|
+
});
|
|
79694
|
+
release2 = await untilAnswered({ context, first, origin: proxy.origin, headers, deadline });
|
|
79695
|
+
} catch (error62) {
|
|
79696
|
+
if (!(error62 instanceof ServerGoneError)) throw error62;
|
|
79697
|
+
context.err(`${error62.message}. Run the command again to keep waiting.
|
|
79698
|
+
`);
|
|
79699
|
+
return { exitCode: 75 };
|
|
79700
|
+
}
|
|
79701
|
+
if (release2 === "capped") return { exitCode: 75 };
|
|
79702
|
+
if (release2.outcome === "deny") {
|
|
79703
|
+
await rm10(keyPath, { force: true });
|
|
79704
|
+
context.err(`${release2.message}
|
|
79705
|
+
`);
|
|
79706
|
+
return { exitCode: release2.exitCode || 1 };
|
|
79707
|
+
}
|
|
79708
|
+
const values = await envOf({ release: release2, run: run4 });
|
|
79709
|
+
await rm10(keyPath, { force: true });
|
|
79710
|
+
if (release2.message) context.err(`${release2.message}
|
|
79711
|
+
`);
|
|
79712
|
+
return { env: values };
|
|
79713
|
+
}
|
|
79714
|
+
async function vaultRun({
|
|
79715
|
+
context,
|
|
79716
|
+
args
|
|
79717
|
+
}) {
|
|
79718
|
+
const connection = args.words[2];
|
|
79719
|
+
const reason = flagText({ args, name: "reason" });
|
|
79720
|
+
if (!connection || args.rest.length === 0) throw new CliUsageError(USAGE8);
|
|
79721
|
+
if (!reason) throw new CliUsageError(`Say why with --reason "<one plain sentence>"
|
|
79722
|
+
${USAGE8}`);
|
|
79723
|
+
const released = await vaultRelease({ context, args, connection, reason, command: args.rest });
|
|
79724
|
+
if ("exitCode" in released) return released.exitCode;
|
|
79725
|
+
return context.runCommand({ command: args.rest, env: released.env });
|
|
79726
|
+
}
|
|
79727
|
+
|
|
79728
|
+
// src/services/vault-share-commands.service.ts
|
|
79729
|
+
var SHARE_USAGE2 = "Usage: laze vault share <connection> --with <email|userId> [--for 1h]";
|
|
79730
|
+
var WAITING_LINE = "It waits for the owner's approval with a passkey or Face ID, in Settings > Vault.";
|
|
79731
|
+
async function personOf({ client, who }) {
|
|
79732
|
+
const members3 = await client.get("/api/workspaces/current/members");
|
|
79733
|
+
const wanted = who.toLowerCase();
|
|
79734
|
+
const found = members3.find(
|
|
79735
|
+
(member) => member.userId === who || member.email.toLowerCase() === wanted
|
|
79736
|
+
);
|
|
79737
|
+
if (!found) throw new CliUsageError(`No one in this workspace is ${who}.`);
|
|
79738
|
+
return found.userId;
|
|
79739
|
+
}
|
|
79740
|
+
async function inTurn({
|
|
79741
|
+
context,
|
|
79742
|
+
client,
|
|
79743
|
+
command
|
|
79744
|
+
}) {
|
|
79745
|
+
const env = context.environment.inherited;
|
|
79746
|
+
const turn = await turnTokenOf3({ env, turnFile: turnFileOf({ env }), command });
|
|
79747
|
+
return client.withHeaders({ "x-laze-turn": turn });
|
|
79748
|
+
}
|
|
79749
|
+
function printShare({ context, grant }) {
|
|
79750
|
+
printGrant({ context, grant });
|
|
79751
|
+
if (grant.awaitingOwner) context.out(`${WAITING_LINE}
|
|
79752
|
+
`);
|
|
79753
|
+
}
|
|
79754
|
+
var shareWith = async ({ context, args }) => {
|
|
79755
|
+
const word3 = args.words[2];
|
|
79756
|
+
const who = flagText({ args, name: "with" });
|
|
79757
|
+
if (!word3 || !who) throw new CliUsageError(SHARE_USAGE2);
|
|
79758
|
+
const { client, profile } = await signedIn({ context, args });
|
|
79759
|
+
const userId = await personOf({ client, who });
|
|
79760
|
+
const grant = profile.kind === "agent" ? await (await inTurn({ context, client, command: "laze vault share" })).post("/api/vault/turn/share", {
|
|
79761
|
+
connection: word3,
|
|
79762
|
+
userId,
|
|
79763
|
+
...durationOf(args)
|
|
79764
|
+
}) : await client.post("/api/vault/shares", {
|
|
79765
|
+
connectionId: (await connectionOf({ client, args, word: word3 })).id,
|
|
79766
|
+
userId,
|
|
79767
|
+
...durationOf(args)
|
|
79768
|
+
});
|
|
79769
|
+
if (args.flags.json) return printJson4({ context, data: grant });
|
|
79770
|
+
printShare({ context, grant });
|
|
79771
|
+
};
|
|
79772
|
+
async function setLevelInTurn({
|
|
79773
|
+
context,
|
|
79774
|
+
client,
|
|
79775
|
+
connection,
|
|
79776
|
+
sensitivity
|
|
79777
|
+
}) {
|
|
79778
|
+
const turned = await inTurn({ context, client, command: "laze vault update --level" });
|
|
79779
|
+
return turned.post("/api/vault/turn/level", { connection, sensitivity });
|
|
79780
|
+
}
|
|
79781
|
+
|
|
79110
79782
|
// src/services/vault-keychain-commands.service.ts
|
|
79111
79783
|
var VAULT_USAGE = `Usage (your own key; an agent's key is refused, values are never printed):
|
|
79112
79784
|
laze vault list [--json] connections you manage or see: names, fields, levels
|
|
@@ -79125,6 +79797,9 @@ var VAULT_USAGE = `Usage (your own key; an agent's key is refused, values are ne
|
|
|
79125
79797
|
laze vault rm|revoke <connection> delete it; revoke also takes it back at the provider
|
|
79126
79798
|
laze vault uses <connection> [--limit <n>] who used it, how, where, under which approval
|
|
79127
79799
|
laze vault grant <connection> --to person|group|channel|agent:<id> [--for 1h]
|
|
79800
|
+
laze vault share <connection> --with <email|userId> [--for 1h] your own key, with one teammate:
|
|
79801
|
+
it waits for your passkey in Settings > Vault; Always ask and Human only keys are shared
|
|
79802
|
+
only from there. Lowering a key's level is done only there too; raising works anywhere
|
|
79128
79803
|
laze vault lend <connection> --channel <channelId> [--for 1h]
|
|
79129
79804
|
laze vault grants <connection> | laze vault ungrant <grantId>
|
|
79130
79805
|
laze vault leases | laze vault end-lease <leaseId>
|
|
@@ -79158,7 +79833,7 @@ async function secretText({ context, args }) {
|
|
|
79158
79833
|
);
|
|
79159
79834
|
}
|
|
79160
79835
|
const file3 = flagText({ args, name: "from-file" });
|
|
79161
|
-
const text2 = file3 ? await
|
|
79836
|
+
const text2 = file3 ? await readFile23(file3, "utf8") : await context.readStdin();
|
|
79162
79837
|
const trimmed = text2.replace(/\r?\n$/, "");
|
|
79163
79838
|
if (!trimmed.trim()) throw new CliUsageError("No value: pipe it on stdin or use --from-file.");
|
|
79164
79839
|
return trimmed;
|
|
@@ -79217,10 +79892,21 @@ var add3 = async ({ context, args }) => {
|
|
|
79217
79892
|
);
|
|
79218
79893
|
};
|
|
79219
79894
|
var update = async ({ context, args }) => {
|
|
79220
|
-
const { client } = await signedIn({ context, args });
|
|
79221
|
-
const target = await connectionOf({ client, args, word: args.words[2] });
|
|
79895
|
+
const { client, profile } = await signedIn({ context, args });
|
|
79222
79896
|
const settings2 = settingsOf(args);
|
|
79223
79897
|
if (Object.keys(settings2).length === 0) throw new CliUsageError(VAULT_USAGE);
|
|
79898
|
+
const word3 = args.words[2];
|
|
79899
|
+
if (profile.kind === "agent" && word3 && settings2.sensitivity && Object.keys(settings2).length === 1) {
|
|
79900
|
+
const raised = await setLevelInTurn({
|
|
79901
|
+
context,
|
|
79902
|
+
client,
|
|
79903
|
+
connection: word3,
|
|
79904
|
+
sensitivity: settings2.sensitivity
|
|
79905
|
+
});
|
|
79906
|
+
if (args.flags.json) return printJson4({ context, data: raised });
|
|
79907
|
+
return printConnection({ context, row: raised });
|
|
79908
|
+
}
|
|
79909
|
+
const target = await connectionOf({ client, args, word: word3 });
|
|
79224
79910
|
const updated = await client.post("/api/vault/connections/update", {
|
|
79225
79911
|
connectionId: target.id,
|
|
79226
79912
|
...settings2
|
|
@@ -79312,6 +79998,7 @@ var VAULT_COMMANDS = {
|
|
|
79312
79998
|
revoke: removal("revoke"),
|
|
79313
79999
|
uses,
|
|
79314
80000
|
grant: grantTo,
|
|
80001
|
+
share: shareWith,
|
|
79315
80002
|
lend: lendTo,
|
|
79316
80003
|
grants: grantsOf,
|
|
79317
80004
|
ungrant: revokeGrant,
|
|
@@ -79368,7 +80055,7 @@ async function keyText({ context, args }) {
|
|
|
79368
80055
|
throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
|
|
79369
80056
|
}
|
|
79370
80057
|
const file3 = flagText({ args, name: "from-file" });
|
|
79371
|
-
const text2 = file3 ? await
|
|
80058
|
+
const text2 = file3 ? await readFile24(resolve8(context.cwd, file3), "utf8") : await context.readStdin();
|
|
79372
80059
|
const trimmed = text2.trim();
|
|
79373
80060
|
if (!trimmed) throw new CliUsageError("No key: pipe it on stdin or use --from-file.");
|
|
79374
80061
|
return trimmed;
|
|
@@ -79732,16 +80419,16 @@ function dndLine({ pausedUntil }) {
|
|
|
79732
80419
|
}
|
|
79733
80420
|
|
|
79734
80421
|
// src/services/dnd-commands.service.ts
|
|
79735
|
-
var
|
|
80422
|
+
var USAGE9 = "Usage: laze dnd 30m|1h|2h|until <HH:mm|ISO time> [--tz <zone>], laze dnd off";
|
|
79736
80423
|
async function dnd({ context, args }) {
|
|
79737
80424
|
const timeZone = flagText({ args, name: "tz" }) || Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
79738
80425
|
let input2;
|
|
79739
80426
|
try {
|
|
79740
80427
|
input2 = dndInputOf({ words: args.words.slice(1), now: nowInstant(), timeZone });
|
|
79741
80428
|
} catch {
|
|
79742
|
-
throw new CliUsageError(
|
|
80429
|
+
throw new CliUsageError(USAGE9);
|
|
79743
80430
|
}
|
|
79744
|
-
if (!input2) throw new CliUsageError(
|
|
80431
|
+
if (!input2) throw new CliUsageError(USAGE9);
|
|
79745
80432
|
const { client } = await signedIn({ context, args });
|
|
79746
80433
|
const settings2 = await client.post(
|
|
79747
80434
|
"/api/agents/me/notifications/snooze",
|
|
@@ -79793,7 +80480,7 @@ async function domains({ context, args }) {
|
|
|
79793
80480
|
}
|
|
79794
80481
|
|
|
79795
80482
|
// src/services/feed-commands.service.ts
|
|
79796
|
-
import { readFile as
|
|
80483
|
+
import { readFile as readFile26 } from "node:fs/promises";
|
|
79797
80484
|
import { resolve as resolve10 } from "node:path";
|
|
79798
80485
|
|
|
79799
80486
|
// src/rules/feed-input.rules.ts
|
|
@@ -79918,7 +80605,7 @@ function feedFlagsOf({ args }) {
|
|
|
79918
80605
|
}
|
|
79919
80606
|
|
|
79920
80607
|
// src/services/feed-files.service.ts
|
|
79921
|
-
import { readFile as
|
|
80608
|
+
import { readFile as readFile25 } from "node:fs/promises";
|
|
79922
80609
|
import { basename as basename4, resolve as resolve9 } from "node:path";
|
|
79923
80610
|
|
|
79924
80611
|
// ../../modules/feed/contract/src/feed.ts
|
|
@@ -80493,7 +81180,7 @@ async function local({ context, path }) {
|
|
|
80493
81180
|
return {
|
|
80494
81181
|
fileName,
|
|
80495
81182
|
contentType: contentTypeOf(fileName),
|
|
80496
|
-
bytes: new Uint8Array(await
|
|
81183
|
+
bytes: new Uint8Array(await readFile25(full))
|
|
80497
81184
|
};
|
|
80498
81185
|
}
|
|
80499
81186
|
async function directWith({ client, to }) {
|
|
@@ -80531,7 +81218,7 @@ async function feedAttachmentIdsOf({
|
|
|
80531
81218
|
}
|
|
80532
81219
|
|
|
80533
81220
|
// src/services/feed-commands.service.ts
|
|
80534
|
-
var
|
|
81221
|
+
var USAGE10 = `Usage:
|
|
80535
81222
|
laze feed post <title> [--channel <channel>] [--tag <tag>] [--summary <line>]
|
|
80536
81223
|
[--draft <text|@file>] [--draft-header "To: ...\\nRe: ..."]
|
|
80537
81224
|
[--metric <json|@file.json> | --table <csv|@file.csv>]
|
|
@@ -80571,7 +81258,7 @@ async function bodyOf2({
|
|
|
80571
81258
|
flags: flags2
|
|
80572
81259
|
}) {
|
|
80573
81260
|
const body = { ...flags2.fields };
|
|
80574
|
-
const read3 = (source) => "file" in source ?
|
|
81261
|
+
const read3 = (source) => "file" in source ? readFile26(resolve10(context.cwd, source.file), "utf8") : source.text;
|
|
80575
81262
|
for (const [field, source] of Object.entries(flags2.texts)) body[field] = await read3(source);
|
|
80576
81263
|
if (flags2.rich) {
|
|
80577
81264
|
const text2 = await read3(flags2.rich.source);
|
|
@@ -80600,7 +81287,7 @@ function printItem({
|
|
|
80600
81287
|
}
|
|
80601
81288
|
async function feedPost({ context, args }) {
|
|
80602
81289
|
const title = args.words.slice(2).join(" ").trim();
|
|
80603
|
-
if (!title) throw new CliUsageError(
|
|
81290
|
+
if (!title) throw new CliUsageError(USAGE10);
|
|
80604
81291
|
const flags2 = flagsOf(args);
|
|
80605
81292
|
const { client } = await signedIn({ context, args });
|
|
80606
81293
|
const channel = flagText({ args, name: "channel" });
|
|
@@ -80622,7 +81309,7 @@ async function feedPost({ context, args }) {
|
|
|
80622
81309
|
}
|
|
80623
81310
|
async function feedUpdate({ context, args }) {
|
|
80624
81311
|
const itemId = args.words[2];
|
|
80625
|
-
if (!itemId) throw new CliUsageError(
|
|
81312
|
+
if (!itemId) throw new CliUsageError(USAGE10);
|
|
80626
81313
|
const flags2 = flagsOf(args);
|
|
80627
81314
|
const { client } = await signedIn({ context, args });
|
|
80628
81315
|
const body = await bodyOf2({ context, flags: flags2 });
|
|
@@ -80638,7 +81325,7 @@ async function feedUpdate({ context, args }) {
|
|
|
80638
81325
|
async function feedReply({ context, args }) {
|
|
80639
81326
|
const itemId = args.words[2];
|
|
80640
81327
|
const text2 = args.words.slice(3).join(" ").trim();
|
|
80641
|
-
if (!itemId || !text2) throw new CliUsageError(
|
|
81328
|
+
if (!itemId || !text2) throw new CliUsageError(USAGE10);
|
|
80642
81329
|
const { client } = await signedIn({ context, args });
|
|
80643
81330
|
const replied = await client.post("/api/feed/items/reply", {
|
|
80644
81331
|
itemId,
|
|
@@ -80650,7 +81337,7 @@ async function feedReply({ context, args }) {
|
|
|
80650
81337
|
}
|
|
80651
81338
|
async function feedRead({ context, args }) {
|
|
80652
81339
|
const itemId = args.words[2];
|
|
80653
|
-
if (!itemId) throw new CliUsageError(
|
|
81340
|
+
if (!itemId) throw new CliUsageError(USAGE10);
|
|
80654
81341
|
const { client } = await signedIn({ context, args });
|
|
80655
81342
|
const read3 = await client.post("/api/feed/items/read", { itemId });
|
|
80656
81343
|
printItem({ context, args, item: read3 });
|
|
@@ -80669,7 +81356,7 @@ async function feedClose({ context, args }) {
|
|
|
80669
81356
|
const itemId = args.words[2];
|
|
80670
81357
|
const loop = flagText({ args, name: "loop" });
|
|
80671
81358
|
const note = flagText({ args, name: "note" });
|
|
80672
|
-
if (!note || Boolean(itemId) === Boolean(loop)) throw new CliUsageError(
|
|
81359
|
+
if (!note || Boolean(itemId) === Boolean(loop)) throw new CliUsageError(USAGE10);
|
|
80673
81360
|
const { client } = await signedIn({ context, args });
|
|
80674
81361
|
const closed = await client.post("/api/feed/items/close", {
|
|
80675
81362
|
...itemId ? { itemId } : { loop },
|
|
@@ -80695,7 +81382,7 @@ async function feedLoops({ context, args }) {
|
|
|
80695
81382
|
}
|
|
80696
81383
|
async function feedGroupSummary({ context, args }) {
|
|
80697
81384
|
const group = args.words.slice(2).join(" ").trim();
|
|
80698
|
-
if (!group) throw new CliUsageError(
|
|
81385
|
+
if (!group) throw new CliUsageError(USAGE10);
|
|
80699
81386
|
const { client } = await signedIn({ context, args });
|
|
80700
81387
|
const pointer = await client.post("/api/feed/group-summary", { group });
|
|
80701
81388
|
if (args.flags.json) return context.out(`${JSON.stringify(pointer, null, 2)}
|
|
@@ -80733,7 +81420,7 @@ async function textFlag({
|
|
|
80733
81420
|
}) {
|
|
80734
81421
|
const value = flagText({ args, name: name2 });
|
|
80735
81422
|
if (!value.startsWith("@")) return value;
|
|
80736
|
-
return
|
|
81423
|
+
return readFile26(resolve10(context.cwd, value.slice(1)), "utf8");
|
|
80737
81424
|
}
|
|
80738
81425
|
async function feedList({ context, args }) {
|
|
80739
81426
|
const { client } = await signedIn({ context, args });
|
|
@@ -80765,7 +81452,7 @@ async function feedCount({ context, args }) {
|
|
|
80765
81452
|
}
|
|
80766
81453
|
async function feedAct({ context, args }) {
|
|
80767
81454
|
const [itemId, actionId] = [args.words[2], args.words[3]];
|
|
80768
|
-
if (!itemId || !actionId) throw new CliUsageError(
|
|
81455
|
+
if (!itemId || !actionId) throw new CliUsageError(USAGE10);
|
|
80769
81456
|
const draft = await textFlag({ context, args, name: "draft" });
|
|
80770
81457
|
const { client } = await signedIn({ context, args });
|
|
80771
81458
|
const item = await client.post("/api/feed/mine/act", {
|
|
@@ -80778,7 +81465,7 @@ async function feedAct({ context, args }) {
|
|
|
80778
81465
|
async function feedComment({ context, args }) {
|
|
80779
81466
|
const itemId = args.words[2];
|
|
80780
81467
|
const text2 = args.words.slice(3).join(" ").trim();
|
|
80781
|
-
if (!itemId || !text2) throw new CliUsageError(
|
|
81468
|
+
if (!itemId || !text2) throw new CliUsageError(USAGE10);
|
|
80782
81469
|
const draft = await textFlag({ context, args, name: "draft" });
|
|
80783
81470
|
const { client } = await signedIn({ context, args });
|
|
80784
81471
|
const item = await client.post("/api/feed/mine/comment", {
|
|
@@ -80792,7 +81479,7 @@ async function feedComment({ context, args }) {
|
|
|
80792
81479
|
function moveItem(path) {
|
|
80793
81480
|
return async ({ context, args }) => {
|
|
80794
81481
|
const itemId = args.words[2];
|
|
80795
|
-
if (!itemId) throw new CliUsageError(
|
|
81482
|
+
if (!itemId) throw new CliUsageError(USAGE10);
|
|
80796
81483
|
const { client } = await signedIn({ context, args });
|
|
80797
81484
|
const item = await client.post(`/api/feed/mine/${path}`, { itemId });
|
|
80798
81485
|
printMoved({ context, args, item });
|
|
@@ -80801,14 +81488,14 @@ function moveItem(path) {
|
|
|
80801
81488
|
async function feedSnooze({ context, args }) {
|
|
80802
81489
|
const itemId = args.words[2];
|
|
80803
81490
|
const until = flagText({ args, name: "until" });
|
|
80804
|
-
if (!itemId || !until) throw new CliUsageError(
|
|
81491
|
+
if (!itemId || !until) throw new CliUsageError(USAGE10);
|
|
80805
81492
|
const { client } = await signedIn({ context, args });
|
|
80806
81493
|
const item = await client.post("/api/feed/mine/snooze", { itemId, until });
|
|
80807
81494
|
printMoved({ context, args, item });
|
|
80808
81495
|
}
|
|
80809
81496
|
async function feedChannel({ context, args }) {
|
|
80810
81497
|
const channelId = args.words[2];
|
|
80811
|
-
if (!channelId) throw new CliUsageError(
|
|
81498
|
+
if (!channelId) throw new CliUsageError(USAGE10);
|
|
80812
81499
|
const { client } = await signedIn({ context, args });
|
|
80813
81500
|
const items = await client.post("/api/feed/channel", { channelId });
|
|
80814
81501
|
if (args.flags.json) return context.out(`${JSON.stringify(items, null, 2)}
|
|
@@ -80838,12 +81525,12 @@ var FEED_COMMANDS = {
|
|
|
80838
81525
|
async function feed({ context, args }) {
|
|
80839
81526
|
const name2 = args.words[1] ?? "";
|
|
80840
81527
|
const command = Object.hasOwn(FEED_COMMANDS, name2) ? FEED_COMMANDS[name2] : void 0;
|
|
80841
|
-
if (!command) throw new CliUsageError(
|
|
81528
|
+
if (!command) throw new CliUsageError(USAGE10);
|
|
80842
81529
|
await command({ context, args });
|
|
80843
81530
|
}
|
|
80844
81531
|
|
|
80845
81532
|
// src/services/github-commands.service.ts
|
|
80846
|
-
import { readFile as
|
|
81533
|
+
import { readFile as readFile27 } from "node:fs/promises";
|
|
80847
81534
|
|
|
80848
81535
|
// src/rules/github-signature.rules.ts
|
|
80849
81536
|
var TURN_SEPARATOR = "~";
|
|
@@ -80913,7 +81600,7 @@ var REAL_GH = "/usr/bin/gh";
|
|
|
80913
81600
|
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>`.";
|
|
80914
81601
|
async function turnFileToken({ env }) {
|
|
80915
81602
|
if (!env.LAZE_TURN_FILE) return "";
|
|
80916
|
-
return
|
|
81603
|
+
return readFile27(env.LAZE_TURN_FILE, "utf8").then(
|
|
80917
81604
|
(text2) => text2.trim(),
|
|
80918
81605
|
() => ""
|
|
80919
81606
|
);
|
|
@@ -80947,7 +81634,7 @@ async function githubGh({
|
|
|
80947
81634
|
args: args.rest,
|
|
80948
81635
|
agentName: profile.name ?? "An agent",
|
|
80949
81636
|
threadUrl: threadUrlOf({ env, workspaceId: profile.workspaceId }),
|
|
80950
|
-
readBodyFile: (path) => path === "-" ? context.readStdin() :
|
|
81637
|
+
readBodyFile: (path) => path === "-" ? context.readStdin() : readFile27(path, "utf8")
|
|
80951
81638
|
});
|
|
80952
81639
|
return context.runCommand({
|
|
80953
81640
|
command: [REAL_GH, ...ghArgs],
|
|
@@ -81046,7 +81733,7 @@ async function setAgentGithub({
|
|
|
81046
81733
|
}
|
|
81047
81734
|
|
|
81048
81735
|
// src/services/history-commands.service.ts
|
|
81049
|
-
import { readFile as
|
|
81736
|
+
import { readFile as readFile28 } from "node:fs/promises";
|
|
81050
81737
|
|
|
81051
81738
|
// src/rules/history-format.rules.ts
|
|
81052
81739
|
function timeOf2(iso) {
|
|
@@ -81137,12 +81824,12 @@ function beforeOf({ args }) {
|
|
|
81137
81824
|
throw new CliUsageError(HISTORY_USAGE);
|
|
81138
81825
|
}
|
|
81139
81826
|
}
|
|
81140
|
-
async function
|
|
81827
|
+
async function turnTokenOf4({ context }) {
|
|
81141
81828
|
const env = context.environment.inherited;
|
|
81142
81829
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
81143
81830
|
if (pinned) return pinned;
|
|
81144
81831
|
if (!env.LAZE_TURN_FILE) return "";
|
|
81145
|
-
return
|
|
81832
|
+
return readFile28(env.LAZE_TURN_FILE, "utf8").then(
|
|
81146
81833
|
(text2) => text2.trim(),
|
|
81147
81834
|
() => ""
|
|
81148
81835
|
);
|
|
@@ -81156,7 +81843,7 @@ async function history({
|
|
|
81156
81843
|
const limit = limitOf3({ args });
|
|
81157
81844
|
const before = beforeOf({ args });
|
|
81158
81845
|
const { client: signed2 } = await signedIn({ context, args });
|
|
81159
|
-
const turn = await
|
|
81846
|
+
const turn = await turnTokenOf4({ context });
|
|
81160
81847
|
const client = turn ? signed2.withHeaders({ "x-laze-turn": turn }) : signed2;
|
|
81161
81848
|
const laze = await client.post("/api/agents/me/history", {
|
|
81162
81849
|
channel,
|
|
@@ -81334,19 +82021,19 @@ async function ip({ context, args }) {
|
|
|
81334
82021
|
}
|
|
81335
82022
|
|
|
81336
82023
|
// src/services/join-commands.service.ts
|
|
81337
|
-
import { mkdir as
|
|
81338
|
-
import { dirname as
|
|
82024
|
+
import { mkdir as mkdir18, readFile as readFile29, rename as rename5, rm as rm11, writeFile as writeFile19 } from "node:fs/promises";
|
|
82025
|
+
import { dirname as dirname18, join as join20 } from "node:path";
|
|
81339
82026
|
var DEFAULT_WAIT_SECONDS2 = 100;
|
|
81340
82027
|
var JOIN_USAGE = "Usage: laze join [--workspace <name|id|invite link>] [--for <email>] [--name <name>] [--note <text>] [--timeout <seconds>] [--project <folder>]";
|
|
81341
82028
|
function pendingPathOf({ context }) {
|
|
81342
|
-
return
|
|
82029
|
+
return join20(dirname18(context.environment.configPath), "join", "pending.json");
|
|
81343
82030
|
}
|
|
81344
82031
|
async function readPending({
|
|
81345
82032
|
context,
|
|
81346
82033
|
url: url2,
|
|
81347
82034
|
args
|
|
81348
82035
|
}) {
|
|
81349
|
-
const pending = await
|
|
82036
|
+
const pending = await readFile29(pendingPathOf({ context }), "utf8").then(
|
|
81350
82037
|
(text2) => JSON.parse(text2),
|
|
81351
82038
|
() => void 0
|
|
81352
82039
|
);
|
|
@@ -81356,13 +82043,13 @@ async function readPending({
|
|
|
81356
82043
|
}
|
|
81357
82044
|
async function keepPending({ context, pending }) {
|
|
81358
82045
|
const path = pendingPathOf({ context });
|
|
81359
|
-
await
|
|
82046
|
+
await mkdir18(dirname18(path), { recursive: true, mode: 448 });
|
|
81360
82047
|
const temporary = `${path}.${process.pid}.tmp`;
|
|
81361
|
-
await
|
|
82048
|
+
await writeFile19(temporary, JSON.stringify(pending), { mode: 384 });
|
|
81362
82049
|
await rename5(temporary, path);
|
|
81363
82050
|
}
|
|
81364
82051
|
async function dropPending({ context }) {
|
|
81365
|
-
await
|
|
82052
|
+
await rm11(pendingPathOf({ context }), { force: true });
|
|
81366
82053
|
}
|
|
81367
82054
|
function waitSecondsOf3({ args }) {
|
|
81368
82055
|
const raw = flagText({ args, name: "timeout" });
|
|
@@ -81674,244 +82361,6 @@ function machineAccessCommand(name2) {
|
|
|
81674
82361
|
return name2 && Object.hasOwn(COMMANDS, name2) ? COMMANDS[name2] : void 0;
|
|
81675
82362
|
}
|
|
81676
82363
|
|
|
81677
|
-
// src/services/vault-commands.service.ts
|
|
81678
|
-
import { createHash as createHash2 } from "node:crypto";
|
|
81679
|
-
import { mkdir as mkdir18, readFile as readFile29, rm as rm11, writeFile as writeFile19 } from "node:fs/promises";
|
|
81680
|
-
import { tmpdir as tmpdir2 } from "node:os";
|
|
81681
|
-
import { dirname as dirname18, join as join20 } from "node:path";
|
|
81682
|
-
var USAGE10 = `Usage: laze vault run <connection> --reason "<one plain sentence>" [--wait <s>] -- <command> [args...]
|
|
81683
|
-
Runs the command with the connection's values in its environment, on a Laze agent's computer
|
|
81684
|
-
or on a machine it runs on.`;
|
|
81685
|
-
var POLL_MS2 = 3e3;
|
|
81686
|
-
var RESTART_WAIT_MS = 12e4;
|
|
81687
|
-
var RESTART_BACKOFF_MS = [1e3, 2e3, 4e3, 8e3, 1e4];
|
|
81688
|
-
var P2562 = { name: "ECDH", namedCurve: "P-256" };
|
|
81689
|
-
var ServerGoneError = class extends Error {
|
|
81690
|
-
};
|
|
81691
|
-
function proxyOf({ env }) {
|
|
81692
|
-
const raw = env.LAZE_VAULT_PROXY || env.HTTP_PROXY || env.http_proxy;
|
|
81693
|
-
if (!raw) {
|
|
81694
|
-
throw new CliUsageError(
|
|
81695
|
-
"laze vault run works only on a Laze agent's computer or on a machine it runs on"
|
|
81696
|
-
);
|
|
81697
|
-
}
|
|
81698
|
-
const url2 = new URL(raw);
|
|
81699
|
-
const user = decodeURIComponent(url2.username);
|
|
81700
|
-
const password = decodeURIComponent(url2.password);
|
|
81701
|
-
return {
|
|
81702
|
-
origin: url2.origin,
|
|
81703
|
-
authorization: `Basic ${Buffer.from(`${user}:${password}`).toString("base64")}`
|
|
81704
|
-
};
|
|
81705
|
-
}
|
|
81706
|
-
function turnFileOf({
|
|
81707
|
-
env
|
|
81708
|
-
}) {
|
|
81709
|
-
return env.LAZE_TURN_FILE || void 0;
|
|
81710
|
-
}
|
|
81711
|
-
async function turnTokenOf4({
|
|
81712
|
-
env,
|
|
81713
|
-
turnFile,
|
|
81714
|
-
command = "laze vault run"
|
|
81715
|
-
}) {
|
|
81716
|
-
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
81717
|
-
if (pinned) return pinned;
|
|
81718
|
-
if (!turnFile) throw new CliUsageError(`${command} works only during an agent's turn`);
|
|
81719
|
-
try {
|
|
81720
|
-
return (await readFile29(turnFile, "utf8")).trim();
|
|
81721
|
-
} catch {
|
|
81722
|
-
throw new CliUsageError(`${command} works only during an agent's turn`);
|
|
81723
|
-
}
|
|
81724
|
-
}
|
|
81725
|
-
function runKeyPathOf({
|
|
81726
|
-
turnFile,
|
|
81727
|
-
connection
|
|
81728
|
-
}) {
|
|
81729
|
-
const name2 = createHash2("sha256").update(connection).digest("hex");
|
|
81730
|
-
const base = turnFile ? dirname18(turnFile) : join20(tmpdir2(), "laze-vault");
|
|
81731
|
-
return join20(base, "vault-run-keys", `${name2}.json`);
|
|
81732
|
-
}
|
|
81733
|
-
async function runKeyAt({ path }) {
|
|
81734
|
-
const saved3 = await readFile29(path, "utf8").then(
|
|
81735
|
-
(text2) => JSON.parse(text2),
|
|
81736
|
-
() => void 0
|
|
81737
|
-
);
|
|
81738
|
-
if (saved3 && typeof saved3.publicKey === "string" && saved3.privateKey) {
|
|
81739
|
-
const privateKey = await globalThis.crypto.subtle.importKey("jwk", saved3.privateKey, P2562, false, ["deriveBits"]).catch(() => void 0);
|
|
81740
|
-
if (privateKey) return { privateKey, publicKey: saved3.publicKey };
|
|
81741
|
-
}
|
|
81742
|
-
const fresh = await generateEcdhKeys();
|
|
81743
|
-
const jwk = await globalThis.crypto.subtle.exportKey("jwk", fresh.privateKey);
|
|
81744
|
-
await mkdir18(dirname18(path), { recursive: true, mode: 448 });
|
|
81745
|
-
await writeFile19(path, JSON.stringify({ publicKey: fresh.publicKey, privateKey: jwk }), {
|
|
81746
|
-
mode: 384
|
|
81747
|
-
});
|
|
81748
|
-
return fresh;
|
|
81749
|
-
}
|
|
81750
|
-
function connectionRefused(error62) {
|
|
81751
|
-
const cause = error62.cause;
|
|
81752
|
-
if (cause?.code === "ECONNREFUSED") return true;
|
|
81753
|
-
return cause?.errors?.some((inner) => inner.code === "ECONNREFUSED") ?? false;
|
|
81754
|
-
}
|
|
81755
|
-
async function sendOnce({
|
|
81756
|
-
context,
|
|
81757
|
-
url: url2,
|
|
81758
|
-
init
|
|
81759
|
-
}) {
|
|
81760
|
-
let response;
|
|
81761
|
-
try {
|
|
81762
|
-
response = await context.fetcher(url2, init);
|
|
81763
|
-
} catch (error62) {
|
|
81764
|
-
const wasRefused = connectionRefused(error62);
|
|
81765
|
-
if (init.method === "POST" && !wasRefused) throw error62;
|
|
81766
|
-
return { restarting: wasRefused ? "connection refused" : String(error62) };
|
|
81767
|
-
}
|
|
81768
|
-
if (response.status !== 502 && response.status !== 503) return { response };
|
|
81769
|
-
const code = codeOf(await response.clone().text());
|
|
81770
|
-
const neverReached = response.status === 503 && code === "vault_not_answering";
|
|
81771
|
-
if (init.method === "POST" && !neverReached) return { response };
|
|
81772
|
-
return { restarting: `status ${response.status}${code ? ` ${code}` : ""}` };
|
|
81773
|
-
}
|
|
81774
|
-
async function reach(input2) {
|
|
81775
|
-
const { context } = input2;
|
|
81776
|
-
const started = context.nowMs();
|
|
81777
|
-
for (let attempt = 0; ; attempt += 1) {
|
|
81778
|
-
const sent = await sendOnce(input2);
|
|
81779
|
-
if ("response" in sent) return sent.response;
|
|
81780
|
-
if (context.nowMs() - started >= RESTART_WAIT_MS) {
|
|
81781
|
-
throw new ServerGoneError(
|
|
81782
|
-
`laze vault: the Laze server did not come back (${sent.restarting})`
|
|
81783
|
-
);
|
|
81784
|
-
}
|
|
81785
|
-
if (attempt === 0) {
|
|
81786
|
-
context.err(
|
|
81787
|
-
`laze vault: the Laze server is not answering (${sent.restarting}), probably restarting; waiting up to 2 min...
|
|
81788
|
-
`
|
|
81789
|
-
);
|
|
81790
|
-
}
|
|
81791
|
-
await context.sleep(RESTART_BACKOFF_MS[Math.min(attempt, RESTART_BACKOFF_MS.length - 1)] ?? 0);
|
|
81792
|
-
}
|
|
81793
|
-
}
|
|
81794
|
-
function codeOf(text2) {
|
|
81795
|
-
return /"code"\s*:\s*"([^"]+)"/.exec(text2)?.[1];
|
|
81796
|
-
}
|
|
81797
|
-
async function releaseOf({ response }) {
|
|
81798
|
-
const text2 = await response.text();
|
|
81799
|
-
if (!response.ok) {
|
|
81800
|
-
return {
|
|
81801
|
-
outcome: "deny",
|
|
81802
|
-
exitCode: 1,
|
|
81803
|
-
message: `laze vault: the release was refused (${codeOf(text2) ?? `status ${response.status}`})`
|
|
81804
|
-
};
|
|
81805
|
-
}
|
|
81806
|
-
return JSON.parse(text2);
|
|
81807
|
-
}
|
|
81808
|
-
async function envOf({
|
|
81809
|
-
release: release2,
|
|
81810
|
-
run: run4
|
|
81811
|
-
}) {
|
|
81812
|
-
if (!release2.sealed) return release2.env;
|
|
81813
|
-
const sealed = await openRunRelease({
|
|
81814
|
-
release: release2.sealed,
|
|
81815
|
-
runPrivateKey: run4.privateKey,
|
|
81816
|
-
runPublicKey: run4.publicKey,
|
|
81817
|
-
requestId: release2.sealed.requestId
|
|
81818
|
-
});
|
|
81819
|
-
return { ...release2.env, ...sealed };
|
|
81820
|
-
}
|
|
81821
|
-
function deadlineOf({ args, nowMs }) {
|
|
81822
|
-
const wait = flagText({ args, name: "wait" }) || (args.flags.wait === true ? args.words[3] : "");
|
|
81823
|
-
if (!wait) return Infinity;
|
|
81824
|
-
if (!(Number(wait) >= 0)) throw new CliUsageError(`--wait takes a number of seconds
|
|
81825
|
-
${USAGE10}`);
|
|
81826
|
-
return nowMs + Number(wait) * 1e3;
|
|
81827
|
-
}
|
|
81828
|
-
async function untilAnswered({
|
|
81829
|
-
context,
|
|
81830
|
-
first,
|
|
81831
|
-
origin,
|
|
81832
|
-
headers,
|
|
81833
|
-
deadline
|
|
81834
|
-
}) {
|
|
81835
|
-
let release2 = first;
|
|
81836
|
-
while (release2.outcome === "ask") {
|
|
81837
|
-
if (context.nowMs() + POLL_MS2 > deadline) {
|
|
81838
|
-
context.err(`${release2.message}. Not approved yet; ask again later.
|
|
81839
|
-
`);
|
|
81840
|
-
return "capped";
|
|
81841
|
-
}
|
|
81842
|
-
if (release2 === first) {
|
|
81843
|
-
context.err(`${release2.message}. Waiting for an answer (cards expire after 12 hours)...
|
|
81844
|
-
`);
|
|
81845
|
-
}
|
|
81846
|
-
await context.sleep(POLL_MS2);
|
|
81847
|
-
const url2 = `${origin}/vault/release/${encodeURIComponent(release2.requestId)}`;
|
|
81848
|
-
release2 = await releaseOf({
|
|
81849
|
-
response: await reach({ context, url: url2, init: { method: "GET", headers } })
|
|
81850
|
-
});
|
|
81851
|
-
}
|
|
81852
|
-
return release2;
|
|
81853
|
-
}
|
|
81854
|
-
async function vaultRelease({
|
|
81855
|
-
context,
|
|
81856
|
-
args,
|
|
81857
|
-
connection,
|
|
81858
|
-
reason,
|
|
81859
|
-
command
|
|
81860
|
-
}) {
|
|
81861
|
-
const deadline = deadlineOf({ args, nowMs: context.nowMs() });
|
|
81862
|
-
const env = context.environment.inherited;
|
|
81863
|
-
const proxy = proxyOf({ env });
|
|
81864
|
-
const turnFile = turnFileOf({ env });
|
|
81865
|
-
const headers = {
|
|
81866
|
-
"proxy-authorization": proxy.authorization,
|
|
81867
|
-
"x-laze-turn": await turnTokenOf4({ env, turnFile })
|
|
81868
|
-
};
|
|
81869
|
-
const keyPath = runKeyPathOf({ turnFile, connection });
|
|
81870
|
-
const run4 = await runKeyAt({ path: keyPath });
|
|
81871
|
-
const body = JSON.stringify({ connection, reason, command, recipient: run4.publicKey });
|
|
81872
|
-
let release2;
|
|
81873
|
-
try {
|
|
81874
|
-
const first = await releaseOf({
|
|
81875
|
-
response: await reach({
|
|
81876
|
-
context,
|
|
81877
|
-
url: `${proxy.origin}/vault/release`,
|
|
81878
|
-
init: { method: "POST", headers: { ...headers, "content-type": "application/json" }, body }
|
|
81879
|
-
})
|
|
81880
|
-
});
|
|
81881
|
-
release2 = await untilAnswered({ context, first, origin: proxy.origin, headers, deadline });
|
|
81882
|
-
} catch (error62) {
|
|
81883
|
-
if (!(error62 instanceof ServerGoneError)) throw error62;
|
|
81884
|
-
context.err(`${error62.message}. Run the command again to keep waiting.
|
|
81885
|
-
`);
|
|
81886
|
-
return { exitCode: 75 };
|
|
81887
|
-
}
|
|
81888
|
-
if (release2 === "capped") return { exitCode: 75 };
|
|
81889
|
-
if (release2.outcome === "deny") {
|
|
81890
|
-
await rm11(keyPath, { force: true });
|
|
81891
|
-
context.err(`${release2.message}
|
|
81892
|
-
`);
|
|
81893
|
-
return { exitCode: release2.exitCode || 1 };
|
|
81894
|
-
}
|
|
81895
|
-
const values = await envOf({ release: release2, run: run4 });
|
|
81896
|
-
await rm11(keyPath, { force: true });
|
|
81897
|
-
if (release2.message) context.err(`${release2.message}
|
|
81898
|
-
`);
|
|
81899
|
-
return { env: values };
|
|
81900
|
-
}
|
|
81901
|
-
async function vaultRun({
|
|
81902
|
-
context,
|
|
81903
|
-
args
|
|
81904
|
-
}) {
|
|
81905
|
-
const connection = args.words[2];
|
|
81906
|
-
const reason = flagText({ args, name: "reason" });
|
|
81907
|
-
if (!connection || args.rest.length === 0) throw new CliUsageError(USAGE10);
|
|
81908
|
-
if (!reason) throw new CliUsageError(`Say why with --reason "<one plain sentence>"
|
|
81909
|
-
${USAGE10}`);
|
|
81910
|
-
const released = await vaultRelease({ context, args, connection, reason, command: args.rest });
|
|
81911
|
-
if ("exitCode" in released) return released.exitCode;
|
|
81912
|
-
return context.runCommand({ command: args.rest, env: released.env });
|
|
81913
|
-
}
|
|
81914
|
-
|
|
81915
82364
|
// src/services/machine-commands.service.ts
|
|
81916
82365
|
var USAGE11 = [
|
|
81917
82366
|
"Usage: laze machine connect <name> the command to run on your own machine (people)",
|
|
@@ -84328,7 +84777,7 @@ async function postInTurn({
|
|
|
84328
84777
|
body
|
|
84329
84778
|
}) {
|
|
84330
84779
|
const env = context.environment.inherited;
|
|
84331
|
-
const turn = await
|
|
84780
|
+
const turn = await turnTokenOf3({
|
|
84332
84781
|
env,
|
|
84333
84782
|
turnFile: turnFileOf({ env }),
|
|
84334
84783
|
command: "laze vault save"
|
|
@@ -85936,7 +86385,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
85936
86385
|
laze agent create --name <name> [--description <text>] [--harness laze-models|claude-code|codex] [--avatar <file>]
|
|
85937
86386
|
make an agent for your owner (or for you): personal, opened in their direct messages
|
|
85938
86387
|
--team makes a team agent; on Claude Code or Codex it needs --pool <pool>, a login pool to draw from
|
|
85939
|
-
laze agent update <agent> [--name] [--description] [--avatar] [--context
|
|
86388
|
+
laze agent update <agent> [--name] [--description] [--avatar] [--model] [--effort] [--max-context] change an agent your owner owns
|
|
85940
86389
|
laze agent archive <agent> remove an agent your owner owns; kept 30 days
|
|
85941
86390
|
laze agent archived removed agents you may restore, with the day each goes
|
|
85942
86391
|
laze agent restore|delete <agent> bring an archived agent back, or delete it for good now
|
|
@@ -85964,7 +86413,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
85964
86413
|
laze vault scrub [--dry-run] move secrets found in messages to the vault now (admins)
|
|
85965
86414
|
laze vault list|add|update|replace|compare|rm|revoke|uses your keychains with your own key
|
|
85966
86415
|
a value comes from stdin or --from-file, never a flag; no command prints a value
|
|
85967
|
-
laze vault grant|lend|grants|ungrant|leases|end-lease|limits|set-limit sharing, leases, limits
|
|
86416
|
+
laze vault grant|share|lend|grants|ungrant|leases|end-lease|limits|set-limit sharing, leases, limits
|
|
85968
86417
|
laze vault audit|activity|most-asked|approvals|judge|devices what happened (audit: admins)
|
|
85969
86418
|
laze vault every laze vault command, with its flags
|
|
85970
86419
|
laze connect suggest <service> --reason "<why>" a connect card for whoever asked (agents)
|