(
exp: CliExport,
ws: WsMeta,
origin?: InboxOrigin,
)
| 66 | * an export only sees the tools its category owns. |
| 67 | */ |
| 68 | const exportCatalog = ( |
| 69 | exp: CliExport, |
| 70 | ws: WsMeta, |
| 71 | origin?: InboxOrigin, |
| 72 | ): { resolve: (name: string) => Tool | null; inventoryNames: () => string[] } => { |
| 73 | if (exp.scope === 'scoped') { |
| 74 | // GLOBAL issue-board reader, backed by the live WorkspaceService. |
| 75 | // Built here so issue_list / issue_show on `alice-workspace` read EVERY |
| 76 | // workspace's issues (reads global), while create/update/comment stay |
| 77 | // caller-local. Absent when the service isn't up yet → tools self-read. |
| 78 | const svc = getWorkspaceService() |
| 79 | const wsTools = workspaceToolCenter.build({ |
| 80 | workspaceId: ws.id, |
| 81 | workspaceLabel: ws.tag, |
| 82 | inboxStore, |
| 83 | entityStore, |
| 84 | // Lets workspace_path resolve ANY peer's dir (not just the caller) — |
| 85 | // the in-workspace cross-workspace addressing path. Shared with the |
| 86 | // mcp.ts build site so the two never drift. |
| 87 | resolveWorkspace: makeWorkspaceResolver(getWorkspaceService), |
| 88 | ...(svc |
| 89 | ? { |
| 90 | board: { |
| 91 | snapshot: () => svc.issuesSnapshot(), |
| 92 | detail: (w: string, i: string) => svc.issueDetail(w, i), |
| 93 | resolveByName: (n: string) => svc.resolveIssuesByName(n), |
| 94 | }, |
| 95 | } |
| 96 | : {}), |
| 97 | // Agent-invisible run provenance from the `x-openalice-run` header |
| 98 | // (resolved server-side). Only the invoke path passes it; manifest omits |
| 99 | // it (no execution, no push). Absent → undefined. |
| 100 | ...(origin ? { origin } : {}), |
| 101 | }) |
| 102 | return { |
| 103 | resolve: (name) => wsTools[name] ?? null, |
| 104 | inventoryNames: () => Object.keys(wsTools), |
| 105 | } |
| 106 | } |
| 107 | return { |
| 108 | resolve: (name) => toolCenter.get(name) ?? null, |
| 109 | inventoryNames: () => toolCenter.getInventory().map((t) => t.name), |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | /** Shared workspace+export resolution for both routes. */ |
| 114 | const resolveCtx = ( |
no test coverage detected