@lazehq/cli 0.1.120 → 0.1.121
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 +558 -163
- package/package.json +1 -1
package/dist/laze.mjs
CHANGED
|
@@ -36881,10 +36881,10 @@ function heldBackLineOf({
|
|
|
36881
36881
|
var CLI_RELEASE_HEADER = "x-laze-cli-release";
|
|
36882
36882
|
var STAMP = /^(\d+)\.(\d+)\.(\d+)(?:-g([0-9a-f]+))?$/;
|
|
36883
36883
|
function releaseSkewOf({
|
|
36884
|
-
mine:
|
|
36884
|
+
mine: mine5,
|
|
36885
36885
|
server
|
|
36886
36886
|
}) {
|
|
36887
|
-
const have = STAMP.exec(
|
|
36887
|
+
const have = STAMP.exec(mine5);
|
|
36888
36888
|
const ships = STAMP.exec(server);
|
|
36889
36889
|
if (!have || !ships) return null;
|
|
36890
36890
|
for (const part of [1, 2, 3]) {
|
|
@@ -36894,51 +36894,51 @@ function releaseSkewOf({
|
|
|
36894
36894
|
return have[4] && ships[4] && have[4] !== ships[4] ? "other_build" : null;
|
|
36895
36895
|
}
|
|
36896
36896
|
function releaseWarningOf({
|
|
36897
|
-
mine:
|
|
36897
|
+
mine: mine5,
|
|
36898
36898
|
server,
|
|
36899
36899
|
sandbox
|
|
36900
36900
|
}) {
|
|
36901
|
-
const skew = releaseSkewOf({ mine:
|
|
36901
|
+
const skew = releaseSkewOf({ mine: mine5, server });
|
|
36902
36902
|
if (!skew || skew === "other_build") return null;
|
|
36903
36903
|
if (sandbox) {
|
|
36904
|
-
return `laze: this CLI is ${
|
|
36904
|
+
return `laze: this CLI is ${mine5}, but the server ships ${server}. Laze updates the computer's CLI each time the agent connects, so restart the agent if this stays.
|
|
36905
36905
|
`;
|
|
36906
36906
|
}
|
|
36907
36907
|
if (skew === "newer") {
|
|
36908
|
-
return `laze: this CLI is ${
|
|
36908
|
+
return `laze: this CLI is ${mine5}, newer than the server's ${server}; a command the server does not have yet fails.
|
|
36909
36909
|
`;
|
|
36910
36910
|
}
|
|
36911
|
-
return `laze: this CLI is ${
|
|
36911
|
+
return `laze: this CLI is ${mine5}, older than the server's ${server}. Update it with npm i -g ${CLI_PACKAGE_LATEST} (or laze update).
|
|
36912
36912
|
`;
|
|
36913
36913
|
}
|
|
36914
36914
|
function selfUpdateLineOf({
|
|
36915
|
-
mine:
|
|
36915
|
+
mine: mine5,
|
|
36916
36916
|
server,
|
|
36917
36917
|
manager
|
|
36918
36918
|
}) {
|
|
36919
|
-
return `laze: this CLI is ${
|
|
36919
|
+
return `laze: this CLI is ${mine5}, older than the server's ${server}. Updating it in the background with ${manager}; the next command runs the new one (LAZE_AUTO_UPDATE=0 turns this off).
|
|
36920
36920
|
`;
|
|
36921
36921
|
}
|
|
36922
36922
|
|
|
36923
36923
|
// src/rules/cli-installs.rules.ts
|
|
36924
36924
|
function newerInstallsOf({
|
|
36925
|
-
mine:
|
|
36925
|
+
mine: mine5,
|
|
36926
36926
|
installs
|
|
36927
36927
|
}) {
|
|
36928
36928
|
return installs.filter(
|
|
36929
|
-
(install) => install.version !== null && releaseSkewOf({ mine:
|
|
36929
|
+
(install) => install.version !== null && releaseSkewOf({ mine: mine5, server: install.version }) === "older"
|
|
36930
36930
|
);
|
|
36931
36931
|
}
|
|
36932
36932
|
function newerInstallLineOf({
|
|
36933
|
-
mine:
|
|
36933
|
+
mine: mine5,
|
|
36934
36934
|
script,
|
|
36935
36935
|
installs
|
|
36936
36936
|
}) {
|
|
36937
|
-
const newer = newerInstallsOf({ mine:
|
|
36937
|
+
const newer = newerInstallsOf({ mine: mine5, installs });
|
|
36938
36938
|
const [first] = newer;
|
|
36939
36939
|
if (!first) return null;
|
|
36940
36940
|
const others = newer.map((install) => `laze ${install.version} at ${install.path}`).join(", ");
|
|
36941
|
-
return `laze: this is laze ${
|
|
36941
|
+
return `laze: this is laze ${mine5} at ${script}, but a newer ${others} is installed. A shell runs the first laze on PATH: run ${first.path} by its path, or remove the older one.
|
|
36942
36942
|
`;
|
|
36943
36943
|
}
|
|
36944
36944
|
function shadowedLineOf({
|
|
@@ -36960,7 +36960,7 @@ function shadowedLinkLineOf({ shadow }) {
|
|
|
36960
36960
|
}
|
|
36961
36961
|
|
|
36962
36962
|
// src/rules/cli-version.rules.ts
|
|
36963
|
-
var STAMPED = "0.1.
|
|
36963
|
+
var STAMPED = "0.1.121";
|
|
36964
36964
|
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
36965
36965
|
return stamped.startsWith("__") ? "dev" : stamped;
|
|
36966
36966
|
}
|
|
@@ -37037,10 +37037,10 @@ async function otherInstallsOf({ context }) {
|
|
|
37037
37037
|
}
|
|
37038
37038
|
async function noteNewerInstall({
|
|
37039
37039
|
context,
|
|
37040
|
-
mine:
|
|
37040
|
+
mine: mine5 = cliVersionOf()
|
|
37041
37041
|
}) {
|
|
37042
37042
|
const { script, others } = await otherInstallsOf({ context });
|
|
37043
|
-
const line = newerInstallLineOf({ mine:
|
|
37043
|
+
const line = newerInstallLineOf({ mine: mine5, script, installs: others });
|
|
37044
37044
|
if (line) context.err(line);
|
|
37045
37045
|
}
|
|
37046
37046
|
async function rerunCommandOf({
|
|
@@ -65163,6 +65163,10 @@ var emailMessageSchemaDefinition = external_exports.discriminatedUnion("template
|
|
|
65163
65163
|
width: external_exports.number().int().positive().max(600),
|
|
65164
65164
|
height: external_exports.number().int().positive().max(600)
|
|
65165
65165
|
}),
|
|
65166
|
+
/** Lines after the button, such as an ask to reply and a sign-off. */
|
|
65167
|
+
closing: external_exports.array(external_exports.string().min(1).max(600)).max(3).optional(),
|
|
65168
|
+
/** Where replies go: only an address on laze.so, whose mail reaches staff. */
|
|
65169
|
+
replyTo: external_exports.email().regex(/@laze\.so$/i, "a laze.so address").optional(),
|
|
65166
65170
|
unsubscribeUrl: external_exports.url()
|
|
65167
65171
|
}),
|
|
65168
65172
|
/**
|
|
@@ -65772,6 +65776,17 @@ var awayPausedPayloadSchemaDefinition = external_exports.object({
|
|
|
65772
65776
|
changeId: external_exports.string().min(1),
|
|
65773
65777
|
at: external_exports.iso.datetime()
|
|
65774
65778
|
});
|
|
65779
|
+
var personSessionStartedPayloadSchemaDefinition = external_exports.object({
|
|
65780
|
+
workspaceId: external_exports.string().min(1),
|
|
65781
|
+
userId: external_exports.string().min(1),
|
|
65782
|
+
/** The Laze client the person used: the web app, the desktop app or the iPhone app. */
|
|
65783
|
+
client: callerClientSchema,
|
|
65784
|
+
/** Their use before this session; null for the first one, or when the client cannot say. */
|
|
65785
|
+
previousSeenAt: external_exports.iso.datetime().nullable(),
|
|
65786
|
+
/** One per person and session: a retry of the same start records it once. */
|
|
65787
|
+
sessionId: external_exports.string().min(1).max(300),
|
|
65788
|
+
at: external_exports.iso.datetime()
|
|
65789
|
+
});
|
|
65775
65790
|
|
|
65776
65791
|
// ../../modules/notification/contract/src/notification.ui.ts
|
|
65777
65792
|
var notificationUi = uiTokens("notification");
|
|
@@ -65865,6 +65880,10 @@ var messagePostedPayloadSchemaDefinition = external_exports.object({
|
|
|
65865
65880
|
forward: postedForwardSchemaDefinition.nullable().optional(),
|
|
65866
65881
|
/** The card this message carries, such as an approval: a system card, not something said. */
|
|
65867
65882
|
cardType: external_exports.string().optional(),
|
|
65883
|
+
/** Its conversation's kind when a person or agent posted it; absent on mirrored, older facts. */
|
|
65884
|
+
channelKind: conversationKindSchema.optional(),
|
|
65885
|
+
/** An agent is a member of its conversation, such as a direct message with one. */
|
|
65886
|
+
withAgent: external_exports.boolean().optional(),
|
|
65868
65887
|
/** Mirrored history in a batch: no live publication of its own, its conversation reads again. */
|
|
65869
65888
|
quiet: external_exports.boolean().optional(),
|
|
65870
65889
|
/**
|
|
@@ -66262,6 +66281,8 @@ var PERSONA = /^[a-z0-9-]{1,40}$/;
|
|
|
66262
66281
|
var REFERRAL_CODE = /^[0-9A-Za-z]{4,64}$/;
|
|
66263
66282
|
var HOST = /^[a-z0-9.-]{1,253}$/;
|
|
66264
66283
|
var tagSchema = external_exports.string().regex(TAG).nullable();
|
|
66284
|
+
var AD_NETWORKS = ["google", "meta", "microsoft", "reddit", "linkedin"];
|
|
66285
|
+
var adNetworkSchema = external_exports.enum(AD_NETWORKS);
|
|
66265
66286
|
var signUpSourceSchemaDefinition = external_exports.object({
|
|
66266
66287
|
source: tagSchema,
|
|
66267
66288
|
medium: tagSchema,
|
|
@@ -66275,7 +66296,9 @@ var signUpSourceSchemaDefinition = external_exports.object({
|
|
|
66275
66296
|
/** The persona page the visitor came through, such as `sales` for `/for/sales`. */
|
|
66276
66297
|
persona: external_exports.string().regex(PERSONA).nullable(),
|
|
66277
66298
|
/** The code of the referral link the visitor first opened. */
|
|
66278
|
-
referralCode: external_exports.string().regex(REFERRAL_CODE).nullable()
|
|
66299
|
+
referralCode: external_exports.string().regex(REFERRAL_CODE).nullable(),
|
|
66300
|
+
/** The ad network a click id on the first visit named; absent from sources kept before it. */
|
|
66301
|
+
adNetwork: adNetworkSchema.nullable().default(null)
|
|
66279
66302
|
});
|
|
66280
66303
|
var signUpSourceSchema = signUpSourceSchemaDefinition;
|
|
66281
66304
|
var HEARD_FROM_ANSWERS = [
|
|
@@ -66659,6 +66682,10 @@ var SignInSettingsSlot = workspaceUi.extension("settings.signIn");
|
|
|
66659
66682
|
var AppsSettingsSlot = workspaceUi.extension("settings.apps");
|
|
66660
66683
|
var ConversationSettingsSlot = workspaceUi.extension("settings.conversations");
|
|
66661
66684
|
var BillingSettingsSlot = workspaceUi.extension("settings.billing");
|
|
66685
|
+
var UsageSettingsSlot = workspaceUi.extension("settings.usage");
|
|
66686
|
+
var UsageActivitySettingsSlot = workspaceUi.extension("settings.usageActivity");
|
|
66687
|
+
var UsageTracingSettingsSlot = workspaceUi.extension("settings.usageTracing");
|
|
66688
|
+
var UsageAccountsSettingsSlot = workspaceUi.extension("settings.usageAccounts");
|
|
66662
66689
|
var ModelSettingsSlot = workspaceUi.extension("settings.models");
|
|
66663
66690
|
var AgentLoginsSettingsSlot = workspaceUi.extension("settings.agentLogins");
|
|
66664
66691
|
var LoginPoolsSettingsSlot = workspaceUi.extension("settings.loginPools");
|
|
@@ -67047,7 +67074,9 @@ var lazeAgentEventSchemaDefinition = external_exports.discriminatedUnion("type",
|
|
|
67047
67074
|
/** Set when the session sends the turn's messages again then (epoch ms): not a failure yet. */
|
|
67048
67075
|
retryAt: external_exports.number().int().nonnegative().optional(),
|
|
67049
67076
|
/** Why a failed turn failed, as the session's error event said it. */
|
|
67050
|
-
failure: external_exports.object({ code: external_exports.string().min(1), message: external_exports.string() }).optional()
|
|
67077
|
+
failure: external_exports.object({ code: external_exports.string().min(1), message: external_exports.string() }).optional(),
|
|
67078
|
+
/** How long the turn ran from its start, in ms; absent from older supervisors. */
|
|
67079
|
+
durationMs: external_exports.number().int().nonnegative().optional()
|
|
67051
67080
|
}),
|
|
67052
67081
|
external_exports.object({ type: external_exports.literal("text_delta"), messageId: external_exports.string().optional(), text: external_exports.string() }),
|
|
67053
67082
|
/** Steps that changed since the last batch, coalesced on the computer; streamed, never stored. */
|
|
@@ -69878,11 +69907,15 @@ var LANGWATCH_REST_PATHS = {
|
|
|
69878
69907
|
level: "/api/langwatch/level",
|
|
69879
69908
|
test: "/api/langwatch/test",
|
|
69880
69909
|
remove: "/api/langwatch/remove",
|
|
69881
|
-
connect: "/api/langwatch/connect"
|
|
69910
|
+
connect: "/api/langwatch/connect",
|
|
69911
|
+
connectPoll: "/api/langwatch/connect/poll",
|
|
69912
|
+
connectCancel: "/api/langwatch/connect/cancel",
|
|
69913
|
+
mine: "/api/langwatch/mine"
|
|
69882
69914
|
};
|
|
69883
69915
|
var workspaceIdSchema5 = external_exports.string().min(1).max(64);
|
|
69884
69916
|
var iso = external_exports.iso.datetime();
|
|
69885
69917
|
var langwatchContentLevelSchema = external_exports.enum(["full", "metadata"]);
|
|
69918
|
+
var langwatchPersonalLevelSchema = external_exports.enum(["metadata", "off"]);
|
|
69886
69919
|
var langwatchAgentLevelSchema = external_exports.enum(["full", "metadata", "off"]);
|
|
69887
69920
|
var langwatchSignalSchema = external_exports.enum(["traces", "logs", "metrics"]);
|
|
69888
69921
|
var outcomeDefinition = external_exports.object({ at: iso, ok: external_exports.boolean(), message: external_exports.string() });
|
|
@@ -69895,10 +69928,18 @@ var integrationDefinition = external_exports.object({
|
|
|
69895
69928
|
/** The key's last four characters; null without a key. */
|
|
69896
69929
|
keyEnding: external_exports.string().nullable(),
|
|
69897
69930
|
level: langwatchContentLevelSchema,
|
|
69931
|
+
/** Personal agents' default. */
|
|
69932
|
+
personalLevel: langwatchPersonalLevelSchema.default("metadata"),
|
|
69898
69933
|
updatedAt: iso.nullable(),
|
|
69899
69934
|
lastTest: outcomeDefinition.nullable(),
|
|
69900
69935
|
/** The latest batch forwarded or refused; null before the first. */
|
|
69901
|
-
lastDelivery: outcomeDefinition.nullable()
|
|
69936
|
+
lastDelivery: outcomeDefinition.nullable(),
|
|
69937
|
+
/** The project Connect with LangWatch picked; null for a pasted key. */
|
|
69938
|
+
project: external_exports.object({ name: external_exports.string(), organizationName: external_exports.string(), url: external_exports.string() }).nullable(),
|
|
69939
|
+
/** When LangWatch last accepted a batch of traces; null before the first. */
|
|
69940
|
+
lastTraceAt: iso.nullable(),
|
|
69941
|
+
/** The reader sends their own personal agents' messages too (full). */
|
|
69942
|
+
mine: external_exports.boolean()
|
|
69902
69943
|
});
|
|
69903
69944
|
var workspaceInputDefinition = external_exports.object({ workspaceId: workspaceIdSchema5 });
|
|
69904
69945
|
var saveKeyDefinition = external_exports.object({
|
|
@@ -69917,7 +69958,8 @@ var enableDefinition = external_exports.object({
|
|
|
69917
69958
|
var langwatchEnableInputSchema = enableDefinition;
|
|
69918
69959
|
var levelDefinition = external_exports.object({
|
|
69919
69960
|
workspaceId: workspaceIdSchema5,
|
|
69920
|
-
level: langwatchContentLevelSchema
|
|
69961
|
+
level: langwatchContentLevelSchema.optional(),
|
|
69962
|
+
personalLevel: langwatchPersonalLevelSchema.optional()
|
|
69921
69963
|
});
|
|
69922
69964
|
var langwatchLevelInputSchema = levelDefinition;
|
|
69923
69965
|
var testResultDefinition = external_exports.object({
|
|
@@ -69941,6 +69983,7 @@ var langwatchUntracedReasonSchema = external_exports.enum([
|
|
|
69941
69983
|
"not_hosted",
|
|
69942
69984
|
"own_machine",
|
|
69943
69985
|
"harness",
|
|
69986
|
+
/** No longer given: personal agents send metadata by default. */
|
|
69944
69987
|
"not_opted_in",
|
|
69945
69988
|
"agent_off"
|
|
69946
69989
|
]);
|
|
@@ -69953,18 +69996,34 @@ var agentTracingDefinition = external_exports.object({
|
|
|
69953
69996
|
eligible: external_exports.boolean(),
|
|
69954
69997
|
workspaceEnabled: external_exports.boolean(),
|
|
69955
69998
|
workspaceLevel: langwatchContentLevelSchema,
|
|
69956
|
-
/**
|
|
69999
|
+
/** Its traces may carry content: a team agent, or a personal agent its owner set to full. */
|
|
69957
70000
|
optedIn: external_exports.boolean(),
|
|
69958
|
-
/** The
|
|
69959
|
-
override: langwatchAgentLevelSchema.nullable()
|
|
70001
|
+
/** The level someone chose for this agent; null when it takes its default. */
|
|
70002
|
+
override: langwatchAgentLevelSchema.nullable(),
|
|
70003
|
+
/** The agent's level, chosen or default, whether or not its traces can go. */
|
|
70004
|
+
level: langwatchAgentLevelSchema.default("off"),
|
|
70005
|
+
/** What it takes without a choice: the workspace's level for a team agent, metadata else. */
|
|
70006
|
+
defaultLevel: langwatchAgentLevelSchema.default("metadata")
|
|
69960
70007
|
});
|
|
69961
70008
|
var langwatchAgentTracingSchema = agentTracingDefinition;
|
|
69962
70009
|
var agentChoiceDefinition = external_exports.object({
|
|
69963
|
-
/**
|
|
70010
|
+
/** Deprecated: true sets full (owner only), false sets metadata. Use `level`. */
|
|
69964
70011
|
optIn: external_exports.boolean().optional(),
|
|
69965
|
-
/** The agent's own level, or `follow` for
|
|
70012
|
+
/** The agent's own level, or `follow` for its default. */
|
|
69966
70013
|
level: external_exports.union([langwatchAgentLevelSchema, external_exports.literal("follow")]).optional()
|
|
69967
70014
|
});
|
|
70015
|
+
var agentRowDefinition = external_exports.object({
|
|
70016
|
+
agentId: external_exports.string(),
|
|
70017
|
+
name: external_exports.string(),
|
|
70018
|
+
kind: external_exports.enum(["personal", "team"]),
|
|
70019
|
+
ownerUserId: external_exports.string(),
|
|
70020
|
+
/** The owner's name or email; null when they left. */
|
|
70021
|
+
ownerName: external_exports.string().nullable(),
|
|
70022
|
+
tracing: agentTracingDefinition,
|
|
70023
|
+
/** The levels this viewer may pick for it; empty when they may not change it. */
|
|
70024
|
+
choices: external_exports.array(langwatchAgentLevelSchema)
|
|
70025
|
+
});
|
|
70026
|
+
var langwatchAgentRowSchema = agentRowDefinition;
|
|
69968
70027
|
var langwatchOtlpPayloadSchemaDefinition = external_exports.record(external_exports.string(), external_exports.unknown());
|
|
69969
70028
|
var langwatchOtlpPayloadSchema = langwatchOtlpPayloadSchemaDefinition;
|
|
69970
70029
|
var ingestDefinition = external_exports.object({
|
|
@@ -69995,15 +70054,21 @@ var connectStartDefinition = external_exports.object({
|
|
|
69995
70054
|
});
|
|
69996
70055
|
var langwatchConnectStartInputSchema = connectStartDefinition;
|
|
69997
70056
|
var connectStartedDefinition = external_exports.object({
|
|
69998
|
-
/**
|
|
69999
|
-
|
|
70057
|
+
/** Names the attempt when the page asks how it is going. */
|
|
70058
|
+
attemptId: external_exports.string(),
|
|
70059
|
+
/** LangWatch's approval page, where the person picks a project. */
|
|
70060
|
+
verificationUrl: external_exports.string(),
|
|
70061
|
+
/** The code LangWatch's page shows, to check it is this connect. */
|
|
70062
|
+
userCode: external_exports.string(),
|
|
70063
|
+
expiresAt: iso,
|
|
70064
|
+
/** The approval page again, for pages loaded before the device flow. */
|
|
70065
|
+
authorizeUrl: external_exports.string().meta({ deprecated: true })
|
|
70000
70066
|
});
|
|
70001
|
-
var
|
|
70002
|
-
|
|
70003
|
-
|
|
70004
|
-
error: external_exports.string().max(200).optional(),
|
|
70005
|
-
error_description: external_exports.string().max(2e3).optional()
|
|
70067
|
+
var connectAttemptDefinition = external_exports.object({
|
|
70068
|
+
workspaceId: workspaceIdSchema5,
|
|
70069
|
+
attemptId: external_exports.string().min(1).max(200)
|
|
70006
70070
|
});
|
|
70071
|
+
var langwatchConnectAttemptInputSchema = connectAttemptDefinition;
|
|
70007
70072
|
var langwatchConnectErrorSchema = external_exports.enum([
|
|
70008
70073
|
"state_invalid",
|
|
70009
70074
|
"expired",
|
|
@@ -70013,11 +70078,29 @@ var langwatchConnectErrorSchema = external_exports.enum([
|
|
|
70013
70078
|
"mint_failed",
|
|
70014
70079
|
"save_failed"
|
|
70015
70080
|
]);
|
|
70081
|
+
var connectStatusDefinition = external_exports.discriminatedUnion("state", [
|
|
70082
|
+
external_exports.object({ state: external_exports.literal("waiting") }),
|
|
70083
|
+
external_exports.object({ state: external_exports.literal("connected"), integration: integrationDefinition }),
|
|
70084
|
+
external_exports.object({ state: external_exports.literal("failed"), error: langwatchConnectErrorSchema })
|
|
70085
|
+
]);
|
|
70086
|
+
var connectCancelledDefinition = external_exports.object({ cancelled: external_exports.boolean() });
|
|
70087
|
+
var mineDefinition = external_exports.object({ workspaceId: workspaceIdSchema5, on: external_exports.boolean() });
|
|
70088
|
+
var langwatchMineInputSchema = mineDefinition;
|
|
70016
70089
|
var LangwatchApi = moduleApi()("langwatch");
|
|
70017
|
-
var langwatchTrpc = defineTrpcContract("langwatch").query("integration").withInput(workspaceInputDefinition).withOutput(integrationDefinition).mutation("saveKey").withInput(saveKeyDefinition).withOutput(integrationDefinition).mutation("enable").withInput(enableDefinition).withOutput(integrationDefinition).mutation("disable").withInput(workspaceInputDefinition).withOutput(integrationDefinition).mutation("setLevel").withInput(levelDefinition).withOutput(integrationDefinition).mutation("test").withInput(workspaceInputDefinition).withOutput(testResultDefinition).mutation("remove").withInput(workspaceInputDefinition).withOutput(integrationDefinition).mutation("connectStart").withInput(connectStartDefinition).withOutput(connectStartedDefinition).build();
|
|
70090
|
+
var langwatchTrpc = defineTrpcContract("langwatch").query("integration").withInput(workspaceInputDefinition).withOutput(integrationDefinition).mutation("saveKey").withInput(saveKeyDefinition).withOutput(integrationDefinition).mutation("enable").withInput(enableDefinition).withOutput(integrationDefinition).mutation("disable").withInput(workspaceInputDefinition).withOutput(integrationDefinition).mutation("setLevel").withInput(levelDefinition).withOutput(integrationDefinition).mutation("test").withInput(workspaceInputDefinition).withOutput(testResultDefinition).mutation("remove").withInput(workspaceInputDefinition).withOutput(integrationDefinition).mutation("connectStart").withInput(connectStartDefinition).withOutput(connectStartedDefinition).mutation("connectPoll").withInput(connectAttemptDefinition).withOutput(connectStatusDefinition).mutation("connectCancel").withInput(connectAttemptDefinition).withOutput(connectCancelledDefinition).mutation("setMine").withInput(mineDefinition).withOutput(integrationDefinition).build();
|
|
70018
70091
|
|
|
70019
70092
|
// ../../modules/langwatch/contract/src/langwatch.config.ts
|
|
70020
|
-
var langwatchConfig = Config.define(() => ({
|
|
70093
|
+
var langwatchConfig = Config.define((c) => ({
|
|
70094
|
+
/**
|
|
70095
|
+
* Dev stacks only: a LangWatch on this machine (`http://127.0.0.1:<port>`) that may be
|
|
70096
|
+
* connected, past the public-https rule and the SSRF fence. Production refuses to boot with it.
|
|
70097
|
+
*/
|
|
70098
|
+
devEndpoint: c.env(
|
|
70099
|
+
"LAZE_LANGWATCH_DEV_ENDPOINT",
|
|
70100
|
+
external_exports.string().regex(/^http:\/\/(127\.0\.0\.1|localhost):\d{1,5}$/).optional()
|
|
70101
|
+
),
|
|
70102
|
+
nodeEnvironment
|
|
70103
|
+
}));
|
|
70021
70104
|
|
|
70022
70105
|
// ../../modules/langwatch/contract/src/langwatch.rest.ts
|
|
70023
70106
|
var keyed = { workspaceId: true };
|
|
@@ -70026,33 +70109,32 @@ var saveKeyDefinition2 = langwatchSaveKeyInputSchema.omit(keyed);
|
|
|
70026
70109
|
var enableDefinition2 = langwatchEnableInputSchema.omit(keyed);
|
|
70027
70110
|
var levelDefinition2 = langwatchLevelInputSchema.omit(keyed);
|
|
70028
70111
|
var connectDefinition = langwatchConnectStartInputSchema.omit(keyed);
|
|
70112
|
+
var connectAttemptDefinition2 = langwatchConnectAttemptInputSchema.omit(keyed);
|
|
70113
|
+
var mineDefinition2 = langwatchMineInputSchema.omit(keyed);
|
|
70029
70114
|
|
|
70030
70115
|
// ../../modules/langwatch/contract/src/langwatch.surfaces.ts
|
|
70031
|
-
var langwatchSurfaces = defineSurfaces(
|
|
70032
|
-
|
|
70033
|
-
{
|
|
70034
|
-
|
|
70035
|
-
|
|
70036
|
-
|
|
70037
|
-
|
|
70038
|
-
|
|
70039
|
-
|
|
70040
|
-
|
|
70041
|
-
|
|
70042
|
-
}
|
|
70043
|
-
|
|
70044
|
-
langwatchConnectCallback: { machineOnly: "LangWatch's OAuth callback, a browser redirect" }
|
|
70045
|
-
}
|
|
70046
|
-
);
|
|
70116
|
+
var langwatchSurfaces = defineSurfaces(langwatchTrpc, {
|
|
70117
|
+
integration: { rest: "langwatchStatus", cli: "langwatch status" },
|
|
70118
|
+
saveKey: { rest: "langwatchSetKey", cli: "langwatch set-key" },
|
|
70119
|
+
enable: { rest: "langwatchEnable", cli: "langwatch on" },
|
|
70120
|
+
disable: { rest: "langwatchDisable", cli: "langwatch off" },
|
|
70121
|
+
setLevel: { rest: "langwatchLevel", cli: "langwatch level" },
|
|
70122
|
+
test: { rest: "langwatchTest", cli: "langwatch test" },
|
|
70123
|
+
remove: { rest: "langwatchRemove", cli: "langwatch remove" },
|
|
70124
|
+
connectStart: { rest: "langwatchConnect", cli: "langwatch connect" },
|
|
70125
|
+
connectPoll: { rest: "langwatchConnectPoll", cli: "langwatch connect" },
|
|
70126
|
+
connectCancel: { rest: "langwatchConnectCancel", cli: "langwatch connect" },
|
|
70127
|
+
setMine: { rest: "langwatchMine", cli: "langwatch mine" }
|
|
70128
|
+
});
|
|
70047
70129
|
|
|
70048
70130
|
// ../../modules/agent/contract/src/agent-langwatch.ts
|
|
70049
70131
|
var agentRefSchema4 = external_exports.string().trim().min(1).max(80);
|
|
70050
70132
|
var workspaceIdSchema6 = external_exports.string().min(1);
|
|
70051
70133
|
var idSchema10 = external_exports.string().min(1).max(80);
|
|
70052
70134
|
var choiceShape = {
|
|
70053
|
-
/**
|
|
70135
|
+
/** Deprecated: true sets full (owner only), false sets metadata. Use `level`. */
|
|
70054
70136
|
optIn: external_exports.boolean().optional(),
|
|
70055
|
-
/** The agent's own level, or `follow` for
|
|
70137
|
+
/** The agent's own level, or `follow` for its default. */
|
|
70056
70138
|
level: external_exports.union([langwatchAgentLevelSchema, external_exports.literal("follow")]).optional()
|
|
70057
70139
|
};
|
|
70058
70140
|
var agentTelemetryInputSchemaDefinition = external_exports.object({
|
|
@@ -70077,6 +70159,10 @@ var setAgentLangwatchAsCallerInputSchemaDefinition = external_exports.object({
|
|
|
70077
70159
|
...choiceShape
|
|
70078
70160
|
});
|
|
70079
70161
|
var agentLangwatchTracingSchema = langwatchAgentTracingSchema;
|
|
70162
|
+
var agentLangwatchListInputSchemaDefinition = external_exports.object({ workspaceId: workspaceIdSchema6 });
|
|
70163
|
+
var agentLangwatchListInputSchema = agentLangwatchListInputSchemaDefinition;
|
|
70164
|
+
var agentLangwatchRowsSchemaDefinition = external_exports.array(langwatchAgentRowSchema);
|
|
70165
|
+
var agentLangwatchRowsSchema = agentLangwatchRowsSchemaDefinition;
|
|
70080
70166
|
|
|
70081
70167
|
// ../../modules/agent/contract/src/agent-lifecycle.ts
|
|
70082
70168
|
var workspaceIdSchema7 = external_exports.string().min(1);
|
|
@@ -70415,6 +70501,8 @@ var loginPoolSchemaDefinition = external_exports.object({
|
|
|
70415
70501
|
contributedByName: external_exports.string(),
|
|
70416
70502
|
/** Whether an agent runs on it now. */
|
|
70417
70503
|
inUse: external_exports.boolean(),
|
|
70504
|
+
/** How many of the pool's agents run on it now. */
|
|
70505
|
+
agentsOnIt: external_exports.number().int().nonnegative().optional(),
|
|
70418
70506
|
usedPercent: external_exports.number().nullable(),
|
|
70419
70507
|
resetsAt: external_exports.iso.datetime().nullable(),
|
|
70420
70508
|
limitedUntil: external_exports.iso.datetime().nullable(),
|
|
@@ -71028,6 +71116,56 @@ var agentTransferResolvedPayloadSchemaDefinition = external_exports.object({
|
|
|
71028
71116
|
resolvedByUserId: external_exports.string().min(1)
|
|
71029
71117
|
});
|
|
71030
71118
|
|
|
71119
|
+
// ../../modules/agent/contract/src/agent-usage-activity.ts
|
|
71120
|
+
var usageHarnessSchema = external_exports.enum(["claude-code", "codex", "laze-models"]);
|
|
71121
|
+
var agentUsageActivityInputDefinition = external_exports.object({
|
|
71122
|
+
workspaceId: external_exports.string().min(1),
|
|
71123
|
+
/** The period's start; the browser takes it from the credits report or the days it covers. */
|
|
71124
|
+
from: external_exports.iso.datetime(),
|
|
71125
|
+
/** The period's end; now when absent. */
|
|
71126
|
+
to: external_exports.iso.datetime().optional()
|
|
71127
|
+
});
|
|
71128
|
+
var agentUsageActivityInputSchema = agentUsageActivityInputDefinition;
|
|
71129
|
+
var agentUsageActivityQueryDefinition = agentUsageActivityInputDefinition.omit({
|
|
71130
|
+
workspaceId: true
|
|
71131
|
+
});
|
|
71132
|
+
var agentUsageActivityRowDefinition = external_exports.object({
|
|
71133
|
+
agentId: external_exports.string(),
|
|
71134
|
+
/** Its current name, or the last one for a removed agent; null once it is deleted. */
|
|
71135
|
+
name: external_exports.string().nullable(),
|
|
71136
|
+
kind: external_exports.enum(["personal", "team"]).nullable(),
|
|
71137
|
+
/** The owner of a personal agent; null for a team or deleted one. */
|
|
71138
|
+
ownerName: external_exports.string().nullable(),
|
|
71139
|
+
removed: external_exports.boolean(),
|
|
71140
|
+
/** The harness of its newest turn in the period. */
|
|
71141
|
+
harness: usageHarnessSchema,
|
|
71142
|
+
turns: external_exports.number().int().nonnegative(),
|
|
71143
|
+
failedTurns: external_exports.number().int().nonnegative(),
|
|
71144
|
+
inputTokens: external_exports.number().int().nonnegative(),
|
|
71145
|
+
outputTokens: external_exports.number().int().nonnegative()
|
|
71146
|
+
});
|
|
71147
|
+
var loginShareDefinition = external_exports.object({
|
|
71148
|
+
/** The login's vault connection id, as the login lists name it. */
|
|
71149
|
+
loginId: external_exports.string(),
|
|
71150
|
+
/** The agents that spent its tokens, most first; percents are whole and of this login. */
|
|
71151
|
+
agents: external_exports.array(
|
|
71152
|
+
external_exports.object({
|
|
71153
|
+
agentId: external_exports.string(),
|
|
71154
|
+
name: external_exports.string().nullable(),
|
|
71155
|
+
tokens: external_exports.number().int().nonnegative(),
|
|
71156
|
+
percent: external_exports.number().int().min(0).max(100)
|
|
71157
|
+
})
|
|
71158
|
+
)
|
|
71159
|
+
});
|
|
71160
|
+
var agentUsageActivityDefinition = external_exports.object({
|
|
71161
|
+
workspaceId: external_exports.string(),
|
|
71162
|
+
from: external_exports.iso.datetime(),
|
|
71163
|
+
to: external_exports.iso.datetime(),
|
|
71164
|
+
agents: external_exports.array(agentUsageActivityRowDefinition),
|
|
71165
|
+
logins: external_exports.array(loginShareDefinition)
|
|
71166
|
+
});
|
|
71167
|
+
var agentUsageActivitySchema = agentUsageActivityDefinition;
|
|
71168
|
+
|
|
71031
71169
|
// ../../modules/agent/contract/src/agent-welcome.ts
|
|
71032
71170
|
var pressWelcomeInputSchemaDefinition = external_exports.object({
|
|
71033
71171
|
workspaceId: external_exports.string().min(1),
|
|
@@ -71694,7 +71832,7 @@ var agentLoginTroubleTrpc = defineTrpcContract("agents").mutation("replaceHarnes
|
|
|
71694
71832
|
var agentWorkspaceDefaultTrpc = defineTrpcContract("agents").query("workspaceDefault").withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).withOutput(workspaceDefaultAgentSchema).mutation("setWorkspaceDefault").withInput(setWorkspaceDefaultAgentInputSchema).withOutput(workspaceDefaultAgentSchema).build();
|
|
71695
71833
|
var agentRuntimeChoiceTrpc = defineTrpcContract("agents").query("setup").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema19 })).withOutput(agentSetupReadingSchema).mutation("retrySetup").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema19 })).withOutput(agentSchema).query("lastRuntime").withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).withOutput(lastRuntimeSchema).build();
|
|
71696
71834
|
var agentArchiveTrpc = defineTrpcContract("agents").query("archived").withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).withOutput(external_exports.array(archivedAgentSchema)).mutation("restore").withInput(restoreAgentInputSchema).withOutput(agentSchema).mutation("copy").withInput(copyAgentInputSchema).withOutput(agentSchema).mutation("deleteArchived").withInput(restoreAgentInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).query("transferOffers").withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).withOutput(external_exports.array(agentTransferOfferSchema)).mutation("acceptTransfer").withInput(agentTransferInputSchema).withOutput(agentSchema).mutation("declineTransfer").withInput(agentTransferInputSchema).withOutput(external_exports.object({ declined: external_exports.literal(true) })).mutation("cancelTransfer").withInput(agentTransferInputSchema).withOutput(external_exports.object({ cancelled: external_exports.literal(true) })).build();
|
|
71697
|
-
var agentLangwatchTrpc = defineTrpcContract("agents").query("langwatchTracing").withInput(agentLangwatchInputSchema).withOutput(agentLangwatchTracingSchema).mutation("setLangwatchTracing").withInput(setAgentLangwatchInputSchema).withOutput(agentLangwatchTracingSchema).build();
|
|
71835
|
+
var agentLangwatchTrpc = defineTrpcContract("agents").query("langwatchTracing").withInput(agentLangwatchInputSchema).withOutput(agentLangwatchTracingSchema).mutation("setLangwatchTracing").withInput(setAgentLangwatchInputSchema).withOutput(agentLangwatchTracingSchema).query("langwatchAgents").withInput(agentLangwatchListInputSchema).withOutput(agentLangwatchRowsSchema).build();
|
|
71698
71836
|
var agentPoolModelTrpc = defineTrpcContract("agents").mutation("setLoginPoolModel").withInput(setLoginPoolModelInputSchema).withOutput(loginPoolsSchema).build();
|
|
71699
71837
|
var agentRunsOnTrpc = defineTrpcContract("agents").mutation("setRunsOn").withInput(setRunsOnInputSchema).withOutput(agentSchema).build();
|
|
71700
71838
|
var agentWelcomeTrpc = defineTrpcContract("agents").mutation("pressWelcome").withInput(pressWelcomeInputSchema).withOutput(pressedWelcomeSchema).mutation("pressCollab").withInput(pressCollabInputSchema).withOutput(pressedCollabSchema).build();
|
|
@@ -71702,12 +71840,14 @@ var agentPoolGroupTrpc = defineTrpcContract("agents").mutation("addPoolGroup").w
|
|
|
71702
71840
|
var agentOpenConversationTrpc = defineTrpcContract("agents").mutation("openConversation").withInput(openConversationInputSchema).withOutput(external_exports.object({ channelId: idSchema19 })).build();
|
|
71703
71841
|
var agentConversationCloseTrpc = defineTrpcContract("agents").mutation("closeConversation").withInput(conversationInputSchema).withOutput(conversationSummarySchema2).mutation("reopenConversation").withInput(conversationInputSchema).withOutput(conversationSummarySchema2).mutation("convertConversation").withInput(convertConversationInputSchema).withOutput(convertedConversationSchema).build();
|
|
71704
71842
|
var agentShareRequestTrpc = defineTrpcContract("agents").mutation("askShare").withInput(askAgentShareInputSchema).withOutput(agentAccessSchema).mutation("cancelShareAsk").withInput(cancelAgentShareAskInputSchema).withOutput(agentAccessSchema).build();
|
|
71843
|
+
var agentUsageActivityTrpc = defineTrpcContract("agents").query("usageActivity").withInput(agentUsageActivityInputSchema).withOutput(agentUsageActivitySchema).build();
|
|
71705
71844
|
var agentReconnectTrpc = defineTrpcContract("agents").query("reconnect").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema19 })).withOutput(agentReconnectSchema).build();
|
|
71706
71845
|
var agentTrpc = joinTrpcContracts(
|
|
71707
71846
|
"agents",
|
|
71708
71847
|
agentCoreTrpc,
|
|
71709
71848
|
agentPoolGroupTrpc,
|
|
71710
71849
|
agentReconnectTrpc,
|
|
71850
|
+
agentUsageActivityTrpc,
|
|
71711
71851
|
agentShareRequestTrpc,
|
|
71712
71852
|
agentOpenConversationTrpc,
|
|
71713
71853
|
agentConversationCloseTrpc,
|
|
@@ -71863,7 +72003,15 @@ var agentTurnEndedPayloadSchemaDefinition = external_exports.object({
|
|
|
71863
72003
|
/** What the session said when the turn failed. */
|
|
71864
72004
|
reason: external_exports.string().max(500).optional(),
|
|
71865
72005
|
/** The failure's kind (`model_error`, `model_key_denied`...); one kind makes one streak. */
|
|
71866
|
-
code: external_exports.string().max(80).optional()
|
|
72006
|
+
code: external_exports.string().max(80).optional(),
|
|
72007
|
+
/** When the turn ended; absent on older facts. */
|
|
72008
|
+
endedAt: external_exports.iso.datetime().optional(),
|
|
72009
|
+
/** How long the turn ran, when its supervisor said. */
|
|
72010
|
+
durationMs: external_exports.number().int().nonnegative().optional(),
|
|
72011
|
+
/** The agent's harness, hosting and owner when the turn ended; absent on older facts. */
|
|
72012
|
+
harness: external_exports.string().max(40).optional(),
|
|
72013
|
+
hosting: external_exports.string().max(40).optional(),
|
|
72014
|
+
ownerUserId: external_exports.string().max(80).optional()
|
|
71867
72015
|
});
|
|
71868
72016
|
var agentTurnFailuresStateSchemaDefinition = external_exports.object({
|
|
71869
72017
|
workspaceId: external_exports.string(),
|
|
@@ -73320,9 +73468,9 @@ function serverUrlOf({ context, args }) {
|
|
|
73320
73468
|
// src/services/agent-access-commands.service.ts
|
|
73321
73469
|
var SHARE_USAGE = "Usage: laze agent share <agent> --person <userId> | --group <groupId> | --agent <agent>\n laze agent share <agent> --ask --person <userId> [--agent <agent> ...]\n laze agent unshare <agent> --person <userId> | --group <groupId> | --channel <channelId> | --agent <agent>";
|
|
73322
73470
|
var CHANNEL_SHARE_GONE = "An agent joins a channel from the channel: laze channel add <channel> <agent>";
|
|
73323
|
-
function agentWord({ args, usage }) {
|
|
73471
|
+
function agentWord({ args, usage: usage2 }) {
|
|
73324
73472
|
const agent3 = args.words[2];
|
|
73325
|
-
if (!agent3) throw new CliUsageError(
|
|
73473
|
+
if (!agent3) throw new CliUsageError(usage2);
|
|
73326
73474
|
return agent3;
|
|
73327
73475
|
}
|
|
73328
73476
|
function printAccess({ context, args, access }) {
|
|
@@ -73331,14 +73479,14 @@ function printAccess({ context, args, access }) {
|
|
|
73331
73479
|
const people2 = access.people.map((person) => person.userId).join(", ") || "no one";
|
|
73332
73480
|
const channels3 = access.channels.map((channel) => `#${channel.name}`).join(", ") || "none";
|
|
73333
73481
|
const groups2 = (access.groups ?? []).map((group) => `@${group.name}`).join(", ") || "none";
|
|
73334
|
-
const
|
|
73482
|
+
const agents2 = (access.agents ?? []).map((agent3) => agent3.name).join(", ") || "none";
|
|
73335
73483
|
const addedTo = (access.addedTo ?? []).map((agent3) => agent3.name).join(", ") || "none";
|
|
73336
73484
|
context.out(
|
|
73337
73485
|
`${access.kind} agent, owned by ${access.ownerUserId}
|
|
73338
73486
|
People: ${people2}
|
|
73339
73487
|
Groups: ${groups2}
|
|
73340
73488
|
Channels: ${channels3}
|
|
73341
|
-
Agents: ${
|
|
73489
|
+
Agents: ${agents2}
|
|
73342
73490
|
Can DM: ${addedTo}
|
|
73343
73491
|
`
|
|
73344
73492
|
);
|
|
@@ -73437,21 +73585,21 @@ async function openAgentDirect({ context, args }) {
|
|
|
73437
73585
|
`);
|
|
73438
73586
|
}
|
|
73439
73587
|
async function stopAgentTurn({ context, args }) {
|
|
73440
|
-
const
|
|
73441
|
-
const agent3 = agentWord({ args, usage });
|
|
73588
|
+
const usage2 = "Usage: laze agent stop <agent> --channel <channelId>";
|
|
73589
|
+
const agent3 = agentWord({ args, usage: usage2 });
|
|
73442
73590
|
const channelId = flagText({ args, name: "channel" });
|
|
73443
|
-
if (!channelId) throw new CliUsageError(
|
|
73591
|
+
if (!channelId) throw new CliUsageError(usage2);
|
|
73444
73592
|
const { client } = await signedIn({ context, args });
|
|
73445
73593
|
await client.post("/api/agents/stop", { agent: agent3, channelId });
|
|
73446
73594
|
context.out(`Stopped ${agent3}'s turn.
|
|
73447
73595
|
`);
|
|
73448
73596
|
}
|
|
73449
73597
|
async function retryAgentTurn({ context, args }) {
|
|
73450
|
-
const
|
|
73451
|
-
const agent3 = agentWord({ args, usage });
|
|
73598
|
+
const usage2 = "Usage: laze agent retry <agent> --channel <channelId> --message <messageId>";
|
|
73599
|
+
const agent3 = agentWord({ args, usage: usage2 });
|
|
73452
73600
|
const channelId = flagText({ args, name: "channel" });
|
|
73453
73601
|
const messageId = flagText({ args, name: "message" });
|
|
73454
|
-
if (!channelId || !messageId) throw new CliUsageError(
|
|
73602
|
+
if (!channelId || !messageId) throw new CliUsageError(usage2);
|
|
73455
73603
|
const { client } = await signedIn({ context, args });
|
|
73456
73604
|
await client.post("/api/agents/retry", { agent: agent3, channelId, messageId });
|
|
73457
73605
|
context.out(`Sent the message to ${agent3} again.
|
|
@@ -73488,6 +73636,65 @@ ${link2.prompt}
|
|
|
73488
73636
|
);
|
|
73489
73637
|
}
|
|
73490
73638
|
|
|
73639
|
+
// src/services/agent-activity-commands.service.ts
|
|
73640
|
+
var AGENTS_ACTIVITY_USAGE = `Usage:
|
|
73641
|
+
laze agents activity [--period 7d|30d|period] turns, failures and tokens per agent, most tokens first (default: this billing period)
|
|
73642
|
+
`;
|
|
73643
|
+
var DAYS = { "7d": 7, "30d": 30 };
|
|
73644
|
+
var RUNS_ON = {
|
|
73645
|
+
"claude-code": "Claude Code",
|
|
73646
|
+
codex: "Codex",
|
|
73647
|
+
"laze-models": "Laze credits"
|
|
73648
|
+
};
|
|
73649
|
+
async function periodStartOf({
|
|
73650
|
+
client,
|
|
73651
|
+
now
|
|
73652
|
+
}) {
|
|
73653
|
+
try {
|
|
73654
|
+
const report3 = await client.get(
|
|
73655
|
+
"/api/billing-account/usage?period=billing_period"
|
|
73656
|
+
);
|
|
73657
|
+
return report3.from;
|
|
73658
|
+
} catch {
|
|
73659
|
+
const day2 = now.toZonedDateTimeISO("UTC");
|
|
73660
|
+
return Temporal3.PlainDateTime.from({ year: day2.year, month: day2.month, day: 1 }).toZonedDateTime("UTC").toInstant().toString();
|
|
73661
|
+
}
|
|
73662
|
+
}
|
|
73663
|
+
async function agentsActivity({ context, args }) {
|
|
73664
|
+
const { client } = await signedIn({ context, args });
|
|
73665
|
+
const asked = flagText({ args, name: "period", fallback: "period" });
|
|
73666
|
+
const days = DAYS[asked];
|
|
73667
|
+
if (!days && asked !== "period") {
|
|
73668
|
+
throw new CliUsageError(`--period takes 7d, 30d or period.
|
|
73669
|
+
${AGENTS_ACTIVITY_USAGE}`);
|
|
73670
|
+
}
|
|
73671
|
+
const now = nowInstant();
|
|
73672
|
+
const from = days ? now.subtract({ hours: 24 * days }).toString() : await periodStartOf({ client, now });
|
|
73673
|
+
const activity2 = await client.get(
|
|
73674
|
+
`/api/agents/usage-activity?from=${encodeURIComponent(from)}`
|
|
73675
|
+
);
|
|
73676
|
+
if (args.flags.json) {
|
|
73677
|
+
context.out(`${JSON.stringify(activity2, null, 2)}
|
|
73678
|
+
`);
|
|
73679
|
+
return;
|
|
73680
|
+
}
|
|
73681
|
+
context.out(`Agent activity ${activity2.from.slice(0, 10)} to ${activity2.to.slice(0, 10)}
|
|
73682
|
+
`);
|
|
73683
|
+
if (activity2.agents.length === 0) {
|
|
73684
|
+
context.out("No agent turns in this period.\n");
|
|
73685
|
+
return;
|
|
73686
|
+
}
|
|
73687
|
+
activity2.agents.forEach((row, index) => {
|
|
73688
|
+
const name3 = row.name ?? "Deleted agent";
|
|
73689
|
+
const removed = row.removed ? " (removed)" : "";
|
|
73690
|
+
const tokens = (row.inputTokens + row.outputTokens).toLocaleString("en-GB");
|
|
73691
|
+
context.out(
|
|
73692
|
+
`${index + 1}. ${name3}${removed} on ${RUNS_ON[row.harness]}: ${row.turns} turns, ${row.failedTurns} failed, ${tokens} tokens
|
|
73693
|
+
`
|
|
73694
|
+
);
|
|
73695
|
+
});
|
|
73696
|
+
}
|
|
73697
|
+
|
|
73491
73698
|
// src/services/agent-archive-commands.service.ts
|
|
73492
73699
|
var RESTORE_USAGE = "Usage: laze agent restore <agent>";
|
|
73493
73700
|
var DELETE_USAGE = "Usage: laze agent delete <agent>";
|
|
@@ -73835,10 +74042,10 @@ function compactionOf({
|
|
|
73835
74042
|
}
|
|
73836
74043
|
function usageOf({ entry: entry2 }) {
|
|
73837
74044
|
const message2 = record2(entry2.message);
|
|
73838
|
-
const
|
|
73839
|
-
const input2 = count7(
|
|
74045
|
+
const usage2 = record2(message2.usage);
|
|
74046
|
+
const input2 = count7(usage2.input_tokens);
|
|
73840
74047
|
if (input2 === void 0) return void 0;
|
|
73841
|
-
const cached2 = (count7(
|
|
74048
|
+
const cached2 = (count7(usage2.cache_read_input_tokens) ?? 0) + (count7(usage2.cache_creation_input_tokens) ?? 0);
|
|
73842
74049
|
return {
|
|
73843
74050
|
tokens: input2 + cached2,
|
|
73844
74051
|
...typeof message2.model === "string" ? { model: message2.model } : {}
|
|
@@ -73857,10 +74064,10 @@ function readTranscript({ lines: lines2 }) {
|
|
|
73857
74064
|
contextTokens = compaction.tokensAfter ?? contextTokens;
|
|
73858
74065
|
continue;
|
|
73859
74066
|
}
|
|
73860
|
-
const
|
|
73861
|
-
if (!
|
|
73862
|
-
contextTokens =
|
|
73863
|
-
if (
|
|
74067
|
+
const usage2 = entry2.type === "assistant" ? usageOf({ entry: entry2 }) : void 0;
|
|
74068
|
+
if (!usage2) continue;
|
|
74069
|
+
contextTokens = usage2.tokens;
|
|
74070
|
+
if (usage2.model) contextWindow = contextWindowOf({ model: usage2.model });
|
|
73864
74071
|
}
|
|
73865
74072
|
return { contextTokens, contextWindow, compactions };
|
|
73866
74073
|
}
|
|
@@ -74160,7 +74367,13 @@ var slackExternalPeopleSchemaDefinition = external_exports.object({
|
|
|
74160
74367
|
});
|
|
74161
74368
|
var slackExternalPeopleSchema = slackExternalPeopleSchemaDefinition;
|
|
74162
74369
|
var slackChannelPeopleSchemaDefinition = external_exports.object({
|
|
74163
|
-
people: external_exports.array(
|
|
74370
|
+
people: external_exports.array(
|
|
74371
|
+
external_exports.object({
|
|
74372
|
+
...slackExternalPersonSchemaDefinition.shape,
|
|
74373
|
+
/** Their Slack workspace when it is not the connected one, as in Slack Connect. */
|
|
74374
|
+
company: slackCompanySchemaDefinition.nullable().optional()
|
|
74375
|
+
})
|
|
74376
|
+
)
|
|
74164
74377
|
});
|
|
74165
74378
|
var slackChannelPeopleSchema = slackChannelPeopleSchemaDefinition;
|
|
74166
74379
|
var slackExternalPeopleCountsInputSchemaDefinition = external_exports.object({
|
|
@@ -74537,6 +74750,8 @@ var slackHistoryMessageSchemaDefinition = external_exports.object({
|
|
|
74537
74750
|
authorAvatarUrl: external_exports.string().nullable(),
|
|
74538
74751
|
/** The Laze person behind the Slack account when linked. */
|
|
74539
74752
|
authorUserId: external_exports.string().nullable(),
|
|
74753
|
+
/** The Slack author's external id, such as `slack:T1:U1`, for their profile card; else null. */
|
|
74754
|
+
authorExternalId: external_exports.string().nullable().default(null),
|
|
74540
74755
|
/** Laze markdown, linked people as mentions. */
|
|
74541
74756
|
body: external_exports.string(),
|
|
74542
74757
|
replyCount: external_exports.number().int().nonnegative(),
|
|
@@ -74598,6 +74813,8 @@ var slackSearchHitSchemaDefinition = external_exports.object({
|
|
|
74598
74813
|
authorAvatarUrl: external_exports.string().nullable(),
|
|
74599
74814
|
/** The Laze person behind the Slack account when linked. */
|
|
74600
74815
|
authorUserId: external_exports.string().nullable(),
|
|
74816
|
+
/** The Slack author's external id, such as `slack:T1:U1`, for their profile card; else null. */
|
|
74817
|
+
authorExternalId: external_exports.string().nullable().default(null),
|
|
74601
74818
|
/** Laze markdown, linked people as mentions. */
|
|
74602
74819
|
body: external_exports.string(),
|
|
74603
74820
|
/** Where the message opens in Slack. */
|
|
@@ -74812,6 +75029,24 @@ function waitsForLinesOf({ posted }) {
|
|
|
74812
75029
|
}).join("");
|
|
74813
75030
|
}
|
|
74814
75031
|
|
|
75032
|
+
// src/rules/promise-reminder.rules.ts
|
|
75033
|
+
var PROMISE = /\b(?:i['’]ll|i will|i['’]m going to|i am going to|we['’]ll|let me get back|get back to you|working on it|on it|starting (?:on it |it )?now)\b|\bback (?:in (?:about |around |~)?\d+\s*(?:min|minutes|mins|h|hours?)|shortly|soon|later)\b/i;
|
|
75034
|
+
function ownWordsOf(text3) {
|
|
75035
|
+
return text3.replace(/```[\s\S]*?```/g, " ").split("\n").filter((line) => !line.trimStart().startsWith(">")).join("\n");
|
|
75036
|
+
}
|
|
75037
|
+
function promisesLaterWork({ text: text3 }) {
|
|
75038
|
+
return PROMISE.test(ownWordsOf(text3));
|
|
75039
|
+
}
|
|
75040
|
+
function promiseReminderOf({ text: text3 }) {
|
|
75041
|
+
if (!promisesLaterWork({ text: text3 })) return "";
|
|
75042
|
+
return [
|
|
75043
|
+
"You promised work in that message. Nothing runs after your turn ends and nothing wakes you",
|
|
75044
|
+
"for it, so do the work now in this turn and post the result when it is done, or set a",
|
|
75045
|
+
"`laze schedule` for it, or say plainly that it waits on someone. You cannot see the clock,",
|
|
75046
|
+
"so never promise a time: say what you will do, then do it.\n"
|
|
75047
|
+
].join(" ");
|
|
75048
|
+
}
|
|
75049
|
+
|
|
74815
75050
|
// src/rules/search-format.rules.ts
|
|
74816
75051
|
var SNIPPET_CHARACTERS = 160;
|
|
74817
75052
|
var TOKEN = /<@(person|agent):([A-Za-z0-9_-]+)>|<!(channel|here)>|<#([A-Za-z0-9_-]{1,64})>/g;
|
|
@@ -75365,8 +75600,8 @@ async function takeOverHere({
|
|
|
75365
75600
|
if (!session || !meta3.session || meta3.host !== session.host) return false;
|
|
75366
75601
|
const sessions = (await context.store.read()).sessions ?? {};
|
|
75367
75602
|
const theirs = sessions[meta3.session];
|
|
75368
|
-
const
|
|
75369
|
-
const stale =
|
|
75603
|
+
const mine5 = sessions[sessionKeyOf({ session })] === profile;
|
|
75604
|
+
const stale = mine5 && theirs !== void 0 && theirs !== profile;
|
|
75370
75605
|
const claudePid = (await nearestHarnessOf({ context }))?.pid;
|
|
75371
75606
|
if (!stale && await liveElsewhere({ context, key: meta3.session, claudePid })) return false;
|
|
75372
75607
|
await forSession({ client, session }).post("/api/agents/me/bind", {});
|
|
@@ -75831,13 +76066,13 @@ function formatScheduled({ list: list13 }) {
|
|
|
75831
76066
|
// src/services/scheduled-commands.service.ts
|
|
75832
76067
|
function scheduleAtOf({
|
|
75833
76068
|
args,
|
|
75834
|
-
usage
|
|
76069
|
+
usage: usage2
|
|
75835
76070
|
}) {
|
|
75836
76071
|
if (args.flags.at === void 0 && args.flags.tz === void 0) return null;
|
|
75837
76072
|
const at8 = flagText({ args, name: "at" });
|
|
75838
76073
|
const timeZone = flagText({ args, name: "tz" }) || currentTimeZone();
|
|
75839
76074
|
const sendAt = at8 ? sendAtOf({ at: at8, timeZone }) : null;
|
|
75840
|
-
if (!sendAt) throw new CliUsageError(`${
|
|
76075
|
+
if (!sendAt) throw new CliUsageError(`${usage2}
|
|
75841
76076
|
${AT_USAGE}`);
|
|
75842
76077
|
return { sendAt, timeZone };
|
|
75843
76078
|
}
|
|
@@ -76150,6 +76385,7 @@ async function post({
|
|
|
76150
76385
|
context.out(linkLineOf({ url: posted.url, base: client.baseUrl }));
|
|
76151
76386
|
context.out(notInChannelLineOf({ posted, channel }));
|
|
76152
76387
|
context.out(waitsForLinesOf({ posted }));
|
|
76388
|
+
context.out(promiseReminderOf({ text: body }));
|
|
76153
76389
|
return void 0;
|
|
76154
76390
|
}
|
|
76155
76391
|
async function reply({
|
|
@@ -76192,6 +76428,7 @@ async function reply({
|
|
|
76192
76428
|
context.out(linkLineOf({ url: posted.url, base: client.baseUrl }));
|
|
76193
76429
|
context.out(notInChannelLineOf({ posted, channel: channel ?? "the channel" }));
|
|
76194
76430
|
context.out(waitsForLinesOf({ posted }));
|
|
76431
|
+
context.out(promiseReminderOf({ text: body }));
|
|
76195
76432
|
return void 0;
|
|
76196
76433
|
}
|
|
76197
76434
|
async function receiveMessages({
|
|
@@ -77630,8 +77867,8 @@ async function waiterOf({
|
|
|
77630
77867
|
}) {
|
|
77631
77868
|
const lock = statePathOf({ context, kind: "waiters", profile });
|
|
77632
77869
|
const waiter = await jsonOf(lock);
|
|
77633
|
-
const
|
|
77634
|
-
return waiter &&
|
|
77870
|
+
const mine5 = waiter?.sessionId === key.slice(key.indexOf(":") + 1);
|
|
77871
|
+
return waiter && mine5 && context.processes.alive(waiter.pid) ? waiter.pid : void 0;
|
|
77635
77872
|
}
|
|
77636
77873
|
async function rearmRushGuards({ context }) {
|
|
77637
77874
|
let started = 0;
|
|
@@ -78350,8 +78587,8 @@ async function takeLock({
|
|
|
78350
78587
|
const self2 = context.processes.pid;
|
|
78351
78588
|
if (holder && holder.pid !== self2 && context.processes.alive(holder.pid)) {
|
|
78352
78589
|
const served = await holderClaudeOf({ context, holder });
|
|
78353
|
-
const
|
|
78354
|
-
if (served && context.processes.alive(served) && !
|
|
78590
|
+
const mine5 = preempt && served === claudePid && !holder.monitor;
|
|
78591
|
+
if (served && context.processes.alive(served) && !mine5) return false;
|
|
78355
78592
|
context.processes.stop(holder.pid);
|
|
78356
78593
|
}
|
|
78357
78594
|
const value = {
|
|
@@ -78639,10 +78876,10 @@ function absorbTurnEvent({ result: result2, message: message2 }) {
|
|
|
78639
78876
|
return;
|
|
78640
78877
|
}
|
|
78641
78878
|
if (message2.method !== "thread/tokenUsage/updated") return;
|
|
78642
|
-
const
|
|
78643
|
-
const total = record3(
|
|
78879
|
+
const usage2 = record3(params.tokenUsage);
|
|
78880
|
+
const total = record3(usage2.last).totalTokens;
|
|
78644
78881
|
if (typeof total === "number") result2.contextTokens = total;
|
|
78645
|
-
const window2 =
|
|
78882
|
+
const window2 = usage2.modelContextWindow;
|
|
78646
78883
|
if (typeof window2 === "number" && window2 > 0) result2.contextWindow = window2;
|
|
78647
78884
|
}
|
|
78648
78885
|
var TURN_HEARTBEAT_MS = 1e4;
|
|
@@ -79730,9 +79967,9 @@ function lineOf(agent3) {
|
|
|
79730
79967
|
}
|
|
79731
79968
|
async function listAgents({ context, args }) {
|
|
79732
79969
|
const { client } = await signedIn({ context, args });
|
|
79733
|
-
const
|
|
79970
|
+
const agents2 = await client.get("/api/agents");
|
|
79734
79971
|
const wanted = args.words[2];
|
|
79735
|
-
const shown2 = wanted ?
|
|
79972
|
+
const shown2 = wanted ? agents2.filter((agent3) => agent3.id === wanted || agent3.name === wanted) : agents2;
|
|
79736
79973
|
if (wanted && shown2.length === 0) throw new CliUsageError(`No agent named ${wanted}.`);
|
|
79737
79974
|
if (args.flags.json) return context.out(`${JSON.stringify(shown2, null, 2)}
|
|
79738
79975
|
`);
|
|
@@ -79760,8 +79997,8 @@ async function showAgent({ context, args }) {
|
|
|
79760
79997
|
const wanted = args.words[2];
|
|
79761
79998
|
if (!wanted) throw new CliUsageError("Usage: laze agents show <agent> [--json]");
|
|
79762
79999
|
const { client, profile } = await signedIn({ context, args });
|
|
79763
|
-
const
|
|
79764
|
-
const agent3 =
|
|
80000
|
+
const agents2 = await client.get("/api/agents");
|
|
80001
|
+
const agent3 = agents2.find((one) => one.id === wanted || one.name === wanted);
|
|
79765
80002
|
if (!agent3) throw new CliUsageError(`No agent named ${wanted}.`);
|
|
79766
80003
|
const members3 = await client.get("/api/workspaces/current/members");
|
|
79767
80004
|
const nameOf2 = (userId) => members3.find((member) => member.userId === userId)?.name ?? "";
|
|
@@ -80177,8 +80414,8 @@ function formatLogins({ list: list13, nowMs: nowMs2 }) {
|
|
|
80177
80414
|
}
|
|
80178
80415
|
const lines2 = list13.logins.map((login2) => {
|
|
80179
80416
|
const state = login2.agentsOnIt > 0 ? `in use by ${login2.agentsOnIt} ${login2.agentsOnIt === 1 ? "agent" : "agents"}` : "ready";
|
|
80180
|
-
const
|
|
80181
|
-
let shown2 =
|
|
80417
|
+
const usage2 = usageOf2({ ...login2, nowMs: nowMs2 });
|
|
80418
|
+
let shown2 = usage2.startsWith("out of usage") ? usage2 : `${state}, ${usage2}`;
|
|
80182
80419
|
if (login2.state === "invalid") shown2 = INVALID2;
|
|
80183
80420
|
const line = `${HARNESS_NAMES2[login2.harness]} ${login2.name} (${shown2}) ${login2.id}`;
|
|
80184
80421
|
return login2.expiresSoon ? `${line}
|
|
@@ -80193,9 +80430,9 @@ function formatPool({ pool, nowMs: nowMs2 }) {
|
|
|
80193
80430
|
lines2.push(
|
|
80194
80431
|
pool.logins.length === 0 ? " Logins: none yet" : " Logins:",
|
|
80195
80432
|
...pool.logins.map((login2) => {
|
|
80196
|
-
const
|
|
80433
|
+
const usage2 = login2.invalid ? INVALID2 : usageOf2({ ...login2, nowMs: nowMs2 });
|
|
80197
80434
|
const use = login2.inUse && !login2.invalid ? "in use, " : "";
|
|
80198
|
-
const line = ` ${HARNESS_NAMES2[login2.harness]} ${login2.name} added by ${login2.contributedByName} (${use}${
|
|
80435
|
+
const line = ` ${HARNESS_NAMES2[login2.harness]} ${login2.name} added by ${login2.contributedByName} (${use}${usage2})`;
|
|
80199
80436
|
return login2.expiresSoon ? `${line}
|
|
80200
80437
|
${EXPIRES_SOON}` : line;
|
|
80201
80438
|
})
|
|
@@ -80269,12 +80506,12 @@ async function avatarOf({
|
|
|
80269
80506
|
context,
|
|
80270
80507
|
args,
|
|
80271
80508
|
client,
|
|
80272
|
-
usage
|
|
80509
|
+
usage: usage2
|
|
80273
80510
|
}) {
|
|
80274
80511
|
const path = flagText({ args, name: "avatar" });
|
|
80275
80512
|
if (args.flags["avatar-emoji"] !== void 0) {
|
|
80276
80513
|
const emoji4 = emojiAvatar(flagText({ args, name: "avatar-emoji" }).trim());
|
|
80277
|
-
if (path || !isEmojiAvatar(emoji4)) throw new CliUsageError(
|
|
80514
|
+
if (path || !isEmojiAvatar(emoji4)) throw new CliUsageError(usage2);
|
|
80278
80515
|
return emoji4;
|
|
80279
80516
|
}
|
|
80280
80517
|
if (!path) return void 0;
|
|
@@ -80626,7 +80863,7 @@ async function secretOnStdin({ context }) {
|
|
|
80626
80863
|
async function loginValueOf({
|
|
80627
80864
|
context,
|
|
80628
80865
|
args,
|
|
80629
|
-
usage
|
|
80866
|
+
usage: usage2
|
|
80630
80867
|
}) {
|
|
80631
80868
|
if (SECRET_FLAGS.some((flag2) => args.flags[flag2] !== void 0)) {
|
|
80632
80869
|
throw new CliUsageError(
|
|
@@ -80636,7 +80873,7 @@ async function loginValueOf({
|
|
|
80636
80873
|
const harness = flagText({ args, name: "harness" });
|
|
80637
80874
|
const name3 = flagText({ args, name: "name" }).trim();
|
|
80638
80875
|
const vaulted = args.flags["from-vault"];
|
|
80639
|
-
if (!LOGIN_HARNESSES.has(harness) || !name3 || vaulted === true) throw new CliUsageError(
|
|
80876
|
+
if (!LOGIN_HARNESSES.has(harness) || !name3 || vaulted === true) throw new CliUsageError(usage2);
|
|
80640
80877
|
const base = { harness, name: name3 };
|
|
80641
80878
|
if (typeof vaulted === "string" && vaulted.trim()) {
|
|
80642
80879
|
return { ...base, fromConnection: vaulted.trim() };
|
|
@@ -80975,9 +81212,9 @@ async function setAgentRunsOn({
|
|
|
80975
81212
|
}
|
|
80976
81213
|
const { client } = await signedIn({ context, args });
|
|
80977
81214
|
return refusing(context, async () => {
|
|
80978
|
-
const
|
|
81215
|
+
const agents2 = await client.get("/api/agents");
|
|
80979
81216
|
const wanted = agent3.toLowerCase();
|
|
80980
|
-
const before =
|
|
81217
|
+
const before = agents2.find((one) => one.id === agent3 || one.name.toLowerCase() === wanted);
|
|
80981
81218
|
const updated = await client.post(PATHS.setRunsOn, {
|
|
80982
81219
|
agentId: agent3,
|
|
80983
81220
|
harness,
|
|
@@ -81127,9 +81364,9 @@ function targetOf(migration) {
|
|
|
81127
81364
|
function modeLine(migration) {
|
|
81128
81365
|
return migration.mode === "resume" ? "Laze resumes that same session" : "Laze starts a fresh session from a summary of it";
|
|
81129
81366
|
}
|
|
81130
|
-
function agentOf({ args, usage }) {
|
|
81367
|
+
function agentOf({ args, usage: usage2 }) {
|
|
81131
81368
|
const agent3 = args.words[3] ?? "";
|
|
81132
|
-
if (!agent3) throw new CliUsageError(
|
|
81369
|
+
if (!agent3) throw new CliUsageError(usage2);
|
|
81133
81370
|
return agent3;
|
|
81134
81371
|
}
|
|
81135
81372
|
async function migrate({ context, args }) {
|
|
@@ -81434,10 +81671,10 @@ function askingAgentOf({
|
|
|
81434
81671
|
asked,
|
|
81435
81672
|
bound
|
|
81436
81673
|
}) {
|
|
81437
|
-
const
|
|
81674
|
+
const agents2 = Object.entries(config2.profiles).filter(([, one]) => one.kind === "agent");
|
|
81438
81675
|
const wanted = asked ?? bound;
|
|
81439
|
-
const named =
|
|
81440
|
-
return named.length > 0 || asked ? named :
|
|
81676
|
+
const named = agents2.filter(([name3]) => name3 === wanted);
|
|
81677
|
+
return named.length > 0 || asked ? named : agents2;
|
|
81441
81678
|
}
|
|
81442
81679
|
async function requestProfileOf({
|
|
81443
81680
|
context,
|
|
@@ -81450,19 +81687,19 @@ async function requestProfileOf({
|
|
|
81450
81687
|
const wanted = asked ? requestProfileNameOf({ profile: asked }) : bound && requestProfileNameOf({ profile: bound });
|
|
81451
81688
|
const found = requests2.find(([name3]) => name3 === wanted || name3 === asked) ?? (requests2.length === 1 && !asked ? requests2[0] : void 0);
|
|
81452
81689
|
if (found) return { name: found[0], profile: found[1] };
|
|
81453
|
-
const
|
|
81454
|
-
const [only, other] =
|
|
81690
|
+
const agents2 = askingAgentOf({ config: config2, asked, bound });
|
|
81691
|
+
const [only, other] = agents2;
|
|
81455
81692
|
if (only && !other) {
|
|
81456
81693
|
const profile = await mintedRequestProfile({ context, name: only[0], agent: only[1] });
|
|
81457
81694
|
return { name: requestProfileNameOf({ profile: only[0] }), profile };
|
|
81458
81695
|
}
|
|
81459
|
-
if (
|
|
81696
|
+
if (agents2.length === 0) {
|
|
81460
81697
|
throw new CliUsageError(
|
|
81461
81698
|
"No agent on this machine to ask with: run `laze agent link` from a session first."
|
|
81462
81699
|
);
|
|
81463
81700
|
}
|
|
81464
81701
|
throw new CliUsageError(
|
|
81465
|
-
`Several agents are linked here; pass --from <profile>: ${
|
|
81702
|
+
`Several agents are linked here; pass --from <profile>: ${agents2.map(([name3]) => name3).join(", ")}`
|
|
81466
81703
|
);
|
|
81467
81704
|
}
|
|
81468
81705
|
async function renewedRequestProfile({
|
|
@@ -84326,11 +84563,11 @@ ${asset.path}
|
|
|
84326
84563
|
async function list({ context, args, open: openApp }) {
|
|
84327
84564
|
const { client, appId, name: name3 } = await openApp();
|
|
84328
84565
|
const answer6 = await client.post("/api/apps/assets/list", { appId });
|
|
84329
|
-
const { usage } = answer6;
|
|
84566
|
+
const { usage: usage2 } = answer6;
|
|
84330
84567
|
const lines2 = answer6.assets.map(
|
|
84331
84568
|
(asset) => ` ${asset.path} ${sizeText(asset.sizeBytes)} ${asset.status}${asset.unreferencedSince ? ", no version uses it" : ""} ${asset.fileName}`
|
|
84332
84569
|
);
|
|
84333
|
-
const head = `${name3}: ${sizeText(
|
|
84570
|
+
const head = `${name3}: ${sizeText(usage2.appBytes)} of ${sizeText(usage2.appMaxBytes)} asset storage (workspace ${sizeText(usage2.workspaceBytes)} of ${sizeText(usage2.workspaceMaxBytes)})`;
|
|
84334
84571
|
const text3 = lines2.length === 0 ? `${head}
|
|
84335
84572
|
No assets yet: laze app asset add <file>
|
|
84336
84573
|
` : `${head}
|
|
@@ -85228,10 +85465,10 @@ function print2({
|
|
|
85228
85465
|
context.out(args.flags.json ? `${JSON.stringify(value, null, 2)}
|
|
85229
85466
|
` : text3);
|
|
85230
85467
|
}
|
|
85231
|
-
function appAndWord({ args, usage }) {
|
|
85468
|
+
function appAndWord({ args, usage: usage2 }) {
|
|
85232
85469
|
const words = args.words.slice(2);
|
|
85233
85470
|
const [app2, word3] = words.length >= 2 ? words : [void 0, ...words];
|
|
85234
|
-
if (!word3) throw new CliUsageError(
|
|
85471
|
+
if (!word3) throw new CliUsageError(usage2);
|
|
85235
85472
|
return { app: app2, word: word3 };
|
|
85236
85473
|
}
|
|
85237
85474
|
var rename2 = async ({ context, args, open: open7 }) => {
|
|
@@ -87275,6 +87512,7 @@ async function changes({ context, args }) {
|
|
|
87275
87512
|
var BILLING_USAGE = `Usage:
|
|
87276
87513
|
laze billing [account] the plan, people, credits, auto-recharge and referral
|
|
87277
87514
|
laze billing invoices the workspace's invoices
|
|
87515
|
+
laze billing usage [--period 7d|30d|period] credits used per agent, highest first (default: this billing period)
|
|
87278
87516
|
laze billing checkout [--currency usd|eur] a Stripe Checkout link that starts Team (admins)
|
|
87279
87517
|
laze billing portal a Stripe link to manage cards and invoices (admins)
|
|
87280
87518
|
laze billing currency usd|eur bill in USD or EUR, until the first payment (admins)
|
|
@@ -87375,6 +87613,42 @@ async function invoices({ context, args }) {
|
|
|
87375
87613
|
);
|
|
87376
87614
|
}
|
|
87377
87615
|
}
|
|
87616
|
+
var USAGE_PERIODS = {
|
|
87617
|
+
"7d": "last_7_days",
|
|
87618
|
+
"30d": "last_30_days",
|
|
87619
|
+
period: "billing_period"
|
|
87620
|
+
};
|
|
87621
|
+
var USAGE_PERIOD_NAMES = {
|
|
87622
|
+
last_7_days: "the last 7 days",
|
|
87623
|
+
last_30_days: "the last 30 days",
|
|
87624
|
+
billing_period: "this billing period"
|
|
87625
|
+
};
|
|
87626
|
+
async function usage({ context, args }) {
|
|
87627
|
+
const { client } = await signedIn({ context, args });
|
|
87628
|
+
const asked = flagText({ args, name: "period", fallback: "period" });
|
|
87629
|
+
const period = USAGE_PERIODS[asked];
|
|
87630
|
+
if (!period) throw new CliUsageError(`--period takes 7d, 30d or period.
|
|
87631
|
+
${BILLING_USAGE}`);
|
|
87632
|
+
const [report3, agents2] = await Promise.all([
|
|
87633
|
+
client.get(`/api/billing-account/usage?period=${period}`),
|
|
87634
|
+
client.get("/api/agents").catch(() => [])
|
|
87635
|
+
]);
|
|
87636
|
+
if (args.flags.json) return printJson(context, report3);
|
|
87637
|
+
const of = (amount) => money(amount, report3.currency);
|
|
87638
|
+
const names = new Map(agents2.map((agent3) => [agent3.id, agent3.name]));
|
|
87639
|
+
const days = `${report3.from.slice(0, 10)} to ${report3.to.slice(0, 10)}`;
|
|
87640
|
+
context.out(
|
|
87641
|
+
`Used in ${USAGE_PERIOD_NAMES[report3.period] ?? report3.period} (${days}): ${of(report3.total)}
|
|
87642
|
+
`
|
|
87643
|
+
);
|
|
87644
|
+
if (report3.byAgent.length === 0) return context.out("No agent used credits in this period.\n");
|
|
87645
|
+
report3.byAgent.forEach((line, index) => {
|
|
87646
|
+
const share3 = report3.total > 0 ? Math.round(line.amount / report3.total * 100) : 0;
|
|
87647
|
+
const name3 = names.get(line.id) ?? "Deleted agent";
|
|
87648
|
+
context.out(`${index + 1}. ${name3} (${line.id}) ${of(line.amount)} ${share3}%
|
|
87649
|
+
`);
|
|
87650
|
+
});
|
|
87651
|
+
}
|
|
87378
87652
|
async function checkout({ context, args }) {
|
|
87379
87653
|
const { client } = await signedIn({ context, args });
|
|
87380
87654
|
const currency2 = flagText({ args, name: "currency" });
|
|
@@ -87503,6 +87777,7 @@ async function keep({ context, args }) {
|
|
|
87503
87777
|
var BILLING_COMMANDS = {
|
|
87504
87778
|
account: show,
|
|
87505
87779
|
invoices,
|
|
87780
|
+
usage,
|
|
87506
87781
|
checkout,
|
|
87507
87782
|
portal,
|
|
87508
87783
|
currency,
|
|
@@ -88464,9 +88739,9 @@ async function changeChannel({
|
|
|
88464
88739
|
}
|
|
88465
88740
|
});
|
|
88466
88741
|
}
|
|
88467
|
-
function channelOf2({ args, usage }) {
|
|
88742
|
+
function channelOf2({ args, usage: usage2 }) {
|
|
88468
88743
|
const channel = args.words[2];
|
|
88469
|
-
if (!channel) throw new CliUsageError(
|
|
88744
|
+
if (!channel) throw new CliUsageError(usage2);
|
|
88470
88745
|
return channel;
|
|
88471
88746
|
}
|
|
88472
88747
|
async function channelBrowse({ context, args }) {
|
|
@@ -88565,10 +88840,10 @@ async function channelUnarchive({ context, args }) {
|
|
|
88565
88840
|
`
|
|
88566
88841
|
});
|
|
88567
88842
|
}
|
|
88568
|
-
function addMembers(
|
|
88843
|
+
function addMembers(usage2) {
|
|
88569
88844
|
return async ({ context, args }) => {
|
|
88570
88845
|
const [, , channel, ...members3] = args.words;
|
|
88571
|
-
if (!channel || members3.length === 0) throw new CliUsageError(
|
|
88846
|
+
if (!channel || members3.length === 0) throw new CliUsageError(usage2);
|
|
88572
88847
|
return changeChannel({
|
|
88573
88848
|
context,
|
|
88574
88849
|
args,
|
|
@@ -88627,10 +88902,10 @@ var channelRemove = removeMember("Usage: laze channel remove <channel> <member>"
|
|
|
88627
88902
|
var conversationRemove = removeMember(
|
|
88628
88903
|
"Usage: laze conversation remove <conversation> <member>"
|
|
88629
88904
|
);
|
|
88630
|
-
function removeMember(
|
|
88905
|
+
function removeMember(usage2) {
|
|
88631
88906
|
return async ({ context, args }) => {
|
|
88632
88907
|
const [, , channel, member] = args.words;
|
|
88633
|
-
if (!channel || !member) throw new CliUsageError(
|
|
88908
|
+
if (!channel || !member) throw new CliUsageError(usage2);
|
|
88634
88909
|
return changeChannel({
|
|
88635
88910
|
context,
|
|
88636
88911
|
args,
|
|
@@ -89393,8 +89668,8 @@ async function deliverOnce({
|
|
|
89393
89668
|
profile
|
|
89394
89669
|
}) {
|
|
89395
89670
|
const lock = statePathOf({ context, kind: "waiters", profile });
|
|
89396
|
-
const
|
|
89397
|
-
if (!
|
|
89671
|
+
const mine5 = (await holderOf({ path: lock }))?.pid === context.processes.pid;
|
|
89672
|
+
if (!mine5 && !await takeLock({ context, path: lock, claudePid, preempt: true })) {
|
|
89398
89673
|
return "outranked";
|
|
89399
89674
|
}
|
|
89400
89675
|
const named = { ...args, flags: { ...args.flags, profile } };
|
|
@@ -90036,6 +90311,28 @@ var claimPromotionOutputDefinition = external_exports.object({
|
|
|
90036
90311
|
});
|
|
90037
90312
|
var claimPromotionOutputSchema = claimPromotionOutputDefinition;
|
|
90038
90313
|
|
|
90314
|
+
// ../../modules/billing/contract/src/billing.usage.ts
|
|
90315
|
+
var usagePeriodSchema = external_exports.enum(["last_7_days", "last_30_days", "billing_period"]);
|
|
90316
|
+
var usageInputDefinition = external_exports.object({
|
|
90317
|
+
workspaceId: external_exports.string().min(1),
|
|
90318
|
+
period: usagePeriodSchema.default("billing_period")
|
|
90319
|
+
});
|
|
90320
|
+
var billingUsageInputSchema = usageInputDefinition;
|
|
90321
|
+
var usageQueryDefinition = external_exports.object({ period: usagePeriodSchema.default("billing_period") });
|
|
90322
|
+
var usageLineDefinition = external_exports.object({ id: external_exports.string(), amount: external_exports.number() });
|
|
90323
|
+
var usageReportDefinition = external_exports.object({
|
|
90324
|
+
workspaceId: external_exports.string(),
|
|
90325
|
+
period: usagePeriodSchema,
|
|
90326
|
+
from: external_exports.iso.datetime(),
|
|
90327
|
+
to: external_exports.iso.datetime(),
|
|
90328
|
+
currency: currencySchema,
|
|
90329
|
+
total: external_exports.number(),
|
|
90330
|
+
byAgent: external_exports.array(usageLineDefinition),
|
|
90331
|
+
byChannel: external_exports.array(usageLineDefinition),
|
|
90332
|
+
byApp: external_exports.array(usageLineDefinition)
|
|
90333
|
+
});
|
|
90334
|
+
var billingUsageReportSchema = usageReportDefinition;
|
|
90335
|
+
|
|
90039
90336
|
// ../../modules/billing/contract/src/billing.ts
|
|
90040
90337
|
var workspaceInputDefinition2 = external_exports.object({ workspaceId: external_exports.string().min(1) });
|
|
90041
90338
|
var billingWorkspaceInputSchema = workspaceInputDefinition2;
|
|
@@ -90351,7 +90648,7 @@ var modelChargeBasisDefinition = external_exports.object({
|
|
|
90351
90648
|
rateDay: external_exports.string().nullable()
|
|
90352
90649
|
});
|
|
90353
90650
|
var BillingApi = moduleApi()("billing");
|
|
90354
|
-
var billingTrpc = defineTrpcContract("billing").query("account").withInput(billingWorkspaceInputSchema).withOutput(billingAccountViewSchema).query("invoices").withInput(billingWorkspaceInputSchema).withOutput(external_exports.array(billingInvoiceSchema)).mutation("startCheckout").withInput(startCheckoutInputSchema).withOutput(billingRedirectSchema).query("inviteQuote").withInput(inviteQuoteInputSchema).withOutput(inviteQuoteSchema).mutation("openPortal").withInput(openPortalInputSchema).withOutput(billingRedirectSchema).mutation("setCurrency").withInput(setCurrencyInputSchema).withOutput(billingAccountViewSchema).mutation("topUp").withInput(topUpInputSchema).withOutput(billingRedirectSchema).mutation("setAutoRecharge").withInput(setAutoRechargeInputSchema).withOutput(billingAccountViewSchema).mutation("applyReferral").withInput(applyReferralInputSchema).withOutput(billingAccountViewSchema).query("referralCard").withInput(billingWorkspaceInputSchema).withOutput(referralCardSchema).mutation("dismissReferralCard").withInput(billingWorkspaceInputSchema).withOutput(referralCardSchema).mutation("claimReferral").withInput(claimReferralInputSchema).withOutput(claimReferralOutputSchema).mutation("applyPromotion").withInput(applyPromotionInputSchema).withOutput(billingAccountViewSchema).mutation("claimPromotion").withInput(claimPromotionInputSchema).withOutput(claimPromotionOutputSchema).query("billingDetails").withInput(billingWorkspaceInputSchema).withOutput(billingDetailsSchema).mutation("setBillingDetails").withInput(setBillingDetailsInputSchema).withOutput(billingDetailsSchema).mutation("cancelPlan").withInput(billingWorkspaceInputSchema).withOutput(billingAccountViewSchema).mutation("keepPlan").withInput(billingWorkspaceInputSchema).withOutput(billingAccountViewSchema).build();
|
|
90651
|
+
var billingTrpc = defineTrpcContract("billing").query("account").withInput(billingWorkspaceInputSchema).withOutput(billingAccountViewSchema).query("invoices").withInput(billingWorkspaceInputSchema).withOutput(external_exports.array(billingInvoiceSchema)).query("usage").withInput(billingUsageInputSchema).withOutput(billingUsageReportSchema).mutation("startCheckout").withInput(startCheckoutInputSchema).withOutput(billingRedirectSchema).query("inviteQuote").withInput(inviteQuoteInputSchema).withOutput(inviteQuoteSchema).mutation("openPortal").withInput(openPortalInputSchema).withOutput(billingRedirectSchema).mutation("setCurrency").withInput(setCurrencyInputSchema).withOutput(billingAccountViewSchema).mutation("topUp").withInput(topUpInputSchema).withOutput(billingRedirectSchema).mutation("setAutoRecharge").withInput(setAutoRechargeInputSchema).withOutput(billingAccountViewSchema).mutation("applyReferral").withInput(applyReferralInputSchema).withOutput(billingAccountViewSchema).query("referralCard").withInput(billingWorkspaceInputSchema).withOutput(referralCardSchema).mutation("dismissReferralCard").withInput(billingWorkspaceInputSchema).withOutput(referralCardSchema).mutation("claimReferral").withInput(claimReferralInputSchema).withOutput(claimReferralOutputSchema).mutation("applyPromotion").withInput(applyPromotionInputSchema).withOutput(billingAccountViewSchema).mutation("claimPromotion").withInput(claimPromotionInputSchema).withOutput(claimPromotionOutputSchema).query("billingDetails").withInput(billingWorkspaceInputSchema).withOutput(billingDetailsSchema).mutation("setBillingDetails").withInput(setBillingDetailsInputSchema).withOutput(billingDetailsSchema).mutation("cancelPlan").withInput(billingWorkspaceInputSchema).withOutput(billingAccountViewSchema).mutation("keepPlan").withInput(billingWorkspaceInputSchema).withOutput(billingAccountViewSchema).build();
|
|
90355
90652
|
var stripeWebhookHeadersDefinition = external_exports.object({
|
|
90356
90653
|
"stripe-signature": external_exports.string().max(1e3).default("")
|
|
90357
90654
|
});
|
|
@@ -92443,8 +92740,8 @@ function creatorsOf(args) {
|
|
|
92443
92740
|
}
|
|
92444
92741
|
function lineOf3(computer2) {
|
|
92445
92742
|
const money4 = `${computer2.monthlyCharge} ${computer2.currency.toUpperCase()} a month`;
|
|
92446
|
-
const
|
|
92447
|
-
return ` ${computer2.computerId} ${computer2.name} ${computer2.kind} ${computer2.size} ${money4} ${
|
|
92743
|
+
const agents2 = `${computer2.agents.length} agent(s)`;
|
|
92744
|
+
return ` ${computer2.computerId} ${computer2.name} ${computer2.kind} ${computer2.size} ${money4} ${agents2} ${computer2.state}`;
|
|
92448
92745
|
}
|
|
92449
92746
|
async function mine({ context, args }) {
|
|
92450
92747
|
const client = await computeClient({ context, args });
|
|
@@ -95694,8 +95991,8 @@ async function clientOf2({ context, args }) {
|
|
|
95694
95991
|
const session = await signedIn({ context, args });
|
|
95695
95992
|
const wanted = flagText({ args, name: "workspace" })?.trim();
|
|
95696
95993
|
if (!wanted) return { client: session.client };
|
|
95697
|
-
const
|
|
95698
|
-
const target =
|
|
95994
|
+
const mine5 = await session.client.post("/api/agents/me/workspace/mine", {});
|
|
95995
|
+
const target = mine5.find((each) => each.id === wanted) ?? mine5.find((each) => each.name.toLowerCase() === wanted.toLowerCase());
|
|
95699
95996
|
if (!target) {
|
|
95700
95997
|
throw new CliUsageError(`You are in no workspace named "${wanted}": laze workspace list.`);
|
|
95701
95998
|
}
|
|
@@ -98899,19 +99196,31 @@ async function keys({ context, args }) {
|
|
|
98899
99196
|
// src/services/langwatch-commands.service.ts
|
|
98900
99197
|
var LANGWATCH_USAGE = `Usage:
|
|
98901
99198
|
laze langwatch status on or off, content level, endpoint, last test and delivery
|
|
98902
|
-
laze langwatch connect [--endpoint <url>]
|
|
99199
|
+
laze langwatch connect [--endpoint <url>] connect a LangWatch project: approve the link it prints (admins)
|
|
98903
99200
|
laze langwatch set-key [--endpoint <url>] save the LangWatch project API key piped on stdin (admins)
|
|
98904
99201
|
laze langwatch on [--content full|metadata] send hosted agents' traces to LangWatch (admins)
|
|
98905
99202
|
laze langwatch off stop sending traces (admins)
|
|
98906
|
-
laze langwatch level
|
|
99203
|
+
laze langwatch level [full|metadata] [--personal metadata|off] the defaults: team agents, personal agents (admins)
|
|
98907
99204
|
laze langwatch test send one test trace with the saved key (admins)
|
|
98908
99205
|
laze langwatch remove turn it off and delete the key from the vault (admins)
|
|
98909
|
-
laze langwatch
|
|
99206
|
+
laze langwatch agents every agent LangWatch can trace, its level, what you may pick
|
|
99207
|
+
laze langwatch agent <agent> [--level full|metadata|off|follow] one agent's traces
|
|
99208
|
+
laze langwatch mine --on|--off send your personal agents' messages too, or stop`;
|
|
98910
99209
|
var LANGWATCH_AGENT_PATH = "/api/agents/langwatch";
|
|
99210
|
+
var LANGWATCH_AGENTS_PATH = "/api/agents/langwatch/agents";
|
|
99211
|
+
var AGENT_LEVEL_WORDS = {
|
|
99212
|
+
full: "full",
|
|
99213
|
+
metadata: "metadata only",
|
|
99214
|
+
off: "off"
|
|
99215
|
+
};
|
|
98911
99216
|
var LEVEL_WORDS = {
|
|
98912
99217
|
full: "full",
|
|
98913
99218
|
metadata: "metadata only"
|
|
98914
99219
|
};
|
|
99220
|
+
var PERSONAL_WORDS = {
|
|
99221
|
+
metadata: "metadata only",
|
|
99222
|
+
off: "nothing"
|
|
99223
|
+
};
|
|
98915
99224
|
var printJson9 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
|
|
98916
99225
|
`);
|
|
98917
99226
|
function contentOf({ value, flag: flag2 }) {
|
|
@@ -98927,10 +99236,15 @@ function statusLines2(integration) {
|
|
|
98927
99236
|
}
|
|
98928
99237
|
const test2 = integration.lastTest;
|
|
98929
99238
|
const delivery = integration.lastDelivery;
|
|
99239
|
+
const { project } = integration;
|
|
98930
99240
|
return [
|
|
98931
99241
|
`LangWatch is ${integration.enabled ? "on" : "off"}, content ${LEVEL_WORDS[integration.level]}`,
|
|
99242
|
+
...project ? [` project: ${project.name} (${project.organizationName}) ${project.url}`] : [],
|
|
98932
99243
|
` endpoint: ${integration.endpoint}`,
|
|
98933
99244
|
` key ending in ${integration.keyEnding ?? "?"}`,
|
|
99245
|
+
integration.lastTraceAt ? ` last trace: ${utcTimeOf(integration.lastTraceAt)}` : " last trace: none yet",
|
|
99246
|
+
` team agents: content ${LEVEL_WORDS[integration.level]} unless set per agent`,
|
|
99247
|
+
` personal agents: ${PERSONAL_WORDS[integration.personalLevel]} unless their owner sends their messages too`,
|
|
98934
99248
|
test2 ? ` last test: ${test2.ok ? "accepted" : `failed, ${test2.message}`} at ${utcTimeOf(test2.at)}` : " last test: never",
|
|
98935
99249
|
...delivery ? [
|
|
98936
99250
|
` last delivery: ${delivery.ok ? "ok" : `failed, ${delivery.message}`} at ${utcTimeOf(delivery.at)}`
|
|
@@ -98962,10 +99276,11 @@ ${LANGWATCH_USAGE}`);
|
|
|
98962
99276
|
});
|
|
98963
99277
|
if (args.flags.json) return printJson9(context, integration);
|
|
98964
99278
|
context.out(
|
|
98965
|
-
`Saved the LangWatch key ending in ${integration.keyEnding ?? "?"} for ${integration.endpoint}.
|
|
99279
|
+
`Saved the LangWatch key ending in ${integration.keyEnding ?? "?"} for ${integration.endpoint}. LangWatch is ${integration.enabled ? "on" : "off"}.
|
|
98966
99280
|
`
|
|
98967
99281
|
);
|
|
98968
99282
|
}
|
|
99283
|
+
var CONNECT_POLL_MS = 3e3;
|
|
98969
99284
|
async function connect3({ context, args }) {
|
|
98970
99285
|
const endpoint = flagText({ args, name: "endpoint" }).trim();
|
|
98971
99286
|
const { client } = await signedIn({ context, args });
|
|
@@ -98973,11 +99288,57 @@ async function connect3({ context, args }) {
|
|
|
98973
99288
|
LANGWATCH_REST_PATHS.connect,
|
|
98974
99289
|
endpoint ? { endpoint } : {}
|
|
98975
99290
|
);
|
|
98976
|
-
if (args.flags.json)
|
|
98977
|
-
|
|
98978
|
-
|
|
98979
|
-
${started.
|
|
99291
|
+
if (!args.flags.json) {
|
|
99292
|
+
context.out(
|
|
99293
|
+
`Open this link, check LangWatch shows the code ${started.userCode} and pick the project:
|
|
99294
|
+
${started.verificationUrl}
|
|
99295
|
+
Waiting for you to approve (10 minutes at most)...
|
|
98980
99296
|
`
|
|
99297
|
+
);
|
|
99298
|
+
}
|
|
99299
|
+
const attempt = { attemptId: started.attemptId };
|
|
99300
|
+
for (; ; ) {
|
|
99301
|
+
await context.sleep(CONNECT_POLL_MS);
|
|
99302
|
+
const status11 = await pollOrCancel({ client, attempt });
|
|
99303
|
+
if (status11.state === "waiting") continue;
|
|
99304
|
+
if (args.flags.json) {
|
|
99305
|
+
printJson9(context, status11);
|
|
99306
|
+
return status11.state === "connected" ? 0 : 1;
|
|
99307
|
+
}
|
|
99308
|
+
if (status11.state === "failed") {
|
|
99309
|
+
context.err(`LangWatch was not connected (${status11.error}).
|
|
99310
|
+
`);
|
|
99311
|
+
return 1;
|
|
99312
|
+
}
|
|
99313
|
+
const { project } = status11.integration;
|
|
99314
|
+
context.out(
|
|
99315
|
+
project ? `Connected. Traces go to ${project.name} (${project.organizationName}): ${project.url}
|
|
99316
|
+
` : "Connected to LangWatch.\n"
|
|
99317
|
+
);
|
|
99318
|
+
return 0;
|
|
99319
|
+
}
|
|
99320
|
+
}
|
|
99321
|
+
async function pollOrCancel({
|
|
99322
|
+
client,
|
|
99323
|
+
attempt
|
|
99324
|
+
}) {
|
|
99325
|
+
try {
|
|
99326
|
+
return await client.post(LANGWATCH_REST_PATHS.connectPoll, attempt);
|
|
99327
|
+
} catch (error63) {
|
|
99328
|
+
await client.post(LANGWATCH_REST_PATHS.connectCancel, attempt).catch(() => void 0);
|
|
99329
|
+
throw error63;
|
|
99330
|
+
}
|
|
99331
|
+
}
|
|
99332
|
+
async function mine4({ context, args }) {
|
|
99333
|
+
const on = args.flags.on !== void 0;
|
|
99334
|
+
const off = args.flags.off !== void 0;
|
|
99335
|
+
if (on === off) throw new CliUsageError(`Pick --on or --off.
|
|
99336
|
+
${LANGWATCH_USAGE}`);
|
|
99337
|
+
const { client } = await signedIn({ context, args });
|
|
99338
|
+
const integration = await client.post(LANGWATCH_REST_PATHS.mine, { on });
|
|
99339
|
+
if (args.flags.json) return printJson9(context, integration);
|
|
99340
|
+
context.out(
|
|
99341
|
+
integration.mine ? "Your personal agents send their messages to LangWatch too, unless one is set otherwise.\n" : "Your personal agents follow the workspace default, unless one is set otherwise.\n"
|
|
98981
99342
|
);
|
|
98982
99343
|
}
|
|
98983
99344
|
async function turnOn2({ context, args }) {
|
|
@@ -98998,15 +99359,26 @@ async function turnOff2({ context, args }) {
|
|
|
98998
99359
|
if (args.flags.json) return printJson9(context, integration);
|
|
98999
99360
|
context.out("LangWatch is off. No traces are sent.\n");
|
|
99000
99361
|
}
|
|
99362
|
+
function personalOf({ args }) {
|
|
99363
|
+
if (args.flags.personal === void 0) return void 0;
|
|
99364
|
+
const value = flagText({ args, name: "personal" });
|
|
99365
|
+
if (value === "metadata" || value === "off") return value;
|
|
99366
|
+
throw new CliUsageError(`--personal takes metadata or off.
|
|
99367
|
+
${LANGWATCH_USAGE}`);
|
|
99368
|
+
}
|
|
99001
99369
|
async function level({ context, args }) {
|
|
99002
|
-
const
|
|
99370
|
+
const personalLevel = personalOf({ args });
|
|
99371
|
+
const team = args.words[2] === void 0 && personalLevel !== void 0 ? void 0 : contentOf({ value: args.words[2], flag: "level" });
|
|
99003
99372
|
const { client } = await signedIn({ context, args });
|
|
99004
99373
|
const integration = await client.post(LANGWATCH_REST_PATHS.level, {
|
|
99005
|
-
level:
|
|
99374
|
+
...team ? { level: team } : {},
|
|
99375
|
+
...personalLevel ? { personalLevel } : {}
|
|
99006
99376
|
});
|
|
99007
99377
|
if (args.flags.json) return printJson9(context, integration);
|
|
99008
|
-
context.out(
|
|
99009
|
-
`
|
|
99378
|
+
context.out(
|
|
99379
|
+
`Team agents send ${LEVEL_WORDS[integration.level]}; personal agents send ${PERSONAL_WORDS[integration.personalLevel]}.
|
|
99380
|
+
`
|
|
99381
|
+
);
|
|
99010
99382
|
}
|
|
99011
99383
|
async function test({ context, args }) {
|
|
99012
99384
|
const { client } = await signedIn({ context, args });
|
|
@@ -99043,16 +99415,14 @@ ${LANGWATCH_USAGE}`);
|
|
|
99043
99415
|
const off = args.flags.off !== void 0;
|
|
99044
99416
|
if (on && off) throw new CliUsageError(`Pick --on or --off.
|
|
99045
99417
|
${LANGWATCH_USAGE}`);
|
|
99046
|
-
const
|
|
99047
|
-
if (
|
|
99418
|
+
const given = args.flags.level === void 0 ? void 0 : flagText({ args, name: "level" });
|
|
99419
|
+
if (given !== void 0 && !["full", "metadata", "off", "follow"].includes(given)) {
|
|
99048
99420
|
throw new CliUsageError(`--level takes full, metadata, off or follow.
|
|
99049
99421
|
${LANGWATCH_USAGE}`);
|
|
99050
99422
|
}
|
|
99423
|
+
const picked = given ?? switchLevelOf({ on, off });
|
|
99051
99424
|
const { client } = await signedIn({ context, args });
|
|
99052
|
-
const choice = {
|
|
99053
|
-
...on || off ? { optIn: on } : {},
|
|
99054
|
-
...picked !== void 0 ? { level: picked } : {}
|
|
99055
|
-
};
|
|
99425
|
+
const choice = picked !== void 0 ? { level: picked } : {};
|
|
99056
99426
|
const tracing = Object.keys(choice).length === 0 ? await client.get(
|
|
99057
99427
|
`${LANGWATCH_AGENT_PATH}?agent=${encodeURIComponent(name3)}`
|
|
99058
99428
|
) : await client.post(LANGWATCH_AGENT_PATH, { agent: name3, ...choice });
|
|
@@ -99060,6 +99430,19 @@ ${LANGWATCH_USAGE}`);
|
|
|
99060
99430
|
context.out(`${agentLine({ name: name3, tracing })}
|
|
99061
99431
|
`);
|
|
99062
99432
|
}
|
|
99433
|
+
function agentRowLine(row) {
|
|
99434
|
+
const owner = row.ownerName ?? "former member";
|
|
99435
|
+
const may = row.choices.length > 0 ? `you may set ${row.choices.join(", ")}` : "you may not change it";
|
|
99436
|
+
return `${row.name} ${row.kind} ${owner} ${AGENT_LEVEL_WORDS[row.tracing.level]} (${may})`;
|
|
99437
|
+
}
|
|
99438
|
+
async function agents({ context, args }) {
|
|
99439
|
+
const { client } = await signedIn({ context, args });
|
|
99440
|
+
const rows = await client.get(LANGWATCH_AGENTS_PATH);
|
|
99441
|
+
if (args.flags.json) return printJson9(context, rows);
|
|
99442
|
+
if (rows.length === 0) return context.out("No agents LangWatch can trace yet.\n");
|
|
99443
|
+
context.out(`${rows.map(agentRowLine).join("\n")}
|
|
99444
|
+
`);
|
|
99445
|
+
}
|
|
99063
99446
|
var LANGWATCH_COMMANDS = {
|
|
99064
99447
|
status: status7,
|
|
99065
99448
|
"set-key": setKey,
|
|
@@ -99069,7 +99452,9 @@ var LANGWATCH_COMMANDS = {
|
|
|
99069
99452
|
level,
|
|
99070
99453
|
test,
|
|
99071
99454
|
remove: remove7,
|
|
99072
|
-
|
|
99455
|
+
mine: mine4,
|
|
99456
|
+
agent,
|
|
99457
|
+
agents
|
|
99073
99458
|
};
|
|
99074
99459
|
async function langwatch({ context, args }) {
|
|
99075
99460
|
const name3 = args.words[1] ?? "status";
|
|
@@ -99077,6 +99462,11 @@ async function langwatch({ context, args }) {
|
|
|
99077
99462
|
if (!command) throw new CliUsageError(LANGWATCH_USAGE);
|
|
99078
99463
|
return command({ context, args });
|
|
99079
99464
|
}
|
|
99465
|
+
function switchLevelOf({ on, off }) {
|
|
99466
|
+
if (on) return "full";
|
|
99467
|
+
if (off) return "off";
|
|
99468
|
+
return void 0;
|
|
99469
|
+
}
|
|
99080
99470
|
|
|
99081
99471
|
// src/services/machine-access-commands.service.ts
|
|
99082
99472
|
var MACHINE_ACCESS_USAGE = [
|
|
@@ -101684,6 +102074,9 @@ var cohortOutputDefinition = external_exports.object({
|
|
|
101684
102074
|
/** The creator's first page and campaign tag, as their sign-up kept them. */
|
|
101685
102075
|
landingPath: external_exports.string().nullable(),
|
|
101686
102076
|
campaign: external_exports.string().nullable(),
|
|
102077
|
+
/** The utm_source tag and the ad network a click id named, never the click id itself. */
|
|
102078
|
+
utmSource: external_exports.string().nullable(),
|
|
102079
|
+
adNetwork: external_exports.string().nullable(),
|
|
101687
102080
|
promotionId: external_exports.string().nullable(),
|
|
101688
102081
|
plan: external_exports.string(),
|
|
101689
102082
|
paying: external_exports.boolean(),
|
|
@@ -102633,21 +103026,21 @@ async function startedUpdate({
|
|
|
102633
103026
|
}
|
|
102634
103027
|
async function noteRelease({
|
|
102635
103028
|
context,
|
|
102636
|
-
mine:
|
|
103029
|
+
mine: mine5,
|
|
102637
103030
|
server,
|
|
102638
103031
|
sandbox,
|
|
102639
103032
|
quiet
|
|
102640
103033
|
}) {
|
|
102641
|
-
const warning = releaseWarningOf({ mine:
|
|
103034
|
+
const warning = releaseWarningOf({ mine: mine5, server, sandbox });
|
|
102642
103035
|
if (!warning) return false;
|
|
102643
|
-
const older = !sandbox && releaseSkewOf({ mine:
|
|
103036
|
+
const older = !sandbox && releaseSkewOf({ mine: mine5, server }) === "older";
|
|
102644
103037
|
const started = older ? await startedUpdate({ context, server }) : null;
|
|
102645
|
-
if (!quiet) context.err(started ? selfUpdateLineOf({ mine:
|
|
103038
|
+
if (!quiet) context.err(started ? selfUpdateLineOf({ mine: mine5, server, ...started }) : warning);
|
|
102646
103039
|
return true;
|
|
102647
103040
|
}
|
|
102648
103041
|
function watchingRelease({
|
|
102649
103042
|
context,
|
|
102650
|
-
mine:
|
|
103043
|
+
mine: mine5 = cliVersionOf(),
|
|
102651
103044
|
quiet = false
|
|
102652
103045
|
}) {
|
|
102653
103046
|
const sandbox = context.program.at(-1) === SANDBOX_CLI_PATH;
|
|
@@ -102657,7 +103050,7 @@ function watchingRelease({
|
|
|
102657
103050
|
fetcher: async (input2, init) => {
|
|
102658
103051
|
const response = await context.fetcher(input2, init);
|
|
102659
103052
|
const server = response.headers.get(CLI_RELEASE_HEADER);
|
|
102660
|
-
if (!warned && server) warned = await noteRelease({ context, mine:
|
|
103053
|
+
if (!warned && server) warned = await noteRelease({ context, mine: mine5, server, sandbox, quiet });
|
|
102661
103054
|
return response;
|
|
102662
103055
|
}
|
|
102663
103056
|
};
|
|
@@ -103496,9 +103889,9 @@ function printClaim(context, claim3) {
|
|
|
103496
103889
|
`);
|
|
103497
103890
|
}
|
|
103498
103891
|
}
|
|
103499
|
-
function domainOf({ args, usage }) {
|
|
103892
|
+
function domainOf({ args, usage: usage2 }) {
|
|
103500
103893
|
const domain2 = args.words[2];
|
|
103501
|
-
if (!domain2) throw new CliUsageError(
|
|
103894
|
+
if (!domain2) throw new CliUsageError(usage2);
|
|
103502
103895
|
return domain2;
|
|
103503
103896
|
}
|
|
103504
103897
|
async function claimCall({
|
|
@@ -103814,7 +104207,7 @@ async function releaseAgeSettingsOf({
|
|
|
103814
104207
|
async function update2({
|
|
103815
104208
|
context,
|
|
103816
104209
|
args,
|
|
103817
|
-
mine:
|
|
104210
|
+
mine: mine5 = cliVersionOf()
|
|
103818
104211
|
}) {
|
|
103819
104212
|
const plan2 = updatePlanOf({ script: await realScriptOf({ program: context.program }) });
|
|
103820
104213
|
if (plan2.kind === "sandbox") {
|
|
@@ -103830,17 +104223,17 @@ async function update2({
|
|
|
103830
104223
|
}
|
|
103831
104224
|
const line = plan2.command.join(" ");
|
|
103832
104225
|
if (args.flags["dry-run"]) {
|
|
103833
|
-
context.out(`laze ${
|
|
104226
|
+
context.out(`laze ${mine5}, installed with ${plan2.manager}. Would run: ${line}
|
|
103834
104227
|
`);
|
|
103835
104228
|
return 0;
|
|
103836
104229
|
}
|
|
103837
104230
|
const latest = await latestReleaseOf({ context });
|
|
103838
|
-
if (latest && latest ===
|
|
103839
|
-
context.out(`laze ${
|
|
104231
|
+
if (latest && latest === mine5) {
|
|
104232
|
+
context.out(`laze ${mine5} is the latest release.
|
|
103840
104233
|
`);
|
|
103841
104234
|
return 0;
|
|
103842
104235
|
}
|
|
103843
|
-
context.out(`Updating laze ${
|
|
104236
|
+
context.out(`Updating laze ${mine5} with ${plan2.manager}: ${line}
|
|
103844
104237
|
`);
|
|
103845
104238
|
const code4 = await context.runCommand({ command: plan2.command, env: {} });
|
|
103846
104239
|
if (code4 !== 0) {
|
|
@@ -103848,12 +104241,12 @@ async function update2({
|
|
|
103848
104241
|
`);
|
|
103849
104242
|
return code4;
|
|
103850
104243
|
}
|
|
103851
|
-
return checkInstalled({ context, plan: plan2, mine:
|
|
104244
|
+
return checkInstalled({ context, plan: plan2, mine: mine5, latest });
|
|
103852
104245
|
}
|
|
103853
104246
|
async function checkInstalled({
|
|
103854
104247
|
context,
|
|
103855
104248
|
plan: plan2,
|
|
103856
|
-
mine:
|
|
104249
|
+
mine: mine5,
|
|
103857
104250
|
latest
|
|
103858
104251
|
}) {
|
|
103859
104252
|
const printed2 = await printedBy({ context, command: [...context.program, "--version"] });
|
|
@@ -103862,13 +104255,13 @@ async function checkInstalled({
|
|
|
103862
104255
|
context.out("Installed. `laze --version` names the new version.\n");
|
|
103863
104256
|
return 0;
|
|
103864
104257
|
}
|
|
103865
|
-
const held = latest ? releaseSkewOf({ mine: installed, server: latest }) === "older" : installed ===
|
|
104258
|
+
const held = latest ? releaseSkewOf({ mine: installed, server: latest }) === "older" : installed === mine5;
|
|
103866
104259
|
const { script, onPath } = await otherInstallsOf({ context });
|
|
103867
104260
|
const shadowed = shadowedLineOf({ updated: installed, script, onPath });
|
|
103868
104261
|
if (!held) {
|
|
103869
104262
|
context.out(
|
|
103870
|
-
installed ===
|
|
103871
|
-
` : `Updated laze ${
|
|
104263
|
+
installed === mine5 ? `laze ${mine5} is the latest release.
|
|
104264
|
+
` : `Updated laze ${mine5} to ${installed}.
|
|
103872
104265
|
`
|
|
103873
104266
|
);
|
|
103874
104267
|
if (shadowed) context.err(shadowed);
|
|
@@ -105825,6 +106218,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
105825
106218
|
laze app every laze app command, with its flags
|
|
105826
106219
|
laze agents list | laze agents status <name> the workspace's agents and their context
|
|
105827
106220
|
laze agents show <name> [--json] an agent's profile: kind, how it runs, intelligence
|
|
106221
|
+
laze agents activity [--period 7d|30d|period] turns, failures and tokens per agent, most tokens first
|
|
105828
106222
|
laze join [--workspace <name|link>] [--for <email>] [--name <name>] [--project <folder>] ask to join as an agent: a person approves once in their feed
|
|
105829
106223
|
laze agent link --token <token> [--name <name>] [--project <folder>] connect this Claude Code or Codex session
|
|
105830
106224
|
laze agent bind the linked agent listens in this session from now on
|
|
@@ -105953,7 +106347,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
105953
106347
|
laze external share|accept-share|decline-share|unshare ... | dm <person> [<message>] shared channels and DMs
|
|
105954
106348
|
laze langwatch [status] | set-key | on|off | level <full|metadata> | test | remove hosted agents' traces
|
|
105955
106349
|
to a LangWatch project (admins); the key is read from stdin only
|
|
105956
|
-
laze langwatch agent <agent> [--
|
|
106350
|
+
laze langwatch agents | agent <agent> [--level full|metadata|off|follow] each agent's traces
|
|
105957
106351
|
laze sso domains|claim|verify|connect|connect-google|enforce|disconnect|remove single sign-on
|
|
105958
106352
|
(admins); an identity provider's client secret is read from stdin or --from-file only
|
|
105959
106353
|
laze scim tokens|create-token|revoke-token tokens for your identity provider's directory (admins)
|
|
@@ -106041,6 +106435,7 @@ var COMMANDS5 = {
|
|
|
106041
106435
|
history: history2,
|
|
106042
106436
|
"agents list": listAgents,
|
|
106043
106437
|
"agents show": showAgent,
|
|
106438
|
+
"agents activity": agentsActivity,
|
|
106044
106439
|
"agents status": listAgents,
|
|
106045
106440
|
agents: listAgents,
|
|
106046
106441
|
"agent link": linkAgent,
|