@compforge/harness-common 0.5.1 → 0.5.3
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 +12 -2
- package/dist/file.d.ts +30 -0
- package/dist/file.js +9 -0
- package/dist/identity.d.ts +7 -0
- package/dist/identity.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/repository.d.ts +7 -1
- package/dist/repository.js +7 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,6 +27,12 @@ view during initialize, so concurrent consumers share them and dispose before th
|
|
|
27
27
|
Dependency graphs must be acyclic. A failed initialization permits retry only after successful cleanup;
|
|
28
28
|
failed cleanup poisons that key and is reported again when the root manager is disposed.
|
|
29
29
|
|
|
30
|
+
`FileDataSource` is an abstract, runtime-recognizable DataSource for one file path. Its `FileClient.read`
|
|
31
|
+
returns fresh `Uint8Array` bytes with explicit `maxBytes`, `timeoutMs` and optional cancellation.
|
|
32
|
+
An empty file succeeds; an oversized or incomplete read rejects. The source's `path` and concrete
|
|
33
|
+
location metadata let consumers attach provenance. Parsing, configuration precedence and persistence
|
|
34
|
+
belong to consumers. Platform implementations live in `@compforge/harness-toolbox/file`.
|
|
35
|
+
|
|
30
36
|
Service identifies a Component's runtime presence in an Environment. A Component belongs to a Repository
|
|
31
37
|
on a Forge. Product is a separate business identity; consumers own its many-to-many associations
|
|
32
38
|
with Components. Repository discovery and directory ownership remain consumer responsibilities.
|
|
@@ -35,7 +41,7 @@ capabilities, without duplicating these identities. For example:
|
|
|
35
41
|
|
|
36
42
|
```typescript
|
|
37
43
|
import {
|
|
38
|
-
conceptToMarkdown, knowledgeToMarkdown, stepToMarkdown, workflowToMarkdown,
|
|
44
|
+
repositoryId, conceptToMarkdown, knowledgeToMarkdown, stepToMarkdown, workflowToMarkdown,
|
|
39
45
|
type Service,
|
|
40
46
|
} from "@compforge/harness-common";
|
|
41
47
|
|
|
@@ -53,7 +59,7 @@ const service: Service = {
|
|
|
53
59
|
upstream: ["gateway"],
|
|
54
60
|
component: {
|
|
55
61
|
name: "api",
|
|
56
|
-
repository: { forge: { name: "github" }, path: "example/app" },
|
|
62
|
+
repository: { forge: { name: "github" }, path: "example/app", id() { return repositoryId(this); } },
|
|
57
63
|
},
|
|
58
64
|
environment: { name: "test" },
|
|
59
65
|
workloads: [{
|
|
@@ -63,6 +69,10 @@ const service: Service = {
|
|
|
63
69
|
};
|
|
64
70
|
```
|
|
65
71
|
|
|
72
|
+
Repository extends Identity: `id()` returns `forge.name/path`, excluding `forkedFrom`.
|
|
73
|
+
Use `repositoryId(this)` when implementing the method, including when restoring a Repository
|
|
74
|
+
from JSON; methods are not serialized.
|
|
75
|
+
|
|
66
76
|
Service and Product accept an optional description for a short introduction, and structured
|
|
67
77
|
`knowledge` for concepts, workflows, articles and dictionaries. Service knowledge covers its own
|
|
68
78
|
responsibilities, while Product knowledge covers end-to-end flows. Consumers maintain this offline
|
package/dist/file.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Client } from "./client.js";
|
|
2
|
+
import type { ClientManager } from "./client-manager.js";
|
|
3
|
+
import type { DataSource } from "./datasource.js";
|
|
4
|
+
export interface FileReadOptions {
|
|
5
|
+
/** Maximum complete file size; exceeding it rejects instead of returning a prefix. */
|
|
6
|
+
maxBytes: number;
|
|
7
|
+
/** Includes time waiting for a concurrency slot. */
|
|
8
|
+
timeoutMs: number;
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @spec Each read obtains fresh bytes from the source's bound path. Empty files succeed;
|
|
13
|
+
* missing files, incomplete reads and exceeded limits reject.
|
|
14
|
+
* @rule Parsing, configuration precedence and evidence persistence belong to consumers.
|
|
15
|
+
*/
|
|
16
|
+
export interface FileClient extends Client {
|
|
17
|
+
read(options: FileReadOptions): Promise<Uint8Array>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A single file location, discoverable without creating a client or performing I/O.
|
|
21
|
+
* @why A shared runtime type lets consumers recognize file sources without a second kind registry.
|
|
22
|
+
* @rule clientKey identifies access, not cached file contents or a Service-owned alias.
|
|
23
|
+
* @see {@link component://../../../docs/toolbox.md}
|
|
24
|
+
*/
|
|
25
|
+
export declare abstract class FileDataSource<C extends FileClient = FileClient> implements DataSource<C> {
|
|
26
|
+
abstract readonly path: string;
|
|
27
|
+
readonly description?: string;
|
|
28
|
+
abstract readonly clientKey: string;
|
|
29
|
+
abstract createClient(clients: Pick<ClientManager, "get">, signal: AbortSignal): C;
|
|
30
|
+
}
|
package/dist/file.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single file location, discoverable without creating a client or performing I/O.
|
|
3
|
+
* @why A shared runtime type lets consumers recognize file sources without a second kind registry.
|
|
4
|
+
* @rule clientKey identifies access, not cached file contents or a Service-owned alias.
|
|
5
|
+
* @see {@link component://../../../docs/toolbox.md}
|
|
6
|
+
*/
|
|
7
|
+
export class FileDataSource {
|
|
8
|
+
description;
|
|
9
|
+
}
|
package/dist/identity.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/repository.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Forge } from "./forge.js";
|
|
2
|
+
import type { Identity } from "./identity.js";
|
|
2
3
|
/**
|
|
3
4
|
* A repository identified by its Forge and path within that Forge.
|
|
4
5
|
* @spec forkedFrom is the direct parent path within the same Forge instance, not repository identity.
|
|
5
6
|
* @see {@link component://docs/kernel.md}
|
|
6
7
|
*/
|
|
7
|
-
export interface Repository {
|
|
8
|
+
export interface Repository extends Identity {
|
|
8
9
|
readonly forge: Forge;
|
|
9
10
|
readonly path: string;
|
|
10
11
|
/**
|
|
@@ -13,3 +14,8 @@ export interface Repository {
|
|
|
13
14
|
*/
|
|
14
15
|
readonly forkedFrom?: string | null;
|
|
15
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Derive the Repository.id() value from identity fields.
|
|
19
|
+
* @spec Repository identity is forge.name/path; fork provenance is excluded.
|
|
20
|
+
*/
|
|
21
|
+
export declare function repositoryId(repository: Pick<Repository, "forge" | "path">): string;
|
package/dist/repository.js
CHANGED