@hasna/instructions 0.4.27 → 0.4.29
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/README.md +6 -0
- package/dist/cli/index.js +52 -6
- package/dist/index.js +51 -5
- package/dist/lib/project-context.d.ts +240 -1
- package/dist/lib/project-context.d.ts.map +1 -1
- package/dist/mcp/index.js +35 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -293,6 +293,12 @@ compatible last-known-good cache can be selected explicitly with
|
|
|
293
293
|
`--allow-stale-cache --expected-project-id <id>`; its bounded age/status is
|
|
294
294
|
visible in the rendered context.
|
|
295
295
|
|
|
296
|
+
Projects v2 bundles may carry the strict optional
|
|
297
|
+
`hasna.projects.finance_project_metadata.v1` object. Instructions validates
|
|
298
|
+
that object and preserves every accepted finance field through the bundle
|
|
299
|
+
cache and session-manifest provenance path; malformed finance metadata and
|
|
300
|
+
finance attached to a legacy v1 bundle fail closed.
|
|
301
|
+
|
|
296
302
|
Compatibility remains additive: project-context manifests keep
|
|
297
303
|
`hasna.configs.session-render/v1`, `Managed by @hasna/configs`, and
|
|
298
304
|
`ownedBy: open-configs`, while recording `canonicalOwner: instructions`. The
|
package/dist/cli/index.js
CHANGED
|
@@ -7959,7 +7959,7 @@ function parseProjectContextBundleInternal(input, allowLegacyHash, normalizeLega
|
|
|
7959
7959
|
}
|
|
7960
7960
|
const result = projectContextBundleSchema.safeParse(value);
|
|
7961
7961
|
if (!result.success) {
|
|
7962
|
-
throw new ProjectContextError("PROJECT_CONTEXT_INVALID", "bundle does not match
|
|
7962
|
+
throw new ProjectContextError("PROJECT_CONTEXT_INVALID", "bundle does not match a strict supported schema", {
|
|
7963
7963
|
issues: result.error.issues.map((issue) => ({ path: issue.path.join("."), code: issue.code, message: issue.message }))
|
|
7964
7964
|
});
|
|
7965
7965
|
}
|
|
@@ -7969,7 +7969,7 @@ function parseProjectContextBundleInternal(input, allowLegacyHash, normalizeLega
|
|
|
7969
7969
|
validateIdentityConsistency(bundle);
|
|
7970
7970
|
rejectCredentialLikeBundle(bundle);
|
|
7971
7971
|
const expected = computeProjectContextSourceHash(bundle);
|
|
7972
|
-
const matchesLegacyHash = bundle.hash !== expected && allowLegacyHash && bundle.hash === computeLegacyProjectContextSourceHash(bundle);
|
|
7972
|
+
const matchesLegacyHash = bundle.hash !== expected && allowLegacyHash && bundle.schema === PROJECT_CONTEXT_SCHEMA && bundle.hash === computeLegacyProjectContextSourceHash(bundle);
|
|
7973
7973
|
if (bundle.hash !== expected && !matchesLegacyHash) {
|
|
7974
7974
|
throw new ProjectContextError("PROJECT_CONTEXT_HASH_MISMATCH", "bundle hash does not match its canonical allowlisted payload");
|
|
7975
7975
|
}
|
|
@@ -8572,10 +8572,24 @@ function findLegacyCodewithWorkspaceSection(workspaceRoot, runtime, content, bun
|
|
|
8572
8572
|
}
|
|
8573
8573
|
return { start: section.index, end };
|
|
8574
8574
|
}
|
|
8575
|
+
function isCanonicalV1ToV2RevisionUpgrade(incoming, cache) {
|
|
8576
|
+
if (cache === null || cache.bundle.schema !== PROJECT_CONTEXT_SCHEMA || incoming.schema !== PROJECT_CONTEXT_SCHEMA_V2 || cache.project_id !== incoming.project.id || cache.bundle.project.id !== incoming.project.id || cache.revision !== incoming.revision) {
|
|
8577
|
+
return false;
|
|
8578
|
+
}
|
|
8579
|
+
const { finance: _finance, ...incomingSharedProject } = incoming.project;
|
|
8580
|
+
const projectedV1 = {
|
|
8581
|
+
...incoming,
|
|
8582
|
+
schema: PROJECT_CONTEXT_SCHEMA,
|
|
8583
|
+
project: incomingSharedProject,
|
|
8584
|
+
hash: ""
|
|
8585
|
+
};
|
|
8586
|
+
return computeProjectContextSourceHash(projectedV1) === computeProjectContextSourceHash(cache.bundle);
|
|
8587
|
+
}
|
|
8575
8588
|
function assertRevisionOrdering(plan, force) {
|
|
8576
8589
|
const observations = [];
|
|
8577
8590
|
const cache = readProjectContextCache(plan.cache_path, plan.workspace_root);
|
|
8578
8591
|
const canonicalCacheHash = cache === null ? null : computeProjectContextSourceHash(cache.bundle);
|
|
8592
|
+
const canonicalV1ToV2Upgrade = isCanonicalV1ToV2RevisionUpgrade(plan.bundle, cache);
|
|
8579
8593
|
const normalizePersistedHash = (revision, hash) => cache !== null && canonicalCacheHash !== null && revision === cache.revision && hash === cache.hash ? canonicalCacheHash : hash;
|
|
8580
8594
|
const manifest = readProjectContextManifest(plan.manifest_path, plan.workspace_root);
|
|
8581
8595
|
if (manifest) {
|
|
@@ -8613,7 +8627,8 @@ function assertRevisionOrdering(plan, force) {
|
|
|
8613
8627
|
if (ordering < 0) {
|
|
8614
8628
|
throw new ProjectContextError("PROJECT_CONTEXT_REVISION_STALE", `incoming revision ${plan.bundle.revision} is older than ${observation.source} revision ${observation.revision}`);
|
|
8615
8629
|
}
|
|
8616
|
-
|
|
8630
|
+
const isProvenV1Observation = canonicalV1ToV2Upgrade && observation.hash === canonicalCacheHash;
|
|
8631
|
+
if (ordering === 0 && plan.bundle.hash !== observation.hash && !isProvenV1Observation) {
|
|
8617
8632
|
throw new ProjectContextError("PROJECT_CONTEXT_REVISION_CONFLICT", `revision ${plan.bundle.revision} has a different hash than ${observation.source}`);
|
|
8618
8633
|
}
|
|
8619
8634
|
}
|
|
@@ -10437,7 +10452,7 @@ function sha2562(content) {
|
|
|
10437
10452
|
function isRecord(value) {
|
|
10438
10453
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
10439
10454
|
}
|
|
10440
|
-
var PROJECT_CONTEXT_SCHEMA = "hasna.projects.project_context_bundle.v1", PROJECT_CONTEXT_SCHEMA_V2 = "hasna.projects.project_context_bundle.v2", PROJECT_CONTEXT_SUPPORTED_SCHEMAS, projectContextSchema, PROJECT_CONTEXT_MAX_INPUT_BYTES, PROJECT_CONTEXT_MAX_RENDERED_BYTES, PROJECT_CONTEXT_MAX_APPROX_TOKENS = 1000, PROJECT_CONTEXT_MAX_COMMANDS = 6, PROJECT_CONTEXT_MAX_WARNINGS = 3, PROJECT_CONTEXT_FRAGMENT_PATH = ".hasna/instructions/project-context.md", PROJECT_CONTEXT_MANIFEST_PATH = ".hasna/project-context-manifest.json", PROJECT_CONTEXT_CACHE_PATH = ".hasna/project-context-cache.json", PROJECT_CONTEXT_LOCK_PATH = ".hasna/project-context.lock", PROJECT_CONTEXT_SNAPSHOT_DIR = ".hasna/project-context-snapshots", PROJECT_CONTEXT_CACHE_SCHEMA = "hasna.instructions.project-context-cache/v1", PROJECT_CONTEXT_MANAGED_COMMENT = "Managed by @hasna/configs project context", SESSION_COMPATIBILITY_MANIFEST_MAX_BYTES, FOREIGN_INPUT_MAX_BYTES, SESSION_MANAGED_OUTPUT_MAX_BYTES, SESSION_MANAGED_INPUT_MAX_BYTES, SESSION_MANAGED_OUTPUT_PATHS, SESSION_MANAGED_OUTPUT_WARN_BYTES, PROJECT_CONTEXT_LOCK_STALE_MS, LEGACY_CONFIGS_PACKAGE = "@hasna/configs", LEGACY_CONFIGS_COMPAT_VERSION = "0.2.45", LEGACY_CONFIGS_EXECUTABLE = "configs", PROJECT_KINDS, PROJECT_STATUSES, LINK_STATES, RESOLUTION_SOURCES, safeId, nullableId, producerSlug, producerName, safeOptionalDisplay, isoTimestamp, revisionSchema, hashSchema, absolutePath, commandArg, commandSchema, projectContextBundleSchema, storedManifestProjectContextSchema, storedManifestFileSchema, storedManifestObservationSchema, projectContextMetadataSnapshotSchema, projectContextCacheSchema, ProjectContextError, ProjectContextHashRace, anchoredFsOps, atomicExchange, atomicExchangeLibraries;
|
|
10455
|
+
var PROJECT_CONTEXT_SCHEMA = "hasna.projects.project_context_bundle.v1", PROJECT_CONTEXT_SCHEMA_V2 = "hasna.projects.project_context_bundle.v2", PROJECT_CONTEXT_SUPPORTED_SCHEMAS, projectContextSchema, PROJECT_CONTEXT_MAX_INPUT_BYTES, PROJECT_CONTEXT_MAX_RENDERED_BYTES, PROJECT_CONTEXT_MAX_APPROX_TOKENS = 1000, PROJECT_CONTEXT_MAX_COMMANDS = 6, PROJECT_CONTEXT_MAX_WARNINGS = 3, PROJECT_CONTEXT_FRAGMENT_PATH = ".hasna/instructions/project-context.md", PROJECT_CONTEXT_MANIFEST_PATH = ".hasna/project-context-manifest.json", PROJECT_CONTEXT_CACHE_PATH = ".hasna/project-context-cache.json", PROJECT_CONTEXT_LOCK_PATH = ".hasna/project-context.lock", PROJECT_CONTEXT_SNAPSHOT_DIR = ".hasna/project-context-snapshots", PROJECT_CONTEXT_CACHE_SCHEMA = "hasna.instructions.project-context-cache/v1", PROJECT_CONTEXT_MANAGED_COMMENT = "Managed by @hasna/configs project context", SESSION_COMPATIBILITY_MANIFEST_MAX_BYTES, FOREIGN_INPUT_MAX_BYTES, SESSION_MANAGED_OUTPUT_MAX_BYTES, SESSION_MANAGED_INPUT_MAX_BYTES, SESSION_MANAGED_OUTPUT_PATHS, SESSION_MANAGED_OUTPUT_WARN_BYTES, PROJECT_CONTEXT_LOCK_STALE_MS, LEGACY_CONFIGS_PACKAGE = "@hasna/configs", LEGACY_CONFIGS_COMPAT_VERSION = "0.2.45", LEGACY_CONFIGS_EXECUTABLE = "configs", PROJECT_KINDS, PROJECT_STATUSES, LINK_STATES, RESOLUTION_SOURCES, safeId, nullableId, producerSlug, producerName, safeOptionalDisplay, isoTimestamp, revisionSchema, hashSchema, absolutePath, commandArg, financeText, financeLegalEntity, financeProjectMetadataSchema, commandSchema, projectContextBundleSchema, storedManifestProjectContextSchema, storedManifestFileSchema, storedManifestObservationSchema, projectContextMetadataSnapshotSchema, projectContextCacheSchema, ProjectContextError, ProjectContextHashRace, anchoredFsOps, atomicExchange, atomicExchangeLibraries;
|
|
10441
10456
|
var init_project_context = __esm(() => {
|
|
10442
10457
|
init_zod();
|
|
10443
10458
|
init_redact();
|
|
@@ -10486,6 +10501,28 @@ var init_project_context = __esm(() => {
|
|
|
10486
10501
|
hashSchema = exports_external.string().regex(/^sha256:[a-f0-9]{64}$/);
|
|
10487
10502
|
absolutePath = exports_external.string().min(1).max(4096).refine((value) => isAbsolute(value), "must be absolute").refine(isSafeSingleLine, "must be safe").nullable();
|
|
10488
10503
|
commandArg = exports_external.string().min(1).max(1024).refine((value) => isSafeCommandArgument(value), "unsafe argv item");
|
|
10504
|
+
financeText = exports_external.string().min(1).max(512).refine((value) => value === value.trim(), "must be normalized");
|
|
10505
|
+
financeLegalEntity = exports_external.string().min(1).max(256).refine((value) => value === value.trim(), "must be normalized");
|
|
10506
|
+
financeProjectMetadataSchema = exports_external.object({
|
|
10507
|
+
schema: exports_external.literal("hasna.projects.finance_project_metadata.v1"),
|
|
10508
|
+
business_area: exports_external.literal("finance"),
|
|
10509
|
+
jurisdiction: exports_external.string().min(2).max(64).regex(/^[A-Z0-9][A-Z0-9._:-]{1,63}$/),
|
|
10510
|
+
legal_entities: exports_external.array(financeLegalEntity).min(1).max(100).refine((values) => new Set(values).size === values.length, "must not contain duplicate legal entities"),
|
|
10511
|
+
fiscal_cycle: exports_external.enum(["monthly", "quarterly", "annual", "event-driven"]),
|
|
10512
|
+
data_classification: exports_external.enum(["public", "internal", "confidential", "restricted"]),
|
|
10513
|
+
retention_policy: financeText,
|
|
10514
|
+
ledger_authority: financeText,
|
|
10515
|
+
evidence_store: financeText,
|
|
10516
|
+
approver: financeText,
|
|
10517
|
+
external_recipient_policy: financeText
|
|
10518
|
+
}).strict().superRefine((value, context) => {
|
|
10519
|
+
if (Buffer.byteLength(JSON.stringify(value), "utf8") > 4 * 1024) {
|
|
10520
|
+
context.addIssue({
|
|
10521
|
+
code: exports_external.ZodIssueCode.custom,
|
|
10522
|
+
message: "finance project metadata exceeds the 4 KiB producer context budget"
|
|
10523
|
+
});
|
|
10524
|
+
}
|
|
10525
|
+
});
|
|
10489
10526
|
commandSchema = exports_external.object({
|
|
10490
10527
|
name: exports_external.enum(["show", "context", "why", "context-bundle"]),
|
|
10491
10528
|
argv: exports_external.array(commandArg).min(1).max(8)
|
|
@@ -10514,7 +10551,8 @@ var init_project_context = __esm(() => {
|
|
|
10514
10551
|
kind: exports_external.enum(PROJECT_KINDS),
|
|
10515
10552
|
status: exports_external.enum(PROJECT_STATUSES),
|
|
10516
10553
|
path: absolutePath,
|
|
10517
|
-
updated_at: isoTimestamp
|
|
10554
|
+
updated_at: isoTimestamp,
|
|
10555
|
+
finance: financeProjectMetadataSchema.optional()
|
|
10518
10556
|
}).strict(),
|
|
10519
10557
|
links: exports_external.object({
|
|
10520
10558
|
todos: exports_external.object({
|
|
@@ -10537,7 +10575,15 @@ var init_project_context = __esm(() => {
|
|
|
10537
10575
|
machine_id: nullableId
|
|
10538
10576
|
}).strict().nullable(),
|
|
10539
10577
|
commands: exports_external.array(commandSchema).max(PROJECT_CONTEXT_MAX_COMMANDS)
|
|
10540
|
-
}).strict()
|
|
10578
|
+
}).strict().superRefine((bundle, context) => {
|
|
10579
|
+
if (bundle.schema === PROJECT_CONTEXT_SCHEMA && bundle.project.finance !== undefined) {
|
|
10580
|
+
context.addIssue({
|
|
10581
|
+
code: exports_external.ZodIssueCode.custom,
|
|
10582
|
+
path: ["project", "finance"],
|
|
10583
|
+
message: "finance project metadata requires project-context bundle v2"
|
|
10584
|
+
});
|
|
10585
|
+
}
|
|
10586
|
+
});
|
|
10541
10587
|
storedManifestProjectContextSchema = exports_external.object({
|
|
10542
10588
|
schema: projectContextSchema,
|
|
10543
10589
|
projectId: safeId,
|
package/dist/index.js
CHANGED
|
@@ -5882,6 +5882,28 @@ var revisionSchema = exports_external.string().min(1).max(512).refine((value) =>
|
|
|
5882
5882
|
var hashSchema = exports_external.string().regex(/^sha256:[a-f0-9]{64}$/);
|
|
5883
5883
|
var absolutePath = exports_external.string().min(1).max(4096).refine((value) => isAbsolute(value), "must be absolute").refine(isSafeSingleLine, "must be safe").nullable();
|
|
5884
5884
|
var commandArg = exports_external.string().min(1).max(1024).refine((value) => isSafeCommandArgument(value), "unsafe argv item");
|
|
5885
|
+
var financeText = exports_external.string().min(1).max(512).refine((value) => value === value.trim(), "must be normalized");
|
|
5886
|
+
var financeLegalEntity = exports_external.string().min(1).max(256).refine((value) => value === value.trim(), "must be normalized");
|
|
5887
|
+
var financeProjectMetadataSchema = exports_external.object({
|
|
5888
|
+
schema: exports_external.literal("hasna.projects.finance_project_metadata.v1"),
|
|
5889
|
+
business_area: exports_external.literal("finance"),
|
|
5890
|
+
jurisdiction: exports_external.string().min(2).max(64).regex(/^[A-Z0-9][A-Z0-9._:-]{1,63}$/),
|
|
5891
|
+
legal_entities: exports_external.array(financeLegalEntity).min(1).max(100).refine((values) => new Set(values).size === values.length, "must not contain duplicate legal entities"),
|
|
5892
|
+
fiscal_cycle: exports_external.enum(["monthly", "quarterly", "annual", "event-driven"]),
|
|
5893
|
+
data_classification: exports_external.enum(["public", "internal", "confidential", "restricted"]),
|
|
5894
|
+
retention_policy: financeText,
|
|
5895
|
+
ledger_authority: financeText,
|
|
5896
|
+
evidence_store: financeText,
|
|
5897
|
+
approver: financeText,
|
|
5898
|
+
external_recipient_policy: financeText
|
|
5899
|
+
}).strict().superRefine((value, context) => {
|
|
5900
|
+
if (Buffer.byteLength(JSON.stringify(value), "utf8") > 4 * 1024) {
|
|
5901
|
+
context.addIssue({
|
|
5902
|
+
code: exports_external.ZodIssueCode.custom,
|
|
5903
|
+
message: "finance project metadata exceeds the 4 KiB producer context budget"
|
|
5904
|
+
});
|
|
5905
|
+
}
|
|
5906
|
+
});
|
|
5885
5907
|
var commandSchema = exports_external.object({
|
|
5886
5908
|
name: exports_external.enum(["show", "context", "why", "context-bundle"]),
|
|
5887
5909
|
argv: exports_external.array(commandArg).min(1).max(8)
|
|
@@ -5910,7 +5932,8 @@ var projectContextBundleSchema = exports_external.object({
|
|
|
5910
5932
|
kind: exports_external.enum(PROJECT_KINDS),
|
|
5911
5933
|
status: exports_external.enum(PROJECT_STATUSES),
|
|
5912
5934
|
path: absolutePath,
|
|
5913
|
-
updated_at: isoTimestamp
|
|
5935
|
+
updated_at: isoTimestamp,
|
|
5936
|
+
finance: financeProjectMetadataSchema.optional()
|
|
5914
5937
|
}).strict(),
|
|
5915
5938
|
links: exports_external.object({
|
|
5916
5939
|
todos: exports_external.object({
|
|
@@ -5933,7 +5956,15 @@ var projectContextBundleSchema = exports_external.object({
|
|
|
5933
5956
|
machine_id: nullableId
|
|
5934
5957
|
}).strict().nullable(),
|
|
5935
5958
|
commands: exports_external.array(commandSchema).max(PROJECT_CONTEXT_MAX_COMMANDS)
|
|
5936
|
-
}).strict()
|
|
5959
|
+
}).strict().superRefine((bundle, context) => {
|
|
5960
|
+
if (bundle.schema === PROJECT_CONTEXT_SCHEMA && bundle.project.finance !== undefined) {
|
|
5961
|
+
context.addIssue({
|
|
5962
|
+
code: exports_external.ZodIssueCode.custom,
|
|
5963
|
+
path: ["project", "finance"],
|
|
5964
|
+
message: "finance project metadata requires project-context bundle v2"
|
|
5965
|
+
});
|
|
5966
|
+
}
|
|
5967
|
+
});
|
|
5937
5968
|
var storedManifestProjectContextSchema = exports_external.object({
|
|
5938
5969
|
schema: projectContextSchema,
|
|
5939
5970
|
projectId: safeId,
|
|
@@ -6050,7 +6081,7 @@ function parseProjectContextBundleInternal(input, allowLegacyHash, normalizeLega
|
|
|
6050
6081
|
}
|
|
6051
6082
|
const result = projectContextBundleSchema.safeParse(value);
|
|
6052
6083
|
if (!result.success) {
|
|
6053
|
-
throw new ProjectContextError("PROJECT_CONTEXT_INVALID", "bundle does not match
|
|
6084
|
+
throw new ProjectContextError("PROJECT_CONTEXT_INVALID", "bundle does not match a strict supported schema", {
|
|
6054
6085
|
issues: result.error.issues.map((issue) => ({ path: issue.path.join("."), code: issue.code, message: issue.message }))
|
|
6055
6086
|
});
|
|
6056
6087
|
}
|
|
@@ -6060,7 +6091,7 @@ function parseProjectContextBundleInternal(input, allowLegacyHash, normalizeLega
|
|
|
6060
6091
|
validateIdentityConsistency(bundle);
|
|
6061
6092
|
rejectCredentialLikeBundle(bundle);
|
|
6062
6093
|
const expected = computeProjectContextSourceHash(bundle);
|
|
6063
|
-
const matchesLegacyHash = bundle.hash !== expected && allowLegacyHash && bundle.hash === computeLegacyProjectContextSourceHash(bundle);
|
|
6094
|
+
const matchesLegacyHash = bundle.hash !== expected && allowLegacyHash && bundle.schema === PROJECT_CONTEXT_SCHEMA && bundle.hash === computeLegacyProjectContextSourceHash(bundle);
|
|
6064
6095
|
if (bundle.hash !== expected && !matchesLegacyHash) {
|
|
6065
6096
|
throw new ProjectContextError("PROJECT_CONTEXT_HASH_MISMATCH", "bundle hash does not match its canonical allowlisted payload");
|
|
6066
6097
|
}
|
|
@@ -6663,10 +6694,24 @@ function findLegacyCodewithWorkspaceSection(workspaceRoot, runtime, content, bun
|
|
|
6663
6694
|
}
|
|
6664
6695
|
return { start: section.index, end };
|
|
6665
6696
|
}
|
|
6697
|
+
function isCanonicalV1ToV2RevisionUpgrade(incoming, cache) {
|
|
6698
|
+
if (cache === null || cache.bundle.schema !== PROJECT_CONTEXT_SCHEMA || incoming.schema !== PROJECT_CONTEXT_SCHEMA_V2 || cache.project_id !== incoming.project.id || cache.bundle.project.id !== incoming.project.id || cache.revision !== incoming.revision) {
|
|
6699
|
+
return false;
|
|
6700
|
+
}
|
|
6701
|
+
const { finance: _finance, ...incomingSharedProject } = incoming.project;
|
|
6702
|
+
const projectedV1 = {
|
|
6703
|
+
...incoming,
|
|
6704
|
+
schema: PROJECT_CONTEXT_SCHEMA,
|
|
6705
|
+
project: incomingSharedProject,
|
|
6706
|
+
hash: ""
|
|
6707
|
+
};
|
|
6708
|
+
return computeProjectContextSourceHash(projectedV1) === computeProjectContextSourceHash(cache.bundle);
|
|
6709
|
+
}
|
|
6666
6710
|
function assertRevisionOrdering(plan, force) {
|
|
6667
6711
|
const observations = [];
|
|
6668
6712
|
const cache = readProjectContextCache(plan.cache_path, plan.workspace_root);
|
|
6669
6713
|
const canonicalCacheHash = cache === null ? null : computeProjectContextSourceHash(cache.bundle);
|
|
6714
|
+
const canonicalV1ToV2Upgrade = isCanonicalV1ToV2RevisionUpgrade(plan.bundle, cache);
|
|
6670
6715
|
const normalizePersistedHash = (revision, hash) => cache !== null && canonicalCacheHash !== null && revision === cache.revision && hash === cache.hash ? canonicalCacheHash : hash;
|
|
6671
6716
|
const manifest = readProjectContextManifest(plan.manifest_path, plan.workspace_root);
|
|
6672
6717
|
if (manifest) {
|
|
@@ -6704,7 +6749,8 @@ function assertRevisionOrdering(plan, force) {
|
|
|
6704
6749
|
if (ordering < 0) {
|
|
6705
6750
|
throw new ProjectContextError("PROJECT_CONTEXT_REVISION_STALE", `incoming revision ${plan.bundle.revision} is older than ${observation.source} revision ${observation.revision}`);
|
|
6706
6751
|
}
|
|
6707
|
-
|
|
6752
|
+
const isProvenV1Observation = canonicalV1ToV2Upgrade && observation.hash === canonicalCacheHash;
|
|
6753
|
+
if (ordering === 0 && plan.bundle.hash !== observation.hash && !isProvenV1Observation) {
|
|
6708
6754
|
throw new ProjectContextError("PROJECT_CONTEXT_REVISION_CONFLICT", `revision ${plan.bundle.revision} has a different hash than ${observation.source}`);
|
|
6709
6755
|
}
|
|
6710
6756
|
}
|
|
@@ -44,7 +44,7 @@ export declare function isSessionManagedOutputRelativePath(relativePath: string)
|
|
|
44
44
|
export declare const LEGACY_CONFIGS_PACKAGE: "@hasna/configs";
|
|
45
45
|
export declare const LEGACY_CONFIGS_COMPAT_VERSION: "0.2.45";
|
|
46
46
|
export declare const LEGACY_CONFIGS_EXECUTABLE: "configs";
|
|
47
|
-
declare const projectContextBundleSchema: z.ZodObject<{
|
|
47
|
+
declare const projectContextBundleSchema: z.ZodEffects<z.ZodObject<{
|
|
48
48
|
schema: z.ZodEnum<["hasna.projects.project_context_bundle.v1", "hasna.projects.project_context_bundle.v2"]>;
|
|
49
49
|
generated_at: z.ZodEffects<z.ZodString, string, string>;
|
|
50
50
|
hash: z.ZodString;
|
|
@@ -87,6 +87,67 @@ declare const projectContextBundleSchema: z.ZodObject<{
|
|
|
87
87
|
status: z.ZodEnum<["active", "archived", "deleted"]>;
|
|
88
88
|
path: z.ZodNullable<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
89
89
|
updated_at: z.ZodEffects<z.ZodString, string, string>;
|
|
90
|
+
finance: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
91
|
+
schema: z.ZodLiteral<"hasna.projects.finance_project_metadata.v1">;
|
|
92
|
+
business_area: z.ZodLiteral<"finance">;
|
|
93
|
+
jurisdiction: z.ZodString;
|
|
94
|
+
legal_entities: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">, string[], string[]>;
|
|
95
|
+
fiscal_cycle: z.ZodEnum<["monthly", "quarterly", "annual", "event-driven"]>;
|
|
96
|
+
data_classification: z.ZodEnum<["public", "internal", "confidential", "restricted"]>;
|
|
97
|
+
retention_policy: z.ZodEffects<z.ZodString, string, string>;
|
|
98
|
+
ledger_authority: z.ZodEffects<z.ZodString, string, string>;
|
|
99
|
+
evidence_store: z.ZodEffects<z.ZodString, string, string>;
|
|
100
|
+
approver: z.ZodEffects<z.ZodString, string, string>;
|
|
101
|
+
external_recipient_policy: z.ZodEffects<z.ZodString, string, string>;
|
|
102
|
+
}, "strict", z.ZodTypeAny, {
|
|
103
|
+
schema: "hasna.projects.finance_project_metadata.v1";
|
|
104
|
+
business_area: "finance";
|
|
105
|
+
jurisdiction: string;
|
|
106
|
+
legal_entities: string[];
|
|
107
|
+
fiscal_cycle: "monthly" | "quarterly" | "annual" | "event-driven";
|
|
108
|
+
data_classification: "public" | "internal" | "confidential" | "restricted";
|
|
109
|
+
retention_policy: string;
|
|
110
|
+
ledger_authority: string;
|
|
111
|
+
evidence_store: string;
|
|
112
|
+
approver: string;
|
|
113
|
+
external_recipient_policy: string;
|
|
114
|
+
}, {
|
|
115
|
+
schema: "hasna.projects.finance_project_metadata.v1";
|
|
116
|
+
business_area: "finance";
|
|
117
|
+
jurisdiction: string;
|
|
118
|
+
legal_entities: string[];
|
|
119
|
+
fiscal_cycle: "monthly" | "quarterly" | "annual" | "event-driven";
|
|
120
|
+
data_classification: "public" | "internal" | "confidential" | "restricted";
|
|
121
|
+
retention_policy: string;
|
|
122
|
+
ledger_authority: string;
|
|
123
|
+
evidence_store: string;
|
|
124
|
+
approver: string;
|
|
125
|
+
external_recipient_policy: string;
|
|
126
|
+
}>, {
|
|
127
|
+
schema: "hasna.projects.finance_project_metadata.v1";
|
|
128
|
+
business_area: "finance";
|
|
129
|
+
jurisdiction: string;
|
|
130
|
+
legal_entities: string[];
|
|
131
|
+
fiscal_cycle: "monthly" | "quarterly" | "annual" | "event-driven";
|
|
132
|
+
data_classification: "public" | "internal" | "confidential" | "restricted";
|
|
133
|
+
retention_policy: string;
|
|
134
|
+
ledger_authority: string;
|
|
135
|
+
evidence_store: string;
|
|
136
|
+
approver: string;
|
|
137
|
+
external_recipient_policy: string;
|
|
138
|
+
}, {
|
|
139
|
+
schema: "hasna.projects.finance_project_metadata.v1";
|
|
140
|
+
business_area: "finance";
|
|
141
|
+
jurisdiction: string;
|
|
142
|
+
legal_entities: string[];
|
|
143
|
+
fiscal_cycle: "monthly" | "quarterly" | "annual" | "event-driven";
|
|
144
|
+
data_classification: "public" | "internal" | "confidential" | "restricted";
|
|
145
|
+
retention_policy: string;
|
|
146
|
+
ledger_authority: string;
|
|
147
|
+
evidence_store: string;
|
|
148
|
+
approver: string;
|
|
149
|
+
external_recipient_policy: string;
|
|
150
|
+
}>>;
|
|
90
151
|
}, "strict", z.ZodTypeAny, {
|
|
91
152
|
id: string;
|
|
92
153
|
name: string;
|
|
@@ -95,6 +156,19 @@ declare const projectContextBundleSchema: z.ZodObject<{
|
|
|
95
156
|
updated_at: string;
|
|
96
157
|
status: "active" | "archived" | "deleted";
|
|
97
158
|
path: string | null;
|
|
159
|
+
finance?: {
|
|
160
|
+
schema: "hasna.projects.finance_project_metadata.v1";
|
|
161
|
+
business_area: "finance";
|
|
162
|
+
jurisdiction: string;
|
|
163
|
+
legal_entities: string[];
|
|
164
|
+
fiscal_cycle: "monthly" | "quarterly" | "annual" | "event-driven";
|
|
165
|
+
data_classification: "public" | "internal" | "confidential" | "restricted";
|
|
166
|
+
retention_policy: string;
|
|
167
|
+
ledger_authority: string;
|
|
168
|
+
evidence_store: string;
|
|
169
|
+
approver: string;
|
|
170
|
+
external_recipient_policy: string;
|
|
171
|
+
} | undefined;
|
|
98
172
|
}, {
|
|
99
173
|
id: string;
|
|
100
174
|
name: string;
|
|
@@ -103,6 +177,19 @@ declare const projectContextBundleSchema: z.ZodObject<{
|
|
|
103
177
|
updated_at: string;
|
|
104
178
|
status: "active" | "archived" | "deleted";
|
|
105
179
|
path: string | null;
|
|
180
|
+
finance?: {
|
|
181
|
+
schema: "hasna.projects.finance_project_metadata.v1";
|
|
182
|
+
business_area: "finance";
|
|
183
|
+
jurisdiction: string;
|
|
184
|
+
legal_entities: string[];
|
|
185
|
+
fiscal_cycle: "monthly" | "quarterly" | "annual" | "event-driven";
|
|
186
|
+
data_classification: "public" | "internal" | "confidential" | "restricted";
|
|
187
|
+
retention_policy: string;
|
|
188
|
+
ledger_authority: string;
|
|
189
|
+
evidence_store: string;
|
|
190
|
+
approver: string;
|
|
191
|
+
external_recipient_policy: string;
|
|
192
|
+
} | undefined;
|
|
106
193
|
}>;
|
|
107
194
|
links: z.ZodObject<{
|
|
108
195
|
todos: z.ZodObject<{
|
|
@@ -201,6 +288,145 @@ declare const projectContextBundleSchema: z.ZodObject<{
|
|
|
201
288
|
updated_at: string;
|
|
202
289
|
status: "active" | "archived" | "deleted";
|
|
203
290
|
path: string | null;
|
|
291
|
+
finance?: {
|
|
292
|
+
schema: "hasna.projects.finance_project_metadata.v1";
|
|
293
|
+
business_area: "finance";
|
|
294
|
+
jurisdiction: string;
|
|
295
|
+
legal_entities: string[];
|
|
296
|
+
fiscal_cycle: "monthly" | "quarterly" | "annual" | "event-driven";
|
|
297
|
+
data_classification: "public" | "internal" | "confidential" | "restricted";
|
|
298
|
+
retention_policy: string;
|
|
299
|
+
ledger_authority: string;
|
|
300
|
+
evidence_store: string;
|
|
301
|
+
approver: string;
|
|
302
|
+
external_recipient_policy: string;
|
|
303
|
+
} | undefined;
|
|
304
|
+
};
|
|
305
|
+
schema: "hasna.projects.project_context_bundle.v1" | "hasna.projects.project_context_bundle.v2";
|
|
306
|
+
generated_at: string;
|
|
307
|
+
hash: string;
|
|
308
|
+
revision: string;
|
|
309
|
+
freshness: "unknown" | "fresh" | "stale";
|
|
310
|
+
resolution: {
|
|
311
|
+
source: "name" | "path" | "marker" | "id-or-slug";
|
|
312
|
+
conflict: boolean;
|
|
313
|
+
create_allowed: boolean;
|
|
314
|
+
};
|
|
315
|
+
authority: {
|
|
316
|
+
mode: "local" | "api";
|
|
317
|
+
owner: "projects";
|
|
318
|
+
storage: "sqlite" | "cloud" | "self-hosted";
|
|
319
|
+
availability: "available" | "unavailable";
|
|
320
|
+
};
|
|
321
|
+
links: {
|
|
322
|
+
todos: {
|
|
323
|
+
state: "linked" | "partial" | "unlinked";
|
|
324
|
+
project_id: string | null;
|
|
325
|
+
task_list_id: string | null;
|
|
326
|
+
};
|
|
327
|
+
conversations: {
|
|
328
|
+
state: "linked" | "partial" | "unlinked";
|
|
329
|
+
channel: string | null;
|
|
330
|
+
};
|
|
331
|
+
mementos: {
|
|
332
|
+
state: "linked" | "partial" | "unlinked";
|
|
333
|
+
project_id: string | null;
|
|
334
|
+
scope: string | null;
|
|
335
|
+
};
|
|
336
|
+
};
|
|
337
|
+
station: {
|
|
338
|
+
machine_id: string | null;
|
|
339
|
+
station_id: string | null;
|
|
340
|
+
} | null;
|
|
341
|
+
commands: {
|
|
342
|
+
name: "show" | "context" | "why" | "context-bundle";
|
|
343
|
+
argv: string[];
|
|
344
|
+
}[];
|
|
345
|
+
}, {
|
|
346
|
+
project: {
|
|
347
|
+
id: string;
|
|
348
|
+
name: string;
|
|
349
|
+
slug: string;
|
|
350
|
+
kind: "open-source" | "internal-app" | "platform" | "company-website" | "scaffold" | "community" | "project" | "experiment" | "docs" | "remote-only" | "generic";
|
|
351
|
+
updated_at: string;
|
|
352
|
+
status: "active" | "archived" | "deleted";
|
|
353
|
+
path: string | null;
|
|
354
|
+
finance?: {
|
|
355
|
+
schema: "hasna.projects.finance_project_metadata.v1";
|
|
356
|
+
business_area: "finance";
|
|
357
|
+
jurisdiction: string;
|
|
358
|
+
legal_entities: string[];
|
|
359
|
+
fiscal_cycle: "monthly" | "quarterly" | "annual" | "event-driven";
|
|
360
|
+
data_classification: "public" | "internal" | "confidential" | "restricted";
|
|
361
|
+
retention_policy: string;
|
|
362
|
+
ledger_authority: string;
|
|
363
|
+
evidence_store: string;
|
|
364
|
+
approver: string;
|
|
365
|
+
external_recipient_policy: string;
|
|
366
|
+
} | undefined;
|
|
367
|
+
};
|
|
368
|
+
schema: "hasna.projects.project_context_bundle.v1" | "hasna.projects.project_context_bundle.v2";
|
|
369
|
+
generated_at: string;
|
|
370
|
+
hash: string;
|
|
371
|
+
revision: string;
|
|
372
|
+
freshness: "unknown" | "fresh" | "stale";
|
|
373
|
+
resolution: {
|
|
374
|
+
source: "name" | "path" | "marker" | "id-or-slug";
|
|
375
|
+
conflict: boolean;
|
|
376
|
+
create_allowed: boolean;
|
|
377
|
+
};
|
|
378
|
+
authority: {
|
|
379
|
+
mode: "local" | "api";
|
|
380
|
+
owner: "projects";
|
|
381
|
+
storage: "sqlite" | "cloud" | "self-hosted";
|
|
382
|
+
availability: "available" | "unavailable";
|
|
383
|
+
};
|
|
384
|
+
links: {
|
|
385
|
+
todos: {
|
|
386
|
+
state: "linked" | "partial" | "unlinked";
|
|
387
|
+
project_id: string | null;
|
|
388
|
+
task_list_id: string | null;
|
|
389
|
+
};
|
|
390
|
+
conversations: {
|
|
391
|
+
state: "linked" | "partial" | "unlinked";
|
|
392
|
+
channel: string | null;
|
|
393
|
+
};
|
|
394
|
+
mementos: {
|
|
395
|
+
state: "linked" | "partial" | "unlinked";
|
|
396
|
+
project_id: string | null;
|
|
397
|
+
scope: string | null;
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
station: {
|
|
401
|
+
machine_id: string | null;
|
|
402
|
+
station_id: string | null;
|
|
403
|
+
} | null;
|
|
404
|
+
commands: {
|
|
405
|
+
name: "show" | "context" | "why" | "context-bundle";
|
|
406
|
+
argv: string[];
|
|
407
|
+
}[];
|
|
408
|
+
}>, {
|
|
409
|
+
project: {
|
|
410
|
+
id: string;
|
|
411
|
+
name: string;
|
|
412
|
+
slug: string;
|
|
413
|
+
kind: "open-source" | "internal-app" | "platform" | "company-website" | "scaffold" | "community" | "project" | "experiment" | "docs" | "remote-only" | "generic";
|
|
414
|
+
updated_at: string;
|
|
415
|
+
status: "active" | "archived" | "deleted";
|
|
416
|
+
path: string | null;
|
|
417
|
+
finance?: {
|
|
418
|
+
schema: "hasna.projects.finance_project_metadata.v1";
|
|
419
|
+
business_area: "finance";
|
|
420
|
+
jurisdiction: string;
|
|
421
|
+
legal_entities: string[];
|
|
422
|
+
fiscal_cycle: "monthly" | "quarterly" | "annual" | "event-driven";
|
|
423
|
+
data_classification: "public" | "internal" | "confidential" | "restricted";
|
|
424
|
+
retention_policy: string;
|
|
425
|
+
ledger_authority: string;
|
|
426
|
+
evidence_store: string;
|
|
427
|
+
approver: string;
|
|
428
|
+
external_recipient_policy: string;
|
|
429
|
+
} | undefined;
|
|
204
430
|
};
|
|
205
431
|
schema: "hasna.projects.project_context_bundle.v1" | "hasna.projects.project_context_bundle.v2";
|
|
206
432
|
generated_at: string;
|
|
@@ -251,6 +477,19 @@ declare const projectContextBundleSchema: z.ZodObject<{
|
|
|
251
477
|
updated_at: string;
|
|
252
478
|
status: "active" | "archived" | "deleted";
|
|
253
479
|
path: string | null;
|
|
480
|
+
finance?: {
|
|
481
|
+
schema: "hasna.projects.finance_project_metadata.v1";
|
|
482
|
+
business_area: "finance";
|
|
483
|
+
jurisdiction: string;
|
|
484
|
+
legal_entities: string[];
|
|
485
|
+
fiscal_cycle: "monthly" | "quarterly" | "annual" | "event-driven";
|
|
486
|
+
data_classification: "public" | "internal" | "confidential" | "restricted";
|
|
487
|
+
retention_policy: string;
|
|
488
|
+
ledger_authority: string;
|
|
489
|
+
evidence_store: string;
|
|
490
|
+
approver: string;
|
|
491
|
+
external_recipient_policy: string;
|
|
492
|
+
} | undefined;
|
|
254
493
|
};
|
|
255
494
|
schema: "hasna.projects.project_context_bundle.v1" | "hasna.projects.project_context_bundle.v2";
|
|
256
495
|
generated_at: string;
|
|
@@ -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;AAQ1H,eAAO,MAAM,sBAAsB,EAAG,0CAAmD,CAAC;AAC1F,eAAO,MAAM,yBAAyB,EAAG,0CAAmD,CAAC;AAG7F,eAAO,MAAM,+BAA+B,QAAW,CAAC;AACxD,eAAO,MAAM,kCAAkC,QAAW,CAAC;AAC3D,eAAO,MAAM,iCAAiC,OAAQ,CAAC;AACvD,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAC9C,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAC9C,eAAO,MAAM,6BAA6B,2CAA2C,CAAC;AACtF,eAAO,MAAM,6BAA6B,yCAAyC,CAAC;AACpF,eAAO,MAAM,0BAA0B,sCAAsC,CAAC;AAC9E,eAAO,MAAM,yBAAyB,gCAAgC,CAAC;AACvE,eAAO,MAAM,4BAA4B,qCAAqC,CAAC;AAC/E,eAAO,MAAM,4BAA4B,EAAG,6CAAsD,CAAC;AACnG,eAAO,MAAM,+BAA+B,8CAA8C,CAAC;AAI3F,eAAO,MAAM,uBAAuB,QAAa,CAAC;AAKlD,eAAO,MAAM,gCAAgC,QAA2C,CAAC;AAIzF,eAAO,MAAM,+BAA+B,QAAmC,CAAC;AAchF,eAAO,MAAM,4BAA4B,UAOxC,CAAC;AAEF;;;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O,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"}
|
package/dist/mcp/index.js
CHANGED
|
@@ -5729,7 +5729,7 @@ function isSafeSingleLine(value) {
|
|
|
5729
5729
|
function isSafeCommandArgument(value) {
|
|
5730
5730
|
return /^[A-Za-z0-9_./:@+=,-]+$/.test(value) && !value.includes("://") && !value.startsWith("-") || /^--[a-z][a-z0-9-]*$/.test(value);
|
|
5731
5731
|
}
|
|
5732
|
-
var PROJECT_CONTEXT_SCHEMA = "hasna.projects.project_context_bundle.v1", PROJECT_CONTEXT_SCHEMA_V2 = "hasna.projects.project_context_bundle.v2", PROJECT_CONTEXT_SUPPORTED_SCHEMAS, projectContextSchema, PROJECT_CONTEXT_MAX_INPUT_BYTES, PROJECT_CONTEXT_MAX_RENDERED_BYTES, PROJECT_CONTEXT_MAX_COMMANDS = 6, PROJECT_CONTEXT_FRAGMENT_PATH = ".hasna/instructions/project-context.md", PROJECT_CONTEXT_CACHE_SCHEMA = "hasna.instructions.project-context-cache/v1", SESSION_COMPATIBILITY_MANIFEST_MAX_BYTES, FOREIGN_INPUT_MAX_BYTES, SESSION_MANAGED_OUTPUT_MAX_BYTES, SESSION_MANAGED_OUTPUT_WARN_BYTES, PROJECT_CONTEXT_LOCK_STALE_MS, PROJECT_KINDS, PROJECT_STATUSES, LINK_STATES, RESOLUTION_SOURCES, safeId, nullableId, producerSlug, producerName, safeOptionalDisplay, isoTimestamp, revisionSchema, hashSchema, absolutePath, commandArg, commandSchema, projectContextBundleSchema, storedManifestProjectContextSchema, storedManifestFileSchema, storedManifestObservationSchema, projectContextMetadataSnapshotSchema, projectContextCacheSchema;
|
|
5732
|
+
var PROJECT_CONTEXT_SCHEMA = "hasna.projects.project_context_bundle.v1", PROJECT_CONTEXT_SCHEMA_V2 = "hasna.projects.project_context_bundle.v2", PROJECT_CONTEXT_SUPPORTED_SCHEMAS, projectContextSchema, PROJECT_CONTEXT_MAX_INPUT_BYTES, PROJECT_CONTEXT_MAX_RENDERED_BYTES, PROJECT_CONTEXT_MAX_COMMANDS = 6, PROJECT_CONTEXT_FRAGMENT_PATH = ".hasna/instructions/project-context.md", PROJECT_CONTEXT_CACHE_SCHEMA = "hasna.instructions.project-context-cache/v1", SESSION_COMPATIBILITY_MANIFEST_MAX_BYTES, FOREIGN_INPUT_MAX_BYTES, SESSION_MANAGED_OUTPUT_MAX_BYTES, SESSION_MANAGED_OUTPUT_WARN_BYTES, PROJECT_CONTEXT_LOCK_STALE_MS, PROJECT_KINDS, PROJECT_STATUSES, LINK_STATES, RESOLUTION_SOURCES, safeId, nullableId, producerSlug, producerName, safeOptionalDisplay, isoTimestamp, revisionSchema, hashSchema, absolutePath, commandArg, financeText, financeLegalEntity, financeProjectMetadataSchema, commandSchema, projectContextBundleSchema, storedManifestProjectContextSchema, storedManifestFileSchema, storedManifestObservationSchema, projectContextMetadataSnapshotSchema, projectContextCacheSchema;
|
|
5733
5733
|
var init_project_context = __esm(() => {
|
|
5734
5734
|
init_zod();
|
|
5735
5735
|
init_redact();
|
|
@@ -5769,6 +5769,28 @@ var init_project_context = __esm(() => {
|
|
|
5769
5769
|
hashSchema = exports_external.string().regex(/^sha256:[a-f0-9]{64}$/);
|
|
5770
5770
|
absolutePath = exports_external.string().min(1).max(4096).refine((value) => isAbsolute(value), "must be absolute").refine(isSafeSingleLine, "must be safe").nullable();
|
|
5771
5771
|
commandArg = exports_external.string().min(1).max(1024).refine((value) => isSafeCommandArgument(value), "unsafe argv item");
|
|
5772
|
+
financeText = exports_external.string().min(1).max(512).refine((value) => value === value.trim(), "must be normalized");
|
|
5773
|
+
financeLegalEntity = exports_external.string().min(1).max(256).refine((value) => value === value.trim(), "must be normalized");
|
|
5774
|
+
financeProjectMetadataSchema = exports_external.object({
|
|
5775
|
+
schema: exports_external.literal("hasna.projects.finance_project_metadata.v1"),
|
|
5776
|
+
business_area: exports_external.literal("finance"),
|
|
5777
|
+
jurisdiction: exports_external.string().min(2).max(64).regex(/^[A-Z0-9][A-Z0-9._:-]{1,63}$/),
|
|
5778
|
+
legal_entities: exports_external.array(financeLegalEntity).min(1).max(100).refine((values) => new Set(values).size === values.length, "must not contain duplicate legal entities"),
|
|
5779
|
+
fiscal_cycle: exports_external.enum(["monthly", "quarterly", "annual", "event-driven"]),
|
|
5780
|
+
data_classification: exports_external.enum(["public", "internal", "confidential", "restricted"]),
|
|
5781
|
+
retention_policy: financeText,
|
|
5782
|
+
ledger_authority: financeText,
|
|
5783
|
+
evidence_store: financeText,
|
|
5784
|
+
approver: financeText,
|
|
5785
|
+
external_recipient_policy: financeText
|
|
5786
|
+
}).strict().superRefine((value, context) => {
|
|
5787
|
+
if (Buffer.byteLength(JSON.stringify(value), "utf8") > 4 * 1024) {
|
|
5788
|
+
context.addIssue({
|
|
5789
|
+
code: exports_external.ZodIssueCode.custom,
|
|
5790
|
+
message: "finance project metadata exceeds the 4 KiB producer context budget"
|
|
5791
|
+
});
|
|
5792
|
+
}
|
|
5793
|
+
});
|
|
5772
5794
|
commandSchema = exports_external.object({
|
|
5773
5795
|
name: exports_external.enum(["show", "context", "why", "context-bundle"]),
|
|
5774
5796
|
argv: exports_external.array(commandArg).min(1).max(8)
|
|
@@ -5797,7 +5819,8 @@ var init_project_context = __esm(() => {
|
|
|
5797
5819
|
kind: exports_external.enum(PROJECT_KINDS),
|
|
5798
5820
|
status: exports_external.enum(PROJECT_STATUSES),
|
|
5799
5821
|
path: absolutePath,
|
|
5800
|
-
updated_at: isoTimestamp
|
|
5822
|
+
updated_at: isoTimestamp,
|
|
5823
|
+
finance: financeProjectMetadataSchema.optional()
|
|
5801
5824
|
}).strict(),
|
|
5802
5825
|
links: exports_external.object({
|
|
5803
5826
|
todos: exports_external.object({
|
|
@@ -5820,7 +5843,15 @@ var init_project_context = __esm(() => {
|
|
|
5820
5843
|
machine_id: nullableId
|
|
5821
5844
|
}).strict().nullable(),
|
|
5822
5845
|
commands: exports_external.array(commandSchema).max(PROJECT_CONTEXT_MAX_COMMANDS)
|
|
5823
|
-
}).strict()
|
|
5846
|
+
}).strict().superRefine((bundle, context) => {
|
|
5847
|
+
if (bundle.schema === PROJECT_CONTEXT_SCHEMA && bundle.project.finance !== undefined) {
|
|
5848
|
+
context.addIssue({
|
|
5849
|
+
code: exports_external.ZodIssueCode.custom,
|
|
5850
|
+
path: ["project", "finance"],
|
|
5851
|
+
message: "finance project metadata requires project-context bundle v2"
|
|
5852
|
+
});
|
|
5853
|
+
}
|
|
5854
|
+
});
|
|
5824
5855
|
storedManifestProjectContextSchema = exports_external.object({
|
|
5825
5856
|
schema: projectContextSchema,
|
|
5826
5857
|
projectId: safeId,
|
|
@@ -7260,7 +7291,7 @@ var init_sync_dir = __esm(() => {
|
|
|
7260
7291
|
var require_package = __commonJS((exports, module) => {
|
|
7261
7292
|
module.exports = {
|
|
7262
7293
|
name: "@hasna/instructions",
|
|
7263
|
-
version: "0.4.
|
|
7294
|
+
version: "0.4.29",
|
|
7264
7295
|
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.",
|
|
7265
7296
|
type: "module",
|
|
7266
7297
|
main: "dist/index.js",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/instructions",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.29",
|
|
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",
|