@pasko70/pibo 1.7.1 → 1.7.3
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 +0 -0
- package/context/codex-base-prompt.md +0 -0
- package/context/compute-worker.md +0 -0
- package/context/pibo-compaction-prompt.md +0 -0
- package/context/pibo-native-tooling.md +0 -0
- package/context/pibo-system-prompt.md +0 -0
- package/dist/apps/chat/chat-trace-helpers.js +3 -1
- package/dist/apps/chat/trace-v2.js +9 -4
- package/dist/apps/chat/trace.js +126 -0
- package/dist/apps/chat/web-app.js +160 -32
- package/dist/apps/chat-ui/assets/{dist-mG9WxdYM.js → dist-0VZenZBV.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-DJJN6SPt.js → dist-BMjRcU4S.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-CA1Gi-1G.js → dist-Bbb6cmLt.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-D8Q2E5o5.js → dist-BxwcyegP.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-exkn8clz.js → dist-CESPWSQ-.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-r34sHBLi.js → dist-CQt6ULIj.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-BDxKfyTI.js → dist-CjbsWko8.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-CTQ40XYd.js → dist-DSDqYG1O.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-B7ZRIJ16.js → dist-DYqe5Zvc.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-BDNjNt4b.js → dist-DnhVsXHZ.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-CcwGcMtk.js → dist-Ih0wkIep.js} +1 -1
- package/dist/apps/chat-ui/assets/{index-D8itqvK_.css → index-Dz6asKNQ.css} +1 -1
- package/dist/apps/chat-ui/assets/index-j2BTjmvp.js +166 -0
- package/dist/apps/chat-ui/assets/pwa-images/android/launchericon-144x144.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/android/launchericon-192x192.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/android/launchericon-48x48.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/android/launchericon-512x512.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/android/launchericon-72x72.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/android/launchericon-96x96.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/1024.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/114.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/120.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/128.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/144.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/152.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/16.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/167.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/180.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/192.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/20.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/256.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/29.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/32.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/40.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/50.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/512.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/57.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/58.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/60.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/64.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/72.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/76.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/80.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/ios/87.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/LargeTile.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/LargeTile.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/LargeTile.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/LargeTile.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/LargeTile.scale-400.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SmallTile.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SmallTile.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SmallTile.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SmallTile.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SmallTile.scale-400.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SplashScreen.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SplashScreen.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SplashScreen.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SplashScreen.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/SplashScreen.scale-400.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square150x150Logo.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square150x150Logo.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square150x150Logo.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square150x150Logo.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square150x150Logo.scale-400.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-16.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-20.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-24.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-256.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-30.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-32.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-36.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-40.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-44.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-48.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-60.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-64.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-72.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-80.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-lightunplated_targetsize-96.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-16.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-20.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-24.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-256.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-30.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-32.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-36.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-40.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-44.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-48.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-60.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-64.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-72.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-80.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.altform-unplated_targetsize-96.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.scale-400.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-16.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-20.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-24.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-256.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-30.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-32.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-36.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-40.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-44.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-48.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-60.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-64.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-72.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-80.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Square44x44Logo.targetsize-96.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/StoreLogo.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/StoreLogo.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/StoreLogo.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/StoreLogo.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/StoreLogo.scale-400.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Wide310x150Logo.scale-100.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Wide310x150Logo.scale-125.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Wide310x150Logo.scale-150.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Wide310x150Logo.scale-200.png +0 -0
- package/dist/apps/chat-ui/assets/pwa-images/windows/Wide310x150Logo.scale-400.png +0 -0
- package/dist/apps/chat-ui/index.html +2 -2
- package/dist/apps/chat-ui/manifest.webmanifest +0 -0
- package/dist/apps/chat-ui/sw.js +0 -0
- package/dist/apps/chat-vscode-web/assets/index-BHL2ZJCu.js +41 -0
- package/dist/apps/chat-vscode-web/index.html +1 -1
- package/dist/apps/vscode-artifacts/latest.vsix +0 -0
- package/dist/apps/vscode-artifacts/pibo-vscode-ext-1.7.3.vsix +0 -0
- package/dist/bin/pibo.js +0 -0
- package/dist/bin/rg.js +0 -0
- package/dist/cli.js +4 -1
- package/dist/compute/docker.js +16 -8
- package/dist/gateway/web.js +3 -12
- package/dist/plugins/dev-auth.js +28 -2
- package/dist/shared/trace-page-merge.js +40 -0
- package/docs/README.md +0 -0
- package/docs/ops/install-developer-host.md +0 -0
- package/docs/ops/install-user-host.md +0 -0
- package/docs/ops/upgrade-user-to-developer-host.md +0 -0
- package/docs/ops/vscode-extension-release.md +0 -0
- package/package.json +93 -93
- package/skills/builtin/graphify/SKILL.md +0 -0
- package/skills/builtin/pi-agent-harness/SKILL.md +0 -0
- package/skills/builtin/pi-agent-harness/agents/openai.yaml +0 -0
- package/skills/builtin/pibo-docker-system/SKILL.md +0 -0
- package/skills/builtin/pibo-spec-writing/SKILL.md +0 -0
- package/skills/builtin/prd/SKILL.md +0 -0
- package/skills/builtin/ralph-loop/SKILL.md +0 -0
- package/skills/builtin/ralph-prd-json/SKILL.md +0 -0
- package/skills/builtin/skill-creator/LICENSE.txt +0 -0
- package/skills/builtin/skill-creator/SKILL.md +0 -0
- package/skills/builtin/skill-creator/agents/analyzer.md +0 -0
- package/skills/builtin/skill-creator/agents/comparator.md +0 -0
- package/skills/builtin/skill-creator/agents/grader.md +0 -0
- package/skills/builtin/skill-creator/assets/eval_review.html +0 -0
- package/skills/builtin/skill-creator/eval-viewer/generate_review.py +0 -0
- package/skills/builtin/skill-creator/eval-viewer/viewer.html +0 -0
- package/skills/builtin/skill-creator/references/schemas.md +0 -0
- package/skills/builtin/skill-creator/scripts/__init__.py +0 -0
- package/skills/builtin/skill-creator/scripts/aggregate_benchmark.py +0 -0
- package/skills/builtin/skill-creator/scripts/generate_report.py +0 -0
- package/skills/builtin/skill-creator/scripts/improve_description.py +0 -0
- package/skills/builtin/skill-creator/scripts/package_skill.py +0 -0
- package/skills/builtin/skill-creator/scripts/quick_validate.py +0 -0
- package/skills/builtin/skill-creator/scripts/run_eval.py +0 -0
- package/skills/builtin/skill-creator/scripts/run_loop.py +0 -0
- package/skills/builtin/skill-creator/scripts/utils.py +0 -0
- package/skills/builtin/web-annotations/SKILL.md +0 -0
- package/src/mcp/LICENSE.mcp-cli +0 -0
- package/dist/apps/chat-ui/assets/index-C5smwAJD.js +0 -166
- package/dist/apps/chat-vscode-web/assets/index-lOZ1r-No.js +0 -41
- package/dist/apps/vscode-artifacts/pibo-vscode-ext-1.7.1.vsix +0 -0
package/README.md
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -75,10 +75,12 @@ export function annotateTracePage(trace, events, input) {
|
|
|
75
75
|
eventLimit: input.pageSize,
|
|
76
76
|
pageSize: input.pageSize,
|
|
77
77
|
beforeSequence: input.beforeSequence,
|
|
78
|
+
beforeCursor: input.beforeCursor,
|
|
78
79
|
firstEventSequence,
|
|
79
80
|
lastEventSequence,
|
|
80
81
|
nextBeforeSequence: firstEventSequence,
|
|
81
|
-
|
|
82
|
+
nextBeforeCursor: input.nextBeforeCursor ?? (firstEventSequence !== undefined ? String(firstEventSequence) : undefined),
|
|
83
|
+
hasOlderEvents: input.hasOlderEvents ?? (firstEventSequence !== undefined ? firstEventSequence > 1 : false),
|
|
82
84
|
};
|
|
83
85
|
}
|
|
84
86
|
export function setTraceCache(cache, key, trace, maxEntries, maxBytes = TRACE_CACHE_MAX_BYTES) {
|
|
@@ -20,6 +20,10 @@ export function traceTimelinePageFromView(input) {
|
|
|
20
20
|
limit: Math.max(1, Math.min(input.limit, TRACE_V2_MAX_TIMELINE_LIMIT)),
|
|
21
21
|
fromTail: input.fromTail,
|
|
22
22
|
});
|
|
23
|
+
const transcriptTailCursor = input.fromTail ? input.transcriptTailCursor : undefined;
|
|
24
|
+
const hasOlder = input.trace.hasOlderEvents === true || transcriptTailCursor !== undefined;
|
|
25
|
+
const nextBeforeCursor = transcriptTailCursor ?? (hasOlder ? input.trace.nextBeforeCursor : undefined);
|
|
26
|
+
const nextBeforeSequence = transcriptTailCursor ? undefined : (hasOlder ? input.trace.nextBeforeSequence : undefined);
|
|
23
27
|
let page = {
|
|
24
28
|
piboSessionId: input.trace.piboSessionId,
|
|
25
29
|
piSessionId: input.trace.piSessionId,
|
|
@@ -28,9 +32,9 @@ export function traceTimelinePageFromView(input) {
|
|
|
28
32
|
latestStreamId: input.trace.latestStreamId,
|
|
29
33
|
projectionStatus: "ready",
|
|
30
34
|
cursor: {
|
|
31
|
-
before:
|
|
35
|
+
before: nextBeforeCursor ?? (nextBeforeSequence !== undefined ? String(nextBeforeSequence) : undefined),
|
|
32
36
|
after: input.trace.lastEventSequence !== undefined ? String(input.trace.lastEventSequence) : undefined,
|
|
33
|
-
hasOlder
|
|
37
|
+
hasOlder,
|
|
34
38
|
hasNewer: false,
|
|
35
39
|
},
|
|
36
40
|
nodes,
|
|
@@ -43,8 +47,9 @@ export function traceTimelinePageFromView(input) {
|
|
|
43
47
|
pageSize: input.trace.pageSize,
|
|
44
48
|
firstEventSequence: input.trace.firstEventSequence,
|
|
45
49
|
lastEventSequence: input.trace.lastEventSequence,
|
|
46
|
-
nextBeforeSequence
|
|
47
|
-
|
|
50
|
+
nextBeforeSequence,
|
|
51
|
+
nextBeforeCursor,
|
|
52
|
+
hasOlderEvents: hasOlder,
|
|
48
53
|
};
|
|
49
54
|
while (Buffer.byteLength(JSON.stringify(page), "utf8") > byteLimit && page.nodes.length > 1) {
|
|
50
55
|
page = {
|
package/dist/apps/chat/trace.js
CHANGED
|
@@ -8,6 +8,8 @@ import { isChatWebSessionArchived } from "./session-metadata.js";
|
|
|
8
8
|
import { workflowSessionKindFromMetadata } from "../../sessions/workflow-session-kind.js";
|
|
9
9
|
export { compareTraceNodes, sortTraceNodes, nestTraceNodes, flattenTraceNodes, mapTraceNodesById, buildTraceViewFromEvents, traceNodesFromEntries, } from "../../shared/trace-engine.js";
|
|
10
10
|
export const TRACE_TRANSCRIPT_TAIL_MAX_BYTES = 2 * 1024 * 1024;
|
|
11
|
+
export const TRACE_TRANSCRIPT_HISTORY_PAGE_MAX_BYTES = 512 * 1024;
|
|
12
|
+
export const TRACE_TRANSCRIPT_HISTORY_SCAN_MAX_BYTES = 16 * 1024 * 1024;
|
|
11
13
|
export async function loadPiSessionMetadata(session, cwd = process.cwd()) {
|
|
12
14
|
const piSession = await findPiSession(session, cwd);
|
|
13
15
|
return metadataFromPiSession(piSession);
|
|
@@ -133,6 +135,9 @@ export async function buildTraceView(input) {
|
|
|
133
135
|
includeRawEvents: input.includeRawEvents,
|
|
134
136
|
rawEventsLimit: input.rawEventsLimit,
|
|
135
137
|
});
|
|
138
|
+
if (input.transcriptOrderOffset && input.transcriptOrderOffset > 0) {
|
|
139
|
+
offsetTranscriptTraceOrder(view.nodes, input.transcriptOrderOffset);
|
|
140
|
+
}
|
|
136
141
|
annotateForkableUserMessageNodes(view.nodes, allEntries);
|
|
137
142
|
return {
|
|
138
143
|
...view,
|
|
@@ -324,6 +329,127 @@ export function readTailEntries(path, maxBytes = TRACE_TRANSCRIPT_TAIL_MAX_BYTES
|
|
|
324
329
|
closeSync(fd);
|
|
325
330
|
}
|
|
326
331
|
}
|
|
332
|
+
export function readTranscriptHistoryPage(path, input = {}) {
|
|
333
|
+
if (!existsSync(path))
|
|
334
|
+
return { entries: [], hasOlder: false, scannedBytes: 0, startByte: 0, endByte: 0 };
|
|
335
|
+
const stats = statSync(path);
|
|
336
|
+
const fileSize = Math.max(0, stats.size);
|
|
337
|
+
const initialEnd = input.beforeByte === undefined
|
|
338
|
+
? fileSize
|
|
339
|
+
: Math.max(0, Math.min(input.beforeByte, fileSize));
|
|
340
|
+
const limit = Math.max(1, Math.min(input.limit ?? 50, 500));
|
|
341
|
+
const pageBytes = Math.max(1024, Math.min(input.pageBytes ?? TRACE_TRANSCRIPT_HISTORY_PAGE_MAX_BYTES, TRACE_TRANSCRIPT_HISTORY_SCAN_MAX_BYTES));
|
|
342
|
+
const maxScanBytes = Math.max(pageBytes, Math.min(input.maxScanBytes ?? TRACE_TRANSCRIPT_HISTORY_SCAN_MAX_BYTES, 32 * 1024 * 1024));
|
|
343
|
+
const beforeTime = input.beforeTimestamp ? Date.parse(input.beforeTimestamp) : undefined;
|
|
344
|
+
const entries = [];
|
|
345
|
+
let cursorEnd = initialEnd;
|
|
346
|
+
let scannedBytes = 0;
|
|
347
|
+
let nextBeforeByte;
|
|
348
|
+
while (cursorEnd > 0 && entries.length < limit && scannedBytes < maxScanBytes) {
|
|
349
|
+
const chunkStart = Math.max(0, cursorEnd - pageBytes);
|
|
350
|
+
const chunk = readUtf8Range(path, chunkStart, cursorEnd);
|
|
351
|
+
scannedBytes += cursorEnd - chunkStart;
|
|
352
|
+
const records = transcriptLineRecords(chunk, chunkStart, cursorEnd);
|
|
353
|
+
for (let index = records.length - 1; index >= 0; index -= 1) {
|
|
354
|
+
const record = records[index];
|
|
355
|
+
const parsed = parseTranscriptLine(record.text);
|
|
356
|
+
for (let entryIndex = parsed.length - 1; entryIndex >= 0; entryIndex -= 1) {
|
|
357
|
+
const entry = parsed[entryIndex];
|
|
358
|
+
if (beforeTime !== undefined && entryTimestampMs(entry) >= beforeTime)
|
|
359
|
+
continue;
|
|
360
|
+
entries.push({ entry, startByte: record.startByte });
|
|
361
|
+
if (entries.length >= limit) {
|
|
362
|
+
nextBeforeByte = record.startByte;
|
|
363
|
+
break;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
if (entries.length >= limit)
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
cursorEnd = chunkStart;
|
|
370
|
+
}
|
|
371
|
+
if (nextBeforeByte === undefined)
|
|
372
|
+
nextBeforeByte = cursorEnd > 0 ? cursorEnd : undefined;
|
|
373
|
+
return {
|
|
374
|
+
entries: entries.reverse().map((item) => item.entry),
|
|
375
|
+
nextBeforeByte,
|
|
376
|
+
hasOlder: nextBeforeByte !== undefined && nextBeforeByte > 0,
|
|
377
|
+
scannedBytes,
|
|
378
|
+
startByte: nextBeforeByte ?? 0,
|
|
379
|
+
endByte: initialEnd,
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
function readUtf8Range(path, start, end) {
|
|
383
|
+
const length = Math.max(0, end - start);
|
|
384
|
+
if (length === 0)
|
|
385
|
+
return "";
|
|
386
|
+
const buffer = Buffer.alloc(length);
|
|
387
|
+
const fd = openSync(path, "r");
|
|
388
|
+
try {
|
|
389
|
+
const bytesRead = readSync(fd, buffer, 0, length, start);
|
|
390
|
+
return buffer.subarray(0, bytesRead).toString("utf8");
|
|
391
|
+
}
|
|
392
|
+
finally {
|
|
393
|
+
closeSync(fd);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
function transcriptLineRecords(content, startByte, endByte) {
|
|
397
|
+
let text = content;
|
|
398
|
+
let byteOffset = startByte;
|
|
399
|
+
if (startByte > 0) {
|
|
400
|
+
const firstNewline = text.indexOf("\n");
|
|
401
|
+
if (firstNewline < 0)
|
|
402
|
+
return [];
|
|
403
|
+
const skipped = text.slice(0, firstNewline + 1);
|
|
404
|
+
byteOffset += Buffer.byteLength(skipped, "utf8");
|
|
405
|
+
text = text.slice(firstNewline + 1);
|
|
406
|
+
}
|
|
407
|
+
if (endByte > startByte && text && !text.endsWith("\n")) {
|
|
408
|
+
const lastNewline = text.lastIndexOf("\n");
|
|
409
|
+
if (lastNewline >= 0)
|
|
410
|
+
text = text.slice(0, lastNewline + 1);
|
|
411
|
+
}
|
|
412
|
+
const records = [];
|
|
413
|
+
const segments = text.match(/[^\n]*(?:\n|$)/g) ?? [];
|
|
414
|
+
for (const segment of segments) {
|
|
415
|
+
if (!segment)
|
|
416
|
+
continue;
|
|
417
|
+
const lineStart = byteOffset;
|
|
418
|
+
byteOffset += Buffer.byteLength(segment, "utf8");
|
|
419
|
+
const line = segment.replace(/\r?\n$/, "");
|
|
420
|
+
if (line.trim())
|
|
421
|
+
records.push({ text: line, startByte: lineStart });
|
|
422
|
+
}
|
|
423
|
+
return records;
|
|
424
|
+
}
|
|
425
|
+
function parseTranscriptLine(line) {
|
|
426
|
+
try {
|
|
427
|
+
return parseSessionEntries(`${line}\n`).filter((entry) => entry.type !== "session");
|
|
428
|
+
}
|
|
429
|
+
catch {
|
|
430
|
+
return [];
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
function entryTimestampMs(entry) {
|
|
434
|
+
const timestamp = entry.timestamp;
|
|
435
|
+
if (typeof timestamp !== "string")
|
|
436
|
+
return Number.POSITIVE_INFINITY;
|
|
437
|
+
const parsed = Date.parse(timestamp);
|
|
438
|
+
return Number.isFinite(parsed) ? parsed : Number.POSITIVE_INFINITY;
|
|
439
|
+
}
|
|
440
|
+
function offsetTranscriptTraceOrder(nodes, offset) {
|
|
441
|
+
for (const node of nodes) {
|
|
442
|
+
if (node.source === "transcript" && node.orderKey) {
|
|
443
|
+
const transcriptIndex = node.orderKey.transcriptIndex;
|
|
444
|
+
node.orderKey = {
|
|
445
|
+
...node.orderKey,
|
|
446
|
+
turnSeq: node.orderKey.turnSeq + offset,
|
|
447
|
+
transcriptIndex: transcriptIndex === undefined ? undefined : transcriptIndex + offset,
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
offsetTranscriptTraceOrder(node.children, offset);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
327
453
|
function annotateForkableUserMessageNodes(nodes, entries) {
|
|
328
454
|
const candidates = userMessageForkCandidates(entries);
|
|
329
455
|
if (!candidates.length)
|
|
@@ -6,7 +6,7 @@ import { OutputCompactor } from "./output-compactor.js";
|
|
|
6
6
|
import { isLiveOnlyOutputEvent, isPersistableOutputEvent } from "./output-event-policy.js";
|
|
7
7
|
import { chatRoomIdFromMetadata, isDefaultPiboRoom, isPiboRoomArchived, roomWorkspaceFromMetadata, withChatRoomId, withPiboRoomWorkspace, } from "./types/rooms.js";
|
|
8
8
|
import { chatStreamFramesFromOutputEvent, createChatStreamState, nextTransientChatStreamFrameId } from "./stream.js";
|
|
9
|
-
import { buildSessionNodes, buildTraceView, createTraceViewVersion, loadPiSessionMetadata, readTailEntries } from "./trace.js";
|
|
9
|
+
import { buildSessionNodes, buildTraceView, createTraceViewVersion, loadPiSessionMetadata, readTailEntries, readTranscriptHistoryPage } from "./trace.js";
|
|
10
10
|
import { DEFAULT_TRACE_EVENTS_PAGE_SIZE, annotateTracePage, etagForVersion, estimateTraceViewBytes, traceCacheEstimatedBytes, liveSnapshotVersion, requestMatchesVersion, setTraceCache, traceCacheKey, withLiveSnapshots, withRawTraceTail, } from "./chat-trace-helpers.js";
|
|
11
11
|
import { TRACE_V2_DEFAULT_TIMELINE_LIMIT, TRACE_V2_MAX_TIMELINE_LIMIT, TRACE_V2_PAYLOAD_DEFAULT_LIMIT_BYTES, TRACE_V2_PAYLOAD_MAX_LIMIT_BYTES, TRACE_V2_RAW_EVENTS_DEFAULT_LIMIT, TRACE_V2_RAW_EVENTS_MAX_LIMIT, TRACE_V2_TIMELINE_HARD_BYTES, parseTracePayloadRef, readTracePayloadChunk, traceRawEventsPageFromEvents, traceTimelinePageFromView, } from "./trace-v2.js";
|
|
12
12
|
import { isChatWebSessionArchived } from "./session-metadata.js";
|
|
@@ -2254,14 +2254,76 @@ function recordTransientReplayEvent(state, event) {
|
|
|
2254
2254
|
function parseTimelineBeforeCursor(url) {
|
|
2255
2255
|
const before = parseOptionalPositiveIntSearchParam(url, "beforeSequence");
|
|
2256
2256
|
if (before !== undefined)
|
|
2257
|
-
return before;
|
|
2257
|
+
return { kind: "event", beforeSequence: before, raw: String(before) };
|
|
2258
2258
|
const cursor = url.searchParams.get("before") ?? url.searchParams.get("cursor");
|
|
2259
2259
|
if (!cursor || cursor === "tail")
|
|
2260
|
-
return
|
|
2260
|
+
return { kind: "tail" };
|
|
2261
|
+
const transcript = parseTranscriptTimelineCursor(cursor);
|
|
2262
|
+
if (transcript)
|
|
2263
|
+
return transcript;
|
|
2261
2264
|
const parsed = Number.parseInt(cursor, 10);
|
|
2262
2265
|
if (!Number.isFinite(parsed) || parsed <= 0)
|
|
2263
|
-
throw new PiboWebHttpError("Trace cursor must be tail or a positive sequence", 400);
|
|
2264
|
-
return parsed;
|
|
2266
|
+
throw new PiboWebHttpError("Trace cursor must be tail, transcript, or a positive sequence", 400);
|
|
2267
|
+
return { kind: "event", beforeSequence: parsed, raw: String(parsed) };
|
|
2268
|
+
}
|
|
2269
|
+
function parseTranscriptTimelineCursor(cursor) {
|
|
2270
|
+
if (!cursor.startsWith("transcript:"))
|
|
2271
|
+
return undefined;
|
|
2272
|
+
const [, byteValue, encodedTimestamp] = cursor.split(":");
|
|
2273
|
+
const beforeByte = Number.parseInt(byteValue ?? "", 10);
|
|
2274
|
+
if (!Number.isFinite(beforeByte) || beforeByte < 0)
|
|
2275
|
+
throw new PiboWebHttpError("Invalid transcript trace cursor", 400);
|
|
2276
|
+
let beforeTimestamp;
|
|
2277
|
+
if (encodedTimestamp) {
|
|
2278
|
+
try {
|
|
2279
|
+
const decoded = Buffer.from(encodedTimestamp, "base64url").toString("utf8");
|
|
2280
|
+
if (decoded)
|
|
2281
|
+
beforeTimestamp = decoded;
|
|
2282
|
+
}
|
|
2283
|
+
catch {
|
|
2284
|
+
throw new PiboWebHttpError("Invalid transcript trace cursor", 400);
|
|
2285
|
+
}
|
|
2286
|
+
}
|
|
2287
|
+
return { kind: "transcript", beforeByte, beforeTimestamp, raw: cursor };
|
|
2288
|
+
}
|
|
2289
|
+
function encodeTranscriptTimelineCursor(beforeByte, beforeTimestamp) {
|
|
2290
|
+
const encodedTimestamp = beforeTimestamp ? Buffer.from(beforeTimestamp, "utf8").toString("base64url") : "";
|
|
2291
|
+
return `transcript:${Math.max(0, Math.floor(beforeByte))}:${encodedTimestamp}`;
|
|
2292
|
+
}
|
|
2293
|
+
function compactionCutoffTimestamp(events) {
|
|
2294
|
+
const compaction = events.find((event) => event.type === "execution_result" && event.payload.type === "execution_result" && event.payload.action === "compact")
|
|
2295
|
+
?? events.find((event) => event.type === "compaction_end" || event.type === "compaction_start");
|
|
2296
|
+
return compaction?.createdAt;
|
|
2297
|
+
}
|
|
2298
|
+
function originTranscriptTailCursor(input) {
|
|
2299
|
+
if (!input.session.originId)
|
|
2300
|
+
return undefined;
|
|
2301
|
+
const sessionPath = input.metadata?.sessionPath;
|
|
2302
|
+
const sessionSize = input.metadata?.sessionSize;
|
|
2303
|
+
if (!sessionPath || !sessionSize || sessionSize <= 0)
|
|
2304
|
+
return undefined;
|
|
2305
|
+
const firstVisibleTranscript = firstVisibleTailTranscriptNode(input.trace.nodes, input.limit);
|
|
2306
|
+
if (!firstVisibleTranscript?.startedAt)
|
|
2307
|
+
return undefined;
|
|
2308
|
+
const probe = readTranscriptHistoryPage(sessionPath, {
|
|
2309
|
+
beforeByte: sessionSize,
|
|
2310
|
+
beforeTimestamp: firstVisibleTranscript.startedAt,
|
|
2311
|
+
limit: 1,
|
|
2312
|
+
});
|
|
2313
|
+
if (probe.entries.length === 0)
|
|
2314
|
+
return undefined;
|
|
2315
|
+
return encodeTranscriptTimelineCursor(sessionSize, firstVisibleTranscript.startedAt);
|
|
2316
|
+
}
|
|
2317
|
+
function firstVisibleTailTranscriptNode(nodes, limit) {
|
|
2318
|
+
const flat = [];
|
|
2319
|
+
const visit = (items) => {
|
|
2320
|
+
for (const item of items) {
|
|
2321
|
+
flat.push(item);
|
|
2322
|
+
visit(item.children);
|
|
2323
|
+
}
|
|
2324
|
+
};
|
|
2325
|
+
visit(nodes);
|
|
2326
|
+
return flat.slice(-Math.max(1, limit)).find((node) => node.source === "transcript" && node.startedAt);
|
|
2265
2327
|
}
|
|
2266
2328
|
function transientReplayScopeKeys(input) {
|
|
2267
2329
|
const keys = [];
|
|
@@ -4002,7 +4064,8 @@ export function createChatWebApp(options = {}) {
|
|
|
4002
4064
|
if (url.pathname === `${CHAT_WEB_API_PREFIX}/trace/timeline` && request.method === "GET") {
|
|
4003
4065
|
const startedAt = performance.now();
|
|
4004
4066
|
const webSession = await requireSession(request, context);
|
|
4005
|
-
const
|
|
4067
|
+
const timelineCursor = parseTimelineBeforeCursor(url);
|
|
4068
|
+
const beforeSequence = timelineCursor.kind === "event" ? timelineCursor.beforeSequence : undefined;
|
|
4006
4069
|
const limit = parsePositiveIntSearchParam(url, "limit", TRACE_V2_DEFAULT_TIMELINE_LIMIT, TRACE_V2_MAX_TIMELINE_LIMIT);
|
|
4007
4070
|
const selectedSession = resolveRequestedSession(state, context, webSession, defaultProfile, url.searchParams.get("piboSessionId") || undefined);
|
|
4008
4071
|
state.sessionQuery.upsertSession(selectedSession);
|
|
@@ -4011,8 +4074,8 @@ export function createChatWebApp(options = {}) {
|
|
|
4011
4074
|
let metadataMs = 0;
|
|
4012
4075
|
const lastEventSequence = state.timelineQuery.getLatestEventSequence(selectedSession.id);
|
|
4013
4076
|
const latestStreamId = state.timelineQuery.getLatestStreamId({ piboSessionId: selectedSession.id });
|
|
4014
|
-
const liveSnapshots =
|
|
4015
|
-
const transcriptMetadata =
|
|
4077
|
+
const liveSnapshots = timelineCursor.kind === "tail" ? state.outputCompactor.snapshotsForSession(selectedSession.id) : [];
|
|
4078
|
+
const transcriptMetadata = timelineCursor.kind === "tail" || timelineCursor.kind === "transcript"
|
|
4016
4079
|
? await loadPiSessionMetadata(selectedSession, selectedSession.workspace ?? process.cwd())
|
|
4017
4080
|
: undefined;
|
|
4018
4081
|
const baseVersion = createFastTraceV2Version({
|
|
@@ -4026,7 +4089,7 @@ export function createChatWebApp(options = {}) {
|
|
|
4026
4089
|
});
|
|
4027
4090
|
const snapshotVersion = liveSnapshotVersion(liveSnapshots);
|
|
4028
4091
|
const version = snapshotVersion ? `${baseVersion}:live:${snapshotVersion}` : baseVersion;
|
|
4029
|
-
const pageCursorKey =
|
|
4092
|
+
const pageCursorKey = timelineCursor.kind === "tail" ? "tail" : `before:${timelineCursor.raw}`;
|
|
4030
4093
|
const cacheKey = traceCacheKey(selectedSession.id, `${baseVersion}:v2:limit:${limit}:${pageCursorKey}`);
|
|
4031
4094
|
const pageCacheKey = traceCacheKey(selectedSession.id, `${version}:v2-page:limit:${limit}:${pageCursorKey}`);
|
|
4032
4095
|
const cachedPage = state.traceTimelinePageCache.get(pageCacheKey);
|
|
@@ -4036,7 +4099,7 @@ export function createChatWebApp(options = {}) {
|
|
|
4036
4099
|
"x-pibo-trace-version": version,
|
|
4037
4100
|
"cache-control": "no-store",
|
|
4038
4101
|
};
|
|
4039
|
-
if (
|
|
4102
|
+
if (timelineCursor.kind === "tail" && requestMatchesVersion(request, version)) {
|
|
4040
4103
|
return new Response(null, { status: 304, headers: baseHeaders });
|
|
4041
4104
|
}
|
|
4042
4105
|
if (cachedPage) {
|
|
@@ -4055,26 +4118,79 @@ export function createChatWebApp(options = {}) {
|
|
|
4055
4118
|
let trace = cached;
|
|
4056
4119
|
let eventCount = 0;
|
|
4057
4120
|
if (!trace) {
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4121
|
+
if (timelineCursor.kind === "transcript") {
|
|
4122
|
+
const history = transcriptMetadata?.sessionPath
|
|
4123
|
+
? readTranscriptHistoryPage(transcriptMetadata.sessionPath, {
|
|
4124
|
+
beforeByte: timelineCursor.beforeByte,
|
|
4125
|
+
beforeTimestamp: timelineCursor.beforeTimestamp,
|
|
4126
|
+
limit,
|
|
4127
|
+
})
|
|
4128
|
+
: { entries: [], hasOlder: false, scannedBytes: 0, startByte: 0, endByte: 0 };
|
|
4129
|
+
trace = await buildTraceView({
|
|
4130
|
+
session: selectedSession,
|
|
4131
|
+
sessions: ownedSessions,
|
|
4132
|
+
events: [],
|
|
4133
|
+
status: indexedSession?.status,
|
|
4134
|
+
metadata: transcriptMetadata ?? {},
|
|
4135
|
+
transcriptEntries: history.entries,
|
|
4136
|
+
transcriptOrderOffset: history.startByte,
|
|
4137
|
+
includeRawEvents: false,
|
|
4138
|
+
latestStreamId,
|
|
4139
|
+
});
|
|
4140
|
+
trace = {
|
|
4141
|
+
...trace,
|
|
4142
|
+
eventCount: lastEventSequence,
|
|
4143
|
+
eventLimit: limit,
|
|
4144
|
+
pageSize: limit,
|
|
4145
|
+
beforeCursor: timelineCursor.raw,
|
|
4146
|
+
nextBeforeCursor: history.hasOlder && history.nextBeforeByte !== undefined
|
|
4147
|
+
? encodeTranscriptTimelineCursor(history.nextBeforeByte, timelineCursor.beforeTimestamp)
|
|
4148
|
+
: undefined,
|
|
4149
|
+
hasOlderEvents: history.hasOlder,
|
|
4150
|
+
};
|
|
4151
|
+
}
|
|
4152
|
+
else {
|
|
4153
|
+
const events = state.timelineQuery.listTraceEvents({
|
|
4154
|
+
piboSessionId: selectedSession.id,
|
|
4155
|
+
limit,
|
|
4156
|
+
...(beforeSequence !== undefined ? { beforeSequence } : {}),
|
|
4157
|
+
});
|
|
4158
|
+
const transcriptEntries = timelineCursor.kind === "tail" && transcriptMetadata?.sessionPath
|
|
4159
|
+
? readTailEntries(transcriptMetadata.sessionPath)
|
|
4160
|
+
: [];
|
|
4161
|
+
eventCount = events.length;
|
|
4162
|
+
trace = await buildTraceView({
|
|
4163
|
+
session: selectedSession,
|
|
4164
|
+
sessions: ownedSessions,
|
|
4165
|
+
events,
|
|
4166
|
+
status: indexedSession?.status,
|
|
4167
|
+
metadata: transcriptMetadata ?? {},
|
|
4168
|
+
transcriptEntries,
|
|
4169
|
+
includeRawEvents: false,
|
|
4170
|
+
latestStreamId,
|
|
4171
|
+
});
|
|
4172
|
+
trace = annotateTracePage(trace, events, {
|
|
4173
|
+
lastEventSequence,
|
|
4174
|
+
pageSize: limit,
|
|
4175
|
+
beforeSequence,
|
|
4176
|
+
beforeCursor: timelineCursor.kind === "event" ? timelineCursor.raw : undefined,
|
|
4177
|
+
});
|
|
4178
|
+
if (trace.hasOlderEvents !== true && events.length > 0) {
|
|
4179
|
+
const cutoff = compactionCutoffTimestamp(events);
|
|
4180
|
+
if (cutoff) {
|
|
4181
|
+
const metadataStartedAt = performance.now();
|
|
4182
|
+
const metadata = transcriptMetadata ?? await loadPiSessionMetadata(selectedSession, selectedSession.workspace ?? process.cwd());
|
|
4183
|
+
metadataMs += performance.now() - metadataStartedAt;
|
|
4184
|
+
if (metadata.sessionPath && metadata.sessionSize && metadata.sessionSize > 0) {
|
|
4185
|
+
trace = {
|
|
4186
|
+
...trace,
|
|
4187
|
+
nextBeforeCursor: encodeTranscriptTimelineCursor(metadata.sessionSize, cutoff),
|
|
4188
|
+
hasOlderEvents: true,
|
|
4189
|
+
};
|
|
4190
|
+
}
|
|
4191
|
+
}
|
|
4192
|
+
}
|
|
4193
|
+
}
|
|
4078
4194
|
setTraceCache(state.traceCache, cacheKey, trace, TRACE_CACHE_MAX_ENTRIES);
|
|
4079
4195
|
}
|
|
4080
4196
|
trace = withLiveSnapshots(trace, liveSnapshots, {
|
|
@@ -4083,12 +4199,21 @@ export function createChatWebApp(options = {}) {
|
|
|
4083
4199
|
status: liveSnapshots.length ? "running" : indexedSession?.status,
|
|
4084
4200
|
});
|
|
4085
4201
|
trace = { ...trace, version };
|
|
4202
|
+
const transcriptTailCursor = timelineCursor.kind === "tail"
|
|
4203
|
+
? originTranscriptTailCursor({
|
|
4204
|
+
session: selectedSession,
|
|
4205
|
+
trace,
|
|
4206
|
+
metadata: transcriptMetadata,
|
|
4207
|
+
limit,
|
|
4208
|
+
})
|
|
4209
|
+
: undefined;
|
|
4086
4210
|
const page = traceTimelinePageFromView({
|
|
4087
4211
|
trace,
|
|
4088
4212
|
payloadStore: state.dataStore.payloads,
|
|
4089
4213
|
limit,
|
|
4090
4214
|
byteLimit: TRACE_V2_TIMELINE_HARD_BYTES,
|
|
4091
|
-
fromTail:
|
|
4215
|
+
fromTail: timelineCursor.kind === "tail",
|
|
4216
|
+
transcriptTailCursor,
|
|
4092
4217
|
});
|
|
4093
4218
|
setTraceTimelinePageCache(state.traceTimelinePageCache, pageCacheKey, page);
|
|
4094
4219
|
return responseJson(page, {
|
|
@@ -4119,7 +4244,10 @@ export function createChatWebApp(options = {}) {
|
|
|
4119
4244
|
}
|
|
4120
4245
|
if (url.pathname === `${CHAT_WEB_API_PREFIX}/trace/raw-events` && request.method === "GET") {
|
|
4121
4246
|
const webSession = await requireSession(request, context);
|
|
4122
|
-
const
|
|
4247
|
+
const rawCursor = parseTimelineBeforeCursor(url);
|
|
4248
|
+
if (rawCursor.kind === "transcript")
|
|
4249
|
+
throw new PiboWebHttpError("Raw event cursor must be tail or a positive sequence", 400);
|
|
4250
|
+
const beforeSequence = rawCursor.kind === "event" ? rawCursor.beforeSequence : undefined;
|
|
4123
4251
|
const limit = parsePositiveIntSearchParam(url, "limit", TRACE_V2_RAW_EVENTS_DEFAULT_LIMIT, TRACE_V2_RAW_EVENTS_MAX_LIMIT);
|
|
4124
4252
|
const selectedSession = resolveRequestedSession(state, context, webSession, defaultProfile, url.searchParams.get("piboSessionId") || undefined);
|
|
4125
4253
|
const events = state.timelineQuery.listTraceEvents({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{C as e,D as t,E as n,H as r,K as i,L as a,M as o,Mt as s,N as c,P as l,R as u,U as d,V as f,_t as p,a as m,b as h,i as g,it as ee,j as _,o as te,p as ne,s as re,vt as ie,xt as ae,y as oe,z as v}from"./dist-SVPsM5Oi.js";import{html as se,htmlCompletionSource as ce}from"./dist-BDxKfyTI.js";import{t as le}from"./index-C5smwAJD.js";var ue=class e{static create(t,n,r,i,a){return new e(t,n,r,i+(i<<8)+t+(n<<4)|0,a,[],[])}constructor(e,t,n,r,i,o,s){this.type=e,this.value=t,this.from=n,this.hash=r,this.end=i,this.children=o,this.positions=s,this.hashProp=[[a.contextHash,r]]}addChild(e,t){e.prop(a.contextHash)!=this.hash&&(e=new r(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(t)}toTree(e,t=this.end){let n=this.children.length-1;return n>=0&&(t=Math.max(t,this.positions[n]+this.children[n].length+this.from)),new r(e.types[this.type],this.children,this.positions,t-this.from).balance({makeTree:(e,t,n)=>new r(v.none,e,t,n,this.hashProp)})}},y;(function(e){e[e.Document=1]=`Document`,e[e.CodeBlock=2]=`CodeBlock`,e[e.FencedCode=3]=`FencedCode`,e[e.Blockquote=4]=`Blockquote`,e[e.HorizontalRule=5]=`HorizontalRule`,e[e.BulletList=6]=`BulletList`,e[e.OrderedList=7]=`OrderedList`,e[e.ListItem=8]=`ListItem`,e[e.ATXHeading1=9]=`ATXHeading1`,e[e.ATXHeading2=10]=`ATXHeading2`,e[e.ATXHeading3=11]=`ATXHeading3`,e[e.ATXHeading4=12]=`ATXHeading4`,e[e.ATXHeading5=13]=`ATXHeading5`,e[e.ATXHeading6=14]=`ATXHeading6`,e[e.SetextHeading1=15]=`SetextHeading1`,e[e.SetextHeading2=16]=`SetextHeading2`,e[e.HTMLBlock=17]=`HTMLBlock`,e[e.LinkReference=18]=`LinkReference`,e[e.Paragraph=19]=`Paragraph`,e[e.CommentBlock=20]=`CommentBlock`,e[e.ProcessingInstructionBlock=21]=`ProcessingInstructionBlock`,e[e.Escape=22]=`Escape`,e[e.Entity=23]=`Entity`,e[e.HardBreak=24]=`HardBreak`,e[e.Emphasis=25]=`Emphasis`,e[e.StrongEmphasis=26]=`StrongEmphasis`,e[e.Link=27]=`Link`,e[e.Image=28]=`Image`,e[e.InlineCode=29]=`InlineCode`,e[e.HTMLTag=30]=`HTMLTag`,e[e.Comment=31]=`Comment`,e[e.ProcessingInstruction=32]=`ProcessingInstruction`,e[e.Autolink=33]=`Autolink`,e[e.HeaderMark=34]=`HeaderMark`,e[e.QuoteMark=35]=`QuoteMark`,e[e.ListMark=36]=`ListMark`,e[e.LinkMark=37]=`LinkMark`,e[e.EmphasisMark=38]=`EmphasisMark`,e[e.CodeMark=39]=`CodeMark`,e[e.CodeText=40]=`CodeText`,e[e.CodeInfo=41]=`CodeInfo`,e[e.LinkTitle=42]=`LinkTitle`,e[e.LinkLabel=43]=`LinkLabel`,e[e.URL=44]=`URL`})(y||={});var de=class{constructor(e,t){this.start=e,this.content=t,this.marks=[],this.parsers=[]}},fe=class{constructor(){this.text=``,this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return x(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,t=0,n=0){for(let r=t;r<e;r++)n+=this.text.charCodeAt(r)==9?4-n%4:1;return n}findColumn(e){let t=0;for(let n=0;t<this.text.length&&n<e;t++)n+=this.text.charCodeAt(t)==9?4-n%4:1;return t}scrub(){if(!this.baseIndent)return this.text;let e=``;for(let t=0;t<this.basePos;t++)e+=` `;return e+this.text.slice(this.basePos)}};function pe(e,t,n){if(n.pos==n.text.length||e!=t.block&&n.indent>=t.stack[n.depth+1].value+n.baseIndent)return!0;if(n.indent>=n.baseIndent+4)return!1;let r=(e.type==y.OrderedList?T:w)(n,t,!1);return r>0&&(e.type!=y.BulletList||C(n,t,!1)<0)&&n.text.charCodeAt(n.pos+r-1)==e.value}var me={[y.Blockquote](e,t,n){return n.next==62?(n.markers.push(L(y.QuoteMark,t.lineStart+n.pos,t.lineStart+n.pos+1)),n.moveBase(n.pos+(b(n.text.charCodeAt(n.pos+1))?2:1)),e.end=t.lineStart+n.text.length,!0):!1},[y.ListItem](e,t,n){return n.indent<n.baseIndent+e.value&&n.next>-1?!1:(n.moveBaseColumn(n.baseIndent+e.value),!0)},[y.OrderedList]:pe,[y.BulletList]:pe,[y.Document](){return!0}};function b(e){return e==32||e==9||e==10||e==13}function x(e,t=0){for(;t<e.length&&b(e.charCodeAt(t));)t++;return t}function he(e,t,n){for(;t>n&&b(e.charCodeAt(t-1));)t--;return t}function S(e){if(e.next!=96&&e.next!=126)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;if(t<e.pos+3)return-1;if(e.next==96){for(let n=t;n<e.text.length;n++)if(e.text.charCodeAt(n)==96)return-1}return t}function ge(e){return e.next==62?e.text.charCodeAt(e.pos+1)==32?2:1:-1}function C(e,t,n){if(e.next!=42&&e.next!=45&&e.next!=95)return-1;let r=1;for(let t=e.pos+1;t<e.text.length;t++){let n=e.text.charCodeAt(t);if(n==e.next)r++;else if(!b(n))return-1}return n&&e.next==45&&ye(e)>-1&&e.depth==t.stack.length&&t.parser.leafBlockParsers.indexOf(j.SetextHeading)>-1||r<3?-1:1}function _e(e,t){for(let n=e.stack.length-1;n>=0;n--)if(e.stack[n].type==t)return!0;return!1}function w(e,t,n){return(e.next==45||e.next==43||e.next==42)&&(e.pos==e.text.length-1||b(e.text.charCodeAt(e.pos+1)))&&(!n||_e(t,y.BulletList)||e.skipSpace(e.pos+2)<e.text.length)?1:-1}function T(e,t,n){let r=e.pos,i=e.next;for(;i>=48&&i<=57;){if(r++,r==e.text.length)return-1;i=e.text.charCodeAt(r)}return r==e.pos||r>e.pos+9||i!=46&&i!=41||r<e.text.length-1&&!b(e.text.charCodeAt(r+1))||n&&!_e(t,y.OrderedList)&&(e.skipSpace(r+1)==e.text.length||r>e.pos+1||e.next!=49)?-1:r+1-e.pos}function ve(e){if(e.next!=35)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==35;)t++;if(t<e.text.length&&e.text.charCodeAt(t)!=32)return-1;let n=t-e.pos;return n>6?-1:n}function ye(e){if(e.next!=45&&e.next!=61||e.indent>=e.baseIndent+4)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;let n=t;for(;t<e.text.length&&b(e.text.charCodeAt(t));)t++;return t==e.text.length?n:-1}var E=/^[ \t]*$/,be=/-->/,xe=/\?>/,D=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,be],[/^\s*<\?/,xe],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,E],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,E]];function Se(e,t,n){if(e.next!=60)return-1;let r=e.text.slice(e.pos);for(let e=0,t=D.length-+!!n;e<t;e++)if(D[e][0].test(r))return e;return-1}function Ce(e,t){let n=e.countIndent(t,e.pos,e.indent),r=e.countIndent(e.skipSpace(t),t,n);return r>=n+5?n+1:r}function O(e,t,n){let r=e.length-1;r>=0&&e[r].to==t&&e[r].type==y.CodeText?e[r].to=n:e.push(L(y.CodeText,t,n))}var k={LinkReference:void 0,IndentedCode(e,t){let n=t.baseIndent+4;if(t.indent<n)return!1;let r=t.findColumn(n),i=e.lineStart+r,a=e.lineStart+t.text.length,o=[],s=[];for(O(o,i,a);e.nextLine()&&t.depth>=e.stack.length;)if(t.pos==t.text.length){O(s,e.lineStart-1,e.lineStart);for(let e of t.markers)s.push(e)}else if(t.indent<n)break;else{if(s.length){for(let e of s)e.type==y.CodeText?O(o,e.from,e.to):o.push(e);s=[]}O(o,e.lineStart-1,e.lineStart);for(let e of t.markers)o.push(e);a=e.lineStart+t.text.length;let n=e.lineStart+t.findColumn(t.baseIndent+4);n<a&&O(o,n,a)}return s.length&&(s=s.filter(e=>e.type!=y.CodeText),s.length&&(t.markers=s.concat(t.markers))),e.addNode(e.buffer.writeElements(o,-i).finish(y.CodeBlock,a-i),i),!0},FencedCode(e,t){let n=S(t);if(n<0)return!1;let r=e.lineStart+t.pos,i=t.next,a=n-t.pos,o=t.skipSpace(n),s=he(t.text,t.text.length,o),c=[L(y.CodeMark,r,r+a)];o<s&&c.push(L(y.CodeInfo,e.lineStart+o,e.lineStart+s));for(let n=!0,r=!0,o=!1;e.nextLine()&&t.depth>=e.stack.length;n=!1){let s=t.pos;if(t.indent-t.baseIndent<4)for(;s<t.text.length&&t.text.charCodeAt(s)==i;)s++;if(s-t.pos>=a&&t.skipSpace(s)==t.text.length){for(let e of t.markers)c.push(e);r&&o&&O(c,e.lineStart-1,e.lineStart),c.push(L(y.CodeMark,e.lineStart+t.pos,e.lineStart+s)),e.nextLine();break}else{o=!0,n||(O(c,e.lineStart-1,e.lineStart),r=!1);for(let e of t.markers)c.push(e);let i=e.lineStart+t.basePos,a=e.lineStart+t.text.length;i<a&&(O(c,i,a),r=!1)}}return e.addNode(e.buffer.writeElements(c,-r).finish(y.FencedCode,e.prevLineEnd()-r),r),!0},Blockquote(e,t){let n=ge(t);return n<0?!1:(e.startContext(y.Blockquote,t.pos),e.addNode(y.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1),t.moveBase(t.pos+n),null)},HorizontalRule(e,t){if(C(t,e,!1)<0)return!1;let n=e.lineStart+t.pos;return e.nextLine(),e.addNode(y.HorizontalRule,n),!0},BulletList(e,t){let n=w(t,e,!1);if(n<0)return!1;e.block.type!=y.BulletList&&e.startContext(y.BulletList,t.basePos,t.next);let r=Ce(t,t.pos+1);return e.startContext(y.ListItem,t.basePos,r-t.baseIndent),e.addNode(y.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},OrderedList(e,t){let n=T(t,e,!1);if(n<0)return!1;e.block.type!=y.OrderedList&&e.startContext(y.OrderedList,t.basePos,t.text.charCodeAt(t.pos+n-1));let r=Ce(t,t.pos+n);return e.startContext(y.ListItem,t.basePos,r-t.baseIndent),e.addNode(y.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},ATXHeading(e,t){let n=ve(t);if(n<0)return!1;let r=t.pos,i=e.lineStart+r,a=he(t.text,t.text.length,r),o=a;for(;o>r&&t.text.charCodeAt(o-1)==t.next;)o--;(o==a||o==r||!b(t.text.charCodeAt(o-1)))&&(o=t.text.length);let s=e.buffer.write(y.HeaderMark,0,n).writeElements(e.parser.parseInline(t.text.slice(r+n+1,o),i+n+1),-i);o<t.text.length&&s.write(y.HeaderMark,o-r,a-r);let c=s.finish(y.ATXHeading1-1+n,t.text.length-r);return e.nextLine(),e.addNode(c,i),!0},HTMLBlock(e,t){let n=Se(t,e,!1);if(n<0)return!1;let r=e.lineStart+t.pos,i=D[n][1],a=[],o=i!=E;for(;!i.test(t.text)&&e.nextLine();){if(t.depth<e.stack.length){o=!1;break}for(let e of t.markers)a.push(e)}o&&e.nextLine();let s=i==be?y.CommentBlock:i==xe?y.ProcessingInstructionBlock:y.HTMLBlock,c=e.prevLineEnd();return e.addNode(e.buffer.writeElements(a,-r).finish(s,c-r),r),!0},SetextHeading:void 0},we=class{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,t,n){if(this.stage==-1)return!1;let r=n.content+`
|
|
1
|
+
import{C as e,D as t,E as n,H as r,K as i,L as a,M as o,Mt as s,N as c,P as l,R as u,U as d,V as f,_t as p,a as m,b as h,i as g,it as ee,j as _,o as te,p as ne,s as re,vt as ie,xt as ae,y as oe,z as v}from"./dist-SVPsM5Oi.js";import{html as se,htmlCompletionSource as ce}from"./dist-CjbsWko8.js";import{t as le}from"./index-j2BTjmvp.js";var ue=class e{static create(t,n,r,i,a){return new e(t,n,r,i+(i<<8)+t+(n<<4)|0,a,[],[])}constructor(e,t,n,r,i,o,s){this.type=e,this.value=t,this.from=n,this.hash=r,this.end=i,this.children=o,this.positions=s,this.hashProp=[[a.contextHash,r]]}addChild(e,t){e.prop(a.contextHash)!=this.hash&&(e=new r(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(t)}toTree(e,t=this.end){let n=this.children.length-1;return n>=0&&(t=Math.max(t,this.positions[n]+this.children[n].length+this.from)),new r(e.types[this.type],this.children,this.positions,t-this.from).balance({makeTree:(e,t,n)=>new r(v.none,e,t,n,this.hashProp)})}},y;(function(e){e[e.Document=1]=`Document`,e[e.CodeBlock=2]=`CodeBlock`,e[e.FencedCode=3]=`FencedCode`,e[e.Blockquote=4]=`Blockquote`,e[e.HorizontalRule=5]=`HorizontalRule`,e[e.BulletList=6]=`BulletList`,e[e.OrderedList=7]=`OrderedList`,e[e.ListItem=8]=`ListItem`,e[e.ATXHeading1=9]=`ATXHeading1`,e[e.ATXHeading2=10]=`ATXHeading2`,e[e.ATXHeading3=11]=`ATXHeading3`,e[e.ATXHeading4=12]=`ATXHeading4`,e[e.ATXHeading5=13]=`ATXHeading5`,e[e.ATXHeading6=14]=`ATXHeading6`,e[e.SetextHeading1=15]=`SetextHeading1`,e[e.SetextHeading2=16]=`SetextHeading2`,e[e.HTMLBlock=17]=`HTMLBlock`,e[e.LinkReference=18]=`LinkReference`,e[e.Paragraph=19]=`Paragraph`,e[e.CommentBlock=20]=`CommentBlock`,e[e.ProcessingInstructionBlock=21]=`ProcessingInstructionBlock`,e[e.Escape=22]=`Escape`,e[e.Entity=23]=`Entity`,e[e.HardBreak=24]=`HardBreak`,e[e.Emphasis=25]=`Emphasis`,e[e.StrongEmphasis=26]=`StrongEmphasis`,e[e.Link=27]=`Link`,e[e.Image=28]=`Image`,e[e.InlineCode=29]=`InlineCode`,e[e.HTMLTag=30]=`HTMLTag`,e[e.Comment=31]=`Comment`,e[e.ProcessingInstruction=32]=`ProcessingInstruction`,e[e.Autolink=33]=`Autolink`,e[e.HeaderMark=34]=`HeaderMark`,e[e.QuoteMark=35]=`QuoteMark`,e[e.ListMark=36]=`ListMark`,e[e.LinkMark=37]=`LinkMark`,e[e.EmphasisMark=38]=`EmphasisMark`,e[e.CodeMark=39]=`CodeMark`,e[e.CodeText=40]=`CodeText`,e[e.CodeInfo=41]=`CodeInfo`,e[e.LinkTitle=42]=`LinkTitle`,e[e.LinkLabel=43]=`LinkLabel`,e[e.URL=44]=`URL`})(y||={});var de=class{constructor(e,t){this.start=e,this.content=t,this.marks=[],this.parsers=[]}},fe=class{constructor(){this.text=``,this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return x(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,t=0,n=0){for(let r=t;r<e;r++)n+=this.text.charCodeAt(r)==9?4-n%4:1;return n}findColumn(e){let t=0;for(let n=0;t<this.text.length&&n<e;t++)n+=this.text.charCodeAt(t)==9?4-n%4:1;return t}scrub(){if(!this.baseIndent)return this.text;let e=``;for(let t=0;t<this.basePos;t++)e+=` `;return e+this.text.slice(this.basePos)}};function pe(e,t,n){if(n.pos==n.text.length||e!=t.block&&n.indent>=t.stack[n.depth+1].value+n.baseIndent)return!0;if(n.indent>=n.baseIndent+4)return!1;let r=(e.type==y.OrderedList?T:w)(n,t,!1);return r>0&&(e.type!=y.BulletList||C(n,t,!1)<0)&&n.text.charCodeAt(n.pos+r-1)==e.value}var me={[y.Blockquote](e,t,n){return n.next==62?(n.markers.push(L(y.QuoteMark,t.lineStart+n.pos,t.lineStart+n.pos+1)),n.moveBase(n.pos+(b(n.text.charCodeAt(n.pos+1))?2:1)),e.end=t.lineStart+n.text.length,!0):!1},[y.ListItem](e,t,n){return n.indent<n.baseIndent+e.value&&n.next>-1?!1:(n.moveBaseColumn(n.baseIndent+e.value),!0)},[y.OrderedList]:pe,[y.BulletList]:pe,[y.Document](){return!0}};function b(e){return e==32||e==9||e==10||e==13}function x(e,t=0){for(;t<e.length&&b(e.charCodeAt(t));)t++;return t}function he(e,t,n){for(;t>n&&b(e.charCodeAt(t-1));)t--;return t}function S(e){if(e.next!=96&&e.next!=126)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;if(t<e.pos+3)return-1;if(e.next==96){for(let n=t;n<e.text.length;n++)if(e.text.charCodeAt(n)==96)return-1}return t}function ge(e){return e.next==62?e.text.charCodeAt(e.pos+1)==32?2:1:-1}function C(e,t,n){if(e.next!=42&&e.next!=45&&e.next!=95)return-1;let r=1;for(let t=e.pos+1;t<e.text.length;t++){let n=e.text.charCodeAt(t);if(n==e.next)r++;else if(!b(n))return-1}return n&&e.next==45&&ye(e)>-1&&e.depth==t.stack.length&&t.parser.leafBlockParsers.indexOf(j.SetextHeading)>-1||r<3?-1:1}function _e(e,t){for(let n=e.stack.length-1;n>=0;n--)if(e.stack[n].type==t)return!0;return!1}function w(e,t,n){return(e.next==45||e.next==43||e.next==42)&&(e.pos==e.text.length-1||b(e.text.charCodeAt(e.pos+1)))&&(!n||_e(t,y.BulletList)||e.skipSpace(e.pos+2)<e.text.length)?1:-1}function T(e,t,n){let r=e.pos,i=e.next;for(;i>=48&&i<=57;){if(r++,r==e.text.length)return-1;i=e.text.charCodeAt(r)}return r==e.pos||r>e.pos+9||i!=46&&i!=41||r<e.text.length-1&&!b(e.text.charCodeAt(r+1))||n&&!_e(t,y.OrderedList)&&(e.skipSpace(r+1)==e.text.length||r>e.pos+1||e.next!=49)?-1:r+1-e.pos}function ve(e){if(e.next!=35)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==35;)t++;if(t<e.text.length&&e.text.charCodeAt(t)!=32)return-1;let n=t-e.pos;return n>6?-1:n}function ye(e){if(e.next!=45&&e.next!=61||e.indent>=e.baseIndent+4)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;let n=t;for(;t<e.text.length&&b(e.text.charCodeAt(t));)t++;return t==e.text.length?n:-1}var E=/^[ \t]*$/,be=/-->/,xe=/\?>/,D=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,be],[/^\s*<\?/,xe],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,E],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,E]];function Se(e,t,n){if(e.next!=60)return-1;let r=e.text.slice(e.pos);for(let e=0,t=D.length-+!!n;e<t;e++)if(D[e][0].test(r))return e;return-1}function Ce(e,t){let n=e.countIndent(t,e.pos,e.indent),r=e.countIndent(e.skipSpace(t),t,n);return r>=n+5?n+1:r}function O(e,t,n){let r=e.length-1;r>=0&&e[r].to==t&&e[r].type==y.CodeText?e[r].to=n:e.push(L(y.CodeText,t,n))}var k={LinkReference:void 0,IndentedCode(e,t){let n=t.baseIndent+4;if(t.indent<n)return!1;let r=t.findColumn(n),i=e.lineStart+r,a=e.lineStart+t.text.length,o=[],s=[];for(O(o,i,a);e.nextLine()&&t.depth>=e.stack.length;)if(t.pos==t.text.length){O(s,e.lineStart-1,e.lineStart);for(let e of t.markers)s.push(e)}else if(t.indent<n)break;else{if(s.length){for(let e of s)e.type==y.CodeText?O(o,e.from,e.to):o.push(e);s=[]}O(o,e.lineStart-1,e.lineStart);for(let e of t.markers)o.push(e);a=e.lineStart+t.text.length;let n=e.lineStart+t.findColumn(t.baseIndent+4);n<a&&O(o,n,a)}return s.length&&(s=s.filter(e=>e.type!=y.CodeText),s.length&&(t.markers=s.concat(t.markers))),e.addNode(e.buffer.writeElements(o,-i).finish(y.CodeBlock,a-i),i),!0},FencedCode(e,t){let n=S(t);if(n<0)return!1;let r=e.lineStart+t.pos,i=t.next,a=n-t.pos,o=t.skipSpace(n),s=he(t.text,t.text.length,o),c=[L(y.CodeMark,r,r+a)];o<s&&c.push(L(y.CodeInfo,e.lineStart+o,e.lineStart+s));for(let n=!0,r=!0,o=!1;e.nextLine()&&t.depth>=e.stack.length;n=!1){let s=t.pos;if(t.indent-t.baseIndent<4)for(;s<t.text.length&&t.text.charCodeAt(s)==i;)s++;if(s-t.pos>=a&&t.skipSpace(s)==t.text.length){for(let e of t.markers)c.push(e);r&&o&&O(c,e.lineStart-1,e.lineStart),c.push(L(y.CodeMark,e.lineStart+t.pos,e.lineStart+s)),e.nextLine();break}else{o=!0,n||(O(c,e.lineStart-1,e.lineStart),r=!1);for(let e of t.markers)c.push(e);let i=e.lineStart+t.basePos,a=e.lineStart+t.text.length;i<a&&(O(c,i,a),r=!1)}}return e.addNode(e.buffer.writeElements(c,-r).finish(y.FencedCode,e.prevLineEnd()-r),r),!0},Blockquote(e,t){let n=ge(t);return n<0?!1:(e.startContext(y.Blockquote,t.pos),e.addNode(y.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1),t.moveBase(t.pos+n),null)},HorizontalRule(e,t){if(C(t,e,!1)<0)return!1;let n=e.lineStart+t.pos;return e.nextLine(),e.addNode(y.HorizontalRule,n),!0},BulletList(e,t){let n=w(t,e,!1);if(n<0)return!1;e.block.type!=y.BulletList&&e.startContext(y.BulletList,t.basePos,t.next);let r=Ce(t,t.pos+1);return e.startContext(y.ListItem,t.basePos,r-t.baseIndent),e.addNode(y.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},OrderedList(e,t){let n=T(t,e,!1);if(n<0)return!1;e.block.type!=y.OrderedList&&e.startContext(y.OrderedList,t.basePos,t.text.charCodeAt(t.pos+n-1));let r=Ce(t,t.pos+n);return e.startContext(y.ListItem,t.basePos,r-t.baseIndent),e.addNode(y.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},ATXHeading(e,t){let n=ve(t);if(n<0)return!1;let r=t.pos,i=e.lineStart+r,a=he(t.text,t.text.length,r),o=a;for(;o>r&&t.text.charCodeAt(o-1)==t.next;)o--;(o==a||o==r||!b(t.text.charCodeAt(o-1)))&&(o=t.text.length);let s=e.buffer.write(y.HeaderMark,0,n).writeElements(e.parser.parseInline(t.text.slice(r+n+1,o),i+n+1),-i);o<t.text.length&&s.write(y.HeaderMark,o-r,a-r);let c=s.finish(y.ATXHeading1-1+n,t.text.length-r);return e.nextLine(),e.addNode(c,i),!0},HTMLBlock(e,t){let n=Se(t,e,!1);if(n<0)return!1;let r=e.lineStart+t.pos,i=D[n][1],a=[],o=i!=E;for(;!i.test(t.text)&&e.nextLine();){if(t.depth<e.stack.length){o=!1;break}for(let e of t.markers)a.push(e)}o&&e.nextLine();let s=i==be?y.CommentBlock:i==xe?y.ProcessingInstructionBlock:y.HTMLBlock,c=e.prevLineEnd();return e.addNode(e.buffer.writeElements(a,-r).finish(s,c-r),r),!0},SetextHeading:void 0},we=class{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,t,n){if(this.stage==-1)return!1;let r=n.content+`
|
|
2
2
|
`+t.scrub(),i=this.advance(r);return i>-1&&i<r.length?this.complete(e,n,i):!1}finish(e,t){return(this.stage==2||this.stage==3)&&x(t.content,this.pos)==t.content.length?this.complete(e,t,t.content.length):!1}complete(e,t,n){return e.addLeafElement(t,L(y.LinkReference,this.start,this.start+n,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;)if(this.stage==-1)return-1;else if(this.stage==0){if(!this.nextStage(Be(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(L(y.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(Re(e,x(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=x(e,this.pos),n=0;if(t>this.pos){let r=ze(e,t,this.start);if(r){let t=A(e,r.to-this.start);t>0&&(this.nextStage(r),n=t)}}return n||=A(e,this.pos),n>0&&n<e.length?n:-1}else return A(e,this.pos)}};function A(e,t){for(;t<e.length;t++){let n=e.charCodeAt(t);if(n==10)break;if(!b(n))return-1}return t}var Te=class{nextLine(e,t,n){let r=t.depth<e.stack.length?-1:ye(t),i=t.next;if(r<0)return!1;let a=L(y.HeaderMark,e.lineStart+t.pos,e.lineStart+r);return e.nextLine(),e.addLeafElement(n,L(i==61?y.SetextHeading1:y.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),a])),!0}finish(){return!1}},j={LinkReference(e,t){return t.content.charCodeAt(0)==91?new we(t):null},SetextHeading(){return new Te}},Ee=[(e,t)=>ve(t)>=0,(e,t)=>S(t)>=0,(e,t)=>ge(t)>=0,(e,t)=>w(t,e,!0)>=0,(e,t)=>T(t,e,!0)>=0,(e,t)=>C(t,e,!0)>=0,(e,t)=>Se(t,e,!0)>=0],De={text:``,end:0},Oe=class{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.line=new fe,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=r[r.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=r[0].from,this.block=ue.create(y.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new He(n,t):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let t=0;;){let n=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;t<e.markers.length&&(!n||e.markers[t].from<n.end);){let n=e.markers[t++];this.addNode(n.type,n.from,n.to)}if(!n)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;start:for(;;){for(let t of this.parser.blockParsers)if(t){let n=t(this,e);if(n!=0){if(n==1)return null;e.forward();continue start}}break}let t=new de(this.lineStart+e.pos,e.text.slice(e.pos));for(let e of this.parser.leafBlockParsers)if(e){let n=e(this,t);n&&t.parsers.push(n)}lines:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let n of this.parser.endLeafBlock)if(n(this,e,t))break lines}for(let n of t.parsers)if(n.nextLine(this,e,t))return null;t.content+=`
|
|
3
3
|
`+e.scrub();for(let n of e.markers)t.marks.push(n)}return this.finishLeaf(t),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw RangeError(`Can't move stoppedAt forward`);this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let t=this.fragments.takeNodes(this);return t?(this.absoluteLineStart+=t,this.lineStart=Ue(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let t=De;if(t.end=e,e>=this.to)t.text=``;else if(t.text=this.lineChunkAt(e),t.end+=t.text.length,this.ranges.length>1){let e=this.absoluteLineStart,n=this.rangeI;for(;this.ranges[n].to<t.end;){n++;let r=this.ranges[n].from,i=this.lineChunkAt(r);t.end=r+i.length,t.text=t.text.slice(0,this.ranges[n-1].to-e)+i,e=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,e.reset(t);e.depth<this.stack.length;e.depth++){let t=this.stack[e.depth],n=this.parser.skipContextMarkup[t.type];if(!n)throw Error(`Unhandled block context `+y[t.type]);let r=this.line.markers.length;if(!n(t,this,e)){this.line.markers.length>r&&(t.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),n;if(this.input.lineChunks)n=t==`
|
|
4
4
|
`?``:t;else{let e=t.indexOf(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{N as e,P as t,U as n,o as r,r as i}from"./dist-SVPsM5Oi.js";import{n as a,r as o}from"./dist-tGfufz3b.js";import{r as s}from"./dist-
|
|
1
|
+
import{N as e,P as t,U as n,o as r,r as i}from"./dist-SVPsM5Oi.js";import{n as a,r as o}from"./dist-tGfufz3b.js";import{r as s}from"./dist-DSDqYG1O.js";import{html as c}from"./dist-CjbsWko8.js";var l=1,u=33,d=34,f=35,p=36,m=new a(e=>{let t=e.pos;for(;;){if(e.next==10){e.advance();break}else if(e.next==123&&e.peek(1)==123||e.next<0)break;e.advance()}e.pos>t&&e.acceptToken(l)});function h(e,t,n){return new a(r=>{let i=r.pos;for(;r.next!=e&&r.next>=0&&(n||r.next!=38&&(r.next!=123||r.peek(1)!=123));)r.advance();r.pos>i&&r.acceptToken(t)})}var g=h(39,u,!1),_=h(34,d,!1),v=h(39,f,!0),y=h(34,p,!0),b=o.deserialize({version:14,states:"(jOVOqOOOeQpOOOvO!bO'#CaOOOP'#Cx'#CxQVOqOOO!OQpO'#CfO!WQpO'#ClO!]QpO'#CrO!bQpO'#CsOOQO'#Cv'#CvQ!gQpOOQ!lQpOOQ!qQpOOOOOV,58{,58{O!vOpO,58{OOOP-E6v-E6vO!{QpO,59QO#TQpO,59QOOQO,59W,59WO#YQpO,59^OOQO,59_,59_O#_QpOOO#_QpOOO#gQpOOOOOV1G.g1G.gO#oQpO'#CyO#tQpO1G.lOOQO1G.l1G.lO#|QpO1G.lOOQO1G.x1G.xO$UO`O'#DUO$ZOWO'#DUOOQO'#Co'#CoQOQpOOOOQO'#Cu'#CuO$`OtO'#CwO$qOrO'#CwOOQO,59e,59eOOQO-E6w-E6wOOQO7+$W7+$WO%SQpO7+$WO%[QpO7+$WOOOO'#Cp'#CpO%aOpO,59pOOOO'#Cq'#CqO%fOpO,59pOOOS'#Cz'#CzO%kOtO,59cOOQO,59c,59cOOOQ'#C{'#C{O%|OrO,59cO&_QpO<<GrOOQO<<Gr<<GrOOQO1G/[1G/[OOOS-E6x-E6xOOQO1G.}1G.}OOOQ-E6y-E6yOOQOAN=^AN=^",stateData:"&d~OvOS~OPROSQOVROWRO~OZTO[XO^VOaUOhWO~OR]OU^O~O[`O^aO~O[bO~O[cO~O[dO~ObeO~ObfO~ObgO~ORhO~O]kOwiO~O[lO~O_mO~OynOzoO~OysOztO~O[uO~O]wOwiO~O_yOwiO~OtzO~Os|O~OSQOV!OOW!OOr!OOy!QO~OSQOV!ROW!ROq!ROz!QO~O_!TOwiO~O]!UO~Oy!VO~Oz!VO~OSQOV!OOW!OOr!OOy!XO~OSQOV!ROW!ROq!ROz!XO~O]!ZO~O",goto:"#dyPPPPPzPPPP!WPPPPP!WPP!Z!^!a!d!dP!g!j!m!p!v#Q#WPPPPPPPP#^SROSS!Os!PT!Rt!SRYPRqeR{nR}oRZPRqfR[PRqgQSOR_SQj`SvjxRxlQ!PsR!W!PQ!StR!Y!SQpeRrf",nodeNames:`⚠ Text Content }} {{ Interpolation InterpolationContent Entity InvalidEntity Attribute BoundAttributeName [ Identifier ] ( ) ReferenceName # Is ExpressionAttributeValue AttributeInterpolation AttributeInterpolation EventName DirectiveName * StatementAttributeValue AttributeName AttributeValue`,maxTerm:42,nodeProps:[[`openedBy`,3,`{{`,15,`(`],[`closedBy`,4,`}}`,14,`)`],[`isolate`,-4,5,19,25,27,``]],skippedNodes:[0],repeatNodeCount:4,tokenData:"0r~RyOX#rXY$mYZ$mZ]#r]^$m^p#rpq$mqr#rrs%jst&Qtv#rvw&hwx)zxy*byz*xz{+`{}#r}!O+v!O!P-]!P!Q#r!Q![+v![!]+v!]!_#r!_!`-s!`!c#r!c!}+v!}#O.Z#O#P#r#P#Q.q#Q#R#r#R#S+v#S#T#r#T#o+v#o#p/X#p#q#r#q#r0Z#r%W#r%W;'S+v;'S;:j-V;:j;=`$g<%lO+vQ#wTUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rQ$ZSO#q#r#r;'S#r;'S;=`$g<%lO#rQ$jP;=`<%l#rR$t[UQvPOX#rXY$mYZ$mZ]#r]^$m^p#rpq$mq#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR%qTyPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR&XTaPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR&oXUQWPOp'[pq#rq!]'[!]!^#r!^#q'[#q#r(d#r;'S'[;'S;=`)t<%lO'[R'aXUQOp'[pq#rq!]'[!]!^'|!^#q'[#q#r(d#r;'S'[;'S;=`)t<%lO'[R(TTVPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR(gXOp'[pq#rq!]'[!]!^'|!^#q'[#q#r)S#r;'S'[;'S;=`)t<%lO'[P)VUOp)Sq!])S!]!^)i!^;'S)S;'S;=`)n<%lO)SP)nOVPP)qP;=`<%l)SR)wP;=`<%l'[R*RTzPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR*iT^PUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR+PT_PUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR+gThPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR+}b[PUQO}#r}!O+v!O!Q#r!Q![+v![!]+v!]!c#r!c!}+v!}#R#r#R#S+v#S#T#r#T#o+v#o#q#r#q#r$W#r%W#r%W;'S+v;'S;:j-V;:j;=`$g<%lO+vR-YP;=`<%l+vR-dTwPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR-zTUQbPO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR.bTZPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR.xT]PUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR/^VUQO#o#r#o#p/s#p#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR/zTSPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#r~0^TO#q#r#q#r0m#r;'S#r;'S;=`$g<%lO#r~0rOR~",tokenizers:[m,g,_,v,y,0,1],topRules:{Content:[0,2],Attribute:[1,9]},tokenPrec:0}),x=s.parser.configure({top:`SingleExpression`}),S=b.configure({props:[e({Text:t.content,Is:t.definitionOperator,AttributeName:t.attributeName,"AttributeValue ExpressionAttributeValue StatementAttributeValue":t.attributeValue,Entity:t.character,InvalidEntity:t.invalid,"BoundAttributeName/Identifier":t.attributeName,"EventName/Identifier":t.special(t.attributeName),"ReferenceName/Identifier":t.variableName,"DirectiveName/Identifier":t.keyword,"{{ }}":t.brace,"( )":t.paren,"[ ]":t.bracket,"# '*'":t.punctuation})]}),C={parser:x},w={parser:s.parser},T=S.configure({wrap:n((e,t)=>e.name==`InterpolationContent`?C:null)}),E=S.configure({wrap:n((e,t)=>e.name==`InterpolationContent`?C:e.name==`AttributeInterpolation`?e.node.parent?.name==`StatementAttributeValue`?w:C:null),top:`Attribute`}),D={parser:T},O={parser:E},k=c({selfClosingTags:!0});function A(e){return e.configure({wrap:n(M)},`angular`)}var j=A(k.language);function M(e,t){switch(e.name){case`Attribute`:return/^[*#(\[]|\{\{/.test(t.read(e.from,e.to))?O:null;case`Text`:return D}return null}function N(e={}){let t=k;if(e.base){if(e.base.language.name!=`html`||!(e.base.language instanceof i))throw RangeError(`The base option must be the result of calling html(...)`);t=e.base}return new r(t.language==k.language?j:A(t.language),[t.support,t.language.data.of({closeBrackets:{brackets:[`[`,`{`,`"`]},indentOnInput:/^\s*[\}\]]$/})])}export{N as angular};
|