🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ chore(agent-tracing): resolve partial op id by _remote/ cache prefix (#15015)
Arvin Xue37cca70c5a3
diff --git a/packages/agent-tracing/src/cli/inspect.ts b/packages/agent-tracing/src/cli/inspect.tsindex 3919f7c4a9f..f564ab490f0 100644--- a/packages/agent-tracing/src/cli/inspect.ts+++ b/packages/agent-tracing/src/cli/inspect.ts@@ -151,6 +151,28 @@ export function registerInspectCommand(program: Command) {snapshot = await remoteStore.fetch(url, traceId);}}+ } else if (traceId && traceId.startsWith('op_')) {+ // Partial op id (e.g. `op_<timestamp>`): first check the local+ // FileSnapshotStore (which also covers `_partial/` in-progress+ // snapshots via substring match), then fall back to a prefix scan+ // of the `_remote/` cache so users don't have to paste the full+ // `op_<ts>_agt_..._tpc_..._<suffix>` string.+ const fileStore = new FileSnapshotStore();+ snapshot = await fileStore.get(traceId);+ if (!snapshot) {+ const remoteStore = new RemoteSnapshotStore();+ const matches = await remoteStore.findCachedByPrefix(traceId);+ if (matches.length === 1) {+ const fullId = matches[0];+ snapshot = await remoteStore.getCached(fullId);+ console.error(`✓ Resolved "${traceId}" → ${fullId}`);+ } else if (matches.length > 1) {+ console.error(`Ambiguous id prefix "${traceId}" — multiple cached snapshots match:`);+ for (const m of matches) console.error(` ${m}`);+ console.error('Re-run with the full operation id.');+ process.exit(1);+ }+ }} else {const store = new FileSnapshotStore();snapshot = traceId ? await store.get(traceId) : await store.getLatest();diff --git a/packages/agent-tracing/src/store/remote-store.ts b/packages/agent-tracing/src/store/remote-store.tsindex 80ec50ee0b0..a005c2d8879 100644--- a/packages/agent-tracing/src/store/remote-store.ts+++ b/packages/agent-tracing/src/store/remote-store.ts@@ -96,6 +96,24 @@ export class RemoteSnapshotStore {}}+ /**+ * Find cached snapshots whose operation ID starts with the given prefix.+ * Lets callers resolve a partial id like `op_<timestamp>` to the full+ * `op_<timestamp>_agt_..._tpc_..._<suffix>` recorded in `_remote/`.+ */+ async findCachedByPrefix(prefix: string): Promise<string[]> {+ try {+ const entries = await fs.readdir(this.cacheDir);+ const suffix = '.json';+ return entries+ .filter((f) => f.endsWith(suffix) && f.startsWith(prefix))+ .map((f) => f.slice(0, -suffix.length))+ .sort();+ } catch {+ return [];+ }+ }+async fetch(url: string, operationId: string): Promise<ExecutionSnapshot> {// Check cache firstconst cached = await this.getCached(operationId);