@dharma-ai-labs/agent-fabric 0.2.165 → 0.2.166

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/dist/index.js CHANGED
@@ -76,7 +76,7 @@ import { namedCodexEnvironment } from './namedCodexEnvironment.js';
76
76
  import { namedCodexNodeOutputArguments } from './namedCodexNodeOutput.js';
77
77
  import { namedCodexFilesystem } from './namedCodexFilesystem.js';
78
78
  import { createNamedSessionChildOwner, currentNamedSessionChildOwner } from './namedSessionChildOwner.js';
79
- import { awaitCodexSetupSession, consumeCodexSetupSessions, currentAcceptedSetupSessionScope, originalCodexSetupSessionSender, withCodexSetupSessionSender } from './codexSetupSessionHandoff.js';
79
+ import { awaitCodexSetupSession, codexSetupSessionPolicyHash, consumeCodexSetupSessions, currentAcceptedSetupSessionScope, originalCodexSetupSessionSender, withCodexSetupSessionSender } from './codexSetupSessionHandoff.js';
80
80
  import { receiveCodexSetupChildStart, runCodexSetupChildStartup, sendCodexSetupChildStart } from './codexSetupChildStartup.js';
81
81
  import { assertBootstrapHostSource, captureBootstrapHostChild, currentBootstrapHostScope, inspectCodexBootstrapHostPreparation, prepareCodexBootstrapHost, runCodexBootstrapHost, runCodexBootstrapHostScope } from './bootstrapHostScope.js';
82
82
  // Trusted runtime composition only; these exports do not enable effectful setup.
@@ -90,7 +90,7 @@ import { assertCodexSetupExecutionLease } from './codexSetupAdmission.js';
90
90
  import { parseLocalCodexSetupReadiness } from '@dharma-ai-labs/agent-fabric-local-vault/setup-readiness';
91
91
  import { writeBootstrapHostJson, writeBootstrapHostText } from './bootstrapHostFiles.js';
92
92
  export { openCooperativeInboxSession } from './cooperativeInboxSession.js';
93
- const VERSION = '0.2.165';
93
+ const VERSION = '0.2.166';
94
94
  const USAGE = CLI_USAGE;
95
95
  const execFileAsync = promisify(execFile);
96
96
  const LOCAL_PROVIDER_IDS = ['codex', 'claude', 'agy', 'hermes'];
@@ -2323,7 +2323,7 @@ async function qualifyCodexSetupSessionSource(request) {
2323
2323
  verifyServerAuthorizedPolicy({ policy, publicKeyEd25519: enrollment.serverPublicKeyEd25519,
2324
2324
  organizationId: request.organizationId, workspaceId: request.workspaceId });
2325
2325
  await assertWorkspaceAuthorizationCurrent(request.workspaceId, policy.serverAuthorization);
2326
- if (policy.revision !== request.policyRevision || sha256(canonicalize(policy)) !== request.policyHash)
2326
+ if (policy.revision !== request.policyRevision || codexSetupSessionPolicyHash(policy) !== request.policyHash)
2327
2327
  return false;
2328
2328
  const fabric = await client();
2329
2329
  await fetchRepositorySourceAuthorization(fabric, role);
@@ -3262,9 +3262,9 @@ async function bootstrap(flags, hostScope) {
3262
3262
  repository: onboarded,
3263
3263
  };
3264
3264
  }
3265
- const launcher = await step(() => installStableRepositoryLauncher(workspace));
3266
- const autostart = flags.has('no-relay-daemon')
3267
- ? { state: 'disabled', backend: null }
3265
+ const { launcher, autostart } = flags.has('no-relay-daemon')
3266
+ ? { launcher: await step(() => installStableRepositoryLauncher(workspace)),
3267
+ autostart: { state: 'disabled', backend: null } }
3268
3268
  : await step(() => withOnboardingStage('autostart', String(onboarded.workspaceId || ''), `dharma bootstrap --resume --complete --portal-url ${hqUrl} --organization-id ${organizationId} --workspace . --policy-revision ${policyRevision}`
3269
3269
  + (joinedBindingId ? ` --join-repository-binding-id ${joinedBindingId} --join-source-fingerprint ${joinedFingerprint}` : ''), () => withRelayStartupMutation(async () => {
3270
3270
  const home = dharmaHome();
@@ -3290,11 +3290,18 @@ async function bootstrap(flags, hostScope) {
3290
3290
  if (canonical.length !== 1)
3291
3291
  throw new Error('relay_workspace_conflict: startup policy route changed.');
3292
3292
  await step(() => loadVerifiedWorkspacePolicy(anchor.policy, authorized.serverAuthorization?.workspaceId ?? ''));
3293
+ if (anchor.version !== VERSION) {
3294
+ throw new Error('relay_runtime_upgrade_required: upgrade the existing startup anchor before connecting another repository.');
3295
+ }
3293
3296
  }
3294
3297
  }
3295
- return step(() => enableRelayAutostart({ home, workspace, policy: resolve(workspace, '.dharma', 'approved-policy.json'),
3298
+ // Keep previous launcher bytes intact until startup ownership and version
3299
+ // admit this operation; the supported upgrade relies on those exact bytes.
3300
+ const launcher = await step(() => installStableRepositoryLauncher(workspace));
3301
+ const autostart = await step(() => enableRelayAutostart({ home, workspace, policy: resolve(workspace, '.dharma', 'approved-policy.json'),
3296
3302
  launcher: resolve(workspace, process.platform === 'win32' ? launcher.windows : launcher.shell),
3297
3303
  version: VERSION, preserveStandardAnchor: true }));
3304
+ return { launcher, autostart };
3298
3305
  })));
3299
3306
  let sharedRepositoryReady = onboarded.sharedRepositoryReady === true;
3300
3307
  const completionRequested = flags.has('complete');
@@ -4691,7 +4698,7 @@ async function requestBootstrapNamedSession(hostScope, flags) {
4691
4698
  organizationId: intent.organizationId, membershipId: intent.recipientMembershipId, deviceId: config.deviceId,
4692
4699
  workspaceId, repositoryBindingId: role.repositoryBindingId, endpointId: role.endpointId, provider: 'codex',
4693
4700
  origin: intent.origin, repositoryFingerprint: intent.repositoryFingerprint, policyRevision: policy.revision,
4694
- policyHash: sha256(canonicalize(policy)), scopeDigest: intent.scopeDigest, contractDigest: intent.contractDigest,
4701
+ policyHash: codexSetupSessionPolicyHash(policy), scopeDigest: intent.scopeDigest, contractDigest: intent.contractDigest,
4695
4702
  name, workspaceRoot: workspace, maximumCostCents: 1000, maximumTurnCostCents: 25,
4696
4703
  issuedAt: new Date().toISOString(), expiresAt: new Date(Math.min(Date.parse(intent.expiresAt), Date.parse(policy.serverAuthorization.expiresAt))).toISOString() } });
4697
4704
  await step(() => assertCodexSetupExecutionLease(sender.lease, intent));