@prefactor/core 0.1.1 → 0.2.1
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 +35 -2
- package/dist/agent/instance-manager.d.ts +16 -0
- package/dist/agent/instance-manager.d.ts.map +1 -0
- package/dist/agent/instance-manager.js +50 -0
- package/dist/agent/instance-manager.js.map +1 -0
- package/dist/config.d.ts +28 -52
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +33 -18
- package/dist/config.js.map +1 -1
- package/dist/create-core.d.ts +10 -0
- package/dist/create-core.d.ts.map +1 -0
- package/dist/create-core.js +31 -0
- package/dist/create-core.js.map +1 -0
- package/dist/index.cjs +632 -256
- package/dist/index.cjs.map +18 -11
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +633 -257
- package/dist/index.js.map +18 -11
- package/dist/queue/actions.d.ts +24 -0
- package/dist/queue/actions.d.ts.map +1 -0
- package/dist/queue/actions.js +2 -0
- package/dist/queue/actions.js.map +1 -0
- package/dist/queue/base.d.ts +19 -0
- package/dist/queue/base.d.ts.map +1 -0
- package/dist/{transport → queue}/base.js.map +1 -1
- package/dist/queue/in-memory-queue.d.ts +11 -0
- package/dist/queue/in-memory-queue.d.ts.map +1 -0
- package/dist/queue/in-memory-queue.js +46 -0
- package/dist/queue/in-memory-queue.js.map +1 -0
- package/dist/queue/task-executor.d.ts +18 -0
- package/dist/queue/task-executor.d.ts.map +1 -0
- package/dist/queue/task-executor.js +77 -0
- package/dist/queue/task-executor.js.map +1 -0
- package/dist/tracing/context.d.ts +12 -0
- package/dist/tracing/context.d.ts.map +1 -1
- package/dist/tracing/context.js +41 -5
- package/dist/tracing/context.js.map +1 -1
- package/dist/tracing/span.d.ts +7 -9
- package/dist/tracing/span.d.ts.map +1 -1
- package/dist/tracing/span.js +6 -8
- package/dist/tracing/span.js.map +1 -1
- package/dist/tracing/tracer.d.ts +5 -16
- package/dist/tracing/tracer.d.ts.map +1 -1
- package/dist/tracing/tracer.js +22 -26
- package/dist/tracing/tracer.js.map +1 -1
- package/dist/transport/http/agent-instance-client.d.ts +23 -0
- package/dist/transport/http/agent-instance-client.d.ts.map +1 -0
- package/dist/transport/http/agent-instance-client.js +25 -0
- package/dist/transport/http/agent-instance-client.js.map +1 -0
- package/dist/transport/http/agent-span-client.d.ts +25 -0
- package/dist/transport/http/agent-span-client.d.ts.map +1 -0
- package/dist/transport/http/agent-span-client.js +37 -0
- package/dist/transport/http/agent-span-client.js.map +1 -0
- package/dist/transport/http/http-client.d.ts +43 -0
- package/dist/transport/http/http-client.d.ts.map +1 -0
- package/dist/transport/http/http-client.js +127 -0
- package/dist/transport/http/http-client.js.map +1 -0
- package/dist/transport/http/retry-policy.d.ts +4 -0
- package/dist/transport/http/retry-policy.d.ts.map +1 -0
- package/dist/transport/http/retry-policy.js +10 -0
- package/dist/transport/http/retry-policy.js.map +1 -0
- package/dist/transport/http.d.ts +30 -72
- package/dist/transport/http.d.ts.map +1 -1
- package/dist/transport/http.js +146 -269
- package/dist/transport/http.js.map +1 -1
- package/dist/utils/logging.d.ts.map +1 -1
- package/dist/utils/logging.js +7 -1
- package/dist/utils/logging.js.map +1 -1
- package/package.json +1 -1
- package/dist/transport/base.d.ts +0 -38
- package/dist/transport/base.d.ts.map +0 -1
- package/dist/transport/stdio.d.ts +0 -48
- package/dist/transport/stdio.d.ts.map +0 -1
- package/dist/transport/stdio.js +0 -71
- package/dist/transport/stdio.js.map +0 -1
- /package/dist/{transport → queue}/base.js +0 -0
package/dist/transport/base.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { Span } from '../tracing/span.js';
|
|
2
|
-
/**
|
|
3
|
-
* Transport interface for emitting spans to different backends
|
|
4
|
-
*
|
|
5
|
-
* Transports are responsible for sending span data to a destination
|
|
6
|
-
* (e.g., stdout, HTTP API). They implement the strategy pattern to allow
|
|
7
|
-
* pluggable backends.
|
|
8
|
-
*/
|
|
9
|
-
export interface Transport {
|
|
10
|
-
/**
|
|
11
|
-
* Emit a span to the transport destination
|
|
12
|
-
*
|
|
13
|
-
* @param span - The span to emit
|
|
14
|
-
*/
|
|
15
|
-
emit(span: Span): void;
|
|
16
|
-
/**
|
|
17
|
-
* Finish a previously emitted span (for long-running spans like AGENT spans)
|
|
18
|
-
*
|
|
19
|
-
* @param spanId - ID of the span to finish
|
|
20
|
-
* @param endTime - End time in milliseconds since Unix epoch
|
|
21
|
-
*/
|
|
22
|
-
finishSpan(spanId: string, endTime: number): void;
|
|
23
|
-
/**
|
|
24
|
-
* Signal the start of an agent instance execution
|
|
25
|
-
*/
|
|
26
|
-
startAgentInstance(): void;
|
|
27
|
-
/**
|
|
28
|
-
* Signal the completion of an agent instance execution
|
|
29
|
-
*/
|
|
30
|
-
finishAgentInstance(): void;
|
|
31
|
-
/**
|
|
32
|
-
* Close the transport and flush any pending data
|
|
33
|
-
*
|
|
34
|
-
* @returns Promise that resolves when the transport is fully closed
|
|
35
|
-
*/
|
|
36
|
-
close(): void | Promise<void>;
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=base.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/transport/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IACxB;;;;OAIG;IACH,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAEvB;;;;;OAKG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAElD;;OAEG;IACH,kBAAkB,IAAI,IAAI,CAAC;IAE3B;;OAEG;IACH,mBAAmB,IAAI,IAAI,CAAC;IAE5B;;;;OAIG;IACH,KAAK,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { Span } from '../tracing/span.js';
|
|
2
|
-
import type { Transport } from './base.js';
|
|
3
|
-
/**
|
|
4
|
-
* STDIO transport emits spans as newline-delimited JSON to stdout.
|
|
5
|
-
*
|
|
6
|
-
* This is the default transport and requires no configuration.
|
|
7
|
-
* It's useful for local development and for piping span data to other tools.
|
|
8
|
-
*
|
|
9
|
-
* Features:
|
|
10
|
-
* - Newline-delimited JSON output
|
|
11
|
-
* - Promise-based write locking for ordering
|
|
12
|
-
* - Graceful error handling
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* const transport = new StdioTransport();
|
|
17
|
-
* const tracer = new Tracer(transport);
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export declare class StdioTransport implements Transport {
|
|
21
|
-
private closed;
|
|
22
|
-
private writeLock;
|
|
23
|
-
/**
|
|
24
|
-
* Emit a span to stdout as JSON
|
|
25
|
-
*
|
|
26
|
-
* @param span - The span to emit
|
|
27
|
-
*/
|
|
28
|
-
emit(span: Span): void;
|
|
29
|
-
/**
|
|
30
|
-
* No-op for stdio transport (not applicable)
|
|
31
|
-
*/
|
|
32
|
-
finishSpan(): void;
|
|
33
|
-
/**
|
|
34
|
-
* No-op for stdio transport (not applicable)
|
|
35
|
-
*/
|
|
36
|
-
startAgentInstance(): void;
|
|
37
|
-
/**
|
|
38
|
-
* No-op for stdio transport (not applicable)
|
|
39
|
-
*/
|
|
40
|
-
finishAgentInstance(): void;
|
|
41
|
-
/**
|
|
42
|
-
* Close the transport and wait for pending writes to complete
|
|
43
|
-
*
|
|
44
|
-
* @returns Promise that resolves when all writes are complete
|
|
45
|
-
*/
|
|
46
|
-
close(): Promise<void>;
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=stdio.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../../src/transport/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,cAAe,YAAW,SAAS;IAC9C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAqB;IAEtC;;;;OAIG;IACH,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAiBtB;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;OAEG;IACH,kBAAkB,IAAI,IAAI;IAI1B;;OAEG;IACH,mBAAmB,IAAI,IAAI;IAI3B;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAI7B"}
|
package/dist/transport/stdio.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { serializeValue } from '../utils/serialization.js';
|
|
2
|
-
/**
|
|
3
|
-
* STDIO transport emits spans as newline-delimited JSON to stdout.
|
|
4
|
-
*
|
|
5
|
-
* This is the default transport and requires no configuration.
|
|
6
|
-
* It's useful for local development and for piping span data to other tools.
|
|
7
|
-
*
|
|
8
|
-
* Features:
|
|
9
|
-
* - Newline-delimited JSON output
|
|
10
|
-
* - Promise-based write locking for ordering
|
|
11
|
-
* - Graceful error handling
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* const transport = new StdioTransport();
|
|
16
|
-
* const tracer = new Tracer(transport);
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export class StdioTransport {
|
|
20
|
-
closed = false;
|
|
21
|
-
writeLock = Promise.resolve();
|
|
22
|
-
/**
|
|
23
|
-
* Emit a span to stdout as JSON
|
|
24
|
-
*
|
|
25
|
-
* @param span - The span to emit
|
|
26
|
-
*/
|
|
27
|
-
emit(span) {
|
|
28
|
-
if (this.closed) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
// Queue write to maintain ordering
|
|
32
|
-
this.writeLock = this.writeLock.then(async () => {
|
|
33
|
-
try {
|
|
34
|
-
const serialized = serializeValue(span);
|
|
35
|
-
const json = JSON.stringify(serialized);
|
|
36
|
-
await Bun.write(Bun.stdout, `${json}\n`);
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
console.error('Failed to emit span to stdout:', error);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* No-op for stdio transport (not applicable)
|
|
45
|
-
*/
|
|
46
|
-
finishSpan() {
|
|
47
|
-
// No-op for stdio transport
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* No-op for stdio transport (not applicable)
|
|
51
|
-
*/
|
|
52
|
-
startAgentInstance() {
|
|
53
|
-
// No-op for stdio transport
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* No-op for stdio transport (not applicable)
|
|
57
|
-
*/
|
|
58
|
-
finishAgentInstance() {
|
|
59
|
-
// No-op for stdio transport
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Close the transport and wait for pending writes to complete
|
|
63
|
-
*
|
|
64
|
-
* @returns Promise that resolves when all writes are complete
|
|
65
|
-
*/
|
|
66
|
-
async close() {
|
|
67
|
-
this.closed = true;
|
|
68
|
-
await this.writeLock;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=stdio.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../../src/transport/stdio.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,cAAc;IACjB,MAAM,GAAG,KAAK,CAAC;IACf,SAAS,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAEtC;;;;OAIG;IACH,IAAI,CAAC,IAAU;QACb,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,OAAO;QACT,CAAC;QAED,mCAAmC;QACnC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE;YAC9C,IAAI,CAAC;gBACH,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;gBACxC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;gBACxC,MAAM,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,IAAI,IAAI,CAAC,CAAC;YAC3C,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;YACzD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,UAAU;QACR,4BAA4B;IAC9B,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,4BAA4B;IAC9B,CAAC;IAED;;OAEG;IACH,mBAAmB;QACjB,4BAA4B;IAC9B,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,MAAM,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;CACF"}
|
|
File without changes
|