@uipath/common 1.203.0-preview.205 → 1.204.0-preview.206

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.
@@ -0,0 +1 @@
1
+ export declare const LOCAL_PERMISSION_ERROR_CODES: ReadonlySet<string>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Extension-to-MIME lookup for upload paths. Pure leaf (no imports) so both
3
+ * barrels export it and any layer can import it (AGENTS.md Hard Rule 19).
4
+ */
5
+ export declare const OCTET_STREAM = "application/octet-stream";
6
+ export declare const MIME_TYPES_BY_EXTENSION: Readonly<Record<string, string>>;
7
+ /** MIME type for a file name (pass a basename). Unknown or missing extension gives octet-stream. */
8
+ export declare function mimeTypeForFileName(fileName: string): string;
@@ -40,10 +40,138 @@ function isTelemetryDisabled() {
40
40
  return value === "1" || value === "true";
41
41
  }
42
42
 
43
+ // src/telemetry/telemetry-dimensions.ts
44
+ var BaseDimensions = {
45
+ ApplicationName: "ApplicationName",
46
+ ProductVersion: "ProductVersion",
47
+ InstallationId: "InstallationId",
48
+ CloudUserId: "CloudUserId",
49
+ CloudTenantId: "CloudTenantId",
50
+ CloudOrganizationId: "CloudOrganizationId",
51
+ IsInternalUser: "IsInternalUser",
52
+ Environment: "Environment",
53
+ BaseUrl: "BaseUrl",
54
+ Region: "Region",
55
+ Agent: "Agent",
56
+ AgentVersion: "AgentVersion",
57
+ AgentModel: "AgentModel",
58
+ ToolName: "ToolName",
59
+ ToolVersion: "ToolVersion",
60
+ ExecutionContext: "ExecutionContext",
61
+ CiProvider: "CiProvider",
62
+ SessionIdSource: "SessionIdSource",
63
+ SessionId: "SessionId"
64
+ };
65
+ var CommandDimensions = {
66
+ IsCommand: "IsCommand",
67
+ IsReexec: "IsReexec",
68
+ CommandName: "CommandName",
69
+ ExitCode: "ExitCode",
70
+ TerminalOutcome: "TerminalOutcome",
71
+ ErrorClass: "ErrorClass",
72
+ TerminalSignal: "TerminalSignal",
73
+ ErrorMessage: "ErrorMessage",
74
+ SkillName: "SkillName",
75
+ ProductArea: "ProductArea",
76
+ Mode: "Mode"
77
+ };
78
+ var ShipDimensions = {
79
+ ShipKind: "ShipKind",
80
+ Target: "Target",
81
+ ProjectType: "ProjectType",
82
+ ProjectTypes: "ProjectTypes",
83
+ ArtifactCorrelationKey: "ArtifactCorrelationKey",
84
+ PackageName: "PackageName",
85
+ PackageVersion: "PackageVersion",
86
+ PackageVersionKey: "PackageVersionKey",
87
+ DeploymentKey: "DeploymentKey",
88
+ SolutionId: "SolutionId",
89
+ FolderKey: "FolderKey",
90
+ FeedId: "FeedId"
91
+ };
92
+ var ErrorDimensions = {
93
+ Result: "Result",
94
+ ErrorCode: "ErrorCode",
95
+ Retry: "Retry",
96
+ ErrorMessage: "ErrorMessage"
97
+ };
98
+ var AuthDimensions = {
99
+ AuthenticationMethod: "AuthenticationMethod",
100
+ Success: "Success",
101
+ Reason: "Reason"
102
+ };
103
+ var SkillsDimensions = {
104
+ SchemaVersion: "SchemaVersion",
105
+ AgentType: "AgentType",
106
+ SkillsVersion: "SkillsVersion",
107
+ UipSubcommand: "UipSubcommand",
108
+ FileExtension: "FileExtension",
109
+ SubagentModel: "SubagentModel",
110
+ SubagentType: "SubagentType",
111
+ PermissionMode: "PermissionMode",
112
+ EffortLevel: "EffortLevel",
113
+ SessionSource: "SessionSource",
114
+ Outcome: "Outcome",
115
+ DurationMs: "DurationMs",
116
+ Source: "Source"
117
+ };
118
+ var PackagerDimensions = {
119
+ ProjectId: "ProjectId",
120
+ ProjectType: "ProjectType",
121
+ SolutionId: "SolutionId"
122
+ };
123
+ var ScopeDimensions = {
124
+ FolderId: "FolderId"
125
+ };
126
+ var ID_DIMENSIONS = new Set([
127
+ BaseDimensions.CloudUserId,
128
+ BaseDimensions.CloudTenantId,
129
+ BaseDimensions.CloudOrganizationId,
130
+ BaseDimensions.InstallationId,
131
+ ShipDimensions.ArtifactCorrelationKey,
132
+ ShipDimensions.PackageVersionKey,
133
+ ShipDimensions.DeploymentKey,
134
+ ShipDimensions.SolutionId,
135
+ ShipDimensions.FolderKey,
136
+ ShipDimensions.FeedId,
137
+ PackagerDimensions.ProjectId
138
+ ]);
139
+ var RESERVED_DIMENSION_NAMES = new Set([
140
+ ...Object.values(BaseDimensions),
141
+ ...Object.values(CommandDimensions),
142
+ ...Object.values(ShipDimensions),
143
+ ...Object.values(ErrorDimensions),
144
+ ...Object.values(AuthDimensions),
145
+ ...Object.values(SkillsDimensions),
146
+ ...Object.values(PackagerDimensions),
147
+ ...Object.values(ScopeDimensions)
148
+ ]);
149
+ var CURATED_DIMENSIONS = new Set([
150
+ BaseDimensions.ApplicationName,
151
+ BaseDimensions.ProductVersion,
152
+ BaseDimensions.InstallationId,
153
+ BaseDimensions.CloudUserId,
154
+ BaseDimensions.CloudTenantId,
155
+ BaseDimensions.CloudOrganizationId,
156
+ BaseDimensions.IsInternalUser,
157
+ BaseDimensions.Environment,
158
+ BaseDimensions.BaseUrl,
159
+ BaseDimensions.Region,
160
+ BaseDimensions.Agent,
161
+ BaseDimensions.AgentVersion,
162
+ BaseDimensions.ToolVersion,
163
+ BaseDimensions.ExecutionContext,
164
+ BaseDimensions.CiProvider,
165
+ BaseDimensions.SessionIdSource,
166
+ BaseDimensions.SessionId,
167
+ ...Object.values(CommandDimensions),
168
+ ...Object.values(ShipDimensions)
169
+ ]);
170
+
43
171
  // src/sdk-user-agent.ts
44
172
  var USER_AGENT_HEADER = "User-Agent";
45
173
  var CODING_AGENT_HEADER = "x-coding-agent-info";
46
- var AGENT_PROPERTY = "agent";
174
+ var AGENT_PROPERTY = BaseDimensions.Agent;
47
175
  var CODING_AGENT_PROPERTY = "CodingAgent";
48
176
  var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
49
177
  function userAgentPatchKey(userAgent) {
@@ -157,4 +285,4 @@ export {
157
285
  setSdkUserAgentHostToken
158
286
  };
159
287
 
160
- //# debugId=6BBB85462D129AD364756E2164756E21
288
+ //# debugId=159182CCF3CDBCFB64756E2164756E21
@@ -1,9 +1,25 @@
1
1
  export type TelemetryMode = "build" | "operate" | "troubleshoot";
2
2
  export interface TelemetryAttribution {
3
- skill_name?: string;
4
- product_area?: string;
5
- mode?: TelemetryMode;
3
+ SkillName?: string;
4
+ ProductArea?: string;
5
+ Mode?: TelemetryMode;
6
6
  }
7
7
  export declare function normalizeSkillName(value: unknown): string | undefined;
8
8
  export declare function buildCommandTelemetryAttribution(commandPath: string, skillSource?: string): TelemetryAttribution;
9
9
  export declare function buildSkillEventTelemetryAttribution(skillSource: unknown, uipSubcommand?: unknown): TelemetryAttribution;
10
+ declare const AGENT_SESSION_ENV: {
11
+ readonly AgentModel: "UIPATH_AGENT_MODEL";
12
+ readonly PermissionMode: "UIPATH_PERMISSION_MODE";
13
+ readonly EffortLevel: "UIPATH_EFFORT_LEVEL";
14
+ readonly SkillsVersion: "UIPATH_SKILLS_VERSION";
15
+ };
16
+ export type AgentSessionTelemetry = Partial<Record<keyof typeof AGENT_SESSION_ENV, string>>;
17
+ /** Bound a free-ish agent-supplied value to a low-cardinality token: anything
18
+ * outside a safe charset becomes `_` (no quotes, backslashes, control chars or
19
+ * pipes survive), capped at 120 chars. Value-level PII redaction still runs
20
+ * downstream. */
21
+ export declare function sanitizeTelemetryToken(value: string): string;
22
+ /** Optional request dimensions from the agent-session env; a variable that is
23
+ * unset or empty contributes no key. */
24
+ export declare function buildAgentSessionTelemetry(env: Record<string, string | undefined>): AgentSessionTelemetry;
25
+ export {};
@@ -2,21 +2,42 @@
2
2
  * How a command's telemetry name is formed.
3
3
  *
4
4
  * `requests.name` is the column every command count, failure rate and duration
5
- * percentile groups by, so the name has to be a command path and nothing else:
6
- * lowercase tokens under a `uip.` root, one per level.
5
+ * percentile groups by, so the name has to be the command and nothing else.
6
+ * The shape is the UiPath business-telemetry convention's
7
+ * `[FeatureName].[PerformedAction]`: exactly two PascalCase segments, `Cli`
8
+ * plus the command path folded into one action token — `uip or assets list`
9
+ * is `Cli.OrAssetsList` (PRENG-7421).
7
10
  *
8
- * Two places work out which command ran — `deriveCommandPath` walks up from the
9
- * command object, and `cli.core.ts` walks the tree down from argv for the runs
10
- * that never reach a handler. That difference is real; the parse-error path is
11
- * handed the second one's answer rather than guessing a third. How the parts
12
- * become a name was never each caller's business either, and having it written
13
- * three times is what let argv text into the column: `uip.config --help` and
14
- * `uip.help config` both shipped as request names.
11
+ * The path's levels are not lost, they move to dimensions: `CommandName`
12
+ * carries the spaced path, and `ToolName` / `ProductArea` / `Mode` carry the
13
+ * groupings a dashboard actually pivots on. That is where the convention says
14
+ * structured detail belongs, and it is why the name can afford to be flat.
15
+ *
16
+ * Two places work out which command ran — `deriveCommandParts` walks up from
17
+ * the command object, and `cli.core.ts` walks the tree down from argv for the
18
+ * runs that never reach a handler. That difference is real; the parse-error
19
+ * path is handed the second one's answer rather than guessing a third. How the
20
+ * parts become a name was never each caller's business either, and having it
21
+ * written three times is what let argv text into the column: `uip.config
22
+ * --help` and `uip.help config` both shipped as request names.
15
23
  *
16
24
  * So the parts are each caller's business and the name is this module's.
17
25
  */
18
- /** Every CLI telemetry name sits under this root. */
26
+ /** The `[FeatureName]` half of every CLI telemetry name. */
27
+ export declare const TELEMETRY_NAME_ROOT = "Cli";
28
+ /**
29
+ * The binary's own name. Dropped from the parts rather than rendered, so a
30
+ * caller that includes argv[0] cannot produce `Cli.UipLogin`.
31
+ */
32
+ export declare const CLI_COMMAND_ROOT = "uip";
33
+ /**
34
+ * @deprecated Use {@link CLI_COMMAND_ROOT}. Kept so existing consumers can
35
+ * keep compiling while telemetry request names use {@link TELEMETRY_NAME_ROOT}.
36
+ * @alias
37
+ */
19
38
  export declare const TELEMETRY_COMMAND_ROOT = "uip";
39
+ /** A run that named no command at all. */
40
+ export declare const TELEMETRY_NAME_BARE_ACTION = "Invoke";
20
41
  /**
21
42
  * Build a command's telemetry name from the path parts a caller resolved.
22
43
  *
@@ -27,34 +48,59 @@ export declare const TELEMETRY_COMMAND_ROOT = "uip";
27
48
  * column. Its VALUE is the caller's business: skipping that needs the option
28
49
  * grammar, which the argv walk in `cli.core.ts` has and this does not, so a
29
50
  * second guess here would only contradict it;
30
- * - a repeated root, so `uip.uip.tools` cannot happen.
51
+ * - the binary name, so `Cli.UipTools` cannot happen.
31
52
  *
32
53
  * What survives is still not trusted to be a command, so shape is checked: a
33
54
  * token has to look like a command name and not like an identifier, and
34
- * anything else becomes `<unknown>` — which keeps the row, a failed run the user
55
+ * anything else becomes `Unknown` — which keeps the row, a failed run the user
35
56
  * cared about, without the column carrying a key.
36
57
  *
37
- * Whitespace inside a part is a part that was never split — the name is
38
- * dot-separated, so a space in it is a sign the caller handed over a joined
39
- * string. It is split back into levels only when EVERY piece is a command name;
40
- * one piece that is not means the part was never a joined path, and it collapses
41
- * whole onto a single `<unknown>`. A single argv token therefore stays a single
42
- * level: `uip "nope\nsecond"` is `uip.<unknown>`, not `uip.<unknown>.second` —
43
- * one typo cannot invent a path level the user never typed.
44
- *
45
- * That check is the second line of defence, not the first. What a caller hands
46
- * over is what bounds this column: `deriveCommandPath` walks the Commander tree
47
- * and passes command names only, and `cli.core.ts`'s walk pushes at most ONE
48
- * unrecognized token, in first position, then stops. So an argument never
49
- * reaches here — `uip or assets get <guid>` is `uip.or.assets.get` and `uip or
50
- * queues items add myqueue` stops at the last command it recognized. What a
51
- * shape check is left to catch is the first token of a run that named no
52
- * command at all, where the user typed something the CLI does not have.
58
+ * Whitespace inside a part is a part that was never split — the caller handed
59
+ * over a joined string. It is split back into tokens only when EVERY piece is a
60
+ * command name; one piece that is not means the part was never a joined path,
61
+ * and it collapses whole onto a single `Unknown`. So one argv token that holds
62
+ * a value contributes one token: `uip "no'pe\nsecond"` is `Cli.Unknown`, not
63
+ * `Cli.UnknownSecond` — one typo cannot invent a path level the user never
64
+ * typed. A token whose pieces all read as command names does still split, and
65
+ * that is the point of the rule: it is how a caller's joined `"help config"`
66
+ * gets back to two levels.
67
+ *
68
+ * That check is the second line of defence, not the first, and it could not be
69
+ * the first: a positional sits in command position and shape cannot tell one
70
+ * from a subcommand — `myasset` in `uip or assets get myasset` is lowercase,
71
+ * dash-free and short, exactly like `assets`. Only the Commander tree knows,
72
+ * so the tree is what bounds this column. `deriveCommandParts` walks up from
73
+ * the command object and passes command names only; `cli.core.ts` walks the
74
+ * tree down from argv, stops at the first token it cannot match, and keeps at
75
+ * most ONE unmatched token, in first position. `commandPartsFromArgs`
76
+ * (`parseError.ts`) has no tree at all, so it applies that same rule with an
77
+ * empty one and keeps exactly one token. So an argument never reaches here —
78
+ * `uip or assets get <guid>` is `Cli.OrAssetsGet`, and `uip or queues items
79
+ * add myqueue` stops at the last command the tree recognized. What a shape
80
+ * check is left to catch is that one first token, where the user typed
81
+ * something the CLI does not have.
53
82
  *
54
83
  * A token shaped like a command name IS kept there, deliberately: `uip deploy`
55
84
  * or `uip login-sso` is a person or an agent guessing at syntax we do not have,
56
- * and that is worth seeing rather than collapsing into one `<unknown>` row. The
57
- * cost is that this column's values are not a closed set — one row per distinct
58
- * guess — bounded by the shapes below rather than by a list.
85
+ * and that is worth seeing rather than collapsing into one `Cli.Unknown` row.
86
+ * The cost is that this column's values are not a closed set — one row per
87
+ * distinct guess — bounded by the shapes below rather than by a list.
59
88
  */
60
89
  export declare function commandTelemetryName(parts: readonly string[]): string;
90
+ /**
91
+ * The same parts as a person would type them: `uip or assets list`.
92
+ *
93
+ * The flat telemetry name cannot be turned back into this — `Cli.OrAssetsList`
94
+ * has lost where the levels were — so both renderings are built from the parts
95
+ * and neither is derived from the other. This one is what `CommandName`
96
+ * carries, what the attribution lookup is keyed on, and what a `--help` hint
97
+ * has to print to stay a command the user can actually run.
98
+ *
99
+ * It runs the parts through the SAME vetting as the name, and that is not
100
+ * cosmetic. The name collapses an unrecognized token to `Unknown`; a raw join
101
+ * would put that same token straight in a dimension, and the redactor behind
102
+ * it only fires on value SHAPES — a GUID would be caught, a queue name or a
103
+ * solution name would not. Vetting here is what keeps the two renderings
104
+ * telling the same truth.
105
+ */
106
+ export declare function commandInvocationPath(parts: readonly string[]): string;
@@ -1,6 +1,6 @@
1
1
  import type { CliErrorCode, ErrorContext, FailureResultType, RetryHint } from "../formatter";
2
2
  import type { TelemetryProperties } from "./telemetry-service";
3
- export type CommandErrorClass = "auth" | "network_http" | "validation" | "missing_dependency" | "timeout" | "internal" | "unknown" | "user_cancelled";
3
+ export type CommandErrorClass = "auth" | "local_permission" | "network_http" | "validation" | "missing_dependency" | "timeout" | "internal" | "unknown" | "user_cancelled";
4
4
  export type TerminalOutcome = "success" | "failure" | "cancelled" | "no_op";
5
5
  export interface RecordedCommandFailure {
6
6
  result?: FailureResultType;
@@ -17,7 +17,7 @@ export declare function normalizeEnvironment(baseUrl: string | undefined): Norma
17
17
  export declare function normalizeBaseUrl(baseUrl: string | undefined): string | undefined;
18
18
  /**
19
19
  * Build the normalized environment telemetry properties for a base URL.
20
- * `environment` is always present (falling back to `unknown`); `base_url` and
21
- * `region` are added only when they can be derived safely.
20
+ * `Environment` is always present (falling back to `unknown`); `BaseUrl` and
21
+ * `Region` are added only when they can be derived safely.
22
22
  */
23
23
  export declare function buildEnvironmentProperties(baseUrl: string | undefined): TelemetryProperties;
@@ -6,6 +6,7 @@ export { buildEnvironmentProperties, type NormalizedEnvironment, normalizeBaseUr
6
6
  export { type CiProvider, detectExecutionContext, EXECUTION_CONTEXT_VALUES, type ExecutionContext, type ExecutionContextDetection, type ExecutionContextDetectionOptions, getExecutionContextTelemetryProperties, setExecutionContextAuthSignal, } from "./execution-context.js";
7
7
  export { redactError, redactProperties, redactProperty, } from "./pii-redactor.js";
8
8
  export { getConfiguredTelemetrySessionId, getTelemetrySessionId, getTelemetrySessionSource, TELEMETRY_SESSION_ID_ENV, TELEMETRY_SESSION_SOURCE_PROPERTY, } from "./session-id.js";
9
+ export * from "./telemetry-dimensions.js";
9
10
  export type { ITelemetryProvider, TelemetryCorrelation, TrackedDependencySpan, TrackedEvent, TrackedException, TrackedSpan, } from "./telemetry-provider.js";
10
11
  export type { ITelemetryService, TelemetryContext, TelemetryProperties, } from "./telemetry-service.js";
11
12
  export { TelemetryService } from "./telemetry-service.js";