@kortix/sdk 0.14.8 → 0.14.9

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 (194) hide show
  1. package/README.md +123 -123
  2. package/dist/core/client/kortix.d.ts +123 -2
  3. package/dist/core/client/kortix.d.ts.map +1 -1
  4. package/dist/core/client/project-core.d.ts.map +1 -1
  5. package/dist/core/client/project-operations-admin.d.ts +52 -0
  6. package/dist/core/client/project-operations-admin.d.ts.map +1 -1
  7. package/dist/core/client/project-operations-review.d.ts +79 -0
  8. package/dist/core/client/project-operations-review.d.ts.map +1 -1
  9. package/dist/core/client/project-operations-review.js +79 -0
  10. package/dist/core/client/project-operations-review.js.map +1 -1
  11. package/dist/core/client/project-operations-workspace.d.ts +52 -0
  12. package/dist/core/client/project-operations-workspace.d.ts.map +1 -1
  13. package/dist/core/client/project-operations.d.ts +112 -4
  14. package/dist/core/client/project-operations.d.ts.map +1 -1
  15. package/dist/core/client/project-operations.js +22 -2
  16. package/dist/core/client/project-operations.js.map +1 -1
  17. package/dist/core/client/project-platform-security.d.ts +29 -0
  18. package/dist/core/client/project-platform-security.d.ts.map +1 -1
  19. package/dist/core/client/project-platform-security.js +27 -0
  20. package/dist/core/client/project-platform-security.js.map +1 -1
  21. package/dist/core/client/project-platform-settings.d.ts +2 -0
  22. package/dist/core/client/project-platform-settings.d.ts.map +1 -1
  23. package/dist/core/files/image-cache.d.ts +56 -0
  24. package/dist/core/files/image-cache.d.ts.map +1 -0
  25. package/dist/core/files/image-cache.js +130 -0
  26. package/dist/core/files/image-cache.js.map +1 -0
  27. package/dist/core/http/response-error.d.ts.map +1 -1
  28. package/dist/core/http/response-error.js +2 -0
  29. package/dist/core/http/response-error.js.map +1 -1
  30. package/dist/core/rest/platform-client/host-boundary.d.ts +21 -15
  31. package/dist/core/rest/platform-client/host-boundary.d.ts.map +1 -1
  32. package/dist/core/rest/platform-client/host-boundary.js +10 -4
  33. package/dist/core/rest/platform-client/host-boundary.js.map +1 -1
  34. package/dist/core/rest/projects-client/agent-config.d.ts +4 -0
  35. package/dist/core/rest/projects-client/agent-config.d.ts.map +1 -1
  36. package/dist/core/rest/projects-client/agent-config.js.map +1 -1
  37. package/dist/core/rest/projects-client/agent-scope.d.ts +8 -0
  38. package/dist/core/rest/projects-client/agent-scope.d.ts.map +1 -1
  39. package/dist/core/rest/projects-client/agent-scope.js.map +1 -1
  40. package/dist/core/rest/projects-client/apps.d.ts +1 -1
  41. package/dist/core/rest/projects-client/apps.d.ts.map +1 -1
  42. package/dist/core/rest/projects-client/artifacts.d.ts +139 -0
  43. package/dist/core/rest/projects-client/artifacts.d.ts.map +1 -0
  44. package/dist/core/rest/projects-client/artifacts.js +72 -0
  45. package/dist/core/rest/projects-client/artifacts.js.map +1 -0
  46. package/dist/core/rest/projects-client/change-request-recovery.d.ts +30 -0
  47. package/dist/core/rest/projects-client/change-request-recovery.d.ts.map +1 -0
  48. package/dist/core/rest/projects-client/change-request-recovery.js +121 -0
  49. package/dist/core/rest/projects-client/change-request-recovery.js.map +1 -0
  50. package/dist/core/rest/projects-client/change-requests.d.ts +5 -0
  51. package/dist/core/rest/projects-client/change-requests.d.ts.map +1 -1
  52. package/dist/core/rest/projects-client/change-requests.js.map +1 -1
  53. package/dist/core/rest/projects-client/channels.d.ts +212 -2
  54. package/dist/core/rest/projects-client/channels.d.ts.map +1 -1
  55. package/dist/core/rest/projects-client/channels.js +111 -8
  56. package/dist/core/rest/projects-client/channels.js.map +1 -1
  57. package/dist/core/rest/projects-client/connectors.d.ts +259 -7
  58. package/dist/core/rest/projects-client/connectors.d.ts.map +1 -1
  59. package/dist/core/rest/projects-client/connectors.js +84 -4
  60. package/dist/core/rest/projects-client/connectors.js.map +1 -1
  61. package/dist/core/rest/projects-client/gateway.d.ts +23 -0
  62. package/dist/core/rest/projects-client/gateway.d.ts.map +1 -1
  63. package/dist/core/rest/projects-client/gateway.js.map +1 -1
  64. package/dist/core/rest/projects-client/iam-actions.d.ts +4 -0
  65. package/dist/core/rest/projects-client/iam-actions.d.ts.map +1 -1
  66. package/dist/core/rest/projects-client/iam-actions.js +4 -0
  67. package/dist/core/rest/projects-client/iam-actions.js.map +1 -1
  68. package/dist/core/rest/projects-client/index.d.ts +5 -0
  69. package/dist/core/rest/projects-client/index.d.ts.map +1 -1
  70. package/dist/core/rest/projects-client/index.js +5 -0
  71. package/dist/core/rest/projects-client/index.js.map +1 -1
  72. package/dist/core/rest/projects-client/memory.d.ts +236 -0
  73. package/dist/core/rest/projects-client/memory.d.ts.map +1 -0
  74. package/dist/core/rest/projects-client/memory.js +92 -0
  75. package/dist/core/rest/projects-client/memory.js.map +1 -0
  76. package/dist/core/rest/projects-client/projects.d.ts +21 -6
  77. package/dist/core/rest/projects-client/projects.d.ts.map +1 -1
  78. package/dist/core/rest/projects-client/projects.js +4 -4
  79. package/dist/core/rest/projects-client/projects.js.map +1 -1
  80. package/dist/core/rest/projects-client/review-items.d.ts.map +1 -1
  81. package/dist/core/rest/projects-client/review-items.js +40 -2
  82. package/dist/core/rest/projects-client/review-items.js.map +1 -1
  83. package/dist/core/rest/projects-client/session-groups.d.ts +48 -0
  84. package/dist/core/rest/projects-client/session-groups.d.ts.map +1 -0
  85. package/dist/core/rest/projects-client/session-groups.js +50 -0
  86. package/dist/core/rest/projects-client/session-groups.js.map +1 -0
  87. package/dist/core/rest/projects-client/sessions.d.ts +32 -0
  88. package/dist/core/rest/projects-client/sessions.d.ts.map +1 -1
  89. package/dist/core/rest/projects-client/sessions.js +10 -0
  90. package/dist/core/rest/projects-client/sessions.js.map +1 -1
  91. package/dist/core/rest/projects-client/setup-links.d.ts +5 -0
  92. package/dist/core/rest/projects-client/setup-links.d.ts.map +1 -1
  93. package/dist/core/rest/projects-client/setup-links.js.map +1 -1
  94. package/dist/core/rest/projects-client/spaces.d.ts +263 -0
  95. package/dist/core/rest/projects-client/spaces.d.ts.map +1 -0
  96. package/dist/core/rest/projects-client/spaces.js +165 -0
  97. package/dist/core/rest/projects-client/spaces.js.map +1 -0
  98. package/dist/core/rest/projects-client/triggers.d.ts +79 -32
  99. package/dist/core/rest/projects-client/triggers.d.ts.map +1 -1
  100. package/dist/core/rest/projects-client/triggers.js +1 -1
  101. package/dist/core/rest/projects-client/triggers.js.map +1 -1
  102. package/dist/core/session-log/turns/blocks.d.ts +2 -2
  103. package/dist/core/session-log/turns/blocks.d.ts.map +1 -1
  104. package/dist/core/session-log/turns/blocks.js +13 -5
  105. package/dist/core/session-log/turns/blocks.js.map +1 -1
  106. package/dist/core/session-log/turns/v1-parts.d.ts.map +1 -1
  107. package/dist/core/session-log/turns/v1-parts.js +18 -4
  108. package/dist/core/session-log/turns/v1-parts.js.map +1 -1
  109. package/dist/core/session-log/types.d.ts +13 -3
  110. package/dist/core/session-log/types.d.ts.map +1 -1
  111. package/dist/core/session-log/v1.d.ts +4 -1
  112. package/dist/core/session-log/v1.d.ts.map +1 -1
  113. package/dist/core/session-log/v1.js +2 -0
  114. package/dist/core/session-log/v1.js.map +1 -1
  115. package/dist/core/turns/parts.js +1 -1
  116. package/dist/core/turns/parts.js.map +1 -1
  117. package/dist/core/turns/safe-url.d.ts +3 -0
  118. package/dist/core/turns/safe-url.d.ts.map +1 -0
  119. package/dist/core/turns/safe-url.js +13 -0
  120. package/dist/core/turns/safe-url.js.map +1 -0
  121. package/dist/core/turns/segments/group-steps.d.ts.map +1 -1
  122. package/dist/core/turns/segments/group-steps.js +7 -6
  123. package/dist/core/turns/segments/group-steps.js.map +1 -1
  124. package/dist/core/turns/segments/narration.d.ts.map +1 -1
  125. package/dist/core/turns/segments/narration.js +35 -18
  126. package/dist/core/turns/segments/narration.js.map +1 -1
  127. package/dist/core/turns/segments/session-activity-groups.d.ts +14 -4
  128. package/dist/core/turns/segments/session-activity-groups.d.ts.map +1 -1
  129. package/dist/core/turns/segments/session-activity-groups.js +47 -7
  130. package/dist/core/turns/segments/session-activity-groups.js.map +1 -1
  131. package/dist/core/turns/segments/work-split.d.ts +1 -1
  132. package/dist/core/turns/segments/work-split.d.ts.map +1 -1
  133. package/dist/core/turns/segments/work-split.js +3 -6
  134. package/dist/core/turns/segments/work-split.js.map +1 -1
  135. package/dist/core/turns/tools/image-gen-view.d.ts +162 -0
  136. package/dist/core/turns/tools/image-gen-view.d.ts.map +1 -0
  137. package/dist/core/turns/tools/image-gen-view.js +402 -0
  138. package/dist/core/turns/tools/image-gen-view.js.map +1 -0
  139. package/dist/core/turns/tools/index.d.ts +2 -1
  140. package/dist/core/turns/tools/index.d.ts.map +1 -1
  141. package/dist/core/turns/tools/index.js +2 -1
  142. package/dist/core/turns/tools/index.js.map +1 -1
  143. package/dist/core/turns/tools/tool-meta.d.ts.map +1 -1
  144. package/dist/core/turns/tools/tool-meta.js +8 -0
  145. package/dist/core/turns/tools/tool-meta.js.map +1 -1
  146. package/dist/index.d.ts +1 -0
  147. package/dist/index.d.ts.map +1 -1
  148. package/dist/index.js +1 -0
  149. package/dist/index.js.map +1 -1
  150. package/dist/kortix.esm.min.js +41 -39
  151. package/dist/kortix.global.js +41 -39
  152. package/dist/react/index.d.ts +4 -0
  153. package/dist/react/index.d.ts.map +1 -1
  154. package/dist/react/index.js +5 -0
  155. package/dist/react/index.js.map +1 -1
  156. package/dist/react/query-keys.d.ts +55 -1
  157. package/dist/react/query-keys.d.ts.map +1 -1
  158. package/dist/react/query-keys.js +62 -2
  159. package/dist/react/query-keys.js.map +1 -1
  160. package/dist/react/session-cache-write.d.ts +8 -0
  161. package/dist/react/session-cache-write.d.ts.map +1 -1
  162. package/dist/react/session-cache-write.js +50 -1
  163. package/dist/react/session-cache-write.js.map +1 -1
  164. package/dist/react/use-artifacts.d.ts +49 -0
  165. package/dist/react/use-artifacts.d.ts.map +1 -0
  166. package/dist/react/use-artifacts.js +120 -0
  167. package/dist/react/use-artifacts.js.map +1 -0
  168. package/dist/react/use-feature-flag.d.ts +1 -1
  169. package/dist/react/use-feature-flag.d.ts.map +1 -1
  170. package/dist/react/use-feature-flag.js +4 -1
  171. package/dist/react/use-feature-flag.js.map +1 -1
  172. package/dist/react/use-project-apps.d.ts.map +1 -1
  173. package/dist/react/use-project-apps.js +8 -5
  174. package/dist/react/use-project-apps.js.map +1 -1
  175. package/dist/react/use-project-memory.d.ts +41 -0
  176. package/dist/react/use-project-memory.d.ts.map +1 -0
  177. package/dist/react/use-project-memory.js +126 -0
  178. package/dist/react/use-project-memory.js.map +1 -0
  179. package/dist/react/use-project-sessions.d.ts +26 -7
  180. package/dist/react/use-project-sessions.d.ts.map +1 -1
  181. package/dist/react/use-project-sessions.js +57 -21
  182. package/dist/react/use-project-sessions.js.map +1 -1
  183. package/dist/react/use-project-spaces.d.ts +74 -0
  184. package/dist/react/use-project-spaces.d.ts.map +1 -0
  185. package/dist/react/use-project-spaces.js +196 -0
  186. package/dist/react/use-project-spaces.js.map +1 -0
  187. package/dist/react/use-session-groups.d.ts +41 -0
  188. package/dist/react/use-session-groups.d.ts.map +1 -0
  189. package/dist/react/use-session-groups.js +140 -0
  190. package/dist/react/use-session-groups.js.map +1 -0
  191. package/dist/workspace-search/client.d.ts.map +1 -1
  192. package/dist/workspace-search/client.js +4 -10
  193. package/dist/workspace-search/client.js.map +1 -1
  194. package/package.json +3 -3
@@ -0,0 +1,263 @@
1
+ import type { App } from './apps.js';
2
+ /** A channel of the project, or the caller's DM with one agent. Same fields as the API's `Space`. */
3
+ export interface ProjectSpace {
4
+ space_id: string;
5
+ kind: 'channel' | 'dm';
6
+ /** Channels: lowercase `a-z0-9-`, 1–40 characters. Null for a DM. */
7
+ slug: string | null;
8
+ name: string;
9
+ description: string | null;
10
+ /** True for the project's `#general` only. */
11
+ is_default: boolean;
12
+ /** The agent of a DM. Null for a channel. */
13
+ dm_agent_name: string | null;
14
+ archived_at: string | null;
15
+ created_at: string;
16
+ updated_at: string;
17
+ /** The caller may rename, describe, archive and unarchive it: the channel's creator or a project manager. False for a DM. Absent on older APIs. */
18
+ can_edit?: boolean;
19
+ /**
20
+ * The channel's agents, in order: the first is the channel's default for a
21
+ * new thread. Empty: no agent list, a new thread starts on the project's
22
+ * default. Always empty for a DM. Absent on older APIs.
23
+ */
24
+ agents?: string[];
25
+ /**
26
+ * The caller is in the channel: always for `#general` and a DM, for another
27
+ * channel once added or joined. A non-member of a public channel still
28
+ * reads and posts. Absent on older APIs.
29
+ */
30
+ is_member?: boolean;
31
+ /**
32
+ * `public`: every project member sees and opens it. `private`: only its
33
+ * members see the channel and its threads. `#general` and a DM are always
34
+ * `public`. Absent on older APIs (read it as `public`).
35
+ */
36
+ visibility?: 'public' | 'private';
37
+ }
38
+ export interface CreateProjectSpaceInput {
39
+ /** 1–80 characters. The slug is derived from it. */
40
+ name: string;
41
+ /** At most 500 characters. */
42
+ description?: string;
43
+ /** People added with the creator (who is always a member); every id a member of the project, at most 100. */
44
+ member_ids?: string[];
45
+ /** Default `public`. `private`: only its members see it. */
46
+ visibility?: 'public' | 'private';
47
+ }
48
+ export interface UpdateProjectSpaceInput {
49
+ name?: string;
50
+ /** `null` clears the description. */
51
+ description?: string | null;
52
+ /** `true` archives the channel; `false` unarchives it. */
53
+ archived?: boolean;
54
+ /**
55
+ * Replaces the channel's agent list, in order: the first is the default.
56
+ * Every name must be an agent of the project, each once (else 400
57
+ * `invalid_agents`); at most 50. `[]` clears it.
58
+ */
59
+ agents?: string[];
60
+ /**
61
+ * `private` makes a public channel private: the people who started a thread
62
+ * in it or added a link become members. One way only.
63
+ */
64
+ visibility?: 'private';
65
+ }
66
+ /**
67
+ * The project's live channels (`#general` first, then oldest first), then the
68
+ * caller's DMs. The first call creates `#general`. A background read: a
69
+ * failure reaches the caller's query state, not the host error handler.
70
+ */
71
+ export declare function listProjectSpaces(projectId: string): Promise<ProjectSpace[]>;
72
+ /**
73
+ * `#general`'s "turned on again" line: `count` sessions started while Channels
74
+ * was off were filed into `#general` at `at`. Present for 7 days after the switch.
75
+ */
76
+ export interface ProjectSpaceGeneralNotice {
77
+ kind: 'reenabled';
78
+ at: string;
79
+ count: number;
80
+ }
81
+ /**
82
+ * `#general`'s "turned on again" line, or null when there is none. Read from
83
+ * the spaces list (`GET /spaces`), so it costs the same request. A background read.
84
+ */
85
+ export declare function getProjectSpaceGeneralNotice(projectId: string): Promise<ProjectSpaceGeneralNotice | null>;
86
+ /**
87
+ * Whether this deployment lets a channel be private (create with `visibility:
88
+ * 'private'`, or make one private). Read from the spaces list; an older API
89
+ * that sends no field reads false. A background read.
90
+ */
91
+ export declare function getPrivateChannelsAvailable(projectId: string): Promise<boolean>;
92
+ /**
93
+ * Create a channel. A name whose slug is taken rejects with an `ApiError`:
94
+ * `status` 409, `code` `'slug_taken'`, and `data.space_id` / `data.archived`
95
+ * name the existing channel; `data.can_edit` says whether the caller may
96
+ * unarchive it, so the caller offers that only when it may. A name
97
+ * with no slug characters rejects with 400 `invalid_name`. The caller shows
98
+ * both, so neither reaches the host error handler.
99
+ */
100
+ export declare function createProjectSpace(projectId: string, input: CreateProjectSpaceInput): Promise<ProjectSpace>;
101
+ /**
102
+ * Rename, describe, archive or unarchive a channel, or replace its agent list. Only its creator or a
103
+ * project manager may (`can_edit`); anyone else rejects with 403 `forbidden`.
104
+ * A rename whose slug is taken rejects with 409 `slug_taken` (fields as in
105
+ * `createProjectSpace`). The caller shows the error, so it never reaches the
106
+ * host error handler.
107
+ */
108
+ export declare function updateProjectSpace(projectId: string, spaceId: string, input: UpdateProjectSpaceInput): Promise<ProjectSpace>;
109
+ /**
110
+ * The caller's DM with `agentName`, created on the first call. An agent the
111
+ * project does not declare rejects with 404 `agent_not_found`. The caller
112
+ * shows the error, so it never reaches the host error handler.
113
+ */
114
+ export declare function getOrCreateProjectDm(projectId: string, agentName: string): Promise<ProjectSpace>;
115
+ /** A person in a channel. Same fields as the API's `SpaceMember`. */
116
+ export interface ProjectSpaceMember {
117
+ user_id: string;
118
+ /** The display name, else the email's local part. Never an email. */
119
+ name: string;
120
+ avatar_url: string | null;
121
+ /** The channel's creator. */
122
+ is_creator: boolean;
123
+ is_viewer: boolean;
124
+ /** When they were added or joined; null in `#general` and for backfilled rows. */
125
+ added_at: string | null;
126
+ /** The caller may remove them: a manager anyone, the creator anyone but themself, a member only themself (Leave). */
127
+ can_remove: boolean;
128
+ }
129
+ /** A channel's people: the same list for every viewer, the caller first. */
130
+ export interface ProjectSpaceMemberList {
131
+ members: ProjectSpaceMember[];
132
+ /** `#general`: every project member is in it; nobody is added and nobody leaves. */
133
+ implicit: boolean;
134
+ /** The caller may add people: a member of the channel, its creator or a project manager. */
135
+ can_add: boolean;
136
+ }
137
+ /** A channel's people. `#general` lists every project member. A background read. */
138
+ export declare function listProjectSpaceMembers(projectId: string, spaceId: string): Promise<ProjectSpaceMemberList>;
139
+ /**
140
+ * Add people to a channel in one request; resolves to the list after the add.
141
+ * Someone already in it is skipped. An id outside the project rejects with
142
+ * 400 `not_project_member` (`data.user_ids` names them; nobody is added). A
143
+ * caller outside the channel who is neither its creator nor a project manager
144
+ * rejects with 403 `forbidden`. `#general` rejects with 400 `default_channel`.
145
+ * The caller shows the error.
146
+ */
147
+ export declare function addProjectSpaceMembers(projectId: string, spaceId: string, userIds: string[]): Promise<ProjectSpaceMemberList>;
148
+ /**
149
+ * Remove someone from a channel; resolves to the list after. A manager
150
+ * removes anyone, the creator anyone but themself, a member only themself.
151
+ * The creator rejects with 403 `creator_not_removable` unless a manager
152
+ * removes them; another refusal is 403 `forbidden`.
153
+ */
154
+ export declare function removeProjectSpaceMember(projectId: string, spaceId: string, userId: string): Promise<ProjectSpaceMemberList>;
155
+ /** A private channel the caller is not in, as a project manager sees it: no content (`GET /spaces/private`). */
156
+ export interface PrivateChannelSummary {
157
+ space_id: string;
158
+ name: string;
159
+ slug: string;
160
+ /** Its people who still have project access. 0: everyone left, a manager can add people. */
161
+ member_count: number;
162
+ created_by: string | null;
163
+ /** The creator's display name, null when unknown. */
164
+ created_by_name: string | null;
165
+ created_at: string;
166
+ archived_at: string | null;
167
+ }
168
+ /**
169
+ * Project managers: the private channels they are not in, archived ones too.
170
+ * A manager renames or archives one with `updateProjectSpace` and adds or
171
+ * removes its people with `addProjectSpaceMembers` / `removeProjectSpaceMember`
172
+ * (never themself: 403 `manager_self_add`). Anyone else rejects with 403
173
+ * `forbidden`. A background read.
174
+ */
175
+ export declare function listPrivateChannelsNotIn(projectId: string): Promise<PrivateChannelSummary[]>;
176
+ /** The caller joins a public channel. Idempotent. `#general` rejects with 400 `default_channel`. */
177
+ export declare function joinProjectSpace(projectId: string, spaceId: string): Promise<ProjectSpaceMemberList>;
178
+ /** The caller leaves a channel. Its creator rejects with 403 `creator_not_removable` (only a manager removes them). */
179
+ export declare function leaveProjectSpace(projectId: string, spaceId: string): Promise<ProjectSpaceMemberList>;
180
+ /** A link of a channel (its Links tab): added with "Add link" or shared in a thread. Same fields as the API's `SpaceLink`. */
181
+ export interface ProjectSpaceLink {
182
+ link_id: string;
183
+ space_id: string;
184
+ url: string;
185
+ title: string | null;
186
+ created_by: string | null;
187
+ /** The creator's display name or email; null when unknown. */
188
+ created_by_name: string | null;
189
+ created_at: string;
190
+ /** The caller may remove it: they added it, or they manage the project. */
191
+ can_delete: boolean;
192
+ /** Agents in the channel read pinned links. Every link starts unpinned (added or shared in a thread) until a member pins it. */
193
+ pinned: boolean;
194
+ /** Who pinned it; null while unpinned or when unknown. */
195
+ pinned_by_name: string | null;
196
+ /** When it was pinned; null while unpinned. */
197
+ pinned_at: string | null;
198
+ /** `manual`: added with "Add link". `message`: collected from a person's message in a thread of the channel. */
199
+ source: 'manual' | 'message';
200
+ /** The latest thread that shared it; null for a link no thread shared. */
201
+ session_id: string | null;
202
+ last_shared_at: string;
203
+ /** The row's name: the title a member gave, else the page's fetched title, else the decoded path, else the host. Absent on older APIs: fall back to `title ?? url`. */
204
+ display_title?: string;
205
+ /** The page's `og:site_name`, fetched by the server; null until fetched or when the page has none. Absent on older APIs. */
206
+ site_name?: string | null;
207
+ /** The page's icon URL, fetched by the server; null until fetched or when none passed the address check. A remote URL: load it only through an image proxy. Absent on older APIs. */
208
+ icon_url?: string | null;
209
+ }
210
+ export interface AddProjectSpaceLinkInput {
211
+ /** An http(s) URL, at most 2,048 characters. */
212
+ url: string;
213
+ /** At most 200 characters. */
214
+ title?: string;
215
+ }
216
+ /**
217
+ * The channel's Apps: the project's Apps with a deployment made from one of
218
+ * its threads, only those the caller may open. A background read.
219
+ */
220
+ export declare function listProjectSpaceApps(projectId: string, spaceId: string): Promise<App[]>;
221
+ /** The channel's links, newest first. A background read. */
222
+ export declare function listProjectSpaceLinks(projectId: string, spaceId: string): Promise<ProjectSpaceLink[]>;
223
+ /**
224
+ * Add a link to a channel, unpinned, with the caller as its adder. A URL that
225
+ * is not http(s), longer than 2,048 characters, or a title over 200 rejects
226
+ * with 400. A channel that already holds 200 added links rejects with 409
227
+ * `link_limit`. The caller shows both. The
228
+ * stored `url` is the parsed form (`new URL(url).href`).
229
+ */
230
+ export declare function addProjectSpaceLink(projectId: string, spaceId: string, input: AddProjectSpaceLinkInput): Promise<ProjectSpaceLink>;
231
+ /** Remove a link. Only its creator or a project manager may: anyone else gets 403 `forbidden`. */
232
+ export declare function removeProjectSpaceLink(projectId: string, spaceId: string, linkId: string): Promise<void>;
233
+ /**
234
+ * Pin or unpin a link. Agents in the channel read the pinned ones. Unpinning
235
+ * only clears the pin: the link stays listed (`removeProjectSpaceLink` removes
236
+ * it). Returns the link; null only from an older server, where unpinning an
237
+ * added link removed it. A channel that already pins 200 links rejects pinning
238
+ * with 409 `link_limit`.
239
+ */
240
+ export declare function pinProjectSpaceLink(projectId: string, spaceId: string, linkId: string, pinned: boolean): Promise<ProjectSpaceLink | null>;
241
+ /** A mark a member leaves once per project: the intro dialog seen, or a "Get started" row done or dismissed. */
242
+ export type ChannelsOnboardingMark = 'channels_intro' | 'get_started.dismissed' | 'get_started.channel' | 'get_started.remember' | 'get_started.dm';
243
+ /**
244
+ * The caller's Channels onboarding state. A "Get started" row is done when its
245
+ * mark is present or its fact is true: the caller created a channel, saved
246
+ * memory in `#general`, or owns a DM.
247
+ */
248
+ export interface ChannelsOnboarding {
249
+ /** The member intro dialog was seen (or Channels was turned on again). */
250
+ intro_seen: boolean;
251
+ get_started: {
252
+ /** Show the block: not dismissed and not every row done. */
253
+ visible: boolean;
254
+ create_channel: boolean;
255
+ remember: boolean;
256
+ open_dm: boolean;
257
+ };
258
+ }
259
+ /** The caller's Channels onboarding state. A background read. */
260
+ export declare function getChannelsOnboarding(projectId: string): Promise<ChannelsOnboarding>;
261
+ /** Record one onboarding mark for the caller. Idempotent. An unknown mark rejects with 400; the caller shows it. */
262
+ export declare function markChannelsOnboarding(projectId: string, mark: ChannelsOnboardingMark): Promise<void>;
263
+ //# sourceMappingURL=spaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spaces.d.ts","sourceRoot":"","sources":["../../../../src/core/rest/projects-client/spaces.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAGlC,qGAAqG;AACrG,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,SAAS,GAAG,IAAI,CAAC;IACvB,qEAAqE;IACrE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,8CAA8C;IAC9C,UAAU,EAAE,OAAO,CAAC;IACpB,6CAA6C;IAC7C,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,mJAAmJ;IACnJ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,QA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CAAC;QACjB,cAAc,EAAE,OAAO,CAAC;QACxB,QAAQ,EAAE,OAAO,CAAC;QAClB,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;CACH;AAED,iEAAiE;AACjE,wBAAsB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAI1F;AAED,oHAAoH;AACpH,wBAAsB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAI3G"}
@@ -0,0 +1,165 @@
1
+ // Project spaces — `/v1/projects/:id/spaces` (apps/api/src/projects/routes/project-spaces.ts).
2
+ // A space is a channel of the project or the caller's DM with one agent. A
3
+ // session filed into a space carries its `space_id` (`createProjectSession`,
4
+ // `listProjectSessions({ spaceId })`). Every route answers 403
5
+ // `feature_disabled` while the project's `project_channels` flag is off.
6
+ import { backendApi } from '../../http/api-client.js';
7
+ import { unwrap } from './shared.js';
8
+ /**
9
+ * The project's live channels (`#general` first, then oldest first), then the
10
+ * caller's DMs. The first call creates `#general`. A background read: a
11
+ * failure reaches the caller's query state, not the host error handler.
12
+ */
13
+ export async function listProjectSpaces(projectId) {
14
+ const body = unwrap(await backendApi.get(`/projects/${projectId}/spaces`, { showErrors: false }));
15
+ return body.spaces;
16
+ }
17
+ /**
18
+ * `#general`'s "turned on again" line, or null when there is none. Read from
19
+ * the spaces list (`GET /spaces`), so it costs the same request. A background read.
20
+ */
21
+ export async function getProjectSpaceGeneralNotice(projectId) {
22
+ const body = unwrap(await backendApi.get(`/projects/${projectId}/spaces`, {
23
+ showErrors: false,
24
+ }));
25
+ return body.general_notice ?? null;
26
+ }
27
+ /**
28
+ * Whether this deployment lets a channel be private (create with `visibility:
29
+ * 'private'`, or make one private). Read from the spaces list; an older API
30
+ * that sends no field reads false. A background read.
31
+ */
32
+ export async function getPrivateChannelsAvailable(projectId) {
33
+ const body = unwrap(await backendApi.get(`/projects/${projectId}/spaces`, {
34
+ showErrors: false,
35
+ }));
36
+ return body.private_channels_available === true;
37
+ }
38
+ /**
39
+ * Create a channel. A name whose slug is taken rejects with an `ApiError`:
40
+ * `status` 409, `code` `'slug_taken'`, and `data.space_id` / `data.archived`
41
+ * name the existing channel; `data.can_edit` says whether the caller may
42
+ * unarchive it, so the caller offers that only when it may. A name
43
+ * with no slug characters rejects with 400 `invalid_name`. The caller shows
44
+ * both, so neither reaches the host error handler.
45
+ */
46
+ export async function createProjectSpace(projectId, input) {
47
+ return unwrap(await backendApi.post(`/projects/${projectId}/spaces`, input, { showErrors: false }));
48
+ }
49
+ /**
50
+ * Rename, describe, archive or unarchive a channel, or replace its agent list. Only its creator or a
51
+ * project manager may (`can_edit`); anyone else rejects with 403 `forbidden`.
52
+ * A rename whose slug is taken rejects with 409 `slug_taken` (fields as in
53
+ * `createProjectSpace`). The caller shows the error, so it never reaches the
54
+ * host error handler.
55
+ */
56
+ export async function updateProjectSpace(projectId, spaceId, input) {
57
+ return unwrap(await backendApi.patch(`/projects/${projectId}/spaces/${spaceId}`, input, { showErrors: false }));
58
+ }
59
+ /**
60
+ * The caller's DM with `agentName`, created on the first call. An agent the
61
+ * project does not declare rejects with 404 `agent_not_found`. The caller
62
+ * shows the error, so it never reaches the host error handler.
63
+ */
64
+ export async function getOrCreateProjectDm(projectId, agentName) {
65
+ return unwrap(await backendApi.post(`/projects/${projectId}/spaces/dm`, { agent_name: agentName }, { showErrors: false }));
66
+ }
67
+ /** A channel's people. `#general` lists every project member. A background read. */
68
+ export async function listProjectSpaceMembers(projectId, spaceId) {
69
+ return unwrap(await backendApi.get(`/projects/${projectId}/spaces/${spaceId}/members`, { showErrors: false }));
70
+ }
71
+ /**
72
+ * Add people to a channel in one request; resolves to the list after the add.
73
+ * Someone already in it is skipped. An id outside the project rejects with
74
+ * 400 `not_project_member` (`data.user_ids` names them; nobody is added). A
75
+ * caller outside the channel who is neither its creator nor a project manager
76
+ * rejects with 403 `forbidden`. `#general` rejects with 400 `default_channel`.
77
+ * The caller shows the error.
78
+ */
79
+ export async function addProjectSpaceMembers(projectId, spaceId, userIds) {
80
+ return unwrap(await backendApi.post(`/projects/${projectId}/spaces/${spaceId}/members`, { user_ids: userIds }, { showErrors: false }));
81
+ }
82
+ /**
83
+ * Remove someone from a channel; resolves to the list after. A manager
84
+ * removes anyone, the creator anyone but themself, a member only themself.
85
+ * The creator rejects with 403 `creator_not_removable` unless a manager
86
+ * removes them; another refusal is 403 `forbidden`.
87
+ */
88
+ export async function removeProjectSpaceMember(projectId, spaceId, userId) {
89
+ return unwrap(await backendApi.delete(`/projects/${projectId}/spaces/${spaceId}/members/${userId}`, {
90
+ showErrors: false,
91
+ }));
92
+ }
93
+ /**
94
+ * Project managers: the private channels they are not in, archived ones too.
95
+ * A manager renames or archives one with `updateProjectSpace` and adds or
96
+ * removes its people with `addProjectSpaceMembers` / `removeProjectSpaceMember`
97
+ * (never themself: 403 `manager_self_add`). Anyone else rejects with 403
98
+ * `forbidden`. A background read.
99
+ */
100
+ export async function listPrivateChannelsNotIn(projectId) {
101
+ return unwrap(await backendApi.get(`/projects/${projectId}/spaces/private`, { showErrors: false })).channels;
102
+ }
103
+ /** The caller joins a public channel. Idempotent. `#general` rejects with 400 `default_channel`. */
104
+ export async function joinProjectSpace(projectId, spaceId) {
105
+ return unwrap(await backendApi.post(`/projects/${projectId}/spaces/${spaceId}/join`, undefined, {
106
+ showErrors: false,
107
+ }));
108
+ }
109
+ /** The caller leaves a channel. Its creator rejects with 403 `creator_not_removable` (only a manager removes them). */
110
+ export async function leaveProjectSpace(projectId, spaceId) {
111
+ return removeProjectSpaceMember(projectId, spaceId, 'me');
112
+ }
113
+ /**
114
+ * The channel's Apps: the project's Apps with a deployment made from one of
115
+ * its threads, only those the caller may open. A background read.
116
+ */
117
+ export async function listProjectSpaceApps(projectId, spaceId) {
118
+ const body = unwrap(await backendApi.get(`/projects/${projectId}/spaces/${spaceId}/apps`, { showErrors: false }));
119
+ return body.apps;
120
+ }
121
+ /** The channel's links, newest first. A background read. */
122
+ export async function listProjectSpaceLinks(projectId, spaceId) {
123
+ const body = unwrap(await backendApi.get(`/projects/${projectId}/spaces/${spaceId}/links`, {
124
+ showErrors: false,
125
+ }));
126
+ return body.links;
127
+ }
128
+ /**
129
+ * Add a link to a channel, unpinned, with the caller as its adder. A URL that
130
+ * is not http(s), longer than 2,048 characters, or a title over 200 rejects
131
+ * with 400. A channel that already holds 200 added links rejects with 409
132
+ * `link_limit`. The caller shows both. The
133
+ * stored `url` is the parsed form (`new URL(url).href`).
134
+ */
135
+ export async function addProjectSpaceLink(projectId, spaceId, input) {
136
+ return unwrap(await backendApi.post(`/projects/${projectId}/spaces/${spaceId}/links`, input, {
137
+ showErrors: false,
138
+ }));
139
+ }
140
+ /** Remove a link. Only its creator or a project manager may: anyone else gets 403 `forbidden`. */
141
+ export async function removeProjectSpaceLink(projectId, spaceId, linkId) {
142
+ unwrap(await backendApi.delete(`/projects/${projectId}/spaces/${spaceId}/links/${linkId}`, {
143
+ showErrors: false,
144
+ }));
145
+ }
146
+ /**
147
+ * Pin or unpin a link. Agents in the channel read the pinned ones. Unpinning
148
+ * only clears the pin: the link stays listed (`removeProjectSpaceLink` removes
149
+ * it). Returns the link; null only from an older server, where unpinning an
150
+ * added link removed it. A channel that already pins 200 links rejects pinning
151
+ * with 409 `link_limit`.
152
+ */
153
+ export async function pinProjectSpaceLink(projectId, spaceId, linkId, pinned) {
154
+ const body = unwrap(await backendApi.patch(`/projects/${projectId}/spaces/${spaceId}/links/${linkId}`, { pinned }, { showErrors: false }));
155
+ return body.link;
156
+ }
157
+ /** The caller's Channels onboarding state. A background read. */
158
+ export async function getChannelsOnboarding(projectId) {
159
+ return unwrap(await backendApi.get(`/projects/${projectId}/onboarding/channels`, { showErrors: false }));
160
+ }
161
+ /** Record one onboarding mark for the caller. Idempotent. An unknown mark rejects with 400; the caller shows it. */
162
+ export async function markChannelsOnboarding(projectId, mark) {
163
+ unwrap(await backendApi.post(`/projects/${projectId}/onboarding/channels/marks`, { mark }, { showErrors: false }));
164
+ }
165
+ //# sourceMappingURL=spaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spaces.js","sourceRoot":"","sources":["../../../../src/core/rest/projects-client/spaces.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,2EAA2E;AAC3E,6EAA6E;AAC7E,+DAA+D;AAC/D,yEAAyE;AAEzE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAqElC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,SAAiB;IACvD,MAAM,IAAI,GAAG,MAAM,CACjB,MAAM,UAAU,CAAC,GAAG,CAA6B,aAAa,SAAS,SAAS,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CACzG,CAAC;IACF,OAAO,IAAI,CAAC,MAAM,CAAC;AACrB,CAAC;AAYD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,SAAiB;IAClE,MAAM,IAAI,GAAG,MAAM,CACjB,MAAM,UAAU,CAAC,GAAG,CAAiD,aAAa,SAAS,SAAS,EAAE;QACpG,UAAU,EAAE,KAAK;KAClB,CAAC,CACH,CAAC;IACF,OAAO,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC;AACrC,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,SAAiB;IACjE,MAAM,IAAI,GAAG,MAAM,CACjB,MAAM,UAAU,CAAC,GAAG,CAA2C,aAAa,SAAS,SAAS,EAAE;QAC9F,UAAU,EAAE,KAAK;KAClB,CAAC,CACH,CAAC;IACF,OAAO,IAAI,CAAC,0BAA0B,KAAK,IAAI,CAAC;AAClD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,SAAiB,EAAE,KAA8B;IACxF,OAAO,MAAM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,EAAE,IAA4B;IAC1F,MAAM,CACJ,MAAM,UAAU,CAAC,IAAI,CAAU,aAAa,SAAS,4BAA4B,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CACpH,CAAC;AACJ,CAAC"}
@@ -1,6 +1,13 @@
1
- export type ProjectTriggerType = 'cron' | 'webhook' | 'monitor' | 'event';
2
1
  /**
3
- * How the platform runs a `type: monitor` trigger's `run` command:
2
+ * `'monitor'` is deprecated: the monitor box was removed, and the API answers
3
+ * 400 to a new monitor trigger. An App with a schedule or a `type: app`
4
+ * trigger replaces it. The member stays until the next major.
5
+ */
6
+ export type ProjectTriggerType = 'cron' | 'webhook' | 'monitor' | 'event' | 'app';
7
+ /**
8
+ * @deprecated The monitor box was removed; the API sends `null`. Removed in the next major.
9
+ *
10
+ * How the platform ran a `type: monitor` trigger's `run` command:
4
11
  * - `poll` — run it every `interval`, print, exit.
5
12
  * - `stream` — run it once and keep it alive.
6
13
  *
@@ -26,6 +33,14 @@ export interface TriggerSessionAccess {
26
33
  memberIds: string[];
27
34
  groupIds: string[];
28
35
  }
36
+ /** What a fire calls when a trigger targets an App: `method path` on the App, with the fire's payload. */
37
+ export interface ProjectTriggerTarget {
38
+ app: string;
39
+ path: string;
40
+ method: 'POST' | 'GET';
41
+ /** Fixed JSON body the call sends instead of the fire's payload. */
42
+ payload?: Record<string, unknown>;
43
+ }
29
44
  /** Subscription state of a `type: event` trigger. */
30
45
  export interface ProjectTriggerEvent {
31
46
  /** The connector (profile) the event happens on. */
@@ -93,24 +108,22 @@ export interface ProjectTrigger {
93
108
  timezone: string;
94
109
  /** project_secrets key holding the webhook HMAC secret. */
95
110
  secret_env: string | null;
96
- /**
97
- * For type='monitor' only — the repo-relative command the platform
98
- * supervises 24/7 in the project's monitor box. Its stdout lines are the
99
- * events; nothing else is. Null on cron/webhook.
100
- */
111
+ /** @deprecated The monitor box was removed; always `null`. Removed in the next major. */
101
112
  run: string | null;
102
- /** For type='monitor' only — see {@link ProjectMonitorMode}. Null otherwise. */
113
+ /** @deprecated The monitor box was removed; always `null`. Removed in the next major. */
103
114
  mode: ProjectMonitorMode | null;
104
- /** For mode='poll' only — the poll period in whole seconds. Null otherwise. */
115
+ /** @deprecated The monitor box was removed; always `null`. Removed in the next major. */
105
116
  interval_seconds: number | null;
106
- /**
107
- * For type='monitor' only — the silence watchdog in whole seconds. No event
108
- * inside this window synthesizes a `silent` lifecycle event, so a wedged
109
- * monitor can never fail silently. Null when the monitor declares none.
110
- */
117
+ /** @deprecated The monitor box was removed; always `null`. Removed in the next major. */
111
118
  expect_event_within_seconds: number | null;
112
119
  /** For type='event' only — see {@link ProjectTriggerEvent}. Null otherwise. */
113
120
  event: ProjectTriggerEvent | null;
121
+ /** For type='app' only — the slug of the App whose emitted events fire this trigger. Null or absent otherwise. */
122
+ app?: string | null;
123
+ /** A fire calls this App instead of running an agent. Null or absent: an agent run. */
124
+ target?: ProjectTriggerTarget | null;
125
+ /** For type='cron' with `every` — the fixed period in whole seconds. Null or absent otherwise. */
126
+ every_seconds?: number | null;
114
127
  prompt_template: string;
115
128
  /** Session strategy — see {@link ProjectTriggerSessionMode}. */
116
129
  session_mode: ProjectTriggerSessionMode;
@@ -156,6 +169,12 @@ export interface ProjectTrigger {
156
169
  filter: Record<string, TriggerFilterValue> | null;
157
170
  /** Access policy applied to every session this trigger creates. */
158
171
  session_access: TriggerSessionAccess;
172
+ /**
173
+ * The channel or DM (`ProjectSpace.space_id`) its runs post to as threads;
174
+ * null = none, the run lands in `#general`. Present only while the project's
175
+ * `project_channels` flag is on; older servers omit it.
176
+ */
177
+ space_id?: string | null;
159
178
  last_fired_at: string | null;
160
179
  /**
161
180
  * The trigger's most recent outcome: `queued` (a prompt waits for its
@@ -211,7 +230,7 @@ export interface CreateProjectTriggerInput {
211
230
  */
212
231
  slug?: string;
213
232
  type: ProjectTriggerType;
214
- prompt_template: string;
233
+ prompt_template?: string;
215
234
  /** Defaults to 'default'. */
216
235
  agent?: string;
217
236
  /** Wire-form model (`provider/model`). Omit or pass null to resolve the
@@ -226,17 +245,25 @@ export interface CreateProjectTriggerInput {
226
245
  timezone?: string;
227
246
  /** For type='webhook'. Name of a project_secrets entry. */
228
247
  secret_env?: string;
229
- /** Required for type='monitor'. Repo-relative command whose stdout lines fire. */
248
+ /** @deprecated The monitor box was removed; the API refuses monitor triggers. Removed in the next major. */
230
249
  run?: string;
231
- /** Required for type='monitor'. See {@link ProjectMonitorMode}. */
250
+ /** @deprecated The monitor box was removed; the API refuses monitor triggers. Removed in the next major. */
232
251
  mode?: ProjectMonitorMode;
233
- /**
234
- * Required for mode='poll', rejected on mode='stream'. Duration literal
235
- * (`30s`, `5m`, `24h`, `7d`), floor 30s. Never a bare number.
236
- */
252
+ /** @deprecated The monitor box was removed; the API refuses monitor triggers. Removed in the next major. */
237
253
  interval?: string;
238
- /** For type='monitor'. Silence watchdog as a duration literal; floor 5m. */
254
+ /** @deprecated The monitor box was removed; the API refuses monitor triggers. Removed in the next major. */
239
255
  expect_event_within?: string;
256
+ /** Required for type='app'. Slug of the App whose events fire the trigger; the App must exist. */
257
+ app?: string;
258
+ /** Call an App instead of running an agent; `prompt_template` is then optional. */
259
+ target?: {
260
+ app: string;
261
+ path?: string;
262
+ method?: 'POST' | 'GET';
263
+ payload?: Record<string, unknown>;
264
+ };
265
+ /** For type='cron'. A fixed period such as `5m`, `1h`, `1d` (at least 1m) instead of `cron` or `run_at`. */
266
+ every?: string;
240
267
  /** Required for type='event'. Connector slug the event happens on. */
241
268
  connector?: string;
242
269
  /** For type='event'. Label of one shared account of the connector; omit or null for the connector default. */
@@ -269,8 +296,18 @@ export interface CreateProjectTriggerInput {
269
296
  session_key?: string | null;
270
297
  /** Payload paths mapped to the condition each must meet for the trigger to fire. See {@link ProjectTrigger.filter}. */
271
298
  filter?: Record<string, TriggerFilterValue> | null;
272
- /** Defaults to private. This is account-local runtime state, not manifest config. */
299
+ /** Defaults to private, or project when `space_id` is a channel. This is account-local runtime state, not manifest config. */
273
300
  session_access?: TriggerSessionAccess;
301
+ /**
302
+ * The channel or DM its runs post to as threads (`project_channels` flag;
303
+ * ignored while it is off). A DM must be the caller's own (else 403
304
+ * `space_forbidden`) and the trigger must run the DM's agent (else 400
305
+ * `agent_mismatch`). A DM run is shared with the DM's member whatever
306
+ * `session_access` says; like every trigger run, trigger managers and account
307
+ * owners and admins can also open it. An unknown or archived space rejects
308
+ * with 404 `space_not_found`. A change applies to later runs only.
309
+ */
310
+ space_id?: string | null;
274
311
  }
275
312
  export interface UpdateProjectTriggerInput {
276
313
  name?: string;
@@ -284,17 +321,25 @@ export interface UpdateProjectTriggerInput {
284
321
  run_at?: string | null;
285
322
  timezone?: string;
286
323
  secret_env?: string;
287
- /** For type='monitor'. Repo-relative command whose stdout lines fire. */
324
+ /** @deprecated The monitor box was removed; the API refuses monitor triggers. Removed in the next major. */
288
325
  run?: string;
289
- /** For type='monitor'. See {@link ProjectMonitorMode}. */
326
+ /** @deprecated The monitor box was removed; the API refuses monitor triggers. Removed in the next major. */
290
327
  mode?: ProjectMonitorMode;
291
- /**
292
- * For mode='poll'. Duration literal (`30s`, `5m`, `24h`, `7d`), floor 30s.
293
- * null clears it — required when switching a poll monitor to 'stream'.
294
- */
328
+ /** @deprecated The monitor box was removed; the API refuses monitor triggers. Removed in the next major. */
295
329
  interval?: string | null;
296
- /** For type='monitor'. Duration literal, floor 5m. null clears the watchdog. */
330
+ /** @deprecated The monitor box was removed; the API refuses monitor triggers. Removed in the next major. */
297
331
  expect_event_within?: string | null;
332
+ /** For type='app'. Slug of the App whose events fire the trigger. */
333
+ app?: string;
334
+ /** Call an App instead of running an agent; null clears it. */
335
+ target?: {
336
+ app: string;
337
+ path?: string;
338
+ method?: 'POST' | 'GET';
339
+ payload?: Record<string, unknown>;
340
+ } | null;
341
+ /** For type='cron'. A fixed period such as `5m`; null clears it. */
342
+ every?: string | null;
298
343
  /** For type='event'. Connector slug. Changing it clears the account unless `event_account` is sent. */
299
344
  connector?: string;
300
345
  /** For type='event'. Label of one shared account of the connector; null clears it to the connector default. */
@@ -317,8 +362,10 @@ export interface UpdateProjectTriggerInput {
317
362
  session_key?: string | null;
318
363
  /** Replaces the whole filter. null or {} clears it. */
319
364
  filter?: Record<string, TriggerFilterValue> | null;
320
- /** Replaces the policy and updates prior sessions created by this trigger. */
365
+ /** Replaces the policy and updates prior sessions created by this trigger, except those in a DM. */
321
366
  session_access?: TriggerSessionAccess;
367
+ /** See {@link CreateProjectTriggerInput.space_id}. null clears it; a move into a channel without `session_access` makes its later threads project-visible. Another member's DM trigger accepts only `space_id` and `enabled` (else 403). */
368
+ space_id?: string | null;
322
369
  }
323
370
  export declare function listProjectTriggers(projectId: string): Promise<ProjectTriggerListing>;
324
371
  export declare function createProjectTrigger(projectId: string, input: CreateProjectTriggerInput): Promise<ProjectTriggerListing>;
@@ -380,7 +427,7 @@ export interface ProjectTriggerDryRunResult {
380
427
  payload: Record<string, unknown>;
381
428
  }
382
429
  /** What fired a run. */
383
- export type ProjectTriggerRunSource = 'cron' | 'webhook' | 'manual' | 'monitor' | 'reminder' | 'event';
430
+ export type ProjectTriggerRunSource = 'cron' | 'webhook' | 'manual' | 'monitor' | 'reminder' | 'event' | 'app';
384
431
  /**
385
432
  * A run's fire outcome. `fired` = a session was started or prompted;
386
433
  * `rejected` = a webhook delivery refused before its signature verified.