@quantiya/codevibe-core 2.0.77 → 2.0.78

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.
@@ -403,6 +403,63 @@ export declare const WORKSPACE_TREE_FINGERPRINT_TIMEOUT_MS = 3000;
403
403
  export declare function probeWorkspaceTreeFingerprint(workspaceRoot: string, options?: {
404
404
  timeoutMs?: number;
405
405
  }): Promise<WorkspaceTreeFingerprintProbe>;
406
+ /** Budget of the git-free walk below; past it the probe fails (fail closed). */
407
+ export declare const ADVISORY_WALK_FINGERPRINT_TIMEOUT_MS = 10000;
408
+ /** Entry cap of the git-free walk below; past it the probe fails (fail closed). */
409
+ export declare const ADVISORY_WALK_FINGERPRINT_MAX_ENTRIES = 200000;
410
+ export type AdvisoryWorkspaceFingerprintProbe = {
411
+ kind: 'fingerprint';
412
+ method: 'git' | 'walk';
413
+ value: string;
414
+ entries: number;
415
+ durationMs: number;
416
+ } | {
417
+ kind: 'probe-failed';
418
+ method: 'git' | 'walk' | 'marker';
419
+ reason: string;
420
+ durationMs: number;
421
+ };
422
+ /**
423
+ * The before/after fingerprint of a read-only advisory turn (`@agent` /
424
+ * `@all`), which fails closed when the two differ or cannot be taken.
425
+ *
426
+ * Inside a git repository (a `.git` entry or git-directory shape in the workspace
427
+ * or any ancestor that git accepts, or a repository-locating GIT_* variable) this
428
+ * is {@link probeWorkspaceTreeFingerprint}, unchanged. A folder that is not a
429
+ * repository — no `.git` at all, a `.git` that git rejects (git's own "not a git
430
+ * repository" failure), or no `git` binary (ENOENT; the macOS shim without the
431
+ * command-line tools is a git failure, so that case fails closed) — is walked
432
+ * instead; with no `.git` marker `git` is never run — 2.0 workspaces are git-free,
433
+ * and on a Mac without the command-line tools `/usr/bin/git` opens an install
434
+ * dialog. A marker check that cannot conclude refuses the turn. Core 2.0.77 used
435
+ * the git probe for every folder, so every advisory turn outside a repository
436
+ * failed closed before any agent ran.
437
+ *
438
+ * The walk records the root's mode and each entry's relative path, type and mode; for files and
439
+ * symlinks also size, mtime (rounded to the nearest second) and inode, and a symlink's target.
440
+ * ctime is left out and mtime is coarse on purpose: in an iCloud-synced folder
441
+ * the sync client moves ctime and file flags without changing content, and a
442
+ * file downloaded again because the agent read it comes back with its mtime off
443
+ * by nanoseconds; without git's content index the walk cannot tell those apart
444
+ * from edits, so they would fail the turn. The cost is that a same-size in-place
445
+ * rewrite whose new mtime rounds to the same whole second as the old one (up to
446
+ * half a second either side of it), or whose mtime is put back, goes unseen; the agents are read-only by their own
447
+ * invocations, and this check is the backstop. Symlinks are not followed. A
448
+ * subfolder or entry that cannot be read is recorded with its error code (so
449
+ * changes inside it go unseen), but a root that cannot be listed fails the
450
+ * probe. A deadline races the asynchronous work — a stalled `readdir` or `lstat`
451
+ * cannot hold the turn, though the stalled call itself keeps its libuv worker
452
+ * until the OS answers — and an entry cap is applied while a folder is read; past
453
+ * either it is `probe-failed`. The final sort and hash are synchronous and cannot
454
+ * be interrupted: if they run past the deadline, the result is `probe-failed`
455
+ * (`timeout`) when they finish, never a late success. The method is part of the value,
456
+ * so a `.git` that appears during the turn also reads as a change. Never
457
+ * throws.
458
+ */
459
+ export declare function probeAdvisoryWorkspaceFingerprint(workspaceRoot: string, options?: {
460
+ timeoutMs?: number;
461
+ maxEntries?: number;
462
+ }): Promise<AdvisoryWorkspaceFingerprintProbe>;
406
463
  /**
407
464
  * Hash the generation inputs (§4.2 conjunct (d)). A `StructuralSummary` is a
408
465
  * pure function of `tree content × generation inputs`; this hashes the
@@ -0,0 +1,19 @@
1
+ /**
2
+ * `present` — `dir` (resolved as git resolves it) or an ancestor holds a `.git` entry, or may itself be a git directory
3
+ * (`HEAD` plus a `commondir` file or `objects` + `refs`: a bare repository); `absent` — at every level `.git` is
4
+ * missing and the folder is definitely not a git directory (`HEAD` missing or of another type, or `objects`/`refs`
5
+ * missing), so git cannot find a repository; `unknown` — the folder could not be resolved, or a level could not be
6
+ * checked (EACCES, EIO, …), so absence is not proven.
7
+ */
8
+ export type GitMarkerState = 'present' | 'absent' | 'unknown';
9
+ export declare function gitMarkerState(dir: string): Promise<GitMarkerState>;
10
+ /**
11
+ * True when the environment can point git at a repository (or at parts of one) whatever the folder holds: `GIT_DIR`,
12
+ * `GIT_WORK_TREE`, `GIT_OBJECT_DIRECTORY`, `GIT_COMMON_DIR`. Callers then defer to git instead of the marker check.
13
+ */
14
+ export declare function gitEnvSelectsRepository(): boolean;
15
+ /**
16
+ * False only when git provably could not find a repository for `dir`: no repository-locating environment variable and
17
+ * the marker check is `absent`. `unknown` is true, so callers run git and keep exactly the answer they gave before.
18
+ */
19
+ export declare function gitMayApply(dir: string): Promise<boolean>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantiya/codevibe-core",
3
- "version": "2.0.77",
3
+ "version": "2.0.78",
4
4
  "description": "Core library for CodeVibe plugins - shared keychain, crypto, AppSync, and auth functionality",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",