@atolis-hq/wake 0.4.114 → 0.4.115

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.
@@ -1,3 +1,4 @@
1
1
  import { type ResourceCorrelationView, type ResourceView } from '../resources/index.js';
2
2
  import type { CompositionRoot } from './composition-root.js';
3
3
  export declare function primaryExternalRef(root: CompositionRoot, rawWorkItemId: string, suppliedCorrelations?: readonly ResourceCorrelationView[], suppliedResources?: readonly ResourceView[]): Promise<string | undefined>;
4
+ export declare function primaryRepository(root: CompositionRoot, rawWorkItemId: string): Promise<string | undefined>;
@@ -3,11 +3,22 @@ import { workItemId } from '../work/index.js';
3
3
  // Work items never embed a provider/repo/issue number (see project/adrs/0001); this joins
4
4
  // the primary correlated resource's adapter-formatted key at the presentation layer only.
5
5
  export async function primaryExternalRef(root, rawWorkItemId, suppliedCorrelations, suppliedResources) {
6
+ const resource = await primaryResource(root, rawWorkItemId, suppliedCorrelations, suppliedResources);
7
+ return resource?.externalKey.key;
8
+ }
9
+ // Generic "repository" display field; only adapters that know a repository identity supply one.
10
+ export async function primaryRepository(root, rawWorkItemId) {
11
+ const resource = await primaryResource(root, rawWorkItemId);
12
+ return resource === undefined
13
+ ? undefined
14
+ : root.resolveResourceRepositoryIdentity(resource.externalKey);
15
+ }
16
+ async function primaryResource(root, rawWorkItemId, suppliedCorrelations, suppliedResources) {
6
17
  const correlations = suppliedCorrelations ?? (await root.resources.correlationsForWork(workItemId(rawWorkItemId)));
7
18
  const primary = correlations.find((value) => value.role === ResourceCorrelationRole.Primary);
8
19
  if (primary === undefined)
9
20
  return undefined;
10
- const resource = suppliedResources?.find((value) => value.resourceId === primary.resourceId) ??
11
- (await root.resources.get(primary.resourceId));
12
- return resource?.externalKey.key;
21
+ return (suppliedResources?.find((value) => value.resourceId === primary.resourceId) ??
22
+ (await root.resources.get(primary.resourceId)) ??
23
+ undefined);
13
24
  }
@@ -3,7 +3,7 @@ import { ApiCommandStatus, ApiHealthCheckKind, fromWorkItemKey, presentBoardCard
3
3
  import { analyticsProjection } from './analytics-projection.js';
4
4
  import { createAnalyticsReports } from './analytics-reports.js';
5
5
  import { boardConditionCounts, boardProjection, normalizeBoardActiveRunPhase, } from './board-projection.js';
6
- import { primaryExternalRef } from './external-ref.js';
6
+ import { primaryExternalRef, primaryRepository } from './external-ref.js';
7
7
  import { createSelfUpdateFailureLog, describeSelfUpdateFailure, } from './self-update-failure-log.js';
8
8
  import { createExecutionApplications } from './surface-api-execution-applications.js';
9
9
  import { projectionMeta, sampledMeta } from './surface-api-metadata.js';
@@ -41,6 +41,7 @@ function createBoardApplications(root, now) {
41
41
  const page = cards.slice(offset, offset + query.limit);
42
42
  const items = await Promise.all(page.map(async (card) => {
43
43
  const externalRef = await primaryExternalRef(root, card.workItemId);
44
+ const repository = await primaryRepository(root, card.workItemId);
44
45
  const { activeRun: _legacyActiveRun, activeRuns: _activeRuns, ...withoutActiveRuns } = card;
45
46
  const activeRuns = activeBoardRuns(board, card);
46
47
  return presentBoardCard({
@@ -51,6 +52,7 @@ function createBoardApplications(root, now) {
51
52
  { ...activeRun, elapsedMs: elapsedSince(activeRun.startedAt, nowMs) },
52
53
  ])),
53
54
  ...(externalRef === undefined ? {} : { externalRef }),
55
+ ...(repository === undefined ? {} : { repository }),
54
56
  ...(card.lastRunAt === undefined
55
57
  ? {}
56
58
  : { lastRunAgeMs: elapsedSince(card.lastRunAt, nowMs) }),
@@ -124,6 +124,6 @@ export function resolveWakeVersion(options = {}) {
124
124
  return `g${headHash.slice(0, 7)}`;
125
125
  return '0.1.0-dev';
126
126
  }
127
- export const wakeVersion = "v0.4.114";
127
+ export const wakeVersion = "v0.4.115";
128
128
  /** The registry-installable version used by packaged sandbox images. */
129
129
  export const wakePackageVersion = packageVersion(defaultRepoRoot) ?? wakeVersion;
@@ -46,6 +46,7 @@ export interface BoardCardResponse {
46
46
  readonly totalCostUsd: number;
47
47
  readonly totalDurationMs: number;
48
48
  readonly externalRef?: string;
49
+ readonly repository?: string;
49
50
  }
50
51
  export interface BoardResponse {
51
52
  readonly conditionCounts: Partial<Record<BoardCardCondition, number>>;