@almadar/workspace 0.3.0 → 0.4.0
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/__tests__/list-workspaces.test.d.ts +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +41 -3
- package/dist/index.js.map +1 -1
- package/dist/list-workspaces.d.ts +14 -0
- package/dist/types.d.ts +20 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* `src/internal/`.
|
|
8
8
|
*/
|
|
9
9
|
export { openWorkspace } from './open-workspace.js';
|
|
10
|
+
export { listWorkspaces } from './list-workspaces.js';
|
|
10
11
|
export { openAccount } from './account.js';
|
|
11
|
-
export type { WorkspaceService, WorkspaceObserver, WorkspaceWriteEvent, WorkspaceWatchEvent, OpenWorkspaceOptions, RestoreBackend, GitHubConfig, GitStatusInfo, FileTreeNode, AccountService, AccountConfig, ProviderCredential, AccountIdentity, OpenAccountOptions, } from './types.js';
|
|
12
|
+
export type { WorkspaceService, WorkspaceObserver, WorkspaceWriteEvent, WorkspaceWatchEvent, OpenWorkspaceOptions, ListWorkspacesOptions, WorkspaceSummary, RestoreBackend, GitHubConfig, GitStatusInfo, FileTreeNode, AccountService, AccountConfig, ProviderCredential, AccountIdentity, OpenAccountOptions, } from './types.js';
|
|
12
13
|
export type { WorkspaceIndex, EmbedderPort, ResolveResult, ResolveOptions, TraitRefEmit, WorkspaceIndexStats, OrbitalIndexEntry, ExtraTraitIdentity, RetrievalResult, RetrievalOptions, RecentlyEditedOptions, EventEdge, EntityBinding, RuleBinding, RecencyEntry, IntentMaps, ComposedMaps, BM25Document, BM25Table, BM25Options, WorkspaceIndexManifest, } from './workspace-index/types.js';
|
|
13
14
|
export { DEFAULT_COERCION_THRESHOLD, DEFAULT_RETRIEVAL_TOP_K, RRF_K, WORKSPACE_INDEX_SCHEMA_VERSION, } from './workspace-index/types.js';
|
package/dist/index.js
CHANGED
|
@@ -760,8 +760,8 @@ function tokenizeSpec(spec) {
|
|
|
760
760
|
for (const p of pages) {
|
|
761
761
|
const obj = asJsonObject2(p);
|
|
762
762
|
if (!obj) continue;
|
|
763
|
-
const
|
|
764
|
-
if (typeof
|
|
763
|
+
const path11 = obj["path"];
|
|
764
|
+
if (typeof path11 === "string") pushTokens(tokens, path11);
|
|
765
765
|
}
|
|
766
766
|
}
|
|
767
767
|
const ruleOverlay = asJsonObject2(params["ruleOverlay"]);
|
|
@@ -2262,6 +2262,44 @@ async function resolveLifecycle(backend, opts) {
|
|
|
2262
2262
|
const workDir = mintSessionDir(opts.root, opts.userId);
|
|
2263
2263
|
return { workDir, appId: opts.appId };
|
|
2264
2264
|
}
|
|
2265
|
+
async function listWorkspaces(opts) {
|
|
2266
|
+
const backend = opts.backend === "memory" ? new MemoryBackend() : new LocalBackend();
|
|
2267
|
+
const userDir = path2.join(opts.root, opts.userId);
|
|
2268
|
+
if (!backend.exists(userDir)) return [];
|
|
2269
|
+
let entries;
|
|
2270
|
+
try {
|
|
2271
|
+
entries = await backend.readdir(userDir);
|
|
2272
|
+
} catch {
|
|
2273
|
+
return [];
|
|
2274
|
+
}
|
|
2275
|
+
const out = [];
|
|
2276
|
+
for (const entry of entries) {
|
|
2277
|
+
const workDir = path2.join(userDir, entry);
|
|
2278
|
+
try {
|
|
2279
|
+
if (!(await backend.stat(workDir)).isDirectory) continue;
|
|
2280
|
+
} catch {
|
|
2281
|
+
continue;
|
|
2282
|
+
}
|
|
2283
|
+
const marker = readAppMarker(backend, workDir);
|
|
2284
|
+
if (!marker) continue;
|
|
2285
|
+
const summary = { appId: marker.appId, workDir, updatedAt: marker.createdAt };
|
|
2286
|
+
const sf = schemaFile(workDir);
|
|
2287
|
+
if (backend.exists(sf)) {
|
|
2288
|
+
try {
|
|
2289
|
+
const parsed = JSON.parse(backend.readFileSync(sf));
|
|
2290
|
+
if (typeof parsed.name === "string") summary.name = parsed.name;
|
|
2291
|
+
} catch {
|
|
2292
|
+
}
|
|
2293
|
+
try {
|
|
2294
|
+
summary.updatedAt = (await backend.stat(sf)).mtimeMs;
|
|
2295
|
+
} catch {
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2298
|
+
out.push(summary);
|
|
2299
|
+
}
|
|
2300
|
+
out.sort((a, b) => (b.updatedAt ?? 0) - (a.updatedAt ?? 0));
|
|
2301
|
+
return out;
|
|
2302
|
+
}
|
|
2265
2303
|
var ACCOUNT_DIR = ".almadar";
|
|
2266
2304
|
var CONFIG_FILE = "config.json";
|
|
2267
2305
|
var CREDENTIALS_FILE = "credentials.json";
|
|
@@ -2345,6 +2383,6 @@ async function openAccount(opts = {}) {
|
|
|
2345
2383
|
};
|
|
2346
2384
|
}
|
|
2347
2385
|
|
|
2348
|
-
export { DEFAULT_COERCION_THRESHOLD, DEFAULT_RETRIEVAL_TOP_K, RRF_K, WORKSPACE_INDEX_SCHEMA_VERSION, openAccount, openWorkspace };
|
|
2386
|
+
export { DEFAULT_COERCION_THRESHOLD, DEFAULT_RETRIEVAL_TOP_K, RRF_K, WORKSPACE_INDEX_SCHEMA_VERSION, listWorkspaces, openAccount, openWorkspace };
|
|
2349
2387
|
//# sourceMappingURL=index.js.map
|
|
2350
2388
|
//# sourceMappingURL=index.js.map
|