@beeuni/sdk 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -10
- package/dist/beeuni.esm.min.js +37 -35
- package/dist/beeuni.global.js +37 -35
- package/dist/browser/cache/idb-sync-cache.js +15 -5
- package/dist/browser/session-sync/server-transcript-mirror.d.ts +7 -1
- package/dist/browser/session-sync/server-transcript-mirror.js +30 -24
- package/dist/browser/session-sync/session-sync-registry.d.ts +3 -1
- package/dist/browser/session-sync/session-sync-registry.js +48 -3
- package/dist/browser/stores/sync-store/keep-unchanged.d.ts +4 -0
- package/dist/browser/stores/sync-store/keep-unchanged.js +34 -0
- package/dist/browser/stores/sync-store.d.ts +1 -0
- package/dist/browser/stores/sync-store.js +72 -16
- package/dist/core/attachments/prompt-attachments.d.ts +4 -0
- package/dist/core/attachments/prompt-attachments.js +34 -0
- package/dist/core/capture/rules.d.ts +17 -0
- package/dist/core/capture/rules.js +27 -0
- package/dist/core/client/beeuni.d.ts +92 -5
- package/dist/core/client/beeuni.js +2 -0
- package/dist/core/client/capture.d.ts +105 -0
- package/dist/core/client/capture.js +48 -0
- package/dist/core/client/facade-identity.d.ts +1 -0
- package/dist/core/client/facade-identity.js +1 -0
- package/dist/core/client/project-access-resources.d.ts +3 -1
- package/dist/core/client/project-access-resources.js +1 -1
- package/dist/core/client/project-operations-admin.d.ts +4 -4
- package/dist/core/client/project-operations-review.d.ts +2 -3
- package/dist/core/client/project-operations-review.js +1 -0
- package/dist/core/client/project-operations-workspace.d.ts +4 -4
- package/dist/core/client/project-operations-workspace.js +1 -1
- package/dist/core/client/project-operations.d.ts +5 -4
- package/dist/core/client/session-context.d.ts +2 -0
- package/dist/core/client/session-handle.d.ts +13 -0
- package/dist/core/client/session-lifecycle-resources.d.ts +11 -0
- package/dist/core/client/session-lifecycle-resources.js +4 -0
- package/dist/core/client/session-lifecycle-security.d.ts +2 -0
- package/dist/core/client/session-lifecycle-security.js +1 -0
- package/dist/core/client/session-readiness.d.ts +2 -0
- package/dist/core/client/session-readiness.js +20 -1
- package/dist/core/http/api-client.d.ts +1 -0
- package/dist/core/http/api-client.js +1 -0
- package/dist/core/http/config.d.ts +2 -0
- package/dist/core/http/response-error.js +26 -11
- package/dist/core/http/transport.js +6 -1
- package/dist/core/models/composer-model.d.ts +14 -0
- package/dist/core/models/composer-model.js +21 -1
- package/dist/core/rest/platform-client/capture.d.ts +363 -0
- package/dist/core/rest/platform-client/capture.js +116 -0
- package/dist/core/rest/platform-client/index.d.ts +1 -0
- package/dist/core/rest/platform-client/index.js +1 -0
- package/dist/core/rest/platform-client/lifecycle.js +18 -12
- package/dist/core/rest/platform-client/shared.d.ts +5 -0
- package/dist/core/rest/platform-client/shared.js +18 -0
- package/dist/core/rest/projects-client/account-secret-resources.d.ts +2 -1
- package/dist/core/rest/projects-client/accounts.d.ts +34 -0
- package/dist/core/rest/projects-client/accounts.js +10 -0
- package/dist/core/rest/projects-client/admin-providers.d.ts +0 -61
- package/dist/core/rest/projects-client/admin-providers.js +0 -6
- package/dist/core/rest/projects-client/agent-config.d.ts +3 -0
- package/dist/core/rest/projects-client/apps-fleet.d.ts +5 -1
- package/dist/core/rest/projects-client/apps-fleet.js +2 -2
- package/dist/core/rest/projects-client/apps.d.ts +3 -0
- package/dist/core/rest/projects-client/change-requests.d.ts +2 -0
- package/dist/core/rest/projects-client/change-requests.js +2 -0
- package/dist/core/rest/projects-client/connectors.d.ts +7 -0
- package/dist/core/rest/projects-client/connectors.js +3 -0
- package/dist/core/rest/projects-client/files.d.ts +3 -0
- package/dist/core/rest/projects-client/files.js +4 -0
- package/dist/core/rest/projects-client/gateway.d.ts +5 -0
- package/dist/core/rest/projects-client/iam-actions.d.ts +76 -0
- package/dist/core/rest/projects-client/iam-actions.js +101 -0
- package/dist/core/rest/projects-client/iam.d.ts +1 -0
- package/dist/core/rest/projects-client/iam.js +1 -0
- package/dist/core/rest/projects-client/notifications.d.ts +1 -1
- package/dist/core/rest/projects-client/notifications.js +4 -0
- package/dist/core/rest/projects-client/projects.d.ts +3 -2
- package/dist/core/rest/projects-client/projects.js +2 -3
- package/dist/core/rest/projects-client/review-items.d.ts +2 -0
- package/dist/core/rest/projects-client/review-items.js +4 -0
- package/dist/core/rest/projects-client/review.d.ts +17 -3
- package/dist/core/rest/projects-client/review.js +11 -0
- package/dist/core/rest/projects-client/secrets.d.ts +3 -0
- package/dist/core/rest/projects-client/session-attachments.js +14 -1
- package/dist/core/rest/projects-client/sessions.d.ts +29 -2
- package/dist/core/rest/projects-client/sessions.js +34 -4
- package/dist/core/runtime/runtime-rest-client.js +1 -1
- package/dist/core/runtime/runtime-types.d.ts +1 -0
- package/dist/core/session/open-bundle.d.ts +4 -4
- package/dist/core/session/open-bundle.js +29 -46
- package/dist/core/session/turn-end-watch.d.ts +47 -0
- package/dist/core/session/turn-end-watch.js +141 -0
- package/dist/core/session-log/index.d.ts +4 -0
- package/dist/core/session-log/index.js +3 -0
- package/dist/core/session-log/tool-call.d.ts +7 -2
- package/dist/core/session-log/tool-call.js +25 -6
- package/dist/core/session-log/turns/blocks.d.ts +60 -0
- package/dist/core/session-log/turns/blocks.js +124 -0
- package/dist/core/session-log/turns/history.d.ts +32 -0
- package/dist/core/session-log/turns/history.js +99 -0
- package/dist/core/session-log/turns/index.d.ts +4 -0
- package/dist/core/session-log/turns/index.js +4 -0
- package/dist/core/session-log/turns/metrics.d.ts +21 -0
- package/dist/core/session-log/turns/metrics.js +29 -0
- package/dist/core/session-log/turns/turn.d.ts +55 -0
- package/dist/core/session-log/turns/turn.js +279 -0
- package/dist/core/session-log/turns/v1-parts.d.ts +8 -0
- package/dist/core/session-log/turns/v1-parts.js +43 -0
- package/dist/core/session-log/v1-view.d.ts +5 -2
- package/dist/core/session-log/v1-view.js +86 -22
- package/dist/core/session-log/v1.js +10 -3
- package/dist/core/session-sync/saved-transcript.d.ts +15 -1
- package/dist/core/session-sync/saved-transcript.js +55 -0
- package/dist/core/session-sync/session-sync-controller.js +3 -0
- package/dist/core/stream/event-stream.js +3 -3
- package/dist/core/turns/classify.js +4 -2
- package/dist/core/turns/edit-blocks.d.ts +1 -0
- package/dist/core/turns/edit-blocks.js +15 -0
- package/dist/core/turns/segments/burst-summary.d.ts +1 -0
- package/dist/core/turns/segments/burst-summary.js +24 -0
- package/dist/core/turns/segments/group-steps.d.ts +4 -3
- package/dist/core/turns/segments/group-steps.js +9 -6
- package/dist/core/turns/segments/narration.d.ts +5 -4
- package/dist/core/turns/segments/narration.js +12 -3
- package/dist/core/turns/segments/session-activity-groups.d.ts +2 -1
- package/dist/core/turns/segments/session-activity-groups.js +3 -1
- package/dist/core/turns/segments/step-label.d.ts +2 -1
- package/dist/core/turns/segments/step-label.js +3 -1
- package/dist/core/turns/segments/working-turn.d.ts +4 -2
- package/dist/core/turns/segments/working-turn.js +9 -8
- package/dist/core/turns/tool-kind.d.ts +1 -1
- package/dist/core/turns/tool-kind.js +3 -2
- package/dist/core/turns/tool-registry.js +1 -0
- package/dist/core/turns/tools/tool-meta.d.ts +1 -1
- package/dist/core/turns/tools/tool-meta.js +3 -2
- package/dist/core/turns/view-model.js +1 -13
- package/dist/genui/catalog.d.ts +28 -0
- package/dist/genui/catalog.js +396 -0
- package/dist/genui/expansion.d.ts +3 -0
- package/dist/genui/expansion.js +295 -0
- package/dist/genui/fence-entry.d.ts +2 -0
- package/dist/genui/fence-entry.js +1 -0
- package/dist/genui/fence.d.ts +21 -0
- package/dist/genui/fence.js +138 -0
- package/dist/genui/index.d.ts +6 -0
- package/dist/genui/index.js +6 -0
- package/dist/genui/markdown.d.ts +12 -0
- package/dist/genui/markdown.js +104 -0
- package/dist/genui/parse.d.ts +6 -0
- package/dist/genui/parse.js +75 -0
- package/dist/genui/prompt.d.ts +2 -0
- package/dist/genui/prompt.js +206 -0
- package/dist/genui/react/default-components.d.ts +2 -0
- package/dist/genui/react/default-components.js +72 -0
- package/dist/genui/react/default-components.test.d.ts +1 -0
- package/dist/genui/react/default-components.test.js +94 -0
- package/dist/genui/react/genui-block-disabled.test.d.ts +1 -0
- package/dist/genui/react/genui-block-disabled.test.js +50 -0
- package/dist/genui/react/genui-block.d.ts +28 -0
- package/dist/genui/react/genui-block.js +91 -0
- package/dist/genui/react/genui-block.test.d.ts +1 -0
- package/dist/genui/react/genui-block.test.js +205 -0
- package/dist/genui/react/index.d.ts +2 -0
- package/dist/genui/react/index.js +2 -0
- package/dist/genui/share.d.ts +5 -0
- package/dist/genui/share.js +30 -0
- package/dist/genui/test-fixtures.d.ts +2 -0
- package/dist/genui/test-fixtures.js +16 -0
- package/dist/genui/types.d.ts +29 -0
- package/dist/genui/types.js +1 -0
- package/dist/genui/urls.d.ts +1 -0
- package/dist/genui/urls.js +18 -0
- package/dist/genui/validate.d.ts +9 -0
- package/dist/genui/validate.js +116 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/internal/connector-catalog.d.ts +1 -0
- package/dist/platform/ui.d.ts +8 -2
- package/dist/platform/ui.js +19 -4
- package/dist/react/chat/use-chat-turns.d.ts +1 -1
- package/dist/react/human-presence.d.ts +9 -0
- package/dist/react/human-presence.js +12 -0
- package/dist/react/index.d.ts +4 -0
- package/dist/react/index.js +4 -0
- package/dist/react/opencode.d.ts +1 -1
- package/dist/react/opencode.js +1 -1
- package/dist/react/query-contracts.d.ts +6 -0
- package/dist/react/query-contracts.js +6 -0
- package/dist/react/query-keys.d.ts +17 -1
- package/dist/react/query-keys.js +24 -1
- package/dist/react/reset-identity-state.js +2 -0
- package/dist/react/session-cache-write.d.ts +1 -0
- package/dist/react/session-cache-write.js +20 -0
- package/dist/react/session-transcript-subscription.js +1 -1
- package/dist/react/sign-in-with-beeuni.d.ts +5 -5
- package/dist/react/turn-end-handoff.d.ts +13 -0
- package/dist/react/turn-end-handoff.js +101 -0
- package/dist/react/use-admin-providers.d.ts +0 -3
- package/dist/react/use-admin-providers.js +1 -11
- package/dist/react/use-capture.d.ts +47 -0
- package/dist/react/use-capture.js +173 -0
- package/dist/react/use-feature-flag.js +1 -0
- package/dist/react/use-opencode-events/handle-interaction-event.js +8 -3
- package/dist/react/use-opencode-events/handle-session-event.js +13 -8
- package/dist/react/use-opencode-events/handler-context.d.ts +1 -0
- package/dist/react/use-opencode-events/helpers.d.ts +1 -0
- package/dist/react/use-opencode-events/helpers.js +11 -1
- package/dist/react/use-opencode-local.d.ts +5 -1
- package/dist/react/use-opencode-local.js +15 -2
- package/dist/react/use-opencode-sessions/commands.d.ts +11 -1
- package/dist/react/use-opencode-sessions/commands.js +21 -1
- package/dist/react/use-opencode-sessions/permissions.js +28 -1
- package/dist/react/use-project-sessions.d.ts +1 -1
- package/dist/react/use-project-sessions.js +6 -5
- package/dist/react/use-prompt-attachments.js +1 -0
- package/dist/react/use-review-summary.d.ts +13 -0
- package/dist/react/use-review-summary.js +32 -0
- package/dist/react/use-runtime-reconnect.js +2 -2
- package/dist/react/use-session-list-state.d.ts +6 -0
- package/dist/react/use-session-list-state.js +33 -0
- package/dist/react/use-session-log.d.ts +3 -2
- package/dist/react/use-session-log.js +26 -17
- package/dist/react/use-session-messages.d.ts +2 -1
- package/dist/react/use-session-messages.js +15 -14
- package/dist/react/use-session-stream.js +12 -1
- package/dist/react/use-session-sync.d.ts +2 -2
- package/dist/react/use-session-sync.js +10 -8
- package/dist/react/use-session-transcript-history.js +2 -12
- package/dist/react/use-session-working.d.ts +2 -0
- package/dist/react/use-session-working.js +10 -0
- package/dist/react/use-session.d.ts +6 -0
- package/dist/react/use-session.js +87 -7
- package/package.json +49 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
3
|
-
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { useOpenCodeCompactionStore } from '../browser/stores/opencode-compaction-store.js';
|
|
5
5
|
import { useSessionWorkingStore } from '../browser/stores/session-working-store.js';
|
|
6
6
|
import { compactionExpiryAtMs, projectCompacting, serverCompactionRevalidateAtMs, } from '../core/session/compaction.js';
|
|
@@ -29,7 +29,7 @@ import { useCanonicalRuntimeSession } from './use-canonical-opencode-session.js'
|
|
|
29
29
|
import { useRuntimeEventStream } from './use-opencode-events/index.js';
|
|
30
30
|
import { useSessionStream } from './use-session-stream.js';
|
|
31
31
|
import { sessionStreamConnected } from '../core/session/control-stream.js';
|
|
32
|
-
import { presenceReporter, watchHumanPresence } from './human-presence.js';
|
|
32
|
+
import { PRESENCE_AWAKE_REFRESH_MS, presenceAwakeFrom, presenceReporter, watchHumanPresence, } from './human-presence.js';
|
|
33
33
|
import { formatModelString } from './use-opencode-local.js';
|
|
34
34
|
import { runtimeKeys, rejectQuestion as rejectQuestionApi, replyToPermission, replyToQuestion, useAbortRuntimeSession, useExecuteRuntimeCommand, useRuntimeSession, } from './use-opencode-sessions/index.js';
|
|
35
35
|
import { mintSessionWireMessageId } from './use-opencode-sessions/messages.js';
|
|
@@ -46,8 +46,9 @@ import { useSessionLogSync } from './use-session-log.js';
|
|
|
46
46
|
import { useSessionSync } from './use-session-sync.js';
|
|
47
47
|
import { selectTranscriptShapeKey } from './session-transcript-subscription.js';
|
|
48
48
|
import { useSessionStartGiveUp } from './use-session-start-give-up.js';
|
|
49
|
-
import { useSessionTurnOutcome, useSessionWorking } from './use-session-working.js';
|
|
49
|
+
import { useSessionCanStop, useSessionTurnOutcome, useSessionWorking } from './use-session-working.js';
|
|
50
50
|
import { cancelSessionTurn } from './session-stop.js';
|
|
51
|
+
import { useTurnEndHandoff } from './turn-end-handoff.js';
|
|
51
52
|
import { useVisibleAgents } from './use-visible-agents.js';
|
|
52
53
|
import { createBeeuni } from '../core/client/beeuni.js';
|
|
53
54
|
import { platformConfig } from '../core/http/config.js';
|
|
@@ -60,6 +61,9 @@ export function shouldRetrySessionStart(failureCount, error, sessionId) {
|
|
|
60
61
|
}
|
|
61
62
|
return !isSessionStartError(error) && failureCount < 3;
|
|
62
63
|
}
|
|
64
|
+
export function presenceReturnReopensSession(heldByThisTab, cachedStage) {
|
|
65
|
+
return heldByThisTab || cachedStage === 'stopped';
|
|
66
|
+
}
|
|
63
67
|
export const SESSION_START_POLL_MS = 1_500;
|
|
64
68
|
export function resolveSessionRuntimeUrl(start) {
|
|
65
69
|
if (!start || start.stage !== 'ready')
|
|
@@ -408,22 +412,53 @@ export function useSession(projectId, sessionId, options = {}) {
|
|
|
408
412
|
const presenceAlertsRef = useRef(presenceAlerts);
|
|
409
413
|
const presencePageExitRef = useRef(presencePageExit);
|
|
410
414
|
const presenceReporterRef = useRef(null);
|
|
415
|
+
const lastPresenceActiveRef = useRef(null);
|
|
416
|
+
const [presenceAwake, setPresenceAwakeState] = useState(null);
|
|
417
|
+
const presenceAwakeRef = useRef(presenceAwake);
|
|
418
|
+
const setPresenceAwake = useCallback((next) => {
|
|
419
|
+
if (next === null && presenceAwakeRef.current === null)
|
|
420
|
+
return;
|
|
421
|
+
presenceAwakeRef.current = next;
|
|
422
|
+
setPresenceAwakeState(next);
|
|
423
|
+
}, []);
|
|
424
|
+
const presenceReportRef = useRef(0);
|
|
411
425
|
useEffect(() => {
|
|
412
426
|
if (!browserPresence || !presenceTabId || !projectId || !sessionId)
|
|
413
427
|
return;
|
|
414
428
|
const tab_id = presenceTabId;
|
|
415
429
|
const handle = createBeeuni(platformConfig()).session(projectId, sessionId);
|
|
416
430
|
const reporter = presenceReporter(({ active, alerts }) => {
|
|
431
|
+
if (active &&
|
|
432
|
+
lastPresenceActiveRef.current === false &&
|
|
433
|
+
presenceReturnReopensSession(stoppedByUserRef.current === sessionId, queryClient.getQueryData(sessionStartKey(projectId, sessionId))
|
|
434
|
+
?.stage)) {
|
|
435
|
+
stoppedByUserRef.current = null;
|
|
436
|
+
openedAtRef.current = { sessionId, at: Date.now() };
|
|
437
|
+
void queryClient.invalidateQueries({ queryKey: sessionStartKey(projectId, sessionId) });
|
|
438
|
+
}
|
|
439
|
+
lastPresenceActiveRef.current = active;
|
|
440
|
+
const report = ++presenceReportRef.current;
|
|
441
|
+
if (!active)
|
|
442
|
+
setPresenceAwake(null);
|
|
417
443
|
const keepalive = !active && presencePageExitRef.current;
|
|
418
|
-
void handle
|
|
444
|
+
void handle
|
|
445
|
+
.presence({ tab_id, active, alerts }, { keepalive })
|
|
446
|
+
.then((res) => {
|
|
447
|
+
if (active && report === presenceReportRef.current && res.data) {
|
|
448
|
+
setPresenceAwake(presenceAwakeFrom(res.data));
|
|
449
|
+
}
|
|
450
|
+
})
|
|
451
|
+
.catch(() => { });
|
|
419
452
|
}, presenceAlertsRef.current);
|
|
420
453
|
presenceReporterRef.current = reporter;
|
|
421
454
|
const stop = watchHumanPresence({ doc: document, win: window }, reporter.report, () => sessionStreamConnected(projectId, sessionId), () => presencePageExitRef.current);
|
|
455
|
+
const refresh = window.setInterval(reporter.refresh, PRESENCE_AWAKE_REFRESH_MS);
|
|
422
456
|
return () => {
|
|
457
|
+
window.clearInterval(refresh);
|
|
423
458
|
presenceReporterRef.current = null;
|
|
424
459
|
stop();
|
|
425
460
|
};
|
|
426
|
-
}, [browserPresence, presenceTabId, projectId, sessionId]);
|
|
461
|
+
}, [browserPresence, presenceTabId, projectId, sessionId, queryClient]);
|
|
427
462
|
useEffect(() => {
|
|
428
463
|
presenceAlertsRef.current = presenceAlerts;
|
|
429
464
|
presenceReporterRef.current?.setAlerts(presenceAlerts);
|
|
@@ -486,6 +521,17 @@ export function useSession(projectId, sessionId, options = {}) {
|
|
|
486
521
|
const sandbox = startData?.sandbox ?? null;
|
|
487
522
|
const startReady = stage === 'ready';
|
|
488
523
|
const terminal = stage === 'failed' || stage === 'stopped';
|
|
524
|
+
const startReadyRef = useRef(startReady);
|
|
525
|
+
useEffect(() => {
|
|
526
|
+
if (startReady && !startReadyRef.current) {
|
|
527
|
+
presenceReporterRef.current?.refresh();
|
|
528
|
+
}
|
|
529
|
+
else if (!startReady && startReadyRef.current) {
|
|
530
|
+
presenceReportRef.current += 1;
|
|
531
|
+
setPresenceAwake(null);
|
|
532
|
+
}
|
|
533
|
+
startReadyRef.current = startReady;
|
|
534
|
+
}, [startReady]);
|
|
489
535
|
useIsomorphicLayoutEffect(() => {
|
|
490
536
|
if (!startEnabled)
|
|
491
537
|
return;
|
|
@@ -550,7 +596,7 @@ export function useSession(projectId, sessionId, options = {}) {
|
|
|
550
596
|
}, [startEnabled, switchedBoxId, refetchStart]);
|
|
551
597
|
useRuntimeEventStream({ enabled: switched, projectId, sessionId });
|
|
552
598
|
const transcriptHistoryEnabled = startEnabled && chatEngine;
|
|
553
|
-
useSessionLogSync(projectId, sessionId, { enabled:
|
|
599
|
+
useSessionLogSync(projectId, sessionId, { enabled: startEnabled });
|
|
554
600
|
const transcriptHistory = useSessionTranscriptHistory(projectId, sessionId, transcriptHistoryEnabled);
|
|
555
601
|
const canonicalSession = useCanonicalRuntimeSession({
|
|
556
602
|
projectId,
|
|
@@ -569,11 +615,24 @@ export function useSession(projectId, sessionId, options = {}) {
|
|
|
569
615
|
enabled,
|
|
570
616
|
runtimeSessionId: ocSessionId,
|
|
571
617
|
});
|
|
618
|
+
const canStop = useSessionCanStop(projectId, sessionId);
|
|
619
|
+
const turnRunning = working.state === 'working';
|
|
620
|
+
const turnRanRef = useRef(turnRunning);
|
|
621
|
+
useEffect(() => {
|
|
622
|
+
if (turnRunning) {
|
|
623
|
+
presenceReportRef.current += 1;
|
|
624
|
+
setPresenceAwake(null);
|
|
625
|
+
}
|
|
626
|
+
else if (turnRanRef.current) {
|
|
627
|
+
presenceReporterRef.current?.refresh();
|
|
628
|
+
}
|
|
629
|
+
turnRanRef.current = turnRunning;
|
|
630
|
+
}, [turnRunning]);
|
|
572
631
|
const { noteSendReceipt, acceptSendReceipt, clearSendReceipt } = useSessionWorkingStore.getState();
|
|
573
632
|
const rawSync = useSessionSync(chatEngine ? ocSessionId : '', {
|
|
574
633
|
beeuniSessionScope: `${projectId}/${sessionId}`,
|
|
575
634
|
streamConnected,
|
|
576
|
-
mirror: transcriptHistory.envelope
|
|
635
|
+
mirror: transcriptHistory.envelope,
|
|
577
636
|
networkEnabled: switched,
|
|
578
637
|
working: working.state === 'working',
|
|
579
638
|
serverHoldsTurn: working.serverOpenTurnToken !== null,
|
|
@@ -591,6 +650,25 @@ export function useSession(projectId, sessionId, options = {}) {
|
|
|
591
650
|
const messages = useMemo(() => messagesBeforeRewind(sync.messages, restRewind), [sync.messages, restRewind]);
|
|
592
651
|
const turnOutcome = useSessionTurnOutcome(projectId, sessionId);
|
|
593
652
|
const turnRead = typeof turnOutcome.atMs === 'number';
|
|
653
|
+
const lastEndedToken = turnOutcome.last_ended?.turn_token ?? null;
|
|
654
|
+
const lastEndedSeenRef = useRef(undefined);
|
|
655
|
+
useEffect(() => {
|
|
656
|
+
if (!turnRead)
|
|
657
|
+
return;
|
|
658
|
+
const seen = lastEndedSeenRef.current;
|
|
659
|
+
lastEndedSeenRef.current = lastEndedToken;
|
|
660
|
+
if (seen !== undefined && seen !== lastEndedToken)
|
|
661
|
+
presenceReporterRef.current?.refresh();
|
|
662
|
+
}, [turnRead, lastEndedToken]);
|
|
663
|
+
useTurnEndHandoff({
|
|
664
|
+
enabled,
|
|
665
|
+
projectId,
|
|
666
|
+
sessionId,
|
|
667
|
+
runtimeSessionId: ocSessionId || null,
|
|
668
|
+
working: turnRunning,
|
|
669
|
+
openTurnToken: working.serverOpenTurnToken,
|
|
670
|
+
lastEndedToken,
|
|
671
|
+
});
|
|
594
672
|
const savedEmptyRoot = transcriptHistoryEnabled ? transcriptHistory.emptyRootSessionId : null;
|
|
595
673
|
const emptyProvenForRoot = savedEmptyRoot !== null && savedEmptyRoot === ocSessionId;
|
|
596
674
|
const savedTranscript = resolveSavedTranscript({
|
|
@@ -857,6 +935,8 @@ export function useSession(projectId, sessionId, options = {}) {
|
|
|
857
935
|
runtimePhase,
|
|
858
936
|
working,
|
|
859
937
|
isBusy: working.state === 'working',
|
|
938
|
+
canStop,
|
|
939
|
+
presenceAwake,
|
|
860
940
|
isCompacting,
|
|
861
941
|
isLoading: sync.isLoading,
|
|
862
942
|
savedTranscript,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beeuni/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Official Beeuni TypeScript SDK. Connect your product to Beeuni Computer with typed projects, sessions, tools, files, and live agent streaming.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Elastic-2.0",
|
|
@@ -14,19 +14,27 @@
|
|
|
14
14
|
],
|
|
15
15
|
"sideEffects": false,
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@beeuni/llm-catalog": "0.
|
|
17
|
+
"@beeuni/llm-catalog": "0.3.0",
|
|
18
18
|
"zustand": "^5.0.3"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
+
"@openuidev/lang-core": "0.3.1",
|
|
21
22
|
"@tanstack/react-query": "^5.75.2",
|
|
22
|
-
"react": ">=18"
|
|
23
|
+
"react": ">=18",
|
|
24
|
+
"zod": "^3.25.0 || ^4.0.0"
|
|
23
25
|
},
|
|
24
26
|
"peerDependenciesMeta": {
|
|
27
|
+
"@openuidev/lang-core": {
|
|
28
|
+
"optional": true
|
|
29
|
+
},
|
|
25
30
|
"@tanstack/react-query": {
|
|
26
31
|
"optional": true
|
|
27
32
|
},
|
|
28
33
|
"react": {
|
|
29
34
|
"optional": true
|
|
35
|
+
},
|
|
36
|
+
"zod": {
|
|
37
|
+
"optional": true
|
|
30
38
|
}
|
|
31
39
|
},
|
|
32
40
|
"main": "./dist/index.js",
|
|
@@ -40,6 +48,18 @@
|
|
|
40
48
|
"types": "./dist/react/index.d.ts",
|
|
41
49
|
"import": "./dist/react/index.js"
|
|
42
50
|
},
|
|
51
|
+
"./genui": {
|
|
52
|
+
"types": "./dist/genui/index.d.ts",
|
|
53
|
+
"import": "./dist/genui/index.js"
|
|
54
|
+
},
|
|
55
|
+
"./genui/fence": {
|
|
56
|
+
"types": "./dist/genui/fence-entry.d.ts",
|
|
57
|
+
"import": "./dist/genui/fence-entry.js"
|
|
58
|
+
},
|
|
59
|
+
"./genui/react": {
|
|
60
|
+
"types": "./dist/genui/react/index.d.ts",
|
|
61
|
+
"import": "./dist/genui/react/index.js"
|
|
62
|
+
},
|
|
43
63
|
"./server": {
|
|
44
64
|
"types": "./dist/node/server.d.ts",
|
|
45
65
|
"import": "./dist/node/server.js"
|
|
@@ -108,6 +128,10 @@
|
|
|
108
128
|
"types": "./dist/deprecated/feature-flags.d.ts",
|
|
109
129
|
"import": "./dist/deprecated/feature-flags.js"
|
|
110
130
|
},
|
|
131
|
+
"./capture-rules": {
|
|
132
|
+
"types": "./dist/core/capture/rules.d.ts",
|
|
133
|
+
"import": "./dist/core/capture/rules.js"
|
|
134
|
+
},
|
|
111
135
|
"./fresh-sessions": {
|
|
112
136
|
"types": "./dist/deprecated/fresh-sessions.d.ts",
|
|
113
137
|
"import": "./dist/deprecated/fresh-sessions.js"
|
|
@@ -180,6 +204,28 @@
|
|
|
180
204
|
"dist",
|
|
181
205
|
"README.md"
|
|
182
206
|
],
|
|
207
|
+
"scripts": {
|
|
208
|
+
"typecheck": "tsc --noEmit && tsc --noEmit -p examples/tsconfig.json",
|
|
209
|
+
"test": "find src \\( -name '*.test.ts' -o -name '*.test.tsx' \\) -print0 | sort -z | xargs -0 -n1 -P4 bun test --isolate",
|
|
210
|
+
"build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json --resolve-full-paths",
|
|
211
|
+
"build:bundles": "pnpm run build && tsup",
|
|
212
|
+
"prepublishOnly": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json --resolve-full-paths && tsup",
|
|
213
|
+
"smoke:install": "node scripts/smoke-install.mjs"
|
|
214
|
+
},
|
|
215
|
+
"devDependencies": {
|
|
216
|
+
"@openuidev/lang-core": "0.3.1",
|
|
217
|
+
"@tanstack/react-query": "^5.75.2",
|
|
218
|
+
"@types/react": "^19.2.0",
|
|
219
|
+
"@types/react-dom": "^19.2.3",
|
|
220
|
+
"@types/react-test-renderer": "^19.1.0",
|
|
221
|
+
"react": "^19.2.0",
|
|
222
|
+
"react-dom": "^19.2.0",
|
|
223
|
+
"react-test-renderer": "^19.2.0",
|
|
224
|
+
"tsc-alias": "^1.8.17",
|
|
225
|
+
"tsup": "^8.5.1",
|
|
226
|
+
"typescript": "^5.4.0",
|
|
227
|
+
"zod": "3.25.76"
|
|
228
|
+
},
|
|
183
229
|
"browser": "./dist/beeuni.esm.min.js",
|
|
184
230
|
"unpkg": "./dist/beeuni.global.js",
|
|
185
231
|
"jsdelivr": "./dist/beeuni.global.js"
|