@40rty/ams-sdk 0.5.0 → 0.5.2

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.
Files changed (24) hide show
  1. package/dist/index.js +816 -548
  2. package/dist/types/sdk/src/analytics/index.d.ts +1 -1
  3. package/dist/types/sdk/src/analytics/outbox.d.ts +2 -0
  4. package/dist/types/sdk/src/analytics/scope-context.d.ts +2 -0
  5. package/dist/types/sdk/src/analytics/scope.d.ts +7 -0
  6. package/dist/types/sdk/src/host/host-modules.d.ts +275 -36
  7. package/dist/types/spacestation/src/analytics/envelope.d.ts +24 -0
  8. package/dist/types/spacestation/src/attachment/attachment.d.ts +8 -5
  9. package/dist/types/spacestation/src/catalog/element-filled.d.ts +2 -2
  10. package/dist/types/spacestation/src/catalog/wire/index.d.ts +2 -0
  11. package/dist/types/spacestation/src/catalog/wire/package-bundle-ref.d.ts +30 -0
  12. package/dist/types/spacestation/src/catalog/wire/package-release.d.ts +20 -0
  13. package/dist/types/spacestation/src/catalog/wire/sdk-compat.d.ts +43 -0
  14. package/dist/types/spacestation/src/contracts/socket-ticket-param.d.ts +9 -0
  15. package/dist/types/spacestation/src/contracts/wire-protocol.d.ts +25 -0
  16. package/dist/types/spacestation/src/index.d.ts +5 -1
  17. package/dist/types/spacestation/src/space/agent-directive.d.ts +239 -0
  18. package/dist/types/spacestation/src/space/session-queue.d.ts +24 -24
  19. package/dist/types/spacestation/src/space/trace.d.ts +12 -12
  20. package/dist/types/spacestation/src/trace/trace-diagnostics.d.ts +8 -0
  21. package/dist/types/spacestation/src/trace/trace-events.d.ts +1 -0
  22. package/dist/types/spacestation/src/widgets/presence/index.d.ts +1 -1
  23. package/dist/types/spacestation/src/widgets/presence/scan.d.ts +21 -0
  24. package/package.json +1 -1
@@ -220,6 +220,8 @@ export declare const SessionBugSchema: z.ZodObject<{
220
220
  }, "strip", z.ZodTypeAny, {
221
221
  id: string;
222
222
  title: string;
223
+ severity: "high" | "medium" | "low";
224
+ createdBy: string;
223
225
  createdAt: string;
224
226
  provider: string;
225
227
  turnIndex: number | null;
@@ -235,13 +237,13 @@ export declare const SessionBugSchema: z.ZodObject<{
235
237
  issueUrl: string | null;
236
238
  issueState: string | null;
237
239
  body: string;
238
- severity: "high" | "medium" | "low";
239
- createdBy: string;
240
240
  resolvedAt: string | null;
241
241
  resolvedBy: string | null;
242
242
  }, {
243
243
  id: string;
244
244
  title: string;
245
+ severity: "high" | "medium" | "low";
246
+ createdBy: string;
245
247
  createdAt: string;
246
248
  provider: string;
247
249
  turnIndex: number | null;
@@ -257,8 +259,6 @@ export declare const SessionBugSchema: z.ZodObject<{
257
259
  issueUrl: string | null;
258
260
  issueState: string | null;
259
261
  body: string;
260
- severity: "high" | "medium" | "low";
261
- createdBy: string;
262
262
  resolvedAt: string | null;
263
263
  resolvedBy: string | null;
264
264
  }>;
@@ -351,6 +351,8 @@ export declare const SpaceBugSchema: z.ZodObject<{
351
351
  sessionId: string;
352
352
  id: string;
353
353
  title: string;
354
+ severity: "high" | "medium" | "low";
355
+ createdBy: string;
354
356
  createdAt: string;
355
357
  provider: string;
356
358
  turnIndex: number | null;
@@ -366,14 +368,14 @@ export declare const SpaceBugSchema: z.ZodObject<{
366
368
  issueUrl: string | null;
367
369
  issueState: string | null;
368
370
  body: string;
369
- severity: "high" | "medium" | "low";
370
- createdBy: string;
371
371
  resolvedAt: string | null;
372
372
  resolvedBy: string | null;
373
373
  }, {
374
374
  sessionId: string;
375
375
  id: string;
376
376
  title: string;
377
+ severity: "high" | "medium" | "low";
378
+ createdBy: string;
377
379
  createdAt: string;
378
380
  provider: string;
379
381
  turnIndex: number | null;
@@ -389,8 +391,6 @@ export declare const SpaceBugSchema: z.ZodObject<{
389
391
  issueUrl: string | null;
390
392
  issueState: string | null;
391
393
  body: string;
392
- severity: "high" | "medium" | "low";
393
- createdBy: string;
394
394
  resolvedAt: string | null;
395
395
  resolvedBy: string | null;
396
396
  }>;
@@ -457,6 +457,7 @@ export declare const SessionCommentSchema: z.ZodObject<{
457
457
  createdAt: z.ZodString;
458
458
  }, "strip", z.ZodTypeAny, {
459
459
  id: string;
460
+ createdBy: string;
460
461
  createdAt: string;
461
462
  turnIndex: number | null;
462
463
  location: {
@@ -468,10 +469,10 @@ export declare const SessionCommentSchema: z.ZodObject<{
468
469
  pageY: number | null;
469
470
  } | null;
470
471
  body: string;
471
- createdBy: string;
472
472
  bugId: string | null;
473
473
  }, {
474
474
  id: string;
475
+ createdBy: string;
475
476
  createdAt: string;
476
477
  turnIndex: number | null;
477
478
  location: {
@@ -483,7 +484,6 @@ export declare const SessionCommentSchema: z.ZodObject<{
483
484
  pageY: number | null;
484
485
  } | null;
485
486
  body: string;
486
- createdBy: string;
487
487
  bugId: string | null;
488
488
  }>;
489
489
  export type SessionComment = z.infer<typeof SessionCommentSchema>;
@@ -1661,6 +1661,8 @@ export declare const SessionDetailSchema: z.ZodObject<{
1661
1661
  }, "strip", z.ZodTypeAny, {
1662
1662
  id: string;
1663
1663
  title: string;
1664
+ severity: "high" | "medium" | "low";
1665
+ createdBy: string;
1664
1666
  createdAt: string;
1665
1667
  provider: string;
1666
1668
  turnIndex: number | null;
@@ -1676,13 +1678,13 @@ export declare const SessionDetailSchema: z.ZodObject<{
1676
1678
  issueUrl: string | null;
1677
1679
  issueState: string | null;
1678
1680
  body: string;
1679
- severity: "high" | "medium" | "low";
1680
- createdBy: string;
1681
1681
  resolvedAt: string | null;
1682
1682
  resolvedBy: string | null;
1683
1683
  }, {
1684
1684
  id: string;
1685
1685
  title: string;
1686
+ severity: "high" | "medium" | "low";
1687
+ createdBy: string;
1686
1688
  createdAt: string;
1687
1689
  provider: string;
1688
1690
  turnIndex: number | null;
@@ -1698,8 +1700,6 @@ export declare const SessionDetailSchema: z.ZodObject<{
1698
1700
  issueUrl: string | null;
1699
1701
  issueState: string | null;
1700
1702
  body: string;
1701
- severity: "high" | "medium" | "low";
1702
- createdBy: string;
1703
1703
  resolvedAt: string | null;
1704
1704
  resolvedBy: string | null;
1705
1705
  }>, "many">;
@@ -1765,6 +1765,7 @@ export declare const SessionDetailSchema: z.ZodObject<{
1765
1765
  createdAt: z.ZodString;
1766
1766
  }, "strip", z.ZodTypeAny, {
1767
1767
  id: string;
1768
+ createdBy: string;
1768
1769
  createdAt: string;
1769
1770
  turnIndex: number | null;
1770
1771
  location: {
@@ -1776,10 +1777,10 @@ export declare const SessionDetailSchema: z.ZodObject<{
1776
1777
  pageY: number | null;
1777
1778
  } | null;
1778
1779
  body: string;
1779
- createdBy: string;
1780
1780
  bugId: string | null;
1781
1781
  }, {
1782
1782
  id: string;
1783
+ createdBy: string;
1783
1784
  createdAt: string;
1784
1785
  turnIndex: number | null;
1785
1786
  location: {
@@ -1791,7 +1792,6 @@ export declare const SessionDetailSchema: z.ZodObject<{
1791
1792
  pageY: number | null;
1792
1793
  } | null;
1793
1794
  body: string;
1794
- createdBy: string;
1795
1795
  bugId: string | null;
1796
1796
  }>, "many">;
1797
1797
  /** Optional during API/console rolling deployment. Absent is unavailable,
@@ -1892,6 +1892,8 @@ export declare const SessionDetailSchema: z.ZodObject<{
1892
1892
  bugs: {
1893
1893
  id: string;
1894
1894
  title: string;
1895
+ severity: "high" | "medium" | "low";
1896
+ createdBy: string;
1895
1897
  createdAt: string;
1896
1898
  provider: string;
1897
1899
  turnIndex: number | null;
@@ -1907,13 +1909,12 @@ export declare const SessionDetailSchema: z.ZodObject<{
1907
1909
  issueUrl: string | null;
1908
1910
  issueState: string | null;
1909
1911
  body: string;
1910
- severity: "high" | "medium" | "low";
1911
- createdBy: string;
1912
1912
  resolvedAt: string | null;
1913
1913
  resolvedBy: string | null;
1914
1914
  }[];
1915
1915
  comments: {
1916
1916
  id: string;
1917
+ createdBy: string;
1917
1918
  createdAt: string;
1918
1919
  turnIndex: number | null;
1919
1920
  location: {
@@ -1925,7 +1926,6 @@ export declare const SessionDetailSchema: z.ZodObject<{
1925
1926
  pageY: number | null;
1926
1927
  } | null;
1927
1928
  body: string;
1928
- createdBy: string;
1929
1929
  bugId: string | null;
1930
1930
  }[];
1931
1931
  activity?: {
@@ -1990,6 +1990,8 @@ export declare const SessionDetailSchema: z.ZodObject<{
1990
1990
  bugs: {
1991
1991
  id: string;
1992
1992
  title: string;
1993
+ severity: "high" | "medium" | "low";
1994
+ createdBy: string;
1993
1995
  createdAt: string;
1994
1996
  provider: string;
1995
1997
  turnIndex: number | null;
@@ -2005,13 +2007,12 @@ export declare const SessionDetailSchema: z.ZodObject<{
2005
2007
  issueUrl: string | null;
2006
2008
  issueState: string | null;
2007
2009
  body: string;
2008
- severity: "high" | "medium" | "low";
2009
- createdBy: string;
2010
2010
  resolvedAt: string | null;
2011
2011
  resolvedBy: string | null;
2012
2012
  }[];
2013
2013
  comments: {
2014
2014
  id: string;
2015
+ createdBy: string;
2015
2016
  createdAt: string;
2016
2017
  turnIndex: number | null;
2017
2018
  location: {
@@ -2023,7 +2024,6 @@ export declare const SessionDetailSchema: z.ZodObject<{
2023
2024
  pageY: number | null;
2024
2025
  } | null;
2025
2026
  body: string;
2026
- createdBy: string;
2027
2027
  bugId: string | null;
2028
2028
  }[];
2029
2029
  activity?: {
@@ -2118,9 +2118,9 @@ export declare const FileBugInputSchema: z.ZodObject<{
2118
2118
  }, "strip", z.ZodTypeAny, {
2119
2119
  payload: Record<string, unknown>;
2120
2120
  title: string;
2121
+ severity: "high" | "medium" | "low";
2121
2122
  turnIndex: number | null;
2122
2123
  body: string;
2123
- severity: "high" | "medium" | "low";
2124
2124
  location?: {
2125
2125
  elementId: string | null;
2126
2126
  elementType: string | null;
@@ -2132,9 +2132,9 @@ export declare const FileBugInputSchema: z.ZodObject<{
2132
2132
  }, {
2133
2133
  payload: Record<string, unknown>;
2134
2134
  title: string;
2135
+ severity: "high" | "medium" | "low";
2135
2136
  turnIndex: number | null;
2136
2137
  body: string;
2137
- severity: "high" | "medium" | "low";
2138
2138
  location?: {
2139
2139
  elementId: string | null;
2140
2140
  elementType: string | null;
@@ -52,7 +52,9 @@ export declare const TraceRecordSchema: z.ZodObject<{
52
52
  createdAt: z.ZodString;
53
53
  }, "strip", z.ZodTypeAny, {
54
54
  sessionId: string;
55
+ turnId: string | null;
55
56
  id: string;
57
+ createdAt: string;
56
58
  spaceId: string | null;
57
59
  visitorEmail: string | null;
58
60
  userPrompt: string;
@@ -69,13 +71,13 @@ export declare const TraceRecordSchema: z.ZodObject<{
69
71
  latencyFirstText: number | null;
70
72
  latencyFirstPatch: number | null;
71
73
  latencyTotal: number | null;
72
- turnId: string | null;
73
- createdAt: string;
74
74
  layout?: unknown;
75
75
  trackerState?: unknown;
76
76
  }, {
77
77
  sessionId: string;
78
+ turnId: string | null;
78
79
  id: string;
80
+ createdAt: string;
79
81
  spaceId: string | null;
80
82
  visitorEmail: string | null;
81
83
  userPrompt: string;
@@ -92,8 +94,6 @@ export declare const TraceRecordSchema: z.ZodObject<{
92
94
  latencyFirstText: number | null;
93
95
  latencyFirstPatch: number | null;
94
96
  latencyTotal: number | null;
95
- turnId: string | null;
96
- createdAt: string;
97
97
  layout?: unknown;
98
98
  trackerState?: unknown;
99
99
  }>;
@@ -144,6 +144,7 @@ export declare const CreateTraceInputSchema: z.ZodObject<{
144
144
  turnId: z.ZodNullable<z.ZodString>;
145
145
  }, "strip", z.ZodTypeAny, {
146
146
  sessionId: string;
147
+ turnId: string | null;
147
148
  spaceId: string | null;
148
149
  visitorEmail: string | null;
149
150
  userPrompt: string;
@@ -160,11 +161,11 @@ export declare const CreateTraceInputSchema: z.ZodObject<{
160
161
  latencyFirstText: number | null;
161
162
  latencyFirstPatch: number | null;
162
163
  latencyTotal: number | null;
163
- turnId: string | null;
164
164
  layout?: unknown;
165
165
  trackerState?: unknown;
166
166
  }, {
167
167
  sessionId: string;
168
+ turnId: string | null;
168
169
  spaceId: string | null;
169
170
  visitorEmail: string | null;
170
171
  userPrompt: string;
@@ -181,7 +182,6 @@ export declare const CreateTraceInputSchema: z.ZodObject<{
181
182
  latencyFirstText: number | null;
182
183
  latencyFirstPatch: number | null;
183
184
  latencyTotal: number | null;
184
- turnId: string | null;
185
185
  layout?: unknown;
186
186
  trackerState?: unknown;
187
187
  }>;
@@ -244,6 +244,7 @@ export declare const SessionTurnSchema: z.ZodObject<{
244
244
  diagnostics: z.ZodNullable<z.ZodArray<z.ZodUnknown, "many">>;
245
245
  }, "strip", z.ZodTypeAny, {
246
246
  id: string;
247
+ createdAt: string;
247
248
  userPrompt: string;
248
249
  responseText: string | null;
249
250
  phaseTimings: Record<string, number> | null;
@@ -254,10 +255,10 @@ export declare const SessionTurnSchema: z.ZodObject<{
254
255
  toolCalls: unknown[] | null;
255
256
  diagnostics: unknown[] | null;
256
257
  latencyTotal: number | null;
257
- createdAt: string;
258
258
  layout?: unknown;
259
259
  }, {
260
260
  id: string;
261
+ createdAt: string;
261
262
  userPrompt: string;
262
263
  responseText: string | null;
263
264
  phaseTimings: Record<string, number> | null;
@@ -268,7 +269,6 @@ export declare const SessionTurnSchema: z.ZodObject<{
268
269
  toolCalls: unknown[] | null;
269
270
  diagnostics: unknown[] | null;
270
271
  latencyTotal: number | null;
271
- createdAt: string;
272
272
  layout?: unknown;
273
273
  }>;
274
274
  export type SessionTurn = z.infer<typeof SessionTurnSchema>;
@@ -305,6 +305,7 @@ export declare const SessionReplaySchema: z.ZodObject<{
305
305
  diagnostics: z.ZodNullable<z.ZodArray<z.ZodUnknown, "many">>;
306
306
  }, "strip", z.ZodTypeAny, {
307
307
  id: string;
308
+ createdAt: string;
308
309
  userPrompt: string;
309
310
  responseText: string | null;
310
311
  phaseTimings: Record<string, number> | null;
@@ -315,10 +316,10 @@ export declare const SessionReplaySchema: z.ZodObject<{
315
316
  toolCalls: unknown[] | null;
316
317
  diagnostics: unknown[] | null;
317
318
  latencyTotal: number | null;
318
- createdAt: string;
319
319
  layout?: unknown;
320
320
  }, {
321
321
  id: string;
322
+ createdAt: string;
322
323
  userPrompt: string;
323
324
  responseText: string | null;
324
325
  phaseTimings: Record<string, number> | null;
@@ -329,7 +330,6 @@ export declare const SessionReplaySchema: z.ZodObject<{
329
330
  toolCalls: unknown[] | null;
330
331
  diagnostics: unknown[] | null;
331
332
  latencyTotal: number | null;
332
- createdAt: string;
333
333
  layout?: unknown;
334
334
  }>, "many">;
335
335
  /**
@@ -346,6 +346,7 @@ export declare const SessionReplaySchema: z.ZodObject<{
346
346
  }, "strip", z.ZodTypeAny, {
347
347
  turns: {
348
348
  id: string;
349
+ createdAt: string;
349
350
  userPrompt: string;
350
351
  responseText: string | null;
351
352
  phaseTimings: Record<string, number> | null;
@@ -356,13 +357,13 @@ export declare const SessionReplaySchema: z.ZodObject<{
356
357
  toolCalls: unknown[] | null;
357
358
  diagnostics: unknown[] | null;
358
359
  latencyTotal: number | null;
359
- createdAt: string;
360
360
  layout?: unknown;
361
361
  }[];
362
362
  sessionLayout: Record<string, unknown> | null;
363
363
  }, {
364
364
  turns: {
365
365
  id: string;
366
+ createdAt: string;
366
367
  userPrompt: string;
367
368
  responseText: string | null;
368
369
  phaseTimings: Record<string, number> | null;
@@ -373,7 +374,6 @@ export declare const SessionReplaySchema: z.ZodObject<{
373
374
  toolCalls: unknown[] | null;
374
375
  diagnostics: unknown[] | null;
375
376
  latencyTotal: number | null;
376
- createdAt: string;
377
377
  layout?: unknown;
378
378
  }[];
379
379
  sessionLayout: Record<string, unknown> | null;
@@ -72,6 +72,14 @@ export type TraceDiagnostic = {
72
72
  kind: 'signal_patch_malformed';
73
73
  stage: 'layout_generation';
74
74
  reason: string;
75
+ }
76
+ /** A `{`-line the model wrote that failed JSON.parse. `repaired` = completed
77
+ * with its missing closers and kept; otherwise the parser drops it. */
78
+ | {
79
+ kind: 'patch_line_malformed';
80
+ stage: 'layout_generation';
81
+ repaired: boolean;
82
+ sample: string;
75
83
  } | {
76
84
  kind: 'follow_up_absent';
77
85
  stage: 'layout_generation';
@@ -439,6 +439,7 @@ export type TraceEvent = {
439
439
  turnId?: string;
440
440
  message: string;
441
441
  step?: string;
442
+ visitorSafe?: true;
442
443
  } | {
443
444
  type: 'diagnostic';
444
445
  diagnostic: TraceDiagnostic;
@@ -1,4 +1,4 @@
1
1
  export { type AgentPresenceFrame, type PresenceFact, SCANNING_FORM, } from './frame';
2
- export { deriveSourceElement, pendingSourceElement, type SourceElementInput, type SourceLookupInput, } from './scan';
2
+ export { deriveSourceElement, pendingSourceElement, projectSourceOutput, type ProjectedSourceOutput, type SourceElementInput, type SourceLookupInput, } from './scan';
3
3
  export { type PresenceElementKind, type PresenceElement, type PresenceSourceRef, type PresenceSourceElement, type PresenceFactArtifact, type PresenceFactElement, type PresenceVoiceElement, type PresenceConcessionElement, type PresenceAskElement, type PresenceRetireOn, type PresenceLifecycle, type PresenceStreamArtifact, isPresenceStreamArtifact, PRESENCE_LIFECYCLE, } from './element';
4
4
  export { type PresenceProfile, PresenceProfileSchema, DEFAULT_PRESENCE_PROFILE } from './profile';
@@ -43,3 +43,24 @@ export declare function pendingSourceElement(input: SourceLookupInput): Presence
43
43
  * rendering gap and an empty shelf are different facts.
44
44
  */
45
45
  export declare function deriveSourceElement(input: SourceElementInput): PresenceSourceElement | undefined;
46
+ /** What `projectSourceOutput` keeps of a tool result: the drawable records under
47
+ * one recognized key, and the tool's own `total` when it reports one. */
48
+ export interface ProjectedSourceOutput {
49
+ results: Record<string, string | number | boolean>[];
50
+ total?: number;
51
+ }
52
+ /**
53
+ * The part of a tool result that may leave the server for a VISITOR.
54
+ *
55
+ * `deriveSourceElement` reads a record's `id`, its image, and its short scalar
56
+ * facets — nothing else. The raw result carries much more (nested objects,
57
+ * documents, audit keys, connector diagnostics), and the visitor wire is
58
+ * public. This keeps exactly what the derivation reads, in a shape it parses
59
+ * to the SAME element, so the trim is invisible to every card while the rest of
60
+ * the result stays on the trace channel.
61
+ *
62
+ * `undefined` when the result carries no recognizable record array — the same
63
+ * line `deriveSourceElement` draws, so a dropped output and an underivable one
64
+ * are the same outcome on the client.
65
+ */
66
+ export declare function projectSourceOutput(output: unknown): ProjectedSourceOutput | undefined;
package/package.json CHANGED
@@ -26,7 +26,7 @@
26
26
  "react": "^18.3.0 || ^19.0.0",
27
27
  "react-dom": "^18.3.0 || ^19.0.0"
28
28
  },
29
- "version": "0.5.0",
29
+ "version": "0.5.2",
30
30
  "homepage": "https://docs.40rty.ai",
31
31
  "license": "UNLICENSED",
32
32
  "engines": {