@kortix/ui 0.15.0 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_vendor/kortix-shared.js +233 -130
- package/dist/_vendor/shared/code-language.d.ts +2 -2
- package/dist/_vendor/shared/html.d.ts +7 -0
- package/dist/_vendor/shared/index.d.ts +1 -2
- package/dist/_vendor/shared/pixel-mark.d.ts +28 -0
- package/dist/_vendor/shared/runtime-versions.d.ts +2 -6
- package/dist/_vendor/shared/tool-output/media-path.d.ts +1 -6
- package/dist/_vendor/shared/tool-output/scan.d.ts +2 -0
- package/dist/_vendor/shared/utils/string.d.ts +6 -0
- package/dist/artifacts/artifact-frame.d.ts +0 -1
- package/dist/artifacts/artifact-frame.js +4 -10
- package/dist/artifacts/artifact-session.js +4 -7
- package/dist/artifacts/frame-policy.d.ts +1 -1
- package/dist/artifacts/frame-policy.js +2 -2
- package/dist/customize/agents/agent-page.js +5 -5
- package/dist/customize/agents/agent-status.js +1 -1
- package/dist/customize/agents/agents-page.js +3 -3
- package/dist/customize/connectors/use-agent-access.d.ts +3 -3
- package/dist/customize/sections/connectors-view.js +50 -37
- package/dist/customize/sections/llm-provider/chatgpt-subscription-connect.js +21 -18
- package/dist/customize/sections/llm-provider/device-grant.d.ts +15 -0
- package/dist/customize/sections/llm-provider/device-grant.js +27 -0
- package/dist/customize/sections/view/agent-editor-catalog.js +0 -5
- package/dist/customize/sections/view/agent-editor.d.ts +2 -2
- package/dist/customize/sections/view/agent-editor.js +2 -2
- package/dist/customize/sections/view/review-center-connected.js +37 -6
- package/dist/customize/sections/view/secret-delivery.d.ts +4 -5
- package/dist/customize/sections/view/secret-delivery.js +5 -4
- package/dist/customize/triggers/schedule/trigger-list.d.ts +2 -2
- package/dist/customize/triggers/schedule/trigger-list.js +12 -18
- package/dist/customize/triggers/schedule/trigger-runs-logic.d.ts +6 -0
- package/dist/customize/triggers/schedule/trigger-runs-logic.js +13 -0
- package/dist/customize/triggers/schedule/trigger-runs-panel.js +9 -2
- package/dist/files/project/api/runtime-files.d.ts +2 -2
- package/dist/files/project/api/runtime-files.js +2 -2
- package/dist/files/project/components/drive-explorer.js +1 -1
- package/dist/files/project/components/drive-grid-view.js +0 -1
- package/dist/files/project/components/drive-list-view.js +0 -1
- package/dist/files/project/components/file-explorer-page.js +1 -1
- package/dist/files/project/hooks/index.d.ts +1 -1
- package/dist/files/project/hooks/index.js +1 -1
- package/dist/files/project/hooks/use-server-health.d.ts +1 -1
- package/dist/files/project/hooks/use-server-health.js +1 -1
- package/dist/files/project/search/workspace-search-service.d.ts +1 -1
- package/dist/files/project/search/workspace-search-service.js +1 -1
- package/dist/files/runtime/hooks/index.d.ts +1 -1
- package/dist/files/runtime/hooks/index.js +1 -1
- package/dist/files/runtime/hooks/server-health-state.d.ts +2 -2
- package/dist/files/runtime/hooks/server-health-state.js +2 -2
- package/dist/files/runtime/hooks/system-dir.js +2 -2
- package/dist/files/runtime/hooks/use-file-content.d.ts +1 -1
- package/dist/files/runtime/hooks/use-file-content.js +1 -1
- package/dist/files/runtime/hooks/use-file-list.d.ts +1 -1
- package/dist/files/runtime/hooks/use-file-list.js +3 -3
- package/dist/files/runtime/hooks/use-server-health.d.ts +2 -2
- package/dist/files/runtime/hooks/use-server-health.js +3 -3
- package/dist/files/runtime/hooks/use-workspace-search.d.ts +1 -2
- package/dist/files/runtime/hooks/use-workspace-search.js +0 -1
- package/dist/files/runtime/index.d.ts +2 -2
- package/dist/files/runtime/index.js +2 -2
- package/dist/files/runtime/path-utils.d.ts +1 -1
- package/dist/files/runtime/path-utils.js +1 -1
- package/dist/files/runtime/sandbox-explorer-source.d.ts +1 -1
- package/dist/files/runtime/sandbox-explorer-source.js +1 -1
- package/dist/files/runtime/sandbox-file-explorer.d.ts +1 -1
- package/dist/files/runtime/sandbox-file-explorer.js +2 -2
- package/dist/files/tree/components/file-tree-item.js +0 -1
- package/dist/files/tree/hooks/use-file-events.d.ts +1 -1
- package/dist/files/tree/hooks/use-file-events.js +1 -1
- package/dist/i18n/en.d.ts +60 -175
- package/dist/i18n/en.js +71 -186
- package/dist/internal/components/agent-mark.js +6 -0
- package/dist/internal/components/clickable-path.d.ts +3 -0
- package/dist/internal/components/clickable-path.js +4 -1
- package/dist/internal/files/file-read-retry.js +1 -1
- package/dist/internal/files/types.d.ts +2 -2
- package/dist/internal/files/types.js +2 -2
- package/dist/internal/goals/goal-meta.d.ts +33 -14
- package/dist/internal/goals/goal-meta.js +55 -13
- package/dist/internal/layout/nav-hover-card.d.ts +1 -1
- package/dist/internal/layout/nav-hover-card.js +1 -1
- package/dist/internal/layout/project-capability-nav.d.ts +1 -1
- package/dist/internal/layout/project-capability-nav.js +1 -1
- package/dist/internal/lib/browser-error-noise.d.ts +1 -1
- package/dist/internal/lib/browser-error-noise.js +1 -1
- package/dist/internal/lib/browser-noise/rules/expected-states.js +1 -1
- package/dist/internal/lib/browser-noise/rules/injected-scripts.js +29 -0
- package/dist/internal/lib/browser-noise/rules/old-browsers.d.ts +1 -0
- package/dist/internal/lib/browser-noise/rules/old-browsers.js +1 -1
- package/dist/internal/lib/browser-noise/rules/rejections.d.ts +0 -9
- package/dist/internal/lib/browser-noise/rules/rejections.js +0 -14
- package/dist/internal/lib/delivered-but-disconnected.js +3 -5
- package/dist/internal/lib/error-handler.js +8 -3
- package/dist/internal/lib/pixel-mark.d.ts +4 -17
- package/dist/internal/lib/pixel-mark.js +5 -148
- package/dist/internal/lib/sounds.d.ts +4 -4
- package/dist/internal/lib/sounds.js +4 -4
- package/dist/internal/lib/trigger-clock.d.ts +5 -0
- package/dist/internal/lib/trigger-clock.js +15 -0
- package/dist/internal/lib/turn-broadcast.d.ts +0 -3
- package/dist/internal/lib/use-project-feature-flags.d.ts +2 -0
- package/dist/internal/lib/use-project-feature-flags.js +5 -5
- package/dist/internal/lib/web-notifications.d.ts +1 -8
- package/dist/internal/lib/web-notifications.js +12 -53
- package/dist/internal/notifications/notification-bell.d.ts +13 -33
- package/dist/internal/notifications/notification-bell.js +14 -117
- package/dist/internal/notifications/notification-inbox.d.ts +45 -0
- package/dist/internal/notifications/notification-inbox.js +119 -0
- package/dist/internal/notifications/notification-rows.d.ts +3 -4
- package/dist/internal/notifications/notification-rows.js +1 -4
- package/dist/internal/notifications/use-inbox-summary.d.ts +13 -0
- package/dist/internal/notifications/use-inbox-summary.js +22 -0
- package/dist/internal/notifications/web-push.d.ts +9 -10
- package/dist/internal/notifications/web-push.js +9 -10
- package/dist/internal/stores/composer-prefill-store.js +4 -1
- package/dist/internal/stores/sound-store.d.ts +4 -4
- package/dist/internal/stores/sound-store.js +10 -0
- package/dist/internal/stores/web-notification-store.d.ts +6 -9
- package/dist/internal/stores/web-notification-store.js +0 -4
- package/dist/lib/routes.d.ts +8 -0
- package/dist/lib/routes.js +4 -1
- package/dist/markdown/code/shiki-highlighter.js +14 -5
- package/dist/markdown/doc-editor/doc-menus.d.ts +1 -10
- package/dist/markdown/doc-editor/doc-menus.js +6 -69
- package/dist/markdown/file-links.js +33 -3
- package/dist/markdown/markdown-frontmatter.d.ts +6 -6
- package/dist/markdown/markdown-frontmatter.js +3 -3
- package/dist/primitives/button.d.ts +1 -1
- package/dist/primitives/button.js +2 -1
- package/dist/session/agents/held-messages.d.ts +1 -5
- package/dist/session/agents/held-messages.js +1 -21
- package/dist/session/composer/ComposerAboveCard.d.ts +4 -1
- package/dist/session/composer/ComposerAboveCard.js +2 -2
- package/dist/session/composer/composer-chat-input.d.ts +1 -1
- package/dist/session/composer/composer-chat-input.js +2 -2
- package/dist/session/composer/composer.js +16 -1
- package/dist/session/composer/hooks/use-file-search.d.ts +15 -15
- package/dist/session/composer/hooks/use-file-search.js +16 -16
- package/dist/session/composer/menus/mention-controller.js +1 -3
- package/dist/session/composer/menus/space-mentions.d.ts +14 -4
- package/dist/session/composer/menus/space-mentions.js +17 -1
- package/dist/session/composer/use-instant-session-send.js +2 -2
- package/dist/session/header/reminder-parts.d.ts +1 -1
- package/dist/session/header/session-goal-indicator.js +4 -4
- package/dist/session/header/session-site-header.js +2 -6
- package/dist/session/panel/easy/plan-card.d.ts +2 -2
- package/dist/session/panel/easy/plan-card.js +2 -2
- package/dist/session/panel/session-desktop.js +6 -0
- package/dist/session/panel/session-reminders-panel.js +4 -15
- package/dist/session/panel/use-session-panel-state.js +2 -2
- package/dist/session/status/sandbox-loading-boundary.js +2 -2
- package/dist/session/status/session-terminal-state.d.ts +47 -0
- package/dist/session/status/session-terminal-state.js +56 -0
- package/dist/session/thread/plan-surface.d.ts +1 -1
- package/dist/session/thread/plan-surface.js +1 -1
- package/dist/session/thread/session-chat.d.ts +1 -1
- package/dist/session/thread/session-chat.js +88 -99
- package/dist/session/thread/stop-sequence.d.ts +51 -0
- package/dist/session/thread/stop-sequence.js +55 -0
- package/dist/session/thread/transcript.d.ts +2 -2
- package/dist/session/thread/transcript.js +2 -2
- package/dist/session/tool/tools/apply-patch-tool.d.ts +1 -1
- package/dist/session/tool/tools/apply-patch-tool.js +1 -1
- package/dist/session/tool/tools/kortix-action-tool.js +1 -1
- package/dist/session/tool/tools/multi-agent-tool-bodies.d.ts +1 -1
- package/dist/session/tool/tools/multi-agent-tool-bodies.js +1 -1
- package/dist/session/tool/tools/multi-agent-tools.js +1 -1
- package/dist/session/tool/tools/pty-kill-tool.d.ts +1 -1
- package/dist/session/tool/tools/pty-kill-tool.js +1 -1
- package/dist/session/tool/tools/pty-read-tool.d.ts +2 -2
- package/dist/session/tool/tools/pty-read-tool.js +2 -2
- package/dist/session/tool/tools/pty-spawn-tool.d.ts +1 -1
- package/dist/session/tool/tools/pty-spawn-tool.js +1 -1
- package/dist/session/tool/tools/pty-write-tool.d.ts +1 -1
- package/dist/session/tool/tools/pty-write-tool.js +1 -1
- package/dist/session/tool/tools/session-spawn-tool.js +7 -4
- package/dist/session/tool/tools/task-tool.js +18 -4
- package/dist/session/tool/tools/todo-write-tool.d.ts +1 -1
- package/dist/session/tool/tools/todo-write-tool.js +1 -1
- package/dist/session/turn/peer-message-row.d.ts +1 -10
- package/dist/session/turn/peer-message-row.js +1 -18
- package/dist/session/turn/plan-anchor.d.ts +3 -3
- package/dist/session/turn/plan-anchor.js +3 -3
- package/dist/session/turn/plan-card.d.ts +7 -7
- package/dist/session/turn/plan-card.js +7 -7
- package/dist/styles.css +1 -1
- package/dist/terminal/terminal-card-gate.d.ts +6 -3
- package/dist/terminal/terminal-card-gate.js +21 -4
- package/dist/workspace/home/access-requests-bell.d.ts +6 -9
- package/dist/workspace/home/access-requests-bell.js +8 -10
- package/dist/workspace/index.d.ts +1 -1
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/layout/project-home.js +1 -2
- package/dist/workspace/review/review-center.d.ts +8 -2
- package/dist/workspace/review/review-center.js +44 -13
- package/dist/workspace/review/review-reducer.d.ts +7 -0
- package/dist/workspace/review/review-reducer.js +11 -0
- package/dist/workspace/sidebar/footer/project-artifacts-nav.d.ts +6 -1
- package/dist/workspace/sidebar/footer/project-artifacts-nav.js +47 -4
- package/dist/workspace/sidebar/project-nav-items.js +11 -12
- package/dist/workspace/sidebar/project-sidebar.js +2 -6
- package/dist/workspace/spaces/principal-card.d.ts +3 -1
- package/dist/workspace/spaces/principal-card.js +3 -3
- package/dist/workspace/spaces/space-agent-ask.d.ts +14 -0
- package/dist/workspace/spaces/space-agent-ask.js +36 -0
- package/dist/workspace/spaces/space-details-dialog.js +1 -1
- package/dist/workspace/spaces/space-details-panel.d.ts +2 -1
- package/dist/workspace/spaces/space-details-panel.js +62 -8
- package/dist/workspace/spaces/space-mention-source.d.ts +3 -2
- package/dist/workspace/spaces/space-mention-source.js +12 -19
- package/dist/workspace/spaces/space-view.js +3 -2
- package/package.json +11 -7
- package/skills/kortix-ui/references/custom-dashboard.md +1 -1
- package/skills/kortix-ui/references/modules.md +1 -1
- package/dist/_vendor/shared/artifact-annotations.d.ts +0 -311
- package/dist/_vendor/shared/artifact-comments.d.ts +0 -155
- package/dist/internal/hooks/use-notification-center.d.ts +0 -50
- package/dist/internal/hooks/use-notification-center.js +0 -151
- package/dist/session/tool/tools/multi-agent-tool-data.d.ts +0 -63
- package/dist/session/tool/tools/multi-agent-tool-data.js +0 -118
|
@@ -37,11 +37,22 @@ export function GoalStatusBadge({ status, paused }) {
|
|
|
37
37
|
}
|
|
38
38
|
const CLOSED = new Set(['done', 'stopped', 'abandoned']);
|
|
39
39
|
/**
|
|
40
|
-
* A person paused the goal
|
|
41
|
-
*
|
|
40
|
+
* A person paused the goal: the server record's `paused_at`. Only a person
|
|
41
|
+
* can pause, and the API enforces it, so the record is the truth. Without a
|
|
42
|
+
* record (an older caller): GOAL.md `paused_at` AND a heartbeat that is not running.
|
|
42
43
|
*/
|
|
43
44
|
export function goalPaused(goal) {
|
|
44
|
-
|
|
45
|
+
if (goal.health.state === 'closed')
|
|
46
|
+
return false;
|
|
47
|
+
if (goal.record)
|
|
48
|
+
return !!goal.record.paused_at;
|
|
49
|
+
return !!goal.goal?.paused_at && goal.heartbeat?.state !== 'active';
|
|
50
|
+
}
|
|
51
|
+
/** When the goal wakes next: the server's `next_wake_at`, else the heartbeat's next fire. Null while paused or waiting. */
|
|
52
|
+
export function goalNextWake(goal) {
|
|
53
|
+
if (goal.record)
|
|
54
|
+
return goal.record.next_wake_at;
|
|
55
|
+
return goal.heartbeat?.state === 'active' ? (goal.heartbeat.next_fire_at ?? null) : null;
|
|
45
56
|
}
|
|
46
57
|
/**
|
|
47
58
|
* One sentence for where a goal stands and what happens next, the same on the
|
|
@@ -61,6 +72,9 @@ export function useGoalStateText() {
|
|
|
61
72
|
return t(`state.${doc.status === 'stopped' ? 'stopped' : 'abandoned'}`);
|
|
62
73
|
if (goalPaused(goal) && doc.paused_at)
|
|
63
74
|
return t('state.paused', { time: formatGoalTime(doc.paused_at, locale, now) });
|
|
75
|
+
// Blocked: the reason is the sentence; the goal page adds the next step.
|
|
76
|
+
if (goal.blockedReason)
|
|
77
|
+
return issueText('blocked', goal);
|
|
64
78
|
// Waiting on a person: the question itself is the sentence. GOAL.md is hand-editable: only text counts.
|
|
65
79
|
const asked = doc.status === 'waiting_on_user' && typeof doc.waiting_on === 'string' ? doc.waiting_on : null;
|
|
66
80
|
const ask = goalOpenAsks(doc)[0]?.title;
|
|
@@ -75,14 +89,14 @@ export function useGoalStateText() {
|
|
|
75
89
|
return t('state.verifying');
|
|
76
90
|
if (doc.status === 'draft')
|
|
77
91
|
return t('state.draft');
|
|
78
|
-
const next = goal
|
|
92
|
+
const next = goalNextWake(goal);
|
|
79
93
|
return next ? t('state.working', { time: formatGoalTime(next, locale, now) }) : t('state.workingNoWake');
|
|
80
94
|
};
|
|
81
95
|
}
|
|
82
96
|
/** Orange: a person must act (a question or a problem). Grey otherwise: green is kept for done (the ring). */
|
|
83
97
|
export function GoalHealthDot({ goal }) {
|
|
84
98
|
const open = goal.health.state !== 'closed';
|
|
85
|
-
const paused =
|
|
99
|
+
const paused = goalPaused(goal);
|
|
86
100
|
const waiting = open && !paused && (goal.goal?.status === 'waiting_on_user' || goalOpenAsks(goal.goal ?? null).length > 0);
|
|
87
101
|
const tone = open && !paused && (waiting || goal.health.state === 'attention') ? 'warning' : 'neutral';
|
|
88
102
|
return _jsx(StatusDot, { tone: tone });
|
|
@@ -147,25 +161,48 @@ export function GoalStatusIcon({ state, progress = 0, label, tone, className, })
|
|
|
147
161
|
const a11y = label ? { role: 'img', 'aria-label': label } : { 'aria-hidden': true };
|
|
148
162
|
return (_jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", style: { color }, className: className ? `shrink-0 ${className}` : 'shrink-0', "data-goal-icon": state, ...a11y, children: state === 'done' ? (_jsxs(_Fragment, { children: [_jsx("circle", { cx: "8", cy: "8", r: "7", fill: "currentColor", stroke: "none" }), _jsx("path", { d: "M5.2 8.2 L7.1 10 L10.8 6.2", stroke: "var(--background)" })] })) : (_jsxs(_Fragment, { children: [_jsx("circle", { cx: "8", cy: "8", r: R, strokeDasharray: state === 'draft' ? '2.4 2.5' : undefined }), state === 'active' && progress > 0 ? _jsx("path", { d: wedge(progress), fill: "currentColor", stroke: "none" }) : null, state === 'verifying' ? _jsx("path", { d: wedge(1), fill: "currentColor", stroke: "none", opacity: "0.55" }) : null, state === 'waiting' ? _jsx("circle", { cx: "8", cy: "8", r: "2.75", fill: "currentColor", stroke: "none" }) : null, state === 'attention' ? (_jsxs(_Fragment, { children: [_jsx("path", { d: "M8 5 L8 8.6" }), _jsx("circle", { cx: "8", cy: "11", r: "0.4", fill: "currentColor" })] })) : null, state === 'paused' ? _jsx("path", { d: "M6.6 5.6 L6.6 10.4 M9.4 5.6 L9.4 10.4" }) : null, state === 'stopped' ? _jsx("path", { d: "M5.4 10.6 L10.6 5.4" }) : null] })) }));
|
|
149
163
|
}
|
|
150
|
-
/** One sentence per issue, for the health line and its tooltip. */
|
|
164
|
+
/** One sentence per issue, for the health line and its tooltip. `blocked` says why, from the server's `blocked_reason`. */
|
|
151
165
|
export function useGoalIssueText() {
|
|
152
166
|
const t = useTranslations('goals');
|
|
153
167
|
return (issue, goal) => issue === 'heartbeat_failed'
|
|
154
168
|
? t('issue.heartbeat_failed', { error: goal.heartbeat?.last_error ?? '—' })
|
|
155
|
-
:
|
|
169
|
+
: issue === 'blocked'
|
|
170
|
+
? goal.blockedReason
|
|
171
|
+
? t(`blocked.${goal.blockedReason}`, { max: goal.blockedReason === 'session_cap' ? (goal.record?.max_sessions ?? 0) : (goal.record?.max_wakes_per_day ?? 0) })
|
|
172
|
+
: t('issue.blocked')
|
|
173
|
+
: t(`issue.${issue}`);
|
|
156
174
|
}
|
|
157
|
-
/**
|
|
175
|
+
/** The next step a person takes for a blocked goal, one sentence. */
|
|
176
|
+
export function useGoalBlockedNextStep() {
|
|
177
|
+
const t = useTranslations('goals');
|
|
178
|
+
return (goal) => (goal.blockedReason ? t(`blockedNext.${goal.blockedReason}`) : null);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Done criteria the agent reports met, as a ring and "met/total". The ring
|
|
182
|
+
* turns green only when the verifier passed every criterion. Nothing while
|
|
183
|
+
* the goal has no criteria.
|
|
184
|
+
*/
|
|
158
185
|
export function GoalCriteriaProgress({ goal, ring = true }) {
|
|
159
186
|
const t = useTranslations('goals');
|
|
160
|
-
const
|
|
187
|
+
const progress = goal && 'record' in goal ? goalCriteriaStatus(goal) : { ...goalProgress(goal), verified: 0 };
|
|
188
|
+
const { met, total, verified } = progress;
|
|
161
189
|
if (total === 0)
|
|
162
190
|
return null;
|
|
163
|
-
return (_jsxs("span", { className: "text-muted-foreground inline-flex items-center gap-1.5 text-xs tabular-nums", "aria-label": t('criteriaMet', { met, total }), children: [ring ? _jsx(ProgressRing, { value: (met / total) * 100, className: "size-3.5", progressClassName:
|
|
191
|
+
return (_jsxs("span", { className: "text-muted-foreground inline-flex items-center gap-1.5 text-xs tabular-nums", "aria-label": t('criteriaMet', { met, total }), children: [ring ? _jsx(ProgressRing, { value: (met / total) * 100, className: "size-3.5", progressClassName: verified === total ? 'text-kortix-green' : 'text-muted-foreground' }) : null, _jsxs("span", { "aria-hidden": true, children: [met, "/", total] })] }));
|
|
164
192
|
}
|
|
193
|
+
/** Criteria the agent reports met (its claim, not verification) and the total. */
|
|
165
194
|
export function goalProgress(goal) {
|
|
166
195
|
const criteria = goal?.success_criteria ?? [];
|
|
167
196
|
return { met: criteria.filter((c) => c.met).length, total: criteria.length };
|
|
168
197
|
}
|
|
198
|
+
/** Criteria reported met by the agent, verified by the independent verifier, and the total. */
|
|
199
|
+
export function goalCriteriaStatus(goal) {
|
|
200
|
+
return {
|
|
201
|
+
met: goal.criteria.filter((c) => c.reported_met).length,
|
|
202
|
+
verified: goal.criteria.filter((c) => c.verified).length,
|
|
203
|
+
total: goal.criteria.length,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
169
206
|
/** Open asks for a person (not the agent): what the goal waits on someone for. */
|
|
170
207
|
export function goalOpenAsks(goal) {
|
|
171
208
|
return (goal?.items ?? []).filter((i) => i.kind === 'ask' && i.status === 'open' && i.owner !== 'agent');
|
|
@@ -174,14 +211,16 @@ export function goalOpenAsks(goal) {
|
|
|
174
211
|
export function goalNeedsYou(goal) {
|
|
175
212
|
if (goal.health.state === 'closed' || goalPaused(goal))
|
|
176
213
|
return false;
|
|
177
|
-
return goal.goal?.status === 'waiting_on_user' || goalOpenAsks(goal.goal).length > 0;
|
|
214
|
+
return goal.goal?.status === 'waiting_on_user' || goalOpenAsks(goal.goal ?? null).length > 0;
|
|
178
215
|
}
|
|
179
216
|
/** The goal runs into a problem no person was asked about: a health issue (no heartbeat, a failed wake, …). */
|
|
180
217
|
export function goalNeedsAttention(goal) {
|
|
181
218
|
return goal.health.state === 'attention' && !goalNeedsYou(goal) && !goalPaused(goal);
|
|
182
219
|
}
|
|
183
|
-
/** When the goal last woke: the heartbeat's last run, else the wake GOAL.md records. */
|
|
220
|
+
/** When the goal last woke: the server's `last_wake_at`, else the heartbeat's last run, else the wake GOAL.md records. */
|
|
184
221
|
export function goalLastWake(goal) {
|
|
222
|
+
if (goal.record)
|
|
223
|
+
return goal.record.last_wake_at;
|
|
185
224
|
return goal.heartbeat?.last_fired_at ?? goal.goal?.last_wake_at ?? null;
|
|
186
225
|
}
|
|
187
226
|
/** Who a goal is for, by name: "You", the member's email, else "A teammate". */
|
|
@@ -222,9 +261,12 @@ export function goalAssignedTo(goal, userId) {
|
|
|
222
261
|
export function formatGoalTime(iso, locale, now) {
|
|
223
262
|
return iso ? formatFireTime(iso, locale, now) : '—';
|
|
224
263
|
}
|
|
264
|
+
/** A goal's page: `/goals/<goal_id>`. Without an id (an older caller): the legacy `/goals/<scope>/<slug>` link, which resolves when the slug is unique. */
|
|
225
265
|
export function goalHref(projectId, goal) {
|
|
226
266
|
const list = uiRoutes().goals(projectId);
|
|
227
|
-
|
|
267
|
+
if (!list)
|
|
268
|
+
return null;
|
|
269
|
+
return goal.goalId ? `${list}/${encodeURIComponent(goal.goalId)}` : `${list}/${goal.scope}/${encodeURIComponent(goal.slug)}`;
|
|
228
270
|
}
|
|
229
271
|
/** The current time, re-read every 30 seconds: relative times and health stay current. */
|
|
230
272
|
export { useNow as useGoalClock } from '../reminders/use-refetch-after-fire.js';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { PopoverContent } from '../../primitives/popover.js';
|
|
3
3
|
import { type ComponentProps, type PointerEvent, type RefObject } from 'react';
|
|
4
4
|
/**
|
|
5
|
-
* The hover card of a sidebar nav row (Apps,
|
|
5
|
+
* The hover card of a sidebar nav row (Apps, Artifacts, Settings): a mouse that rests on
|
|
6
6
|
* the row opens a list of where the row leads, so one click lands on the
|
|
7
7
|
* thing instead of two. The row stays a plain link: the card is a Popover
|
|
8
8
|
* anchored to it (`anchorRef` as `PopoverAnchor virtualRef`), not a menu
|
|
@@ -10,7 +10,7 @@ const HOVER_OPEN_DELAY_MS = 400;
|
|
|
10
10
|
/** Time to cross the gap between the row and its card before it closes. Same as the More row. */
|
|
11
11
|
const HOVER_CLOSE_DELAY_MS = 150;
|
|
12
12
|
/**
|
|
13
|
-
* The hover card of a sidebar nav row (Apps,
|
|
13
|
+
* The hover card of a sidebar nav row (Apps, Artifacts, Settings): a mouse that rests on
|
|
14
14
|
* the row opens a list of where the row leads, so one click lands on the
|
|
15
15
|
* thing instead of two. The row stays a plain link: the card is a Popover
|
|
16
16
|
* anchored to it (`anchorRef` as `PopoverAnchor virtualRef`), not a menu
|
|
@@ -16,7 +16,7 @@ export declare function isProjectAdminPath(pathname: string | null | undefined):
|
|
|
16
16
|
* by asking an agent in a session, so the sidebar lists only the agents you
|
|
17
17
|
* pinned (none pinned: the first five) and All agents when more exist, then Review (with its "needs you" count), Models, and Settings
|
|
18
18
|
* (Project admin, whose top bar holds every library and Members).
|
|
19
|
-
* The header's +
|
|
19
|
+
* The header's + (New agent) button sits on the Customize row itself.
|
|
20
20
|
*/
|
|
21
21
|
export declare function ProjectCapabilityNav({ projectId }: {
|
|
22
22
|
projectId: string;
|
|
@@ -44,7 +44,7 @@ function RowGlyph({ children }) {
|
|
|
44
44
|
* by asking an agent in a session, so the sidebar lists only the agents you
|
|
45
45
|
* pinned (none pinned: the first five) and All agents when more exist, then Review (with its "needs you" count), Models, and Settings
|
|
46
46
|
* (Project admin, whose top bar holds every library and Members).
|
|
47
|
-
* The header's +
|
|
47
|
+
* The header's + (New agent) button sits on the Customize row itself.
|
|
48
48
|
*/
|
|
49
49
|
export function ProjectCapabilityNav({ projectId }) {
|
|
50
50
|
const pathname = useUiPathname();
|
|
@@ -10,7 +10,7 @@ export { isConnectionClosedNoise, isFailedToSendMessageNoise, isFramelessNetwork
|
|
|
10
10
|
export { isIosWebViewInjectedStackOverflowNoise, isOldBrowserDomNullDerefNoise, isFirefoxDeadObjectUnattributableNoise, isOldBrowserSyntaxParseError, isOldWebkitRegexNoiseMessage, isUndefinedVariableThirdPartyNoise, isUnresolvableStackOverflowNoise, } from './browser-noise/rules/old-browsers.js';
|
|
11
11
|
export { isEmbedPdfTilingReactUpdateDepthNoise, isEmbedPdfTilingTileDestructureNoise, } from './browser-noise/rules/pdf.js';
|
|
12
12
|
export { isDocumentStateNotFoundNoise, isExpectedNextRecoveryBailoutNoise, isFirefoxReactSchedulerReentryNoise, isLikelyDomMutationNoise, isServerSuspenseBailoutNoise, isThirdPartyReactUpdateDepthNoise, } from './browser-noise/rules/react.js';
|
|
13
|
-
export {
|
|
13
|
+
export { isAutoplayNotAllowedRejectionNoise, isNonErrorObjectNotFoundRejectionNoise, isNonErrorUndefinedRejectionNoise, isOperationErrorPopErrorScopeNoise, isPlayNotSupportedRejectionNoise, isSupabaseTokenExpiredNoise, } from './browser-noise/rules/rejections.js';
|
|
14
14
|
export { isSafariGenericSecurityErrorNoise, isStorageDisabledWebViewNoiseMessage, isStorageSecurityErrorNoise, } from './browser-noise/rules/storage.js';
|
|
15
15
|
export { isAndroidWebViewNativeBridgePostEventNoise, isAndroidWebViewNativeBridgePostMessageNoise, isIOSWebViewWebKitBridgeNoise, } from './browser-noise/rules/webview.js';
|
|
16
16
|
export declare const NOISE_RULES: readonly NoiseRule[];
|
|
@@ -35,7 +35,7 @@ export { isConnectionClosedNoise, isFailedToSendMessageNoise, isFramelessNetwork
|
|
|
35
35
|
export { isIosWebViewInjectedStackOverflowNoise, isOldBrowserDomNullDerefNoise, isFirefoxDeadObjectUnattributableNoise, isOldBrowserSyntaxParseError, isOldWebkitRegexNoiseMessage, isUndefinedVariableThirdPartyNoise, isUnresolvableStackOverflowNoise, } from './browser-noise/rules/old-browsers.js';
|
|
36
36
|
export { isEmbedPdfTilingReactUpdateDepthNoise, isEmbedPdfTilingTileDestructureNoise, } from './browser-noise/rules/pdf.js';
|
|
37
37
|
export { isDocumentStateNotFoundNoise, isExpectedNextRecoveryBailoutNoise, isFirefoxReactSchedulerReentryNoise, isLikelyDomMutationNoise, isServerSuspenseBailoutNoise, isThirdPartyReactUpdateDepthNoise, } from './browser-noise/rules/react.js';
|
|
38
|
-
export {
|
|
38
|
+
export { isAutoplayNotAllowedRejectionNoise, isNonErrorObjectNotFoundRejectionNoise, isNonErrorUndefinedRejectionNoise, isOperationErrorPopErrorScopeNoise, isPlayNotSupportedRejectionNoise, isSupabaseTokenExpiredNoise, } from './browser-noise/rules/rejections.js';
|
|
39
39
|
export { isSafariGenericSecurityErrorNoise, isStorageDisabledWebViewNoiseMessage, isStorageSecurityErrorNoise, } from './browser-noise/rules/storage.js';
|
|
40
40
|
export { isAndroidWebViewNativeBridgePostEventNoise, isAndroidWebViewNativeBridgePostMessageNoise, isIOSWebViewWebKitBridgeNoise, } from './browser-noise/rules/webview.js';
|
|
41
41
|
export const NOISE_RULES = [
|
|
@@ -16,7 +16,7 @@ import { normalizeString } from '../evidence.js';
|
|
|
16
16
|
const RUNTIME_NOT_READY_NOISE_PATTERNS = [
|
|
17
17
|
'Server URL not ready',
|
|
18
18
|
'sandbox is still loading',
|
|
19
|
-
// The daemon's not-ready 503,
|
|
19
|
+
// The daemon's not-ready 503, with or without its code.
|
|
20
20
|
...RUNTIME_NOT_READY_MARKERS,
|
|
21
21
|
];
|
|
22
22
|
// Expected billing-gate HTTP 402 messages. The API billing gate
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isBrowserBundleSource, isFirstPartyResolvedSource, normalizeString, sourcesOf, stripErrorWrappers, } from '../evidence.js';
|
|
2
|
+
import { isScriptAssetSource } from './old-browsers.js';
|
|
2
3
|
// OneTrust cookie-consent SDK JSON-parse noise. OneTrust
|
|
3
4
|
// (`https://onetrust.com`) is a third-party cookie-consent / IAB TCF banner
|
|
4
5
|
// vendors inject into pages via a small bootstrap stub
|
|
@@ -227,6 +228,22 @@ export function isGoogletagUndefinedNoise(input) {
|
|
|
227
228
|
return (GOOGLETAG_UNDEFINED_MESSAGE.test(stripErrorWrappers(normalizeString(input.message))) &&
|
|
228
229
|
!sourcesOf(input).some((source) => isBrowserBundleSource(source) || isFirstPartyResolvedSource(source)));
|
|
229
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* A script injected into the page twice declares the same top-level `let` or
|
|
233
|
+
* `const`: `Identifier 'originalQuery' has already been declared`. Better
|
|
234
|
+
* Stack, Kortix Frontend prod, 2026-11-06 (KRTX-4353, pattern `cc5efbb8…`):
|
|
235
|
+
* one frame, the page document `app:///` at 1:1, global `onerror`, 0 users.
|
|
236
|
+
* Kortix code cannot raise it from the document: our bundle chunks wrap their
|
|
237
|
+
* code in functions and report their own `_next/static` URL, and our inline
|
|
238
|
+
* scripts declare nothing at the top level. A frame in a loaded script (our
|
|
239
|
+
* bundles, any `.js` URL, an extension) or in resolved first-party source
|
|
240
|
+
* keeps reporting.
|
|
241
|
+
*/
|
|
242
|
+
const REDECLARED_IDENTIFIER_MESSAGE = /^(?:Uncaught SyntaxError: )?Identifier '[^']+' has already been declared$/;
|
|
243
|
+
function isRedeclaredInjectedIdentifierNoise(input) {
|
|
244
|
+
return (REDECLARED_IDENTIFIER_MESSAGE.test(stripErrorWrappers(normalizeString(input.message))) &&
|
|
245
|
+
!sourcesOf(input).some((source) => isScriptAssetSource(source) || isFirstPartyResolvedSource(source)));
|
|
246
|
+
}
|
|
230
247
|
/** Vercel toolbar frames have a reserved source path outside app bundles. */
|
|
231
248
|
export function isVercelLiveFeedbackNoise(input) {
|
|
232
249
|
const sources = sourcesOf(input);
|
|
@@ -240,5 +257,17 @@ export const INJECTED_SCRIPT_RULES = [
|
|
|
240
257
|
{ id: 'redefine-wallet-provider', appliesTo: 'both', match: isRedefineInjectedWalletNoise },
|
|
241
258
|
{ id: 'wallet-provider-write', appliesTo: 'both', match: isInjectedWalletProviderWriteNoise },
|
|
242
259
|
{ id: 'googletag-undefined', appliesTo: 'both', match: isGoogletagUndefinedNoise },
|
|
260
|
+
{ id: 'redeclared-injected-identifier', appliesTo: 'both', match: isRedeclaredInjectedIdentifierNoise },
|
|
243
261
|
{ id: 'vercel-live-feedback', appliesTo: 'both', match: isVercelLiveFeedbackNoise },
|
|
262
|
+
{
|
|
263
|
+
// KRTX-4387: an injected `tracking_script.js` (no Kortix code, GTM tag or
|
|
264
|
+
// vendor loads it) asks Closure's jsloader for the gapi client. The CSP
|
|
265
|
+
// blocks apis.google.com and the loader throws `CustomError`. Require the
|
|
266
|
+
// exact message and the injected frame; keep any first-party frame.
|
|
267
|
+
id: 'injected-gapi-jsloader',
|
|
268
|
+
appliesTo: 'sentry',
|
|
269
|
+
match: ({ message, frames }) => /^Jsloader error \(code #\d+\): Error while loading script https:\/\/apis\.google\.com\//.test(normalizeString(message)) &&
|
|
270
|
+
!frames.some((frame) => isFirstPartyResolvedSource(frame.filename)) &&
|
|
271
|
+
frames.some((frame) => frame.filename === 'app:///tracking_script.js'),
|
|
272
|
+
},
|
|
244
273
|
];
|
|
@@ -189,6 +189,7 @@ export declare function isUndefinedVariableThirdPartyNoise(input: {
|
|
|
189
189
|
filename?: unknown;
|
|
190
190
|
} | undefined>;
|
|
191
191
|
}): boolean;
|
|
192
|
+
export declare function isScriptAssetSource(filename: unknown): boolean;
|
|
192
193
|
/**
|
|
193
194
|
* Whether a Sentry / window.onerror event is the Firefox dead-object
|
|
194
195
|
* external-scope noise class: a `TypeError: can't access dead object`
|
|
@@ -608,7 +608,7 @@ const FIREFOX_DEAD_OBJECT_NOISE_PATTERN = /^can['’]t access dead object$/i;
|
|
|
608
608
|
// `app:///projects/…`) carries no file extension and is NOT a script frame:
|
|
609
609
|
// it is Firefox's fallback source for a throw whose stack is uncapturable,
|
|
610
610
|
// and it is exactly the shape this rule drops.
|
|
611
|
-
function isScriptAssetSource(filename) {
|
|
611
|
+
export function isScriptAssetSource(filename) {
|
|
612
612
|
const normalized = normalizeString(filename);
|
|
613
613
|
if (normalized === '' || normalized === 'undefined')
|
|
614
614
|
return false;
|
|
@@ -102,15 +102,6 @@ export declare function isNonErrorObjectNotFoundRejectionNoise(input: {
|
|
|
102
102
|
filename?: unknown;
|
|
103
103
|
} | undefined>;
|
|
104
104
|
}): boolean;
|
|
105
|
-
export declare function isAnonymousAuthRefreshRace(input: {
|
|
106
|
-
message?: unknown;
|
|
107
|
-
requestUrl?: string;
|
|
108
|
-
mechanism?: unknown;
|
|
109
|
-
frames?: Array<{
|
|
110
|
-
function?: unknown;
|
|
111
|
-
filename?: unknown;
|
|
112
|
-
}>;
|
|
113
|
-
}): boolean;
|
|
114
105
|
/**
|
|
115
106
|
* Whether a Sentry event is the frameless `HTMLMediaElement.play()`
|
|
116
107
|
* `NotAllowedError` autoplay-policy rejection: the play promise denied by
|
|
@@ -414,19 +414,6 @@ export function isNonErrorObjectNotFoundRejectionNoise(input) {
|
|
|
414
414
|
}
|
|
415
415
|
return true;
|
|
416
416
|
}
|
|
417
|
-
// A Supabase refresh can race with sign-out on the anonymous landing page.
|
|
418
|
-
// The SDK rejects with AuthSessionMissingError when its stored session has
|
|
419
|
-
// disappeared; there is no session to recover and no user to notify.
|
|
420
|
-
export function isAnonymousAuthRefreshRace(input) {
|
|
421
|
-
if (normalizeString(input.message) !== 'Auth session missing!' ||
|
|
422
|
-
input.requestUrl !== 'https://kortix.com/' ||
|
|
423
|
-
input.mechanism !== 'auto.browser.global_handlers.onunhandledrejection')
|
|
424
|
-
return false;
|
|
425
|
-
const frames = input.frames ?? [];
|
|
426
|
-
return frames.some((frame) => normalizeString(frame.function).includes('refreshSession') &&
|
|
427
|
-
isBrowserBundleSource(frame.filename)) &&
|
|
428
|
-
!frames.some((frame) => isFirstPartyResolvedSource(frame.filename));
|
|
429
|
-
}
|
|
430
417
|
// An `HTMLMediaElement.play()` promise the browser's autoplay policy denied.
|
|
431
418
|
// The HTML spec fixes the DOMException message: `NotAllowedError: The play
|
|
432
419
|
// method is not allowed by the user agent or the platform in the current
|
|
@@ -532,7 +519,6 @@ export const REJECTION_RULES = [
|
|
|
532
519
|
appliesTo: 'sentry',
|
|
533
520
|
match: isNonErrorUndefinedRejectionNoise,
|
|
534
521
|
},
|
|
535
|
-
{ id: 'anonymous-auth-refresh-race', appliesTo: 'sentry', match: isAnonymousAuthRefreshRace },
|
|
536
522
|
{ id: 'pop-error-scope', appliesTo: 'sentry', match: isOperationErrorPopErrorScopeNoise },
|
|
537
523
|
{ id: 'supabase-token-expired', appliesTo: 'sentry', match: isSupabaseTokenExpiredNoise },
|
|
538
524
|
{
|
|
@@ -3,8 +3,8 @@ import { RUNTIME_NOT_READY_MARKERS } from '@kortix/sdk';
|
|
|
3
3
|
* Did the prompt reach the agent before the connection gave up?
|
|
4
4
|
*
|
|
5
5
|
* `POST /session/:id/command` blocks until the whole turn finishes, and two
|
|
6
|
-
* proxy hops sit between the browser and
|
|
7
|
-
* while
|
|
6
|
+
* proxy hops sit between the browser and the runtime. Either can stop waiting
|
|
7
|
+
* while the runtime is still working perfectly well:
|
|
8
8
|
*
|
|
9
9
|
* - the sandbox daemon answers `502 {"error":"upstream unreachable"}` once its
|
|
10
10
|
* header wait elapses (`kortix-sandbox-agent-server/src/app/server.ts`)
|
|
@@ -57,11 +57,9 @@ const DELIVERED_BUT_DISCONNECTED = [
|
|
|
57
57
|
* forwarding, so nothing was delivered and the message really is lost.
|
|
58
58
|
*/
|
|
59
59
|
const REFUSED_BEFORE_DELIVERY = [
|
|
60
|
-
// The daemon's not-ready 503,
|
|
60
|
+
// The daemon's not-ready 503, with or without its code.
|
|
61
61
|
...RUNTIME_NOT_READY_MARKERS,
|
|
62
62
|
'initial_runtime_session',
|
|
63
|
-
// A daemon built before W4 names the same refusal this way.
|
|
64
|
-
'initial_opencode_session',
|
|
65
63
|
'econnrefused',
|
|
66
64
|
'connection refused',
|
|
67
65
|
'unauthorized',
|
|
@@ -182,8 +182,12 @@ export const handleApiError = (error, context, tI18nComplete) => {
|
|
|
182
182
|
// (`isGitMirrorUnavailableNoiseMessage`); a genuine 503 with another
|
|
183
183
|
// message/code still reports.
|
|
184
184
|
const isGitMirrorUnavailable503 = status === 503 && isGitMirrorUnavailableNoiseMessage(errorMessage);
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
// The previous API tasks answer `503 deploy_in_progress` while a release
|
|
186
|
+
// migration they predate rolls out (`resolveSessionInsertFailure`): accepted
|
|
187
|
+
// deploy downtime. The toast tells the user to retry; nothing to report.
|
|
188
|
+
const isDeployInProgress503 = status === 503 && error?.code === 'deploy_in_progress';
|
|
189
|
+
const reportsServerError = status >= 500 && !isServerDeadline503 && !isGitMirrorUnavailable503 && !isDeployInProgress503;
|
|
190
|
+
if (reportsServerError || error?.code === 'NETWORK_ERROR') {
|
|
187
191
|
captureException(error instanceof Error ? error : new Error(error?.message || String(error)), {
|
|
188
192
|
tags: {
|
|
189
193
|
errorType: status >= 500 ? 'server_error' : 'network_error',
|
|
@@ -286,8 +290,9 @@ export const handleApiError = (error, context, tI18nComplete) => {
|
|
|
286
290
|
return;
|
|
287
291
|
}
|
|
288
292
|
if (error?.status >= 500) {
|
|
293
|
+
// "Our team has been notified" is true only when it was captured above.
|
|
289
294
|
errorToast(formattedMessage, {
|
|
290
|
-
description: tI18nComplete.raw('text75aec78d2ee8'),
|
|
295
|
+
description: reportsServerError ? tI18nComplete.raw('text75aec78d2ee8') : undefined,
|
|
291
296
|
duration: 6000,
|
|
292
297
|
});
|
|
293
298
|
}
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
/** @internal Kortix apps only. No semver: it may change in any release. */
|
|
2
2
|
/**
|
|
3
|
-
* An agent's pixel mark
|
|
4
|
-
*
|
|
5
|
-
* Same slug, same mark, on every surface and every device. Nothing is stored:
|
|
6
|
-
* the slug is hashed (FNV-1a), the hash seeds a PRNG (mulberry32), the PRNG
|
|
7
|
-
* fills the left half of the grid against a density mask, and the half is
|
|
8
|
-
* mirrored. A draw that fails the quality gate is redrawn from a salted seed,
|
|
9
|
-
* so retries stay deterministic. The tone comes from a second hash.
|
|
10
|
-
*
|
|
11
|
-
* Changing SIZE, MASK, the gate or PALETTES changes every agent's mark — the
|
|
12
|
-
* golden test in `pixel-mark.test.ts` exists to make that a deliberate act.
|
|
3
|
+
* An agent's pixel mark on its tile: the shape from `pixelMarkShape`
|
|
4
|
+
* (`@kortix/shared/pixel-mark`) plus a tile tone from a second hash of the slug.
|
|
13
5
|
*/
|
|
14
|
-
export
|
|
6
|
+
export { passesPixelMarkGate } from '../../_vendor/shared/pixel-mark.js';
|
|
15
7
|
export interface PixelMarkTone {
|
|
16
8
|
name: string;
|
|
17
9
|
tile: string;
|
|
@@ -21,16 +13,11 @@ export interface PixelMarkTone {
|
|
|
21
13
|
inkDark: string;
|
|
22
14
|
}
|
|
23
15
|
export declare const PIXEL_MARK_TONES: readonly PixelMarkTone[];
|
|
24
|
-
type Grid = boolean[][];
|
|
25
|
-
export declare function fnv1a(input: string): number;
|
|
26
|
-
/** Readable at 14px, fills the frame, one connected body. */
|
|
27
|
-
export declare function passesPixelMarkGate(grid: Grid): boolean;
|
|
28
16
|
export declare function pixelMark(slug: string): {
|
|
17
|
+
tone: PixelMarkTone;
|
|
29
18
|
grid: boolean[][];
|
|
30
19
|
path: string;
|
|
31
20
|
ditherPath: string;
|
|
32
21
|
width: number;
|
|
33
22
|
height: number;
|
|
34
|
-
tone: PixelMarkTone;
|
|
35
23
|
};
|
|
36
|
-
export {};
|
|
@@ -1,30 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* An agent's pixel mark
|
|
3
|
-
*
|
|
4
|
-
* Same slug, same mark, on every surface and every device. Nothing is stored:
|
|
5
|
-
* the slug is hashed (FNV-1a), the hash seeds a PRNG (mulberry32), the PRNG
|
|
6
|
-
* fills the left half of the grid against a density mask, and the half is
|
|
7
|
-
* mirrored. A draw that fails the quality gate is redrawn from a salted seed,
|
|
8
|
-
* so retries stay deterministic. The tone comes from a second hash.
|
|
9
|
-
*
|
|
10
|
-
* Changing SIZE, MASK, the gate or PALETTES changes every agent's mark — the
|
|
11
|
-
* golden test in `pixel-mark.test.ts` exists to make that a deliberate act.
|
|
2
|
+
* An agent's pixel mark on its tile: the shape from `pixelMarkShape`
|
|
3
|
+
* (`@kortix/shared/pixel-mark`) plus a tile tone from a second hash of the slug.
|
|
12
4
|
*/
|
|
13
|
-
import {
|
|
14
|
-
export
|
|
15
|
-
const HALF = 4;
|
|
16
|
-
const MAX_ATTEMPTS = 256;
|
|
17
|
-
// Fill chance per cell, outer edge → spine. Dense centre, sparse edges, so the
|
|
18
|
-
// mirrored result reads as one body.
|
|
19
|
-
const MASK = [
|
|
20
|
-
[0.15, 0.3, 0.45, 0.55],
|
|
21
|
-
[0.3, 0.5, 0.6, 0.7],
|
|
22
|
-
[0.4, 0.6, 0.65, 0.7],
|
|
23
|
-
[0.5, 0.65, 0.7, 0.75],
|
|
24
|
-
[0.4, 0.55, 0.6, 0.65],
|
|
25
|
-
[0.3, 0.45, 0.5, 0.5],
|
|
26
|
-
[0.2, 0.35, 0.4, 0.35],
|
|
27
|
-
];
|
|
5
|
+
import { fnv1a, pixelMarkShape } from '../../_vendor/kortix-shared.js';
|
|
6
|
+
export { passesPixelMarkGate } from '../../_vendor/kortix-shared.js';
|
|
28
7
|
const tone = (name, tile, ink) => ({
|
|
29
8
|
name,
|
|
30
9
|
tile,
|
|
@@ -51,129 +30,7 @@ const BRAND = {
|
|
|
51
30
|
inkDark: '#FFFFFF',
|
|
52
31
|
};
|
|
53
32
|
const RESERVED = { kortix: BRAND, mykortix: BRAND, meta: BRAND };
|
|
54
|
-
/** My Kortix (slug `mykortix`) wears the Kortix symbol itself, the same 12 × 10
|
|
55
|
-
* grid as `PixelKortixMark` and the merch chips. `+` cells are the dithered
|
|
56
|
-
* curve cells; at agent-mark sizes they paint at half ink. */
|
|
57
|
-
const RESERVED_ROWS = { mykortix: PIXEL_KORTIX_ROWS, meta: PIXEL_KORTIX_ROWS };
|
|
58
|
-
export function fnv1a(input) {
|
|
59
|
-
let h = 0x811c9dc5;
|
|
60
|
-
for (let i = 0; i < input.length; i++) {
|
|
61
|
-
h ^= input.charCodeAt(i);
|
|
62
|
-
h = Math.imul(h, 0x01000193);
|
|
63
|
-
}
|
|
64
|
-
return h >>> 0;
|
|
65
|
-
}
|
|
66
|
-
function mulberry32(seed) {
|
|
67
|
-
let a = seed;
|
|
68
|
-
return () => {
|
|
69
|
-
a = (a + 0x6d2b79f5) | 0;
|
|
70
|
-
let t = Math.imul(a ^ (a >>> 15), 1 | a);
|
|
71
|
-
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
|
|
72
|
-
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
function draw(seed) {
|
|
76
|
-
const rand = mulberry32(seed);
|
|
77
|
-
return MASK.map((row) => {
|
|
78
|
-
const half = row.map((p) => rand() < p);
|
|
79
|
-
return [...half, half[2], half[1], half[0]];
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
function largestComponent(grid) {
|
|
83
|
-
const seen = grid.map((row) => row.map(() => false));
|
|
84
|
-
let best = 0;
|
|
85
|
-
for (let r = 0; r < PIXEL_MARK_SIZE; r++)
|
|
86
|
-
for (let c = 0; c < PIXEL_MARK_SIZE; c++) {
|
|
87
|
-
if (!grid[r][c] || seen[r][c])
|
|
88
|
-
continue;
|
|
89
|
-
let size = 0;
|
|
90
|
-
const stack = [[r, c]];
|
|
91
|
-
seen[r][c] = true;
|
|
92
|
-
while (stack.length) {
|
|
93
|
-
const [y, x] = stack.pop();
|
|
94
|
-
size++;
|
|
95
|
-
for (const [ny, nx] of [[y + 1, x], [y - 1, x], [y, x + 1], [y, x - 1]]) {
|
|
96
|
-
if (grid[ny]?.[nx] && !seen[ny][nx]) {
|
|
97
|
-
seen[ny][nx] = true;
|
|
98
|
-
stack.push([ny, nx]);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
best = Math.max(best, size);
|
|
103
|
-
}
|
|
104
|
-
return best;
|
|
105
|
-
}
|
|
106
|
-
function hasIsolatedPixel(grid) {
|
|
107
|
-
return grid.some((row, r) => row.some((on, c) => {
|
|
108
|
-
if (!on)
|
|
109
|
-
return false;
|
|
110
|
-
for (let dy = -1; dy <= 1; dy++)
|
|
111
|
-
for (let dx = -1; dx <= 1; dx++)
|
|
112
|
-
if ((dy || dx) && grid[r + dy]?.[c + dx])
|
|
113
|
-
return false;
|
|
114
|
-
return true;
|
|
115
|
-
}));
|
|
116
|
-
}
|
|
117
|
-
/** Readable at 14px, fills the frame, one connected body. */
|
|
118
|
-
export function passesPixelMarkGate(grid) {
|
|
119
|
-
const filled = grid.flat().filter(Boolean).length;
|
|
120
|
-
if (filled < 18 || filled > 30)
|
|
121
|
-
return false;
|
|
122
|
-
const rows = grid.filter((row) => row.some(Boolean)).length;
|
|
123
|
-
const cols = grid[0].filter((_, c) => grid.some((row) => row[c])).length;
|
|
124
|
-
if (rows < 5 || cols < 5)
|
|
125
|
-
return false;
|
|
126
|
-
if (grid.filter((row) => row.every(Boolean)).length > 1)
|
|
127
|
-
return false;
|
|
128
|
-
if (grid.filter((row) => row[HALF - 1]).length < 3)
|
|
129
|
-
return false;
|
|
130
|
-
if (hasIsolatedPixel(grid))
|
|
131
|
-
return false;
|
|
132
|
-
return largestComponent(grid) >= Math.ceil(filled * 0.85);
|
|
133
|
-
}
|
|
134
|
-
/** One SVG path, horizontal runs merged, in grid units. */
|
|
135
|
-
function toPath(grid) {
|
|
136
|
-
let d = '';
|
|
137
|
-
grid.forEach((row, y) => {
|
|
138
|
-
for (let x = 0; x < row.length;) {
|
|
139
|
-
if (!row[x]) {
|
|
140
|
-
x++;
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
const start = x;
|
|
144
|
-
while (x < row.length && row[x])
|
|
145
|
-
x++;
|
|
146
|
-
d += `M${start} ${y}h${x - start}v1h-${x - start}z`;
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
return d;
|
|
150
|
-
}
|
|
151
|
-
/** Runs of one cell character on one row, as an SVG path. */
|
|
152
|
-
function rowsToPath(rows, cell) {
|
|
153
|
-
return toPath(rows.map((row) => [...row].map((c) => c === cell)));
|
|
154
|
-
}
|
|
155
33
|
export function pixelMark(slug) {
|
|
156
|
-
const rows = RESERVED_ROWS[slug];
|
|
157
|
-
if (rows) {
|
|
158
|
-
return {
|
|
159
|
-
grid: rows.map((row) => [...row].map((c) => c !== ' ')),
|
|
160
|
-
path: rowsToPath(rows, '#'),
|
|
161
|
-
ditherPath: rowsToPath(rows, '+'),
|
|
162
|
-
width: rows[0].length,
|
|
163
|
-
height: rows.length,
|
|
164
|
-
tone: RESERVED[slug] ?? BRAND,
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
let grid = draw(fnv1a(slug));
|
|
168
|
-
for (let attempt = 1; !passesPixelMarkGate(grid) && attempt < MAX_ATTEMPTS; attempt++)
|
|
169
|
-
grid = draw(fnv1a(`${slug}:${attempt}`));
|
|
170
34
|
const tone = RESERVED[slug] ?? PIXEL_MARK_TONES[fnv1a(`${slug}#tone`) % PIXEL_MARK_TONES.length];
|
|
171
|
-
return {
|
|
172
|
-
grid,
|
|
173
|
-
path: toPath(grid),
|
|
174
|
-
ditherPath: '',
|
|
175
|
-
width: PIXEL_MARK_SIZE,
|
|
176
|
-
height: PIXEL_MARK_SIZE,
|
|
177
|
-
tone,
|
|
178
|
-
};
|
|
35
|
+
return { ...pixelMarkShape(slug), tone };
|
|
179
36
|
}
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
* -----------------------------------------------------------------------
|
|
9
9
|
* FILE PLACEMENT:
|
|
10
10
|
*
|
|
11
|
-
* public/sounds/
|
|
12
|
-
* public/sounds/
|
|
13
|
-
* public/sounds/
|
|
14
|
-
* public/sounds/
|
|
11
|
+
* public/sounds/classic/completion.mp3
|
|
12
|
+
* public/sounds/classic/error.mp3
|
|
13
|
+
* public/sounds/classic/notification.mp3
|
|
14
|
+
* public/sounds/classic/send.mp3
|
|
15
15
|
*
|
|
16
16
|
* public/sounds/kortix/completion.mp3
|
|
17
17
|
* public/sounds/kortix/error.mp3
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
* -----------------------------------------------------------------------
|
|
8
8
|
* FILE PLACEMENT:
|
|
9
9
|
*
|
|
10
|
-
* public/sounds/
|
|
11
|
-
* public/sounds/
|
|
12
|
-
* public/sounds/
|
|
13
|
-
* public/sounds/
|
|
10
|
+
* public/sounds/classic/completion.mp3
|
|
11
|
+
* public/sounds/classic/error.mp3
|
|
12
|
+
* public/sounds/classic/notification.mp3
|
|
13
|
+
* public/sounds/classic/send.mp3
|
|
14
14
|
*
|
|
15
15
|
* public/sounds/kortix/completion.mp3
|
|
16
16
|
* public/sounds/kortix/error.mp3
|
|
@@ -40,3 +40,8 @@ export declare const CLOCK_TONE: {
|
|
|
40
40
|
};
|
|
41
41
|
/** "2d ago", "9h ago", "3w ago" in the viewer's locale, or "Never run". */
|
|
42
42
|
export declare function lastRunLabel(trigger: Pick<ProjectTrigger, 'last_fired_at' | 'event'>, t: UiTranslator, locale: string, now?: number): string;
|
|
43
|
+
/**
|
|
44
|
+
* A future run in whole minutes, hours or days, worded by `rtf`: "in 25m"
|
|
45
|
+
* (narrow), "in 25 minutes" (long). A past time reads as now; "—" with no time.
|
|
46
|
+
*/
|
|
47
|
+
export declare function nextRunIn(iso: string | null, rtf: Intl.RelativeTimeFormat, now?: number): string;
|