@xpert-ai/xpert-sdk 0.21.0 → 0.23.0

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 (70) hide show
  1. package/dist/artifact-presentation-types.d.ts +43 -0
  2. package/dist/artifact-presentation-types.js +2 -0
  3. package/dist/artifact-presentation-types.js.map +1 -0
  4. package/dist/artifact-presentation-types.mjs +2 -0
  5. package/dist/artifact-presentation-types.mjs.map +1 -0
  6. package/dist/conversation-resource-types.d.ts +10 -0
  7. package/dist/conversation-resource-types.js +3 -0
  8. package/dist/conversation-resource-types.js.map +1 -0
  9. package/dist/conversation-resource-types.mjs +3 -0
  10. package/dist/conversation-resource-types.mjs.map +1 -0
  11. package/dist/group-artifact-types.d.ts +95 -0
  12. package/dist/group-artifact-types.js +2 -0
  13. package/dist/group-artifact-types.js.map +1 -0
  14. package/dist/group-artifact-types.mjs +2 -0
  15. package/dist/group-artifact-types.mjs.map +1 -0
  16. package/dist/group-artifacts.d.ts +42 -0
  17. package/dist/group-artifacts.js +43 -0
  18. package/dist/group-artifacts.js.map +1 -0
  19. package/dist/group-artifacts.mjs +43 -0
  20. package/dist/group-artifacts.mjs.map +1 -0
  21. package/dist/group-resource-links.d.ts +34 -0
  22. package/dist/group-resource-links.js +71 -0
  23. package/dist/group-resource-links.js.map +1 -0
  24. package/dist/group-resource-links.mjs +71 -0
  25. package/dist/group-resource-links.mjs.map +1 -0
  26. package/dist/group-types.d.ts +64 -0
  27. package/dist/groups.d.ts +6 -1
  28. package/dist/groups.js +64 -11
  29. package/dist/groups.js.map +1 -1
  30. package/dist/groups.mjs +64 -11
  31. package/dist/groups.mjs.map +1 -1
  32. package/dist/index.d.ts +25 -20
  33. package/dist/index.js +2 -0
  34. package/dist/index.js.map +1 -1
  35. package/dist/index.mjs +2 -0
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/resource-analysis-types.d.ts +40 -0
  38. package/dist/resource-analysis-types.js +2 -0
  39. package/dist/resource-analysis-types.js.map +1 -0
  40. package/dist/resource-analysis-types.mjs +2 -0
  41. package/dist/resource-analysis-types.mjs.map +1 -0
  42. package/dist/tests/group-artifacts.test.d.ts +1 -0
  43. package/dist/tests/group-artifacts.test.js +38 -0
  44. package/dist/tests/group-artifacts.test.js.map +1 -0
  45. package/dist/tests/group-artifacts.test.mjs +38 -0
  46. package/dist/tests/group-artifacts.test.mjs.map +1 -0
  47. package/dist/tests/group-reply-stages.test.d.ts +1 -0
  48. package/dist/tests/group-reply-stages.test.js +50 -0
  49. package/dist/tests/group-reply-stages.test.js.map +1 -0
  50. package/dist/tests/group-reply-stages.test.mjs +50 -0
  51. package/dist/tests/group-reply-stages.test.mjs.map +1 -0
  52. package/dist/tests/group-resource-links.test.d.ts +1 -0
  53. package/dist/tests/group-resource-links.test.js +94 -0
  54. package/dist/tests/group-resource-links.test.js.map +1 -0
  55. package/dist/tests/group-resource-links.test.mjs +94 -0
  56. package/dist/tests/group-resource-links.test.mjs.map +1 -0
  57. package/dist/tests/groups.test.js +92 -2
  58. package/dist/tests/groups.test.js.map +1 -1
  59. package/dist/tests/groups.test.mjs +92 -2
  60. package/dist/tests/groups.test.mjs.map +1 -1
  61. package/dist/tests/workbench-open.test.js +14 -0
  62. package/dist/tests/workbench-open.test.js.map +1 -1
  63. package/dist/tests/workbench-open.test.mjs +14 -0
  64. package/dist/tests/workbench-open.test.mjs.map +1 -1
  65. package/dist/workbench-open.d.ts +16 -1
  66. package/dist/workbench-open.js +16 -1
  67. package/dist/workbench-open.js.map +1 -1
  68. package/dist/workbench-open.mjs +16 -1
  69. package/dist/workbench-open.mjs.map +1 -1
  70. package/package.json +1 -1
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Transport-independent viewer envelope for one immutable published Artifact version.
3
+ * The supplying transport reauthorizes reads/queries; this payload is not a credential.
4
+ * Render the provider entry in an isolated viewer, never as trusted host application HTML.
5
+ */
6
+ export interface ArtifactPresentation {
7
+ /** Envelope protocol version; independent of the published content's versionNumber. */
8
+ schemaVersion: 1;
9
+ /** Exact source Artifact/version pair. Never replace versionId with a latest-version lookup. */
10
+ target: {
11
+ artifactId: string;
12
+ versionId: string;
13
+ };
14
+ /** Display text only; not a resource identity or type discriminator. */
15
+ title: string;
16
+ /** Human-readable release sequence; target.versionId identifies the actual version. */
17
+ versionNumber: number;
18
+ /** Source editing is unavailable; authorized read-only interactions may still be exposed. */
19
+ readOnly: true;
20
+ /** Provider-supplied viewer document, subject to the host's sandbox and CSP. */
21
+ entry: {
22
+ html: string;
23
+ };
24
+ /** Client-safe provider state. The domain renderer validates it; generic hosts treat it as opaque. */
25
+ data: object;
26
+ /** Allowed read-only operation names; not Agent tools or a grant of upstream data access. */
27
+ operations: string[];
28
+ /** Optional ISO 8601 access deadline. Absence does not waive live authorization checks. */
29
+ expiresAt?: string | null;
30
+ }
31
+ /**
32
+ * Read-only viewer operation executed through the transport that supplied the presentation.
33
+ * The server checks the pinned target, operation allowlist and current caller's data permissions.
34
+ * This is not a request for the Agent's conversational resource_query tool.
35
+ */
36
+ export interface ArtifactPresentationQuery {
37
+ /** Copy from the current authorized presentation, without changing its pinned version. */
38
+ target: ArtifactPresentation['target'];
39
+ /** Must be declared in that presentation's operations list. */
40
+ operation: string;
41
+ /** Domain-specific request body, validated by the provider; carries no identity overrides. */
42
+ input: object;
43
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=artifact-presentation-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-presentation-types.js","sourceRoot":"","sources":["../src/artifact-presentation-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=artifact-presentation-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-presentation-types.mjs","sourceRoot":"","sources":["../src/artifact-presentation-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ /** Stable locator in the current authorized conversation. IDs never carry permissions or change Project scope. */
2
+ export type ConversationResourceTarget = {
3
+ kind: 'project-content';
4
+ id: string;
5
+ } | {
6
+ kind: 'group-reference';
7
+ id: string;
8
+ };
9
+ /** Host-owned navigation through the target's native authorization adapter; no arbitrary URLs or source Project IDs. */
10
+ export declare const WORKBENCH_RESOURCE_OPEN_COMMAND = "workbench.resource.open";
@@ -0,0 +1,3 @@
1
+ /** Host-owned navigation through the target's native authorization adapter; no arbitrary URLs or source Project IDs. */
2
+ export const WORKBENCH_RESOURCE_OPEN_COMMAND = 'workbench.resource.open';
3
+ //# sourceMappingURL=conversation-resource-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-resource-types.js","sourceRoot":"","sources":["../src/conversation-resource-types.ts"],"names":[],"mappings":"AAKA,wHAAwH;AACxH,MAAM,CAAC,MAAM,+BAA+B,GAAG,yBAAyB,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Host-owned navigation through the target's native authorization adapter; no arbitrary URLs or source Project IDs. */
2
+ export const WORKBENCH_RESOURCE_OPEN_COMMAND = 'workbench.resource.open';
3
+ //# sourceMappingURL=conversation-resource-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-resource-types.mjs","sourceRoot":"","sources":["../src/conversation-resource-types.ts"],"names":[],"mappings":"AAKA,wHAAwH;AACxH,MAAM,CAAC,MAAM,+BAA+B,GAAG,yBAAyB,CAAC"}
@@ -0,0 +1,95 @@
1
+ import type { ArtifactPresentation, ArtifactPresentationQuery } from './artifact-presentation-types.js';
2
+ import type { ResourceAnalysisPolicy } from './resource-analysis-types.js';
3
+ /**
4
+ * Client-safe grant metadata for fixed published content and one receiving group/Project.
5
+ * Contains no credentials or source file access. Status and expiry are display hints;
6
+ * every operation must still be authorized by the server.
7
+ */
8
+ export interface GroupArtifactGrant {
9
+ /** Grant identity, distinct from the reference created when the owner accepts it. */
10
+ id: string;
11
+ /** Original Artifact in the authoring Project; no copy is created in the group Project. */
12
+ artifactId: string;
13
+ /** Pinned published version ID, unrelated to a draft revision. */
14
+ versionId: string;
15
+ /** Project retaining source ownership and authoring permissions. */
16
+ ownerProjectId: string;
17
+ /** Receiving group's Project captured when the grant was offered. */
18
+ targetProjectId: string;
19
+ /** Receiving audience; another group in the same Project has no implied access. */
20
+ targetGroupId: string;
21
+ /** Read-only use of the resource, without automatic upstream data access. */
22
+ permission: 'read';
23
+ /** Proposed scope on an offer, accepted scope when active; absent/null means view-only. */
24
+ analysis?: ResourceAnalysisPolicy | null;
25
+ /** Lifecycle state; expiry or changed membership can also make a grant unusable. */
26
+ status: 'offered' | 'active' | 'revoked' | 'removed';
27
+ /** Grant concurrency token for acceptance; do not substitute a reference revision. */
28
+ revision: number;
29
+ /** ISO 8601 access deadline serialized by the host. */
30
+ expiresAt: string;
31
+ /** Display label, not an identity or permission discriminator. */
32
+ title: string;
33
+ /** Display sequence; versionId identifies the published version. */
34
+ versionNumber: number;
35
+ }
36
+ /**
37
+ * Accepted placement of a source Artifact's fixed version in one group's runtime Project.
38
+ * Keep ownerProjectId and runtimeProjectId separate; opening never switches to the source Project.
39
+ * The placement grants neither source membership nor access to other groups' references.
40
+ */
41
+ export interface GroupArtifactReference {
42
+ /** Reference ID used for group read, query, remove and navigation operations. */
43
+ id: string;
44
+ /** Backing authorization, whose live status is checked on each operation. */
45
+ grantId: string;
46
+ /** Source Artifact identity, not a copied group Artifact. */
47
+ artifactId: string;
48
+ /** Fixed published version ID; source publication never silently advances this reference. */
49
+ versionId: string;
50
+ /** Project retaining authoring authority. */
51
+ ownerProjectId: string;
52
+ /** Receiving Project, which must still match the group's current binding. */
53
+ runtimeProjectId: string;
54
+ /** Group audience owning this placement. */
55
+ groupId: string;
56
+ /** Stored display title; never resolve resource identity from it. */
57
+ title: string;
58
+ /** Reference concurrency token for removal, independent of the grant revision. */
59
+ revision: number;
60
+ /** Human-readable release sequence; use versionId for identity. */
61
+ versionNumber: number;
62
+ /** Backing grant's ISO 8601 deadline; a cached reference can still be revoked earlier. */
63
+ expiresAt: string;
64
+ /** No source editing through this placement; permitted analysis is described separately. */
65
+ readOnly: true;
66
+ /** Effective analysis scope explicitly accepted by the owner; absent/null is view-only. */
67
+ analysis?: ResourceAnalysisPolicy | null;
68
+ /** Authenticated library-view URL, not a public share link or authorization bypass. */
69
+ url: string;
70
+ }
71
+ /** Compatibility name for presentations obtained through the group API. */
72
+ export type GroupArtifactPresentation = ArtifactPresentation;
73
+ /** Authorized viewer payload and revalidated placement for subsequent group-scoped requests. */
74
+ export interface GroupArtifactView {
75
+ /** Placement reauthorized when this view was read; later operations must recheck access. */
76
+ reference: GroupArtifactReference;
77
+ /** Placement display title. */
78
+ title: string;
79
+ /** Placement revision, not a published version number or grant revision. */
80
+ revision: number;
81
+ /** Explicit content discriminator; render through the generic isolated presentation host. */
82
+ content: {
83
+ kind: 'presentation';
84
+ presentation: ArtifactPresentation;
85
+ };
86
+ }
87
+ /** Compatibility name for queries sent through the group API. */
88
+ export type GroupArtifactQuery = ArtifactPresentationQuery;
89
+ /** Server-paginated offers or references after audience/access filtering. */
90
+ export interface GroupArtifactPage<T> {
91
+ /** Visible items in this page; an empty page alone does not imply pagination is complete. */
92
+ items: T[];
93
+ /** Pass as the next offset; null means no further page. Do not derive it from items.length. */
94
+ nextOffset: number | null;
95
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=group-artifact-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group-artifact-types.js","sourceRoot":"","sources":["../src/group-artifact-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=group-artifact-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group-artifact-types.mjs","sourceRoot":"","sources":["../src/group-artifact-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,42 @@
1
+ import type { GroupTransport, GroupRequestOptions } from './groups.js';
2
+ import type { GroupArtifactGrant, GroupArtifactPage, GroupArtifactReference, GroupArtifactView, GroupArtifactQuery } from './group-artifact-types.js';
3
+ /**
4
+ * Receiving-group API exposed as client.groups.artifacts, using its existing auth/refresh transport.
5
+ * The server enforces owner-only acceptance/removal and live access on every read/query.
6
+ * Source-side offering and revocation require the separate authenticated authoring host.
7
+ */
8
+ export declare class GroupArtifactsClient {
9
+ private readonly transport;
10
+ constructor(transport: GroupTransport);
11
+ private path;
12
+ /** List pending offers for owner review; an offer is not yet an accepted resource. */
13
+ offers(groupId: string, page?: {
14
+ offset?: number;
15
+ limit?: number;
16
+ }, options?: GroupRequestOptions): Promise<GroupArtifactPage<GroupArtifactGrant>>;
17
+ /** List accessible, accepted references for this group and its current Project. */
18
+ list(groupId: string, page?: {
19
+ offset?: number;
20
+ limit?: number;
21
+ }, options?: GroupRequestOptions): Promise<GroupArtifactPage<GroupArtifactReference>>;
22
+ /** Accept an offer as group owner, creating a fixed-version reference without changing ownership. */
23
+ accept(groupId: string, input: {
24
+ /** Identity returned by offers(), not an Artifact or reference ID. */
25
+ grantId: string;
26
+ /** Grant revision observed by the owner; stale acceptance must not overwrite newer consent. */
27
+ expectedRevision: number;
28
+ /** Explicitly accept the offered analysis scope. Omitted/false accepts viewing only. */
29
+ acceptAnalysis?: boolean;
30
+ }, options?: GroupRequestOptions): Promise<GroupArtifactReference>;
31
+ /** Reauthorize a reference and load its published presentation; this does not open a UI itself. */
32
+ read(groupId: string, referenceId: string, options?: GroupRequestOptions): Promise<GroupArtifactView>;
33
+ /** Execute an allowed viewer operation under the current caller; not the Agent analysis API. */
34
+ query(groupId: string, referenceId: string, input: GroupArtifactQuery, options?: GroupRequestOptions): Promise<object>;
35
+ /** Remove this group's placement as owner. Source content remains; reattachment needs a new grant. */
36
+ remove(groupId: string, referenceId: string, input: {
37
+ /** Reference revision returned by list/read, not the backing grant's revision. */
38
+ expectedRevision: number;
39
+ }, options?: GroupRequestOptions): Promise<{
40
+ removed: boolean;
41
+ }>;
42
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Receiving-group API exposed as client.groups.artifacts, using its existing auth/refresh transport.
3
+ * The server enforces owner-only acceptance/removal and live access on every read/query.
4
+ * Source-side offering and revocation require the separate authenticated authoring host.
5
+ */
6
+ export class GroupArtifactsClient {
7
+ transport;
8
+ constructor(transport) {
9
+ this.transport = transport;
10
+ }
11
+ path(groupId, suffix) {
12
+ return `/groups/${encodeURIComponent(groupId)}/artifacts/${suffix}`;
13
+ }
14
+ /** List pending offers for owner review; an offer is not yet an accepted resource. */
15
+ offers(groupId, page = {}, options) {
16
+ return this.transport.json(this.path(groupId, 'offers'), { ...options, params: page });
17
+ }
18
+ /** List accessible, accepted references for this group and its current Project. */
19
+ list(groupId, page = {}, options) {
20
+ return this.transport.json(this.path(groupId, 'references'), { ...options, params: page });
21
+ }
22
+ /** Accept an offer as group owner, creating a fixed-version reference without changing ownership. */
23
+ accept(groupId, input, options) {
24
+ return this.transport.json(this.path(groupId, 'references'), {
25
+ ...options,
26
+ method: 'POST',
27
+ json: input,
28
+ });
29
+ }
30
+ /** Reauthorize a reference and load its published presentation; this does not open a UI itself. */
31
+ read(groupId, referenceId, options) {
32
+ return this.transport.json(this.path(groupId, `references/${encodeURIComponent(referenceId)}`), options);
33
+ }
34
+ /** Execute an allowed viewer operation under the current caller; not the Agent analysis API. */
35
+ query(groupId, referenceId, input, options) {
36
+ return this.transport.json(this.path(groupId, `references/${encodeURIComponent(referenceId)}/query`), { ...options, method: 'POST', json: input });
37
+ }
38
+ /** Remove this group's placement as owner. Source content remains; reattachment needs a new grant. */
39
+ remove(groupId, referenceId, input, options) {
40
+ return this.transport.json(this.path(groupId, `references/${encodeURIComponent(referenceId)}/remove`), { ...options, method: 'POST', json: input });
41
+ }
42
+ }
43
+ //# sourceMappingURL=group-artifacts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group-artifacts.js","sourceRoot":"","sources":["../src/group-artifacts.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,MAAM,OAAO,oBAAoB;IACF;IAA7B,YAA6B,SAAyB;QAAzB,cAAS,GA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C,IAAI,CACxB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,kBAAkB,CAAC,WAAW,CAAC,QAAQ,CAAC,EACzE,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAC5C,CAAC;IACJ,CAAC;IACD,sGAAsG;IACtG,MAAM,CACJ,OAAe,EACf,WAAmB,EACnB,KAGC,EACD,OAA6B;QAE7B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CACxB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,kBAAkB,CAAC,WAAW,CAAC,SAAS,CAAC,EAC1E,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAC5C,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Receiving-group API exposed as client.groups.artifacts, using its existing auth/refresh transport.
3
+ * The server enforces owner-only acceptance/removal and live access on every read/query.
4
+ * Source-side offering and revocation require the separate authenticated authoring host.
5
+ */
6
+ export class GroupArtifactsClient {
7
+ transport;
8
+ constructor(transport) {
9
+ this.transport = transport;
10
+ }
11
+ path(groupId, suffix) {
12
+ return `/groups/${encodeURIComponent(groupId)}/artifacts/${suffix}`;
13
+ }
14
+ /** List pending offers for owner review; an offer is not yet an accepted resource. */
15
+ offers(groupId, page = {}, options) {
16
+ return this.transport.json(this.path(groupId, 'offers'), { ...options, params: page });
17
+ }
18
+ /** List accessible, accepted references for this group and its current Project. */
19
+ list(groupId, page = {}, options) {
20
+ return this.transport.json(this.path(groupId, 'references'), { ...options, params: page });
21
+ }
22
+ /** Accept an offer as group owner, creating a fixed-version reference without changing ownership. */
23
+ accept(groupId, input, options) {
24
+ return this.transport.json(this.path(groupId, 'references'), {
25
+ ...options,
26
+ method: 'POST',
27
+ json: input,
28
+ });
29
+ }
30
+ /** Reauthorize a reference and load its published presentation; this does not open a UI itself. */
31
+ read(groupId, referenceId, options) {
32
+ return this.transport.json(this.path(groupId, `references/${encodeURIComponent(referenceId)}`), options);
33
+ }
34
+ /** Execute an allowed viewer operation under the current caller; not the Agent analysis API. */
35
+ query(groupId, referenceId, input, options) {
36
+ return this.transport.json(this.path(groupId, `references/${encodeURIComponent(referenceId)}/query`), { ...options, method: 'POST', json: input });
37
+ }
38
+ /** Remove this group's placement as owner. Source content remains; reattachment needs a new grant. */
39
+ remove(groupId, referenceId, input, options) {
40
+ return this.transport.json(this.path(groupId, `references/${encodeURIComponent(referenceId)}/remove`), { ...options, method: 'POST', json: input });
41
+ }
42
+ }
43
+ //# sourceMappingURL=group-artifacts.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group-artifacts.mjs","sourceRoot":"","sources":["../src/group-artifacts.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,MAAM,OAAO,oBAAoB;IACF;IAA7B,YAA6B,SAAyB;QAAzB,cAAS,GAAT,SAAS,CAAgB;IAAG,CAAC;IAClD,IAAI,CAAC,OAAe,EAAE,MAAc;QAC1C,OAAO,WAAW,kBAAkB,CAAC,OAAO,CAAC,cAAc,MAAM,EAAE,CAAC;IACtE,CAAC;IACD,sFAAsF;IACtF,MAAM,CACJ,OAAe,EACf,OAA4C,EAAE,EAC9C,OAA6B;QAE7B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IACzF,CAAC;IACD,mFAAmF;IACnF,IAAI,CACF,OAAe,EACf,OAA4C,EAAE,EAC9C,OAA6B;QAE7B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,EAAE,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7F,CAAC;IACD,qGAAqG;IACrG,MAAM,CACJ,OAAe,EACf,KAOC,EACD,OAA6B;QAE7B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,EAAE;YAC3D,GAAG,OAAO;YACV,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;IACL,CAAC;IACD,mGAAmG;IACnG,IAAI,CACF,OAAe,EACf,WAAmB,EACnB,OAA6B;QAE7B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CACxB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,kBAAkB,CAAC,WAAW,CAAC,EAAE,CAAC,EACnE,OAAO,CACR,CAAC;IACJ,CAAC;IACD,gGAAgG;IAChG,KAAK,CACH,OAAe,EACf,WAAmB,EACnB,KAAyB,EACzB,OAA6B;QAE7B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CACxB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,kBAAkB,CAAC,WAAW,CAAC,QAAQ,CAAC,EACzE,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAC5C,CAAC;IACJ,CAAC;IACD,sGAAsG;IACtG,MAAM,CACJ,OAAe,EACf,WAAmB,EACnB,KAGC,EACD,OAA6B;QAE7B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CACxB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,kBAAkB,CAAC,WAAW,CAAC,SAAS,CAAC,EAC1E,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAC5C,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,34 @@
1
+ import type { ChatGroupEvent, ChatGroupMessage, ChatGroupResourceLink, ChatGroupResourceOpenRequest, ChatGroupSnapshot } from './group-types.js';
2
+ type LegacyResourceLink = Pick<ChatGroupResourceLink, 'projectId' | 'title'> & ({
3
+ kind?: 'group-reference';
4
+ referenceId: string;
5
+ } | {
6
+ kind: 'project-content';
7
+ contentId: string;
8
+ });
9
+ export type GroupResourceLinkWire = ChatGroupResourceLink | LegacyResourceLink;
10
+ export type GroupMessageWire = Omit<ChatGroupMessage, 'communication'> & {
11
+ communication: Omit<ChatGroupMessage['communication'], 'resourceLinks'> & {
12
+ resourceLinks?: GroupResourceLinkWire[];
13
+ };
14
+ };
15
+ export type GroupSnapshotWire = Omit<ChatGroupSnapshot, 'messages'> & {
16
+ messages: GroupMessageWire[];
17
+ };
18
+ export type GroupEventWire = Exclude<ChatGroupEvent, {
19
+ type: 'snapshot' | 'resource_open';
20
+ }> | {
21
+ type: 'snapshot';
22
+ snapshot: GroupSnapshotWire;
23
+ } | {
24
+ type: 'resource_open';
25
+ request: GroupResourceLinkWire & Pick<ChatGroupResourceOpenRequest, 'requestId' | 'clientMessageId'>;
26
+ };
27
+ export declare function isResourceUuid(value: unknown): value is string;
28
+ /** Reject ambiguous locators instead of choosing between old and new identities. */
29
+ export declare function parseGroupResourceLink(value: unknown): ChatGroupResourceLink | null;
30
+ export declare function isGroupResourceLinkWire(value: unknown): value is GroupResourceLinkWire;
31
+ export declare function isCanonicalResourceLink(value: GroupResourceLinkWire): value is ChatGroupResourceLink;
32
+ export declare function normalizeGroupMessage(message: GroupMessageWire): ChatGroupMessage;
33
+ export declare function normalizeGroupSnapshot(snapshot: GroupSnapshotWire): ChatGroupSnapshot;
34
+ export {};
@@ -0,0 +1,71 @@
1
+ export function isResourceUuid(value) {
2
+ return (typeof value === 'string' &&
3
+ /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value));
4
+ }
5
+ /** Reject ambiguous locators instead of choosing between old and new identities. */
6
+ export function parseGroupResourceLink(value) {
7
+ if (!value ||
8
+ typeof value !== 'object' ||
9
+ !('projectId' in value) ||
10
+ !isResourceUuid(value.projectId) ||
11
+ !('title' in value) ||
12
+ typeof value.title !== 'string' ||
13
+ value.title.length > 200)
14
+ return null;
15
+ const base = { projectId: value.projectId, title: value.title };
16
+ if ('resource' in value) {
17
+ if ('kind' in value || 'referenceId' in value || 'contentId' in value)
18
+ return null;
19
+ const resource = value.resource;
20
+ if (!resource ||
21
+ typeof resource !== 'object' ||
22
+ !('kind' in resource) ||
23
+ !('id' in resource) ||
24
+ !isResourceUuid(resource.id) ||
25
+ (resource.kind !== 'group-reference' && resource.kind !== 'project-content') ||
26
+ Object.keys(resource).some((key) => key !== 'kind' && key !== 'id'))
27
+ return null;
28
+ return { ...base, resource: { kind: resource.kind, id: resource.id } };
29
+ }
30
+ if ((!('kind' in value) || value.kind === 'group-reference') &&
31
+ 'referenceId' in value &&
32
+ isResourceUuid(value.referenceId) &&
33
+ !('contentId' in value))
34
+ return { ...base, resource: { kind: 'group-reference', id: value.referenceId } };
35
+ if ('kind' in value &&
36
+ value.kind === 'project-content' &&
37
+ 'contentId' in value &&
38
+ isResourceUuid(value.contentId) &&
39
+ !('referenceId' in value))
40
+ return { ...base, resource: { kind: 'project-content', id: value.contentId } };
41
+ return null;
42
+ }
43
+ export function isGroupResourceLinkWire(value) {
44
+ return parseGroupResourceLink(value) !== null;
45
+ }
46
+ export function isCanonicalResourceLink(value) {
47
+ return 'resource' in value;
48
+ }
49
+ export function normalizeGroupMessage(message) {
50
+ const { resourceLinks, ...communication } = message.communication;
51
+ if (resourceLinks === undefined)
52
+ return { ...message, communication };
53
+ if (!Array.isArray(resourceLinks))
54
+ throw new Error('Invalid group resource links');
55
+ return {
56
+ ...message,
57
+ communication: {
58
+ ...communication,
59
+ resourceLinks: resourceLinks.map((link) => {
60
+ const parsed = parseGroupResourceLink(link);
61
+ if (!parsed)
62
+ throw new Error('Invalid group resource link');
63
+ return parsed;
64
+ }),
65
+ },
66
+ };
67
+ }
68
+ export function normalizeGroupSnapshot(snapshot) {
69
+ return { ...snapshot, messages: snapshot.messages.map(normalizeGroupMessage) };
70
+ }
71
+ //# sourceMappingURL=group-resource-links.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group-resource-links.js","sourceRoot":"","sources":["../src/group-resource-links.ts"],"names":[],"mappings":"AAgCA,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,iEAAiE,CAAC,IAAI,CAAC,KAAK,CAAC,CAC9E,CAAC;AACJ,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,sBAAsB,CAAC,KAAc;IACnD,IACE,CAAC,KAAK;QACN,OAAO,KAAK,KAAK,QAAQ;QACzB,CAAC,CAAC,WAAW,IAAI,KAAK,CAAC;QACvB,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,CAAC;QAChC,CAAC,CAAC,OAAO,IAAI,KAAK,CAAC;QACnB,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;QAC/B,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG;QAExB,OAAO,IAAI,CAAC;IACd,MAAM,IAAI,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;IAChE,IAAI,UAAU,IAAI,KAAK,EAAE,CAAC;QACxB,IAAI,MAAM,IAAI,KAAK,IAAI,aAAa,IAAI,KAAK,IAAI,WAAW,IAAI,KAAK;YAAE,OAAO,IAAI,CAAC;QACnF,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAChC,IACE,CAAC,QAAQ;YACT,OAAO,QAAQ,KAAK,QAAQ;YAC5B,CAAC,CAAC,MAAM,IAAI,QAAQ,CAAC;YACrB,CAAC,CAAC,IAAI,IAAI,QAAQ,CAAC;YACnB,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,CAAC,QAAQ,CAAC,IAAI,KAAK,iBAAiB,IAAI,QAAQ,CAAC,IAAI,KAAK,iBAAi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AAyB;IAC7D,MAAM,EAAE,aAAa,EAAE,GAAG,aAAa,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC;IAClE,IAAI,aAAa,KAAK,SAAS;QAAE,OAAO,EAAE,GAAG,OAAO,EAAE,aAAa,EAAE,CAAC;IACtE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACnF,OAAO;QACL,GAAG,OAAO;QACV,aAAa,EAAE;YACb,GAAG,aAAa;YAChB,aAAa,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;gBACxC,MAAM,MAAM,GAAG,sBAAsB,CAAC,IAAI,CAAC,CAAC;gBAC5C,IAAI,CAAC,MAAM;oBAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;gBAC5D,OAAO,MAAM,CAAC;YAChB,CAAC,CAAC;SACH;KACF,CAAC;AACJ,CAAC;AACD,MAAM,UAAU,sBAAsB,CAAC,QAA2B;IAChE,OAAO,EAAE,GAAG,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,qBAAqB,CAAC,EAAE,CAAC;AACjF,CAAC"}
@@ -0,0 +1,71 @@
1
+ export function isResourceUuid(value) {
2
+ return (typeof value === 'string' &&
3
+ /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value));
4
+ }
5
+ /** Reject ambiguous locators instead of choosing between old and new identities. */
6
+ export function parseGroupResourceLink(value) {
7
+ if (!value ||
8
+ typeof value !== 'object' ||
9
+ !('projectId' in value) ||
10
+ !isResourceUuid(value.projectId) ||
11
+ !('title' in value) ||
12
+ typeof value.title !== 'string' ||
13
+ value.title.length > 200)
14
+ return null;
15
+ const base = { projectId: value.projectId, title: value.title };
16
+ if ('resource' in value) {
17
+ if ('kind' in value || 'referenceId' in value || 'contentId' in value)
18
+ return null;
19
+ const resource = value.resource;
20
+ if (!resource ||
21
+ typeof resource !== 'object' ||
22
+ !('kind' in resource) ||
23
+ !('id' in resource) ||
24
+ !isResourceUuid(resource.id) ||
25
+ (resource.kind !== 'group-reference' && resource.kind !== 'project-content') ||
26
+ Object.keys(resource).some((key) => key !== 'kind' && key !== 'id'))
27
+ return null;
28
+ return { ...base, resource: { kind: resource.kind, id: resource.id } };
29
+ }
30
+ if ((!('kind' in value) || value.kind === 'group-reference') &&
31
+ 'referenceId' in value &&
32
+ isResourceUuid(value.referenceId) &&
33
+ !('contentId' in value))
34
+ return { ...base, resource: { kind: 'group-reference', id: value.referenceId } };
35
+ if ('kind' in value &&
36
+ value.kind === 'project-content' &&
37
+ 'contentId' in value &&
38
+ isResourceUuid(value.contentId) &&
39
+ !('referenceId' in value))
40
+ return { ...base, resource: { kind: 'project-content', id: value.contentId } };
41
+ return null;
42
+ }
43
+ export function isGroupResourceLinkWire(value) {
44
+ return parseGroupResourceLink(value) !== null;
45
+ }
46
+ export function isCanonicalResourceLink(value) {
47
+ return 'resource' in value;
48
+ }
49
+ export function normalizeGroupMessage(message) {
50
+ const { resourceLinks, ...communication } = message.communication;
51
+ if (resourceLinks === undefined)
52
+ return { ...message, communication };
53
+ if (!Array.isArray(resourceLinks))
54
+ throw new Error('Invalid group resource links');
55
+ return {
56
+ ...message,
57
+ communication: {
58
+ ...communication,
59
+ resourceLinks: resourceLinks.map((link) => {
60
+ const parsed = parseGroupResourceLink(link);
61
+ if (!parsed)
62
+ throw new Error('Invalid group resource link');
63
+ return parsed;
64
+ }),
65
+ },
66
+ };
67
+ }
68
+ export function normalizeGroupSnapshot(snapshot) {
69
+ return { ...snapshot, messages: snapshot.messages.map(normalizeGroupMessage) };
70
+ }
71
+ //# sourceMappingURL=group-resource-links.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group-resource-links.mjs","sourceRoot":"","sources":["../src/group-resource-links.ts"],"names":[],"mappings":"AAgCA,MAAM,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,CAAC;IACtE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACnF,OAAO;QACL,GAAG,OAAO;QACV,aAAa,EAAE;YACb,GAAG,aAAa;YAChB,aAAa,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;gBACxC,MAAM,MAAM,GAAG,sBAAsB,CAAC,IAAI,CAAC,CAAC;gBAC5C,IAAI,CAAC,MAAM;oBAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;gBAC5D,OAAO,MAAM,CAAC;YAChB,CAAC,CAAC;SACH;KACF,CAAC;AACJ,CAAC;AACD,MAAM,UAAU,sBAAsB,CAAC,QAA2B;IAChE,OAAO,EAAE,GAAG,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,qBAAqB,CAAC,EAAE,CAAC;AACjF,CAAC"}
@@ -1,9 +1,16 @@
1
+ import type { ConversationResourceTarget } from './conversation-resource-types.js';
1
2
  import type { ChatMessage } from './schema.js';
2
3
  import type { XpertProjectTypeRef } from './schema.js';
3
4
  import type { RuntimeCapabilitiesSelection } from './schema.js';
4
5
  import type { RuntimeResourcesSelection } from './runtime-resources.js';
5
6
  /** Snapshots expose public messages; runtime details require workspace read access. */
6
7
  export type ChatGroupIntent = 'request' | 'reply' | 'message';
8
+ /**
9
+ * Completion intent for one sender's answer to one request, independent of delivery/run status.
10
+ * Progress is a partial answer and does not wake the requester; final completes the answer only
11
+ * after successful publication. Neither stage accepts or completes a Project task.
12
+ */
13
+ export type ChatGroupReplyStage = 'progress' | 'final';
7
14
  export type ChatGroupDeliveryStatus = 'pending' | 'starting' | 'steering' | 'consumed' | 'blocked' | 'canceled' | 'failed';
8
15
  export interface ChatGroupParticipant {
9
16
  id: string;
@@ -40,7 +47,42 @@ export interface ChatGroupComposerInput {
40
47
  runtimeResources?: RuntimeResourcesSelection;
41
48
  runtimeCapabilities?: RuntimeCapabilitiesSelection;
42
49
  }
50
+ /**
51
+ * Server-authored clickable entry persisted in message history, not an open-on-load instruction.
52
+ * Clicking reauthorizes the resource through the current conversation's host adapter.
53
+ */
54
+ export interface ChatGroupResourceLink {
55
+ /** Canonical locator shared with discovery and Workbench. Contains no access grant. */
56
+ resource: ConversationResourceTarget;
57
+ /** Receiving group's runtime Project; checked before opening, never a source Project override. */
58
+ projectId: string;
59
+ /** Display label only; never use it to infer resource identity or type. */
60
+ title: string;
61
+ }
62
+ /** Live, requester-addressed navigation event; consumers match the local send and deduplicate it. */
63
+ export interface ChatGroupResourceOpenRequest extends ChatGroupResourceLink {
64
+ /** Server-generated deduplication ID; do not open the same request twice. */
65
+ requestId: string;
66
+ /** Initiating client message correlation ID, or server message ID fallback. */
67
+ clientMessageId: string;
68
+ }
43
69
  export interface ChatGroupCommunication {
70
+ /** Inert resource entries, including during history playback; these alone never auto-open. */
71
+ resourceLinks?: ChatGroupResourceLink[];
72
+ /**
73
+ * Server-authored routing metadata used to derive a fresh, audience-scoped resource_open event.
74
+ * Renderers must not treat replayed communication metadata as a new navigation request.
75
+ */
76
+ resourceNavigation?: {
77
+ /** Navigation deduplication ID propagated to ChatGroupResourceOpenRequest. */
78
+ requestId: string;
79
+ /** Server emission time in Unix epoch milliseconds for freshness checks. */
80
+ issuedAt: number;
81
+ /** Initiating client message ID, with server message ID as fallback. */
82
+ clientMessageId: string;
83
+ /** Intended viewer's group membership ID, not an account or Assistant ID. */
84
+ participantId: string;
85
+ };
44
86
  /** Host-owned task context, unavailable in group send inputs. */
45
87
  projectTask?: {
46
88
  invocationId: string;
@@ -62,6 +104,12 @@ export interface ChatGroupCommunication {
62
104
  senderId: string;
63
105
  recipientIds: string[];
64
106
  replyToMessageId?: string;
107
+ /**
108
+ * Only valid on replies. Missing on legacy replies means final; new publications include it.
109
+ * A successfully published final tool reply suppresses the automatic final answer for the same
110
+ * request and sender. Progress, message and request publications do not suppress that answer.
111
+ */
112
+ replyStage?: ChatGroupReplyStage;
65
113
  causedByMessageId?: string;
66
114
  rootMessageId: string;
67
115
  rootUserId: string;
@@ -72,6 +120,19 @@ export interface ChatGroupMessage {
72
120
  clientMessageId: string;
73
121
  sequence: number;
74
122
  text: string;
123
+ /**
124
+ * Optional server-filtered result snapshots. May be present with empty text.
125
+ * IDs are stable within this public message; repeated snapshots replace rather than append blocks.
126
+ * Known forms use existing ChatKit `resource_card` or `component` (Widget / McpApp) payloads.
127
+ * Payloads stay opaque at this transport boundary: renderers must validate the concrete type,
128
+ * ignore unknown forms and never reconnect a copied MCP result to the originating App session.
129
+ * These blocks confer no resource permissions, do not wake recipients and do not complete replies.
130
+ */
131
+ display?: {
132
+ id: string;
133
+ type: 'component' | 'resource_card';
134
+ data: unknown;
135
+ }[];
75
136
  createdAt: string;
76
137
  communication: ChatGroupCommunication;
77
138
  runtimeParticipantIds?: string[];
@@ -153,6 +214,9 @@ export interface ChatGroupRun {
153
214
  status: 'busy' | 'pausing' | 'paused' | 'interrupted' | 'idle' | 'error';
154
215
  }
155
216
  export type ChatGroupEvent = {
217
+ type: 'resource_open';
218
+ request: ChatGroupResourceOpenRequest;
219
+ } | {
156
220
  type: 'snapshot';
157
221
  snapshot: ChatGroupSnapshot;
158
222
  } | {