@hasna/instructions 0.4.9 → 0.4.11

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/cli/index.js CHANGED
@@ -8716,7 +8716,7 @@ function atomicWriteFile(path, content, workspaceRoot, defaultMode, expectedHash
8716
8716
  fd = null;
8717
8717
  beforeInstall?.(tempPath);
8718
8718
  assertManagedDirectoryStable(dir, workspaceRoot, directory.identity);
8719
- if (anchoredFileHash(directory, tempName) !== desiredHash) {
8719
+ if (anchoredPreparedObservation(directory, tempName, path, "before installation").hash !== desiredHash) {
8720
8720
  throw new ProjectContextHashRace(`prepared bytes changed before installation: ${relativePosix(workspaceRoot, path)}`);
8721
8721
  }
8722
8722
  if (expectedHash === undefined) {
@@ -8725,8 +8725,8 @@ function atomicWriteFile(path, content, workspaceRoot, defaultMode, expectedHash
8725
8725
  }
8726
8726
  directoryChanged = true;
8727
8727
  } else if (expectedHash === null) {
8728
- const prepared = anchoredFileObservation(directory, tempName);
8729
- if (!prepared || anchoredFileObservation(directory, targetName) !== null) {
8728
+ const prepared = anchoredPreparedObservation(directory, tempName, path, "before creation");
8729
+ if (anchoredFileObservation(directory, targetName) !== null) {
8730
8730
  throw new ProjectContextHashRace(`managed path appeared before creation: ${relativePosix(workspaceRoot, path)}`);
8731
8731
  }
8732
8732
  if (!directory.ops.linkat(directory.fd, tempName, directory.fd, targetName)) {
@@ -8734,7 +8734,8 @@ function atomicWriteFile(path, content, workspaceRoot, defaultMode, expectedHash
8734
8734
  }
8735
8735
  directoryChanged = true;
8736
8736
  const installed = anchoredFileObservation(directory, targetName);
8737
- if (!installed || installed.dev !== prepared.dev || installed.ino !== prepared.ino || anchoredFileHash(directory, tempName) !== desiredHash || installed.hash !== desiredHash) {
8737
+ const stagedHash = anchoredFileHash(directory, tempName);
8738
+ if (!installed || installed.dev !== prepared.dev || installed.ino !== prepared.ino || stagedHash !== desiredHash || installed.hash !== desiredHash) {
8738
8739
  directory.ops.unlinkat(directory.fd, tempName);
8739
8740
  preserveTemp = true;
8740
8741
  throw new ProjectContextHashRace(`prepared bytes changed during creation: ${relativePosix(workspaceRoot, path)}`);
@@ -8751,7 +8752,7 @@ function atomicWriteFile(path, content, workspaceRoot, defaultMode, expectedHash
8751
8752
  if (anchoredFileHash(directory, targetName) !== expectedHash) {
8752
8753
  throw new ProjectContextHashRace(`managed path changed before atomic replacement: ${relativePosix(workspaceRoot, path)}`);
8753
8754
  }
8754
- if (anchoredFileHash(directory, tempName) !== desiredHash) {
8755
+ if (anchoredPreparedObservation(directory, tempName, path, "before atomic replacement").hash !== desiredHash) {
8755
8756
  throw new ProjectContextHashRace(`prepared bytes changed before atomic replacement: ${relativePosix(workspaceRoot, path)}`);
8756
8757
  }
8757
8758
  atomicExchangeEntries(directory.fd, tempName, targetName);
@@ -8848,7 +8849,7 @@ function atomicWritePortable(path, content, workspaceRoot, defaultMode, expected
8848
8849
  assertManagedDirectoryStable(dir, workspaceRoot, directoryIdentity);
8849
8850
  assertNoSymlinkSegments(workspaceRoot, tempPath);
8850
8851
  assertNoSymlinkSegments(workspaceRoot, path);
8851
- if (portableFileHash(tempPath, workspaceRoot, maxObservedBytes) !== desiredHash || portableFileHash(path, workspaceRoot, maxObservedBytes) !== null) {
8852
+ if (portablePreparedHash(tempPath, path, workspaceRoot, maxObservedBytes, "before portable creation") !== desiredHash || portableFileHash(path, workspaceRoot, maxObservedBytes) !== null) {
8852
8853
  throw new ProjectContextHashRace(`managed path changed before portable creation: ${relativePosix(workspaceRoot, path)}`);
8853
8854
  }
8854
8855
  const prepared = lstatSync(tempPath);
@@ -8906,7 +8907,7 @@ function atomicWritePortableReplacement(path, content, workspaceRoot, expectedHa
8906
8907
  assertManagedDirectoryStable(dir, workspaceRoot, directoryIdentity);
8907
8908
  assertNoSymlinkSegments(workspaceRoot, tempPath);
8908
8909
  assertNoSymlinkSegments(workspaceRoot, path);
8909
- if (portableFileHash(path, workspaceRoot, maxObservedBytes) !== expectedHash || portableFileHash(tempPath, workspaceRoot, maxObservedBytes) !== desiredHash) {
8910
+ if (portableFileHash(path, workspaceRoot, maxObservedBytes) !== expectedHash || portablePreparedHash(tempPath, path, workspaceRoot, maxObservedBytes, "before portable replacement") !== desiredHash) {
8910
8911
  throw new ProjectContextHashRace(`managed path changed before portable replacement: ${relativePosix(workspaceRoot, path)}`);
8911
8912
  }
8912
8913
  renameSync(tempPath, path);
@@ -8930,6 +8931,20 @@ function atomicWritePortableReplacement(path, content, workspaceRoot, expectedHa
8930
8931
  throw error;
8931
8932
  }
8932
8933
  }
8934
+ function portablePreparedHash(tempPath, path, workspaceRoot, maxObservedBytes, stage) {
8935
+ const unreadable = (cause) => new ProjectContextError("PROJECT_CONTEXT_PREPARED_FILE_UNREADABLE", `the prepared managed file could not be read back ${stage}: ${relativePosix(workspaceRoot, path)}`, { staged_path: tempPath, stage, ...cause === undefined ? {} : { cause } });
8936
+ let hash;
8937
+ try {
8938
+ hash = portableFileHash(tempPath, workspaceRoot, maxObservedBytes);
8939
+ } catch (error) {
8940
+ if (error instanceof ProjectContextError || error instanceof ProjectContextHashRace)
8941
+ throw error;
8942
+ throw unreadable(error.message);
8943
+ }
8944
+ if (hash === null)
8945
+ throw unreadable();
8946
+ return hash;
8947
+ }
8933
8948
  function portableFileHash(path, workspaceRoot, maxObservedBytes) {
8934
8949
  if (maxObservedBytes === undefined)
8935
8950
  return currentFileHash(path, workspaceRoot);
@@ -8945,7 +8960,7 @@ function portableFileHash(path, workspaceRoot, maxObservedBytes) {
8945
8960
  return createHash2("sha256").update(readFileSync(path)).digest("hex");
8946
8961
  }
8947
8962
  function writeProjectContextCoordinatedFile(input) {
8948
- atomicWriteFile(resolve(input.path), input.content, assertSafeWorkspaceRoot(input.workspace_root), input.default_mode ?? 420, input.expected_hash, undefined, false, undefined, input.force_portable_file_ops ?? false, input.max_observed_bytes, input.allow_portable_replacement ?? false);
8963
+ atomicWriteFile(resolve(input.path), input.content, assertSafeWorkspaceRoot(input.workspace_root), input.default_mode ?? 420, input.expected_hash, undefined, false, input.test_hooks?.before_install, input.force_portable_file_ops ?? false, input.max_observed_bytes, input.allow_portable_replacement ?? false);
8949
8964
  }
8950
8965
  function removeProjectContextCoordinatedFile(input) {
8951
8966
  const workspaceRoot = assertSafeWorkspaceRoot(input.workspace_root);
@@ -9089,15 +9104,43 @@ function openAnchoredDirectory(path, workspaceRoot, providedOps, maxObservedByte
9089
9104
  }
9090
9105
  }
9091
9106
  function anchoredOpenExclusive(directory, name, mode) {
9092
- const fd = directory.ops.openat(directory.fd, name, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, mode);
9093
- if (fd < 0)
9107
+ const requestedMode = mode & 4095;
9108
+ let fd;
9109
+ try {
9110
+ fd = openSync(join4(directory.path, name), constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, requestedMode);
9111
+ } catch {
9094
9112
  throw new ProjectContextHashRace(`could not create prepared managed file in ${relativePosix(directory.workspaceRoot, directory.path)}`);
9095
- const opened = fstatSync(fd);
9096
- if (!opened.isFile()) {
9113
+ }
9114
+ try {
9115
+ const opened = fstatSync(fd);
9116
+ if (!opened.isFile()) {
9117
+ throw new ProjectContextHashRace("prepared managed output is not a regular file");
9118
+ }
9119
+ if (!isPreparedManagedFileModeUsable(requestedMode, opened.mode)) {
9120
+ throw new ProjectContextError("PROJECT_CONTEXT_PREPARED_FILE_MODE_REJECTED", `the platform created the prepared managed file with an unusable mode in ${relativePosix(directory.workspaceRoot, directory.path)}`, { requested_mode: modeLiteral(requestedMode), observed_mode: modeLiteral(opened.mode) });
9121
+ }
9122
+ assertManagedDirectoryStable(directory.path, directory.workspaceRoot, directory.identity);
9123
+ const anchored = anchoredFileObservation(directory, name);
9124
+ if (!anchored || anchored.dev !== opened.dev || anchored.ino !== opened.ino) {
9125
+ throw new ProjectContextHashRace(`prepared managed file is not the one anchored in ${relativePosix(directory.workspaceRoot, directory.path)}`);
9126
+ }
9127
+ return fd;
9128
+ } catch (error) {
9097
9129
  closeSync(fd);
9098
- throw new ProjectContextHashRace("prepared managed output is not a regular file");
9130
+ throw error;
9099
9131
  }
9100
- return fd;
9132
+ }
9133
+ function modeLiteral(mode) {
9134
+ return `0o${(mode & 4095).toString(8).padStart(3, "0")}`;
9135
+ }
9136
+ function isPreparedManagedFileModeUsable(requestedMode, observedMode) {
9137
+ const requested = requestedMode & 4095;
9138
+ const observed = observedMode & 4095;
9139
+ if ((observed & ~requested) !== 0)
9140
+ return false;
9141
+ if ((requested & 256) !== 0 && (observed & 256) === 0)
9142
+ return false;
9143
+ return true;
9101
9144
  }
9102
9145
  function anchoredFileObservation(directory, name) {
9103
9146
  const fd = directory.ops.openat(directory.fd, name, constants.O_RDONLY | constants.O_NOFOLLOW, 0);
@@ -9125,6 +9168,13 @@ function anchoredFileObservation(directory, name) {
9125
9168
  function anchoredFileHash(directory, name) {
9126
9169
  return anchoredFileObservation(directory, name)?.hash ?? null;
9127
9170
  }
9171
+ function anchoredPreparedObservation(directory, name, path, stage) {
9172
+ const observed = anchoredFileObservation(directory, name);
9173
+ if (!observed) {
9174
+ throw new ProjectContextError("PROJECT_CONTEXT_PREPARED_FILE_UNREADABLE", `the prepared managed file could not be read back ${stage}: ${relativePosix(directory.workspaceRoot, path)}`, { staged_name: name, stage });
9175
+ }
9176
+ return observed;
9177
+ }
9128
9178
  function captureManagedDirectoryIdentity(path, workspaceRoot) {
9129
9179
  assertNoSymlinkSegments(workspaceRoot, join4(path, ".project-context-directory-guard"));
9130
9180
  let stat;
@@ -10998,8 +11048,10 @@ function sourcesFromIdentityExport(value, options = {}) {
10998
11048
  function requireIdentityExportShape(record) {
10999
11049
  if (record["contract"] === "hasna.identities.configs-instructions/v1")
11000
11050
  return "configs-contract";
11001
- if (record["version"] === 1 && record["package"] === "@hasna/identities")
11051
+ const packageName = record["package"];
11052
+ if (record["version"] === 1 && typeof packageName === "string" && CANONICAL_IDENTITY_EXPORT_PACKAGES.has(packageName)) {
11002
11053
  return "canonical-open-identities";
11054
+ }
11003
11055
  throw new Error("Unsupported identity instruction export contract.");
11004
11056
  }
11005
11057
  function normalizeInstructionRules(source, tool) {
@@ -11258,7 +11310,7 @@ function asStringArray(value) {
11258
11310
  return [];
11259
11311
  return value.filter((item) => typeof item === "string");
11260
11312
  }
11261
- var RAW_STORE_ROOT_ENV = "HASNA_CONFIGS_HOME", ANTIGRAVITY_RULE_FILE_CHAR_LIMIT = 12000, SESSION_RENDERER_OWNER_ID = "instructions-session-renderer", SESSION_RENDER_TOOLS, SESSION_RENDER_PROFILE_ENTRYPOINTS, SESSION_RENDER_OWNED_CONFIG_TARGETS, CODEWITH_FLATTENED_ADAPTER, CODEWITH_NATIVE_ADAPTER, SESSION_TOOL_ADAPTERS, SESSION_RENDER_MANAGED_DIRS, SESSION_RENDER_SHARED_MANAGED_DIRS, SESSION_RENDER_EXCLUSIVE_MANAGED_PATHS, SESSION_LAYER_RANK;
11313
+ var RAW_STORE_ROOT_ENV = "HASNA_CONFIGS_HOME", ANTIGRAVITY_RULE_FILE_CHAR_LIMIT = 12000, SESSION_RENDERER_OWNER_ID = "instructions-session-renderer", SESSION_RENDER_TOOLS, SESSION_RENDER_PROFILE_ENTRYPOINTS, SESSION_RENDER_OWNED_CONFIG_TARGETS, CODEWITH_FLATTENED_ADAPTER, CODEWITH_NATIVE_ADAPTER, SESSION_TOOL_ADAPTERS, SESSION_RENDER_MANAGED_DIRS, SESSION_RENDER_SHARED_MANAGED_DIRS, SESSION_RENDER_EXCLUSIVE_MANAGED_PATHS, SESSION_LAYER_RANK, CANONICAL_IDENTITY_EXPORT_PACKAGES;
11262
11314
  var init_session_render = __esm(() => {
11263
11315
  init_global_agent_rules_standard();
11264
11316
  init_project_context();
@@ -11394,6 +11446,10 @@ var init_session_render = __esm(() => {
11394
11446
  session: 100,
11395
11447
  local: 110
11396
11448
  };
11449
+ CANONICAL_IDENTITY_EXPORT_PACKAGES = new Set([
11450
+ "@hasna/identities",
11451
+ "@hasna/personas"
11452
+ ]);
11397
11453
  });
11398
11454
 
11399
11455
  // src/lib/session-render-ownership.ts
package/dist/index.js CHANGED
@@ -6807,7 +6807,7 @@ function atomicWriteFile(path, content, workspaceRoot, defaultMode, expectedHash
6807
6807
  fd = null;
6808
6808
  beforeInstall?.(tempPath);
6809
6809
  assertManagedDirectoryStable(dir, workspaceRoot, directory.identity);
6810
- if (anchoredFileHash(directory, tempName) !== desiredHash) {
6810
+ if (anchoredPreparedObservation(directory, tempName, path, "before installation").hash !== desiredHash) {
6811
6811
  throw new ProjectContextHashRace(`prepared bytes changed before installation: ${relativePosix(workspaceRoot, path)}`);
6812
6812
  }
6813
6813
  if (expectedHash === undefined) {
@@ -6816,8 +6816,8 @@ function atomicWriteFile(path, content, workspaceRoot, defaultMode, expectedHash
6816
6816
  }
6817
6817
  directoryChanged = true;
6818
6818
  } else if (expectedHash === null) {
6819
- const prepared = anchoredFileObservation(directory, tempName);
6820
- if (!prepared || anchoredFileObservation(directory, targetName) !== null) {
6819
+ const prepared = anchoredPreparedObservation(directory, tempName, path, "before creation");
6820
+ if (anchoredFileObservation(directory, targetName) !== null) {
6821
6821
  throw new ProjectContextHashRace(`managed path appeared before creation: ${relativePosix(workspaceRoot, path)}`);
6822
6822
  }
6823
6823
  if (!directory.ops.linkat(directory.fd, tempName, directory.fd, targetName)) {
@@ -6825,7 +6825,8 @@ function atomicWriteFile(path, content, workspaceRoot, defaultMode, expectedHash
6825
6825
  }
6826
6826
  directoryChanged = true;
6827
6827
  const installed = anchoredFileObservation(directory, targetName);
6828
- if (!installed || installed.dev !== prepared.dev || installed.ino !== prepared.ino || anchoredFileHash(directory, tempName) !== desiredHash || installed.hash !== desiredHash) {
6828
+ const stagedHash = anchoredFileHash(directory, tempName);
6829
+ if (!installed || installed.dev !== prepared.dev || installed.ino !== prepared.ino || stagedHash !== desiredHash || installed.hash !== desiredHash) {
6829
6830
  directory.ops.unlinkat(directory.fd, tempName);
6830
6831
  preserveTemp = true;
6831
6832
  throw new ProjectContextHashRace(`prepared bytes changed during creation: ${relativePosix(workspaceRoot, path)}`);
@@ -6842,7 +6843,7 @@ function atomicWriteFile(path, content, workspaceRoot, defaultMode, expectedHash
6842
6843
  if (anchoredFileHash(directory, targetName) !== expectedHash) {
6843
6844
  throw new ProjectContextHashRace(`managed path changed before atomic replacement: ${relativePosix(workspaceRoot, path)}`);
6844
6845
  }
6845
- if (anchoredFileHash(directory, tempName) !== desiredHash) {
6846
+ if (anchoredPreparedObservation(directory, tempName, path, "before atomic replacement").hash !== desiredHash) {
6846
6847
  throw new ProjectContextHashRace(`prepared bytes changed before atomic replacement: ${relativePosix(workspaceRoot, path)}`);
6847
6848
  }
6848
6849
  atomicExchangeEntries(directory.fd, tempName, targetName);
@@ -6939,7 +6940,7 @@ function atomicWritePortable(path, content, workspaceRoot, defaultMode, expected
6939
6940
  assertManagedDirectoryStable(dir, workspaceRoot, directoryIdentity);
6940
6941
  assertNoSymlinkSegments(workspaceRoot, tempPath);
6941
6942
  assertNoSymlinkSegments(workspaceRoot, path);
6942
- if (portableFileHash(tempPath, workspaceRoot, maxObservedBytes) !== desiredHash || portableFileHash(path, workspaceRoot, maxObservedBytes) !== null) {
6943
+ if (portablePreparedHash(tempPath, path, workspaceRoot, maxObservedBytes, "before portable creation") !== desiredHash || portableFileHash(path, workspaceRoot, maxObservedBytes) !== null) {
6943
6944
  throw new ProjectContextHashRace(`managed path changed before portable creation: ${relativePosix(workspaceRoot, path)}`);
6944
6945
  }
6945
6946
  const prepared = lstatSync(tempPath);
@@ -6997,7 +6998,7 @@ function atomicWritePortableReplacement(path, content, workspaceRoot, expectedHa
6997
6998
  assertManagedDirectoryStable(dir, workspaceRoot, directoryIdentity);
6998
6999
  assertNoSymlinkSegments(workspaceRoot, tempPath);
6999
7000
  assertNoSymlinkSegments(workspaceRoot, path);
7000
- if (portableFileHash(path, workspaceRoot, maxObservedBytes) !== expectedHash || portableFileHash(tempPath, workspaceRoot, maxObservedBytes) !== desiredHash) {
7001
+ if (portableFileHash(path, workspaceRoot, maxObservedBytes) !== expectedHash || portablePreparedHash(tempPath, path, workspaceRoot, maxObservedBytes, "before portable replacement") !== desiredHash) {
7001
7002
  throw new ProjectContextHashRace(`managed path changed before portable replacement: ${relativePosix(workspaceRoot, path)}`);
7002
7003
  }
7003
7004
  renameSync(tempPath, path);
@@ -7021,6 +7022,20 @@ function atomicWritePortableReplacement(path, content, workspaceRoot, expectedHa
7021
7022
  throw error;
7022
7023
  }
7023
7024
  }
7025
+ function portablePreparedHash(tempPath, path, workspaceRoot, maxObservedBytes, stage) {
7026
+ const unreadable = (cause) => new ProjectContextError("PROJECT_CONTEXT_PREPARED_FILE_UNREADABLE", `the prepared managed file could not be read back ${stage}: ${relativePosix(workspaceRoot, path)}`, { staged_path: tempPath, stage, ...cause === undefined ? {} : { cause } });
7027
+ let hash;
7028
+ try {
7029
+ hash = portableFileHash(tempPath, workspaceRoot, maxObservedBytes);
7030
+ } catch (error) {
7031
+ if (error instanceof ProjectContextError || error instanceof ProjectContextHashRace)
7032
+ throw error;
7033
+ throw unreadable(error.message);
7034
+ }
7035
+ if (hash === null)
7036
+ throw unreadable();
7037
+ return hash;
7038
+ }
7024
7039
  function portableFileHash(path, workspaceRoot, maxObservedBytes) {
7025
7040
  if (maxObservedBytes === undefined)
7026
7041
  return currentFileHash(path, workspaceRoot);
@@ -7036,7 +7051,7 @@ function portableFileHash(path, workspaceRoot, maxObservedBytes) {
7036
7051
  return createHash2("sha256").update(readFileSync(path)).digest("hex");
7037
7052
  }
7038
7053
  function writeProjectContextCoordinatedFile(input) {
7039
- atomicWriteFile(resolve(input.path), input.content, assertSafeWorkspaceRoot(input.workspace_root), input.default_mode ?? 420, input.expected_hash, undefined, false, undefined, input.force_portable_file_ops ?? false, input.max_observed_bytes, input.allow_portable_replacement ?? false);
7054
+ atomicWriteFile(resolve(input.path), input.content, assertSafeWorkspaceRoot(input.workspace_root), input.default_mode ?? 420, input.expected_hash, undefined, false, input.test_hooks?.before_install, input.force_portable_file_ops ?? false, input.max_observed_bytes, input.allow_portable_replacement ?? false);
7040
7055
  }
7041
7056
  function removeProjectContextCoordinatedFile(input) {
7042
7057
  const workspaceRoot = assertSafeWorkspaceRoot(input.workspace_root);
@@ -7181,15 +7196,43 @@ function openAnchoredDirectory(path, workspaceRoot, providedOps, maxObservedByte
7181
7196
  }
7182
7197
  }
7183
7198
  function anchoredOpenExclusive(directory, name, mode) {
7184
- const fd = directory.ops.openat(directory.fd, name, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, mode);
7185
- if (fd < 0)
7199
+ const requestedMode = mode & 4095;
7200
+ let fd;
7201
+ try {
7202
+ fd = openSync(join3(directory.path, name), constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, requestedMode);
7203
+ } catch {
7186
7204
  throw new ProjectContextHashRace(`could not create prepared managed file in ${relativePosix(directory.workspaceRoot, directory.path)}`);
7187
- const opened = fstatSync(fd);
7188
- if (!opened.isFile()) {
7205
+ }
7206
+ try {
7207
+ const opened = fstatSync(fd);
7208
+ if (!opened.isFile()) {
7209
+ throw new ProjectContextHashRace("prepared managed output is not a regular file");
7210
+ }
7211
+ if (!isPreparedManagedFileModeUsable(requestedMode, opened.mode)) {
7212
+ throw new ProjectContextError("PROJECT_CONTEXT_PREPARED_FILE_MODE_REJECTED", `the platform created the prepared managed file with an unusable mode in ${relativePosix(directory.workspaceRoot, directory.path)}`, { requested_mode: modeLiteral(requestedMode), observed_mode: modeLiteral(opened.mode) });
7213
+ }
7214
+ assertManagedDirectoryStable(directory.path, directory.workspaceRoot, directory.identity);
7215
+ const anchored = anchoredFileObservation(directory, name);
7216
+ if (!anchored || anchored.dev !== opened.dev || anchored.ino !== opened.ino) {
7217
+ throw new ProjectContextHashRace(`prepared managed file is not the one anchored in ${relativePosix(directory.workspaceRoot, directory.path)}`);
7218
+ }
7219
+ return fd;
7220
+ } catch (error) {
7189
7221
  closeSync(fd);
7190
- throw new ProjectContextHashRace("prepared managed output is not a regular file");
7222
+ throw error;
7191
7223
  }
7192
- return fd;
7224
+ }
7225
+ function modeLiteral(mode) {
7226
+ return `0o${(mode & 4095).toString(8).padStart(3, "0")}`;
7227
+ }
7228
+ function isPreparedManagedFileModeUsable(requestedMode, observedMode) {
7229
+ const requested = requestedMode & 4095;
7230
+ const observed = observedMode & 4095;
7231
+ if ((observed & ~requested) !== 0)
7232
+ return false;
7233
+ if ((requested & 256) !== 0 && (observed & 256) === 0)
7234
+ return false;
7235
+ return true;
7193
7236
  }
7194
7237
  function anchoredFileObservation(directory, name) {
7195
7238
  const fd = directory.ops.openat(directory.fd, name, constants.O_RDONLY | constants.O_NOFOLLOW, 0);
@@ -7217,6 +7260,13 @@ function anchoredFileObservation(directory, name) {
7217
7260
  function anchoredFileHash(directory, name) {
7218
7261
  return anchoredFileObservation(directory, name)?.hash ?? null;
7219
7262
  }
7263
+ function anchoredPreparedObservation(directory, name, path, stage) {
7264
+ const observed = anchoredFileObservation(directory, name);
7265
+ if (!observed) {
7266
+ throw new ProjectContextError("PROJECT_CONTEXT_PREPARED_FILE_UNREADABLE", `the prepared managed file could not be read back ${stage}: ${relativePosix(directory.workspaceRoot, path)}`, { staged_name: name, stage });
7267
+ }
7268
+ return observed;
7269
+ }
7220
7270
  function captureManagedDirectoryIdentity(path, workspaceRoot) {
7221
7271
  assertNoSymlinkSegments(workspaceRoot, join3(path, ".project-context-directory-guard"));
7222
7272
  let stat;
@@ -9162,11 +9212,17 @@ function sourcesFromIdentityExport(value, options = {}) {
9162
9212
  exportShape: shape
9163
9213
  })).filter((source) => source !== null);
9164
9214
  }
9215
+ var CANONICAL_IDENTITY_EXPORT_PACKAGES = new Set([
9216
+ "@hasna/identities",
9217
+ "@hasna/personas"
9218
+ ]);
9165
9219
  function requireIdentityExportShape(record) {
9166
9220
  if (record["contract"] === "hasna.identities.configs-instructions/v1")
9167
9221
  return "configs-contract";
9168
- if (record["version"] === 1 && record["package"] === "@hasna/identities")
9222
+ const packageName = record["package"];
9223
+ if (record["version"] === 1 && typeof packageName === "string" && CANONICAL_IDENTITY_EXPORT_PACKAGES.has(packageName)) {
9169
9224
  return "canonical-open-identities";
9225
+ }
9170
9226
  throw new Error("Unsupported identity instruction export contract.");
9171
9227
  }
9172
9228
  function normalizeInstructionRules(source, tool) {
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=project-context-prepared-file.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-context-prepared-file.test.d.ts","sourceRoot":"","sources":["../../src/lib/project-context-prepared-file.test.ts"],"names":[],"mappings":""}
@@ -424,6 +424,9 @@ export declare function writeProjectContextCoordinatedFile(input: {
424
424
  max_observed_bytes?: number | null;
425
425
  allow_portable_replacement?: boolean;
426
426
  force_portable_file_ops?: boolean;
427
+ test_hooks?: {
428
+ before_install?: (tempPath: string) => void;
429
+ };
427
430
  }): void;
428
431
  export declare function removeProjectContextCoordinatedFile(input: {
429
432
  path: string;
@@ -436,5 +439,12 @@ export declare function removeProjectContextCoordinatedFile(input: {
436
439
  after_displace?: (displacedPath: string) => void;
437
440
  };
438
441
  }): void;
442
+ export declare function isPreparedManagedFileModeUsable(requestedMode: number, observedMode: number): boolean;
443
+ export declare function projectContextFileOpsDiagnostics(): {
444
+ platform: string;
445
+ arch: string;
446
+ anchored_file_ops: boolean;
447
+ atomic_exchange: boolean;
448
+ };
439
449
  export {};
440
450
  //# sourceMappingURL=project-context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"project-context.d.ts","sourceRoot":"","sources":["../../src/lib/project-context.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAG1H,eAAO,MAAM,sBAAsB,EAAG,0CAAmD,CAAC;AAC1F,eAAO,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AAM,GAAG,IAAI,CAAC;IACnC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,UAAU,CAAC,EAAE;QACX,cAAc,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;KAClD,CAAC;CACH,GAAG,IAAI,CAkEP;AAwPD,wBAAgB,+BAA+B,CAAC,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAMpG;AAMD,wBAAgB,gCAAgC,IAAI;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,OAAO,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;CAC1B,CAOA"}
@@ -0,0 +1,7 @@
1
+ /** An existing, symlink-free temp directory: the canonical form of os.tmpdir(). */
2
+ export declare function realTempDir(): string;
3
+ /** A fresh, symlink-free temp directory, safe to use as a managed workspace root. */
4
+ export declare function makeTempRoot(prefix: string): string;
5
+ /** A symlink-free path under the temp dir for a caller that creates it itself. */
6
+ export declare function tempRootPath(name: string): string;
7
+ //# sourceMappingURL=test-temp-root.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-temp-root.d.ts","sourceRoot":"","sources":["../../src/lib/test-temp-root.ts"],"names":[],"mappings":"AAiBA,mFAAmF;AACnF,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED,qFAAqF;AACrF,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,kFAAkF;AAClF,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD"}
package/dist/mcp/index.js CHANGED
@@ -5649,7 +5649,7 @@ function applyTransform(source, output, context = {}) {
5649
5649
  var init_transforms = () => {};
5650
5650
 
5651
5651
  // src/lib/session-render.ts
5652
- var ANTIGRAVITY_RULE_FILE_CHAR_LIMIT = 12000, SESSION_RENDERER_OWNER_ID = "instructions-session-renderer", SESSION_RENDER_PROFILE_ENTRYPOINTS, SESSION_RENDER_OWNED_CONFIG_TARGETS, CODEWITH_FLATTENED_ADAPTER, CODEWITH_NATIVE_ADAPTER, SESSION_TOOL_ADAPTERS, SESSION_RENDER_MANAGED_DIRS, SESSION_RENDER_SHARED_MANAGED_DIRS, SESSION_RENDER_EXCLUSIVE_MANAGED_PATHS;
5652
+ var ANTIGRAVITY_RULE_FILE_CHAR_LIMIT = 12000, SESSION_RENDERER_OWNER_ID = "instructions-session-renderer", SESSION_RENDER_PROFILE_ENTRYPOINTS, SESSION_RENDER_OWNED_CONFIG_TARGETS, CODEWITH_FLATTENED_ADAPTER, CODEWITH_NATIVE_ADAPTER, SESSION_TOOL_ADAPTERS, SESSION_RENDER_MANAGED_DIRS, SESSION_RENDER_SHARED_MANAGED_DIRS, SESSION_RENDER_EXCLUSIVE_MANAGED_PATHS, CANONICAL_IDENTITY_EXPORT_PACKAGES;
5653
5653
  var init_session_render = __esm(() => {
5654
5654
  init_global_agent_rules_standard();
5655
5655
  init_project_context();
@@ -5762,6 +5762,10 @@ var init_session_render = __esm(() => {
5762
5762
  SESSION_RENDER_MANIFEST_RELATIVE_PATH,
5763
5763
  SESSION_RENDER_SNAPSHOT_RELATIVE_DIR
5764
5764
  ];
5765
+ CANONICAL_IDENTITY_EXPORT_PACKAGES = new Set([
5766
+ "@hasna/identities",
5767
+ "@hasna/personas"
5768
+ ]);
5765
5769
  });
5766
5770
 
5767
5771
  // src/lib/session-render-ownership.ts
@@ -6788,7 +6792,7 @@ var init_sync_dir = __esm(() => {
6788
6792
  var require_package = __commonJS((exports, module) => {
6789
6793
  module.exports = {
6790
6794
  name: "@hasna/instructions",
6791
- version: "0.4.9",
6795
+ version: "0.4.11",
6792
6796
  description: "AI coding agent instruction & configuration manager \u2014 store, version, apply, and share all your AI coding configs. CLI + MCP + HTTP API (instructions-serve) + generated SDK + Dashboard.",
6793
6797
  type: "module",
6794
6798
  main: "dist/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/instructions",
3
- "version": "0.4.9",
3
+ "version": "0.4.11",
4
4
  "description": "AI coding agent instruction & configuration manager \u2014 store, version, apply, and share all your AI coding configs. CLI + MCP + HTTP API (instructions-serve) + generated SDK + Dashboard.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",