terse-types 0.0.38 → 0.0.39

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.
@@ -32,7 +32,6 @@ export declare const ApiRoutes: {
32
32
  };
33
33
  GITHUB: {
34
34
  INTEGRATIONS: string;
35
- INSTALLATION_URL: string;
36
35
  GET_REPOSITORIES_FOR_INTEGRATION: string;
37
36
  INSTALLATION_CALLBACK: string;
38
37
  INSTALLATION_DELETED: string;
@@ -32,7 +32,6 @@
32
32
  },
33
33
  "GITHUB": {
34
34
  "INTEGRATIONS": "/github/integrations",
35
- "INSTALLATION_URL": "/github/installation-url",
36
35
  "GET_REPOSITORIES_FOR_INTEGRATION": "/github/get-repositories-for-integration",
37
36
  "INSTALLATION_CALLBACK": "/github/installation-callback",
38
37
  "INSTALLATION_DELETED": "/github/installation-deleted",
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Collapses a single Attio value entry (or nested structure) toward primitives /
3
+ * simple objects, matching the shape produced for generated Attio tool outputs.
4
+ */
5
+ export declare function flattenAttioLeafValue(value: unknown): unknown;
6
+ /**
7
+ * Flattens one attribute’s raw value (often an array of interaction rows from the REST API).
8
+ * @param preferArray When true, keep all entries as an array; when false, use the first entry only.
9
+ */
10
+ export declare function flattenAttioAttributeValue(rawValue: unknown, preferArray: boolean): unknown;
11
+ /**
12
+ * Flattens `record.values` from Attio’s GET record / webhook enrichment payload.
13
+ */
14
+ export declare function flattenAttioRecordValues(values: Record<string, unknown>, isMultiValueAttribute: (attributeSlug: string) => boolean): Record<string, unknown>;
15
+ /**
16
+ * Slug-only heuristic when object attribute metadata is unavailable (e.g. Attio webhook triggers).
17
+ * Prefer {@link flattenAttioRecordValues} with object-aware multi-value info from codegen when possible.
18
+ */
19
+ export declare function isProbablyAttioMultiValueAttributeSlug(attributeSlug: string): boolean;
@@ -0,0 +1,71 @@
1
+ /** Keys Attio nests on attribute timeline entries (not the semantic payload). */
2
+ const ATTIO_VALUE_METADATA_KEYS = new Set([
3
+ "active_from",
4
+ "active_until",
5
+ "attribute_type",
6
+ "created_by_actor"
7
+ ]);
8
+ /**
9
+ * Collapses a single Attio value entry (or nested structure) toward primitives /
10
+ * simple objects, matching the shape produced for generated Attio tool outputs.
11
+ */
12
+ export function flattenAttioLeafValue(value) {
13
+ if (value === null || value === undefined)
14
+ return value;
15
+ if (Array.isArray(value))
16
+ return value.map(entry => flattenAttioLeafValue(entry));
17
+ if (typeof value !== "object")
18
+ return value;
19
+ const rawObject = value;
20
+ if (typeof rawObject.full_name === "string")
21
+ return rawObject.full_name;
22
+ if (typeof rawObject.email_address === "string")
23
+ return rawObject.email_address;
24
+ if (typeof rawObject.domain === "string")
25
+ return rawObject.domain;
26
+ if (typeof rawObject.phone_number === "string")
27
+ return rawObject.phone_number;
28
+ if ("value" in rawObject)
29
+ return flattenAttioLeafValue(rawObject.value);
30
+ const dataEntries = Object.entries(rawObject).filter(([key]) => !ATTIO_VALUE_METADATA_KEYS.has(key));
31
+ if (dataEntries.length === 0)
32
+ return rawObject;
33
+ if (dataEntries.length === 1)
34
+ return flattenAttioLeafValue(dataEntries[0][1]);
35
+ return Object.fromEntries(dataEntries.map(([key, entryValue]) => [key, flattenAttioLeafValue(entryValue)]));
36
+ }
37
+ /**
38
+ * Flattens one attribute’s raw value (often an array of interaction rows from the REST API).
39
+ * @param preferArray When true, keep all entries as an array; when false, use the first entry only.
40
+ */
41
+ export function flattenAttioAttributeValue(rawValue, preferArray) {
42
+ if (!Array.isArray(rawValue))
43
+ return flattenAttioLeafValue(rawValue);
44
+ const flattened = rawValue.map(entry => flattenAttioLeafValue(entry)).filter(entry => entry !== undefined);
45
+ return preferArray ? flattened : flattened[0];
46
+ }
47
+ /**
48
+ * Flattens `record.values` from Attio’s GET record / webhook enrichment payload.
49
+ */
50
+ export function flattenAttioRecordValues(values, isMultiValueAttribute) {
51
+ const flattenedValues = {};
52
+ for (const [attributeSlug, rawValue] of Object.entries(values)) {
53
+ flattenedValues[attributeSlug] = flattenAttioAttributeValue(rawValue, isMultiValueAttribute(attributeSlug));
54
+ }
55
+ return flattenedValues;
56
+ }
57
+ /**
58
+ * Slug-only heuristic when object attribute metadata is unavailable (e.g. Attio webhook triggers).
59
+ * Prefer {@link flattenAttioRecordValues} with object-aware multi-value info from codegen when possible.
60
+ */
61
+ export function isProbablyAttioMultiValueAttributeSlug(attributeSlug) {
62
+ const slug = attributeSlug.toLowerCase();
63
+ return (slug === "email_addresses" ||
64
+ slug === "domains" ||
65
+ slug === "phone_numbers" ||
66
+ slug === "social_profiles" ||
67
+ slug === "links" ||
68
+ slug === "tags" ||
69
+ slug.endsWith("_addresses") ||
70
+ slug.endsWith("_ids"));
71
+ }
@@ -7,12 +7,7 @@
7
7
  },
8
8
  "ONBOARD": "/onboard",
9
9
  "AGENTS": {
10
- "LIST": "/app/agents",
11
- "SETUP": "/app/agents/setup",
12
- "NEW": "/app/agents/new",
13
- "NEW_WITH_TEMPLATE": "/app/agents/new/template/:templateId",
14
10
  "BY_ID": "/app/agents/:id",
15
- "HISTORY": "/app/agents/:id?tab=history",
16
11
  "IMPROVEMENTS": "/app/agents/:id?tab=improvements",
17
12
  "ALERTS": "/app/agents/:id?tab=setup&section=alerts",
18
13
  "RUN_HISTORY": "/app/agents/:id?tab=history&runId=:runId"
@@ -9,12 +9,7 @@ export declare const FrontendRoutes: {
9
9
  };
10
10
  ONBOARD: string;
11
11
  AGENTS: {
12
- LIST: string;
13
- SETUP: string;
14
- NEW: string;
15
- NEW_WITH_TEMPLATE: string;
16
12
  BY_ID: string;
17
- HISTORY: string;
18
13
  IMPROVEMENTS: string;
19
14
  ALERTS: string;
20
15
  RUN_HISTORY: string;
@@ -134,16 +134,6 @@ export declare const toolCallCompleteSchema: z.ZodObject<{
134
134
  }, z.core.$strip>>;
135
135
  }, z.core.$strip>;
136
136
  export type ToolCallComplete = z.infer<typeof toolCallCompleteSchema>;
137
- export declare const filterResultSchema: z.ZodObject<{
138
- id: z.ZodString;
139
- timestamp: z.ZodNumber;
140
- response_id: z.ZodString;
141
- isRelevant: z.ZodBoolean;
142
- reason: z.ZodString;
143
- confidence: z.ZodNumber;
144
- type: z.ZodLiteral<"FilterResult">;
145
- }, z.core.$strip>;
146
- export type FilterResult = z.infer<typeof filterResultSchema>;
147
137
  export declare enum SandboxStage {
148
138
  DOWNLOADING_SOURCE = "downloading_source",
149
139
  BOOTING = "booting",
@@ -445,14 +435,6 @@ export declare const modelEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
445
435
  timestamp: z.ZodNumber;
446
436
  response_id: z.ZodString;
447
437
  type: z.ZodLiteral<"NaturalStop">;
448
- }, z.core.$strip>, z.ZodObject<{
449
- id: z.ZodString;
450
- timestamp: z.ZodNumber;
451
- response_id: z.ZodString;
452
- isRelevant: z.ZodBoolean;
453
- reason: z.ZodString;
454
- confidence: z.ZodNumber;
455
- type: z.ZodLiteral<"FilterResult">;
456
438
  }, z.core.$strip>, z.ZodObject<{
457
439
  id: z.ZodString;
458
440
  timestamp: z.ZodNumber;
@@ -90,12 +90,6 @@ export const toolCallCompleteSchema = modelEventBaseSchema.extend({
90
90
  result: z.string().optional(),
91
91
  errorContext: sharedErrorContextSchema.optional()
92
92
  });
93
- export const filterResultSchema = modelEventBaseSchema.extend({
94
- isRelevant: z.boolean(),
95
- reason: z.string(),
96
- confidence: z.number(),
97
- type: z.literal("FilterResult")
98
- });
99
93
  export var SandboxStage;
100
94
  (function (SandboxStage) {
101
95
  SandboxStage["DOWNLOADING_SOURCE"] = "downloading_source";
@@ -188,7 +182,6 @@ export const modelEventSchema = z.discriminatedUnion("type", [
188
182
  runErrorSchema,
189
183
  cancelledSchema,
190
184
  naturalStopSchema,
191
- filterResultSchema,
192
185
  userMessageSchema,
193
186
  thinkingSchema,
194
187
  modelEventChatSnippetSchema,