@kortix/ui 0.14.15 → 0.14.17

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 (33) hide show
  1. package/dist/_vendor/shared/artifact-annotations.d.ts +126 -1
  2. package/dist/_vendor/shared/artifact-comments.d.ts +30 -1
  3. package/dist/_vendor/shared/channel-descriptors.d.ts +5 -1
  4. package/dist/customize/settings/tabs/experimental-tab.js +1 -4
  5. package/dist/customize/shared/channels-switch-dialog.d.ts +4 -8
  6. package/dist/customize/shared/channels-switch-dialog.js +5 -16
  7. package/dist/customize/shared/feature-gate-screen.js +5 -7
  8. package/dist/files/drives/drive-path-param.d.ts +4 -0
  9. package/dist/files/drives/drive-path-param.js +50 -0
  10. package/dist/files/index.d.ts +1 -0
  11. package/dist/files/index.js +1 -0
  12. package/dist/i18n/en.d.ts +48 -18
  13. package/dist/i18n/en.js +62 -32
  14. package/dist/internal/lib/use-project-feature-flags.js +0 -2
  15. package/dist/internal/lib/utils/kortix-system-tags.d.ts +2 -8
  16. package/dist/internal/lib/utils/kortix-system-tags.js +4 -58
  17. package/dist/markdown/doc-editor/doc-menus.d.ts +6 -0
  18. package/dist/markdown/doc-editor/doc-menus.js +74 -9
  19. package/dist/session/status/provisioning-failure.d.ts +22 -1
  20. package/dist/session/status/provisioning-failure.js +35 -7
  21. package/dist/session/status/session-starting-loader.js +15 -5
  22. package/dist/session/tool/tools/kortix-tool-card.d.ts +4 -81
  23. package/dist/session/tool/tools/kortix-tool-card.js +4 -184
  24. package/dist/session/tool/tools/workflow-run.d.ts +4 -126
  25. package/dist/session/tool/tools/workflow-run.js +4 -249
  26. package/dist/session/turn/subagent-notice.d.ts +4 -56
  27. package/dist/session/turn/subagent-notice.js +4 -109
  28. package/dist/styles.css +1 -1
  29. package/dist/workspace/sidebar/project-session-list.js +13 -26
  30. package/dist/workspace/sidebar/session-brief-hover-card.d.ts +0 -3
  31. package/dist/workspace/sidebar/session-brief-hover-card.js +0 -3
  32. package/package.json +3 -3
  33. package/skills/kortix-ui/references/modules.md +1 -1
@@ -1,58 +1,6 @@
1
- import { type PeerMessagePromptInfo } from '../../_vendor/shared/index.js';
2
1
  /**
3
- * The notices the API delivers into a session as a prompt, written by
4
- * `subagentNoticeText` in `apps/api/src/projects/subagent-notice.ts`:
5
- *
6
- * A background subagent you started has finished. This message is from the platform, not from the user.
7
- * (or) Your teammate <handle> finished its turn and is idle. This message is from the platform, not from the user.
8
- * task_id: <child session id>
9
- * status: completed | error | failed | stopped
10
- *
11
- * <kortix_system type="session-report" source="subagent"><session-report>…</session-report></kortix_system>
12
- *
13
- * Tasks <handle> still owns: #3 subject (in progress); … . (a teammate only)
14
- * …
15
- *
16
- * `apps/api/src/projects/session-notice-batch.ts` coalesces the notices that
17
- * arrive together into one prompt, joined by a blank line (at most 20): these,
18
- * and the idle notice a `send_message({ notify_when_idle })` asked for
19
- * (`peerMessagePromptText` kind `idle_notice`).
2
+ * The background subagent, teammate and peer idle notices the API delivers
3
+ * into a session as a prompt. The parsers live in `@kortix/sdk`
4
+ * (`core/turns/subagent-notice.ts`); this file keeps the old import path.
20
5
  */
21
- export interface SubagentNotice {
22
- /** `teammate`: a teammate of an agent team went idle; `subagent`: a background subagent ended. */
23
- kind: 'subagent' | 'teammate';
24
- sessionId: string;
25
- status: 'completed' | 'failed' | 'stopped';
26
- /** A teammate's handle, from its lead line; null for a subagent. */
27
- handle: string | null;
28
- /** The project agent the child ran as, or null. */
29
- agent: string | null;
30
- /** The child's title, without the "(@agent subagent)" suffix, or null. */
31
- title: string | null;
32
- /** The child's final report (Markdown), or its error. */
33
- result: string;
34
- /** The first line of `result` that holds words. */
35
- excerpt: string;
36
- /** A teammate's unfinished tasks ("#3 Write the fix (in progress); #4 …"), or null when it owns none. */
37
- ownedTasks: string | null;
38
- }
39
- /** One notice of a delivered notice prompt. */
40
- export type NoticeBatchItem = {
41
- kind: 'subagent' | 'teammate';
42
- notice: SubagentNotice;
43
- } | {
44
- kind: 'peer_idle';
45
- info: PeerMessagePromptInfo;
46
- };
47
- /** The first line with words, without Markdown heading, list and emphasis marks. */
48
- export declare function firstLine(text: string): string;
49
- /** The background subagent or teammate notice a text carries (one notice, not a batch), or null. */
50
- export declare function parseSubagentNotice(text: string | null | undefined): SubagentNotice | null;
51
- /**
52
- * The notices a delivered prompt carries, in order, or null when the prompt is
53
- * anything else. A notice starts at the start of the prompt or right after the
54
- * blank line that joins two notices, so a notice line quoted inside a report
55
- * never splits one. Every piece must parse: one that does not makes the whole
56
- * prompt "not a batch", and it renders as the turn it is.
57
- */
58
- export declare function parseNoticeBatch(text: string | null | undefined): NoticeBatchItem[] | null;
6
+ export { noticeFirstLine as firstLine, parseNoticeBatch, parseSubagentNotice, type NoticeBatchItem, type SubagentNotice, } from '@kortix/sdk';
@@ -1,111 +1,6 @@
1
- import { parsePeerMessagePrompt, tagBlocks } from '../../_vendor/kortix-shared.js';
2
- import { extractSessionReport } from '../../internal/lib/utils/kortix-system-tags.js';
3
- const SUBAGENT_LEAD = 'A background subagent you started has finished.';
4
- const TEAMMATE_LEAD = /^Your teammate (\S+) finished its turn and is idle\./;
5
- const PEER_IDLE_HEAD = '[idle notice from ';
6
- const STATUSES = new Set(['completed', 'failed', 'stopped']);
7
- /** `session-notice-batch.ts` `NOTICE_BATCH_MAX`; a longer prompt is not a batch it wrote. */
8
- const MAX_NOTICES = 20;
9
- function block(text, tag) {
10
- const found = tagBlocks(text, tag, { limit: 1 })[0];
11
- return found ? found.body.trim() : null;
12
- }
13
- /** The first line with words, without Markdown heading, list and emphasis marks. */
14
- export function firstLine(text) {
15
- for (const raw of text.split('\n')) {
16
- const line = raw
17
- .replace(/^\s*(?:#{1,6}\s+|[-*+]\s+|>\s*|\d+\.\s+)/, '')
18
- .replace(/[*_`]+/g, '')
19
- .trim();
20
- if (line)
21
- return line;
22
- }
23
- return '';
24
- }
25
- /** The background subagent or teammate notice a text carries (one notice, not a batch), or null. */
26
- export function parseSubagentNotice(text) {
27
- if (!text)
28
- return null;
29
- const body = text.trimStart();
30
- const teammate = TEAMMATE_LEAD.exec(body);
31
- if (!teammate && !body.startsWith(SUBAGENT_LEAD))
32
- return null;
33
- const report = extractSessionReport(body);
34
- const head = body.slice(0, 600);
35
- const sessionId = /^task_id:\s*(\S+)/m.exec(head)?.[1] ?? report?.sessionId ?? '';
36
- if (!sessionId)
37
- return null;
38
- const stated = /^status:\s*(\w+)/m.exec(head)?.[1];
39
- // The API writes `error` for a turn that ended on an error; it reads as a failure.
40
- const normalized = stated === 'error' ? 'failed' : stated;
41
- const status = normalized && STATUSES.has(normalized)
42
- ? normalized
43
- : report?.status === 'FAILED'
44
- ? 'failed'
45
- : 'completed';
46
- const resultXml = report?.result ?? '';
47
- const answer = block(resultXml, 'task_result');
48
- const error = block(resultXml, 'task_error');
49
- const result = (status === 'completed' ? answer : (error ?? answer)) ?? resultXml;
50
- const title = report?.prompt?.replace(/\s*\(@[^)]*\bsubagent\)\s*$/i, '').trim() || null;
51
- const handle = teammate?.[1] ?? null;
52
- const owned = handle ? /^Tasks \S+ still owns: (.+?)\.?$/m.exec(body)?.[1]?.trim() : undefined;
53
- return {
54
- kind: teammate ? 'teammate' : 'subagent',
55
- sessionId,
56
- status,
57
- handle,
58
- agent: report?.project?.trim() || null,
59
- title,
60
- result,
61
- excerpt: firstLine(result),
62
- ownedTasks: owned || null,
63
- };
64
- }
65
- /** True when a notice of any kind starts at `index` of `text`. */
66
- function startsNotice(text, index) {
67
- return (text.startsWith(SUBAGENT_LEAD, index) ||
68
- text.startsWith(PEER_IDLE_HEAD, index) ||
69
- (text.startsWith('Your teammate ', index) && TEAMMATE_LEAD.test(text.slice(index, index + 300))));
70
- }
71
1
  /**
72
- * The notices a delivered prompt carries, in order, or null when the prompt is
73
- * anything else. A notice starts at the start of the prompt or right after the
74
- * blank line that joins two notices, so a notice line quoted inside a report
75
- * never splits one. Every piece must parse: one that does not makes the whole
76
- * prompt "not a batch", and it renders as the turn it is.
2
+ * The background subagent, teammate and peer idle notices the API delivers
3
+ * into a session as a prompt. The parsers live in `@kortix/sdk`
4
+ * (`core/turns/subagent-notice.ts`); this file keeps the old import path.
77
5
  */
78
- export function parseNoticeBatch(text) {
79
- if (!text)
80
- return null;
81
- const body = text.trim();
82
- if (!startsNotice(body, 0))
83
- return null;
84
- const starts = [0];
85
- for (let at = body.indexOf('\n\n'); at !== -1; at = body.indexOf('\n\n', at + 2)) {
86
- // Several blank lines in a row: the notice starts at the first non-newline.
87
- let index = at + 2;
88
- while (body[index] === '\n')
89
- index += 1;
90
- if (index > starts[starts.length - 1] && startsNotice(body, index))
91
- starts.push(index);
92
- if (starts.length > MAX_NOTICES)
93
- return null;
94
- }
95
- const items = [];
96
- for (const [i, start] of starts.entries()) {
97
- const piece = body.slice(start, starts[i + 1] ?? body.length).trim();
98
- if (piece.startsWith(PEER_IDLE_HEAD)) {
99
- const info = parsePeerMessagePrompt(piece);
100
- if (!info || info.kind !== 'idle_notice')
101
- return null;
102
- items.push({ kind: 'peer_idle', info });
103
- continue;
104
- }
105
- const notice = parseSubagentNotice(piece);
106
- if (!notice)
107
- return null;
108
- items.push({ kind: notice.kind, notice });
109
- }
110
- return items;
111
- }
6
+ export { noticeFirstLine as firstLine, parseNoticeBatch, parseSubagentNotice, } from '@kortix/sdk';