managed-deepagents 0.8.0-dev.6 → 0.8.0-dev.8
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 +85 -5
- package/dist/channels/binding.d.ts +4 -0
- package/dist/channels/binding.d.ts.map +1 -1
- package/dist/channels/binding.js +18 -3
- package/dist/channels/binding.js.map +1 -1
- package/dist/channels/http/http.d.ts.map +1 -1
- package/dist/channels/http/http.js +39 -22
- package/dist/channels/http/http.js.map +1 -1
- package/dist/channels/http/ingress.d.ts.map +1 -1
- package/dist/channels/http/ingress.js +3 -0
- package/dist/channels/http/ingress.js.map +1 -1
- package/dist/channels/http/types.d.ts +4 -0
- package/dist/channels/http/types.d.ts.map +1 -1
- package/dist/channels/response-format.d.ts +1 -1
- package/dist/channels/response-format.d.ts.map +1 -1
- package/dist/channels/response-format.js +3 -1
- package/dist/channels/response-format.js.map +1 -1
- package/dist/channels/slack/api.d.ts +13 -0
- package/dist/channels/slack/api.d.ts.map +1 -0
- package/dist/channels/slack/api.js +57 -0
- package/dist/channels/slack/api.js.map +1 -0
- package/dist/channels/slack/files-middleware.d.ts +9 -0
- package/dist/channels/slack/files-middleware.d.ts.map +1 -0
- package/dist/channels/slack/files-middleware.js +56 -0
- package/dist/channels/slack/files-middleware.js.map +1 -0
- package/dist/channels/slack/files.d.ts +15 -0
- package/dist/channels/slack/files.d.ts.map +1 -0
- package/dist/channels/slack/files.js +261 -0
- package/dist/channels/slack/files.js.map +1 -0
- package/dist/channels/slack/transport.d.ts.map +1 -1
- package/dist/channels/slack/transport.js +6 -38
- package/dist/channels/slack/transport.js.map +1 -1
- package/dist/credential-gate.d.ts +1 -1
- package/dist/credential-gate.d.ts.map +1 -1
- package/dist/credential-gate.js +28 -19
- package/dist/credential-gate.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/memory/define-memory.d.ts +1 -0
- package/dist/memory/define-memory.d.ts.map +1 -1
- package/dist/memory/define-memory.js +1 -0
- package/dist/memory/define-memory.js.map +1 -1
- package/dist/memory/index.d.ts +1 -1
- package/dist/memory/index.d.ts.map +1 -1
- package/dist/memory/index.js +1 -1
- package/dist/memory/index.js.map +1 -1
- package/dist/memory/instructions-middleware.d.ts +9 -18
- package/dist/memory/instructions-middleware.d.ts.map +1 -1
- package/dist/memory/instructions-middleware.js +50 -25
- package/dist/memory/instructions-middleware.js.map +1 -1
- package/dist/memory/layers.d.ts +0 -2
- package/dist/memory/layers.d.ts.map +1 -1
- package/dist/memory/layers.js +0 -4
- package/dist/memory/layers.js.map +1 -1
- package/dist/memory/types.d.ts +1 -1
- package/dist/memory/types.d.ts.map +1 -1
- package/dist/runtime/backend.d.ts +1 -0
- package/dist/runtime/backend.d.ts.map +1 -1
- package/dist/runtime/backend.js +35 -5
- package/dist/runtime/backend.js.map +1 -1
- package/dist/runtime/identity-runtime.d.ts +2 -0
- package/dist/runtime/identity-runtime.d.ts.map +1 -1
- package/dist/runtime/identity-runtime.js +1 -1
- package/dist/runtime/identity-runtime.js.map +1 -1
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +104 -28
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/memory/policy.d.ts +14 -1
- package/dist/runtime/memory/policy.d.ts.map +1 -1
- package/dist/runtime/memory/policy.js +34 -9
- package/dist/runtime/memory/policy.js.map +1 -1
- package/dist/runtime/memory/user-memory.d.ts.map +1 -1
- package/dist/runtime/memory/user-memory.js +5 -7
- package/dist/runtime/memory/user-memory.js.map +1 -1
- package/dist/runtime/sandbox-manager.d.ts +2 -0
- package/dist/runtime/sandbox-manager.d.ts.map +1 -1
- package/dist/runtime/sandbox-manager.js +40 -1
- package/dist/runtime/sandbox-manager.js.map +1 -1
- package/dist/runtime/types.d.ts +12 -3
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/sandbox-proxy.d.ts +39 -0
- package/dist/sandbox-proxy.d.ts.map +1 -0
- package/dist/sandbox-proxy.js +138 -0
- package/dist/sandbox-proxy.js.map +1 -0
- package/dist/sandbox.d.ts +5 -2
- package/dist/sandbox.d.ts.map +1 -1
- package/dist/sandbox.js +3 -0
- package/dist/sandbox.js.map +1 -1
- package/dist/telemetry/client.d.ts +9 -0
- package/dist/telemetry/client.d.ts.map +1 -0
- package/dist/telemetry/client.js +19 -0
- package/dist/telemetry/client.js.map +1 -0
- package/dist/telemetry/event.d.ts +13 -0
- package/dist/telemetry/event.d.ts.map +1 -0
- package/dist/telemetry/event.js +2 -0
- package/dist/telemetry/event.js.map +1 -0
- package/dist/telemetry/gates.d.ts +4 -0
- package/dist/telemetry/gates.d.ts.map +1 -0
- package/dist/telemetry/gates.js +14 -0
- package/dist/telemetry/gates.js.map +1 -0
- package/dist/telemetry/index.d.ts +10 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +6 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/metadata.d.ts +8 -0
- package/dist/telemetry/metadata.d.ts.map +1 -0
- package/dist/telemetry/metadata.js +49 -0
- package/dist/telemetry/metadata.js.map +1 -0
- package/dist/telemetry/run-listener.d.ts +20 -0
- package/dist/telemetry/run-listener.d.ts.map +1 -0
- package/dist/telemetry/run-listener.js +54 -0
- package/dist/telemetry/run-listener.js.map +1 -0
- package/dist/telemetry/run.d.ts +104 -0
- package/dist/telemetry/run.d.ts.map +1 -0
- package/dist/telemetry/run.js +65 -0
- package/dist/telemetry/run.js.map +1 -0
- package/dist/telemetry/transport/posthog.d.ts +23 -0
- package/dist/telemetry/transport/posthog.d.ts.map +1 -0
- package/dist/telemetry/transport/posthog.js +86 -0
- package/dist/telemetry/transport/posthog.js.map +1 -0
- package/dist/telemetry/transport/types.d.ts +5 -0
- package/dist/telemetry/transport/types.d.ts.map +1 -0
- package/dist/telemetry/transport/types.js +2 -0
- package/dist/telemetry/transport/types.js.map +1 -0
- package/package.json +10 -10
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { TelemetryEvent } from "./event.js";
|
|
2
|
+
declare const EVENT_TYPE = "run_completed";
|
|
3
|
+
/**
|
|
4
|
+
* `mda dev` has no LangSmith tenant, so those runs share one id rather than
|
|
5
|
+
* inflating the organization count, as the CLI folds CI runs into one `ci`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const LOCAL_DISTINCT_ID = "local";
|
|
8
|
+
export type RunEnvironment = "local" | "deployed";
|
|
9
|
+
export type RunOutcome = "success" | "failure" | "interrupted";
|
|
10
|
+
export type RunChannel = "slack" | "http" | "schedule" | "unknown";
|
|
11
|
+
export type MemoryLayerType = "agent" | "user";
|
|
12
|
+
/**
|
|
13
|
+
* `resolveUserMemoryAccess` returns the same `undefined` for several distinct
|
|
14
|
+
* denials, so adoption measured from the presence of `memory.ts` overcounts.
|
|
15
|
+
* These name the paths it collapses.
|
|
16
|
+
*/
|
|
17
|
+
export type UserMemoryDeniedReason = "not_a_person" | "not_slack_dm" | "policy_denied" | "no_context";
|
|
18
|
+
/** Whether `run_id` is the platform's or one we minted for a run without it. */
|
|
19
|
+
export type RunIdSource = "platform" | "minted";
|
|
20
|
+
/** Which filesystem a run's unrouted paths resolve against. */
|
|
21
|
+
export type BackendKind = "sandbox" | "state" | "trial_disk";
|
|
22
|
+
/** Where `instructions.md` and `/skills/` are read from, if anywhere. */
|
|
23
|
+
export type ContextSource = "hub" | "local" | "none";
|
|
24
|
+
/**
|
|
25
|
+
* `user_denied_reason` is nullable rather than optional because `JSON.stringify`
|
|
26
|
+
* drops `undefined`, and a key present in one runtime but not the other becomes
|
|
27
|
+
* a sometimes-missing warehouse column.
|
|
28
|
+
*/
|
|
29
|
+
export interface MemoryObservations {
|
|
30
|
+
layers_declared: MemoryLayerType[];
|
|
31
|
+
layers_mounted: MemoryLayerType[];
|
|
32
|
+
user_denied_reason: UserMemoryDeniedReason | null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* One completed warehouse row, created when the run ends.
|
|
36
|
+
* Per-op counts are 0..N per run, so they get their own stream keyed on `run_id`.
|
|
37
|
+
*/
|
|
38
|
+
export interface RunCompletedEvent extends TelemetryEvent {
|
|
39
|
+
event_type: typeof EVENT_TYPE;
|
|
40
|
+
tenant_id: string | null;
|
|
41
|
+
deployment_id: string | null;
|
|
42
|
+
deployment_name: string | null;
|
|
43
|
+
environment: RunEnvironment;
|
|
44
|
+
sdk_language: "node";
|
|
45
|
+
sdk_version: string;
|
|
46
|
+
run_id: string;
|
|
47
|
+
run_id_source: RunIdSource;
|
|
48
|
+
thread_id: string | null;
|
|
49
|
+
channel: RunChannel;
|
|
50
|
+
sandbox_declared: boolean;
|
|
51
|
+
identity_declared: boolean;
|
|
52
|
+
skills_declared: boolean;
|
|
53
|
+
backend_kind: BackendKind;
|
|
54
|
+
context_source: ContextSource;
|
|
55
|
+
memory: MemoryObservations;
|
|
56
|
+
outcome: RunOutcome;
|
|
57
|
+
duration_ms: number;
|
|
58
|
+
}
|
|
59
|
+
/** Application state only; it cannot be recorded as a telemetry event. */
|
|
60
|
+
export interface PendingRun {
|
|
61
|
+
identity: RunIdentity;
|
|
62
|
+
configuration: RunConfiguration;
|
|
63
|
+
runId: string;
|
|
64
|
+
runIdSource: RunIdSource;
|
|
65
|
+
threadId: string | null;
|
|
66
|
+
eventId: string;
|
|
67
|
+
startedMonotonicMs: number;
|
|
68
|
+
/** The caller's emitted-once guard; finalization does not change it. */
|
|
69
|
+
emitted: boolean;
|
|
70
|
+
}
|
|
71
|
+
/** The identity fields, derived so they are declared only on the event. */
|
|
72
|
+
export type RunIdentity = Pick<RunCompletedEvent, "tenant_id" | "deployment_id" | "deployment_name" | "environment" | "sdk_language" | "sdk_version">;
|
|
73
|
+
/** How a run was configured, all of it known before the first model call. */
|
|
74
|
+
export interface RunConfiguration {
|
|
75
|
+
channel: RunChannel;
|
|
76
|
+
sandboxDeclared: boolean;
|
|
77
|
+
identityDeclared: boolean;
|
|
78
|
+
skillsDeclared: boolean;
|
|
79
|
+
backendKind: BackendKind;
|
|
80
|
+
contextSource: ContextSource;
|
|
81
|
+
memory: MemoryObservations;
|
|
82
|
+
}
|
|
83
|
+
export interface StartRunOptions {
|
|
84
|
+
identity: RunIdentity;
|
|
85
|
+
configuration: RunConfiguration;
|
|
86
|
+
/** Platform run id. A minted fallback keeps local runs joinable to each other. */
|
|
87
|
+
runId?: string;
|
|
88
|
+
threadId?: string;
|
|
89
|
+
/** A performance.now() reading, never an epoch timestamp. */
|
|
90
|
+
startedMonotonicMs?: number;
|
|
91
|
+
eventId?: string;
|
|
92
|
+
}
|
|
93
|
+
export declare function startRun(options: StartRunOptions): PendingRun;
|
|
94
|
+
/** Create the event at completion; wall time never determines elapsed time. */
|
|
95
|
+
export declare function finishRun(pending: PendingRun, outcome: RunOutcome, overrides?: {
|
|
96
|
+
endedMonotonicMs?: number;
|
|
97
|
+
/** Completion wall time in milliseconds since the Unix epoch. */
|
|
98
|
+
completedAtMs?: number;
|
|
99
|
+
eventId?: string;
|
|
100
|
+
}): RunCompletedEvent;
|
|
101
|
+
/** Must match `format_timestamp` in the Python runtime exactly. */
|
|
102
|
+
export declare function formatTimestamp(epochMs: number): string;
|
|
103
|
+
export {};
|
|
104
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/telemetry/run.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,QAAA,MAAM,UAAU,kBAAkB,CAAC;AAEnC;;;GAGG;AACH,eAAO,MAAM,iBAAiB,UAAU,CAAC;AAEzC,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,UAAU,CAAC;AAElD,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,aAAa,CAAC;AAE/D,MAAM,MAAM,UAAU,GAAG,OA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GAAE;IACT,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iEAAiE;IACjE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CACb,GACL,iBAAiB,CAgCnB;AAED,mEAAmE;AACnE,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEvD"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
const SCHEMA_VERSION = "2026-09-15";
|
|
3
|
+
const EVENT_TYPE = "run_completed";
|
|
4
|
+
/**
|
|
5
|
+
* `mda dev` has no LangSmith tenant, so those runs share one id rather than
|
|
6
|
+
* inflating the organization count, as the CLI folds CI runs into one `ci`.
|
|
7
|
+
*/
|
|
8
|
+
export const LOCAL_DISTINCT_ID = "local";
|
|
9
|
+
export function startRun(options) {
|
|
10
|
+
const startedMonotonicMs = options.startedMonotonicMs ?? performance.now();
|
|
11
|
+
const { configuration } = options;
|
|
12
|
+
return {
|
|
13
|
+
startedMonotonicMs,
|
|
14
|
+
emitted: false,
|
|
15
|
+
identity: { ...options.identity },
|
|
16
|
+
configuration: {
|
|
17
|
+
...configuration,
|
|
18
|
+
memory: {
|
|
19
|
+
...configuration.memory,
|
|
20
|
+
layers_declared: [...configuration.memory.layers_declared],
|
|
21
|
+
layers_mounted: [...configuration.memory.layers_mounted],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
runId: options.runId ?? randomUUID(),
|
|
25
|
+
runIdSource: options.runId === undefined ? "minted" : "platform",
|
|
26
|
+
threadId: options.threadId ?? null,
|
|
27
|
+
eventId: options.eventId ?? randomUUID(),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** Create the event at completion; wall time never determines elapsed time. */
|
|
31
|
+
export function finishRun(pending, outcome, overrides = {}) {
|
|
32
|
+
const endedMonotonicMs = overrides.endedMonotonicMs ?? performance.now();
|
|
33
|
+
const completedAtMs = overrides.completedAtMs ?? Date.now();
|
|
34
|
+
const { identity, configuration } = pending;
|
|
35
|
+
return {
|
|
36
|
+
event_id: overrides.eventId ?? pending.eventId,
|
|
37
|
+
event_type: EVENT_TYPE,
|
|
38
|
+
schema_version: SCHEMA_VERSION,
|
|
39
|
+
created_at: formatTimestamp(completedAtMs),
|
|
40
|
+
distinct_id: identity.tenant_id ?? LOCAL_DISTINCT_ID,
|
|
41
|
+
tenant_id: identity.tenant_id,
|
|
42
|
+
deployment_id: identity.deployment_id,
|
|
43
|
+
deployment_name: identity.deployment_name,
|
|
44
|
+
environment: identity.environment,
|
|
45
|
+
sdk_language: identity.sdk_language,
|
|
46
|
+
sdk_version: identity.sdk_version,
|
|
47
|
+
run_id: pending.runId,
|
|
48
|
+
run_id_source: pending.runIdSource,
|
|
49
|
+
thread_id: pending.threadId,
|
|
50
|
+
channel: configuration.channel,
|
|
51
|
+
sandbox_declared: configuration.sandboxDeclared,
|
|
52
|
+
identity_declared: configuration.identityDeclared,
|
|
53
|
+
skills_declared: configuration.skillsDeclared,
|
|
54
|
+
backend_kind: configuration.backendKind,
|
|
55
|
+
context_source: configuration.contextSource,
|
|
56
|
+
memory: configuration.memory,
|
|
57
|
+
outcome,
|
|
58
|
+
duration_ms: Math.max(0, Math.floor(endedMonotonicMs - pending.startedMonotonicMs)),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/** Must match `format_timestamp` in the Python runtime exactly. */
|
|
62
|
+
export function formatTimestamp(epochMs) {
|
|
63
|
+
return new Date(epochMs).toISOString().replace(/\.(\d{3})\d*Z$/, ".$1Z");
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/telemetry/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC,MAAM,cAAc,GAAG,YAAY,CAAC;AACpC,MAA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thogConfig {
|
|
4
|
+
apiKey: string;
|
|
5
|
+
host: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function resolvePosthogConfig(env: Record<string, string | undefined>, bakedApiKey?: string): PosthogConfig | undefined;
|
|
8
|
+
export interface PosthogTransportOptions {
|
|
9
|
+
apiKey: string;
|
|
10
|
+
host?: string;
|
|
11
|
+
/** Fetch override for tests. */
|
|
12
|
+
fetch?: typeof fetch;
|
|
13
|
+
}
|
|
14
|
+
export declare class PosthogTransport implements TelemetryTransport {
|
|
15
|
+
private readonly apiKey;
|
|
16
|
+
private readonly captureUrl;
|
|
17
|
+
private readonly fetchImpl;
|
|
18
|
+
constructor(options: PosthogTransportOptions);
|
|
19
|
+
send(event: TelemetryEvent): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export declare function posthogTransport(env?: Record<string, string | undefined>): PosthogTransport | undefined;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=posthog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"posthog.d.ts","sourceRoot":"","sources":["../../../src/telemetry/transport/posthog.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AA2BrD,UAAU,aAAa;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EACvC,WAAW,GAAE,MAAgC,GAC5C,aAAa,GAAG,SAAS,CAS3B;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gCAAgC;IAChC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED,qBAAa,gBAAiB,YAAW,kBAAkB;IACzD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAM;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAe;IAEzC,YAAY,OAAO,EAAE,uBAAuB,EAO3C;IAEK,IAAI,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CA+B/C;CACF;AAED,wBAAgB,gBAAgB,CAC9B,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GACpD,gBAAgB,GAAG,SAAS,CAW9B"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { fetchWithTimeout } from "../../runtime/http.js";
|
|
2
|
+
const POSTHOG_API_KEY_ENV = "MDA_POSTHOG_API_KEY";
|
|
3
|
+
const POSTHOG_HOST_ENV = "MDA_POSTHOG_HOST";
|
|
4
|
+
const DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com";
|
|
5
|
+
const POSTHOG_CAPTURE_PATH = "/i/v0/e/";
|
|
6
|
+
/** A send is awaited at the end of a run, so it must not extend the wall clock. */
|
|
7
|
+
const REQUEST_TIMEOUT_MS = 1_000;
|
|
8
|
+
/** Public write-only key: submission only, and already in every released binary. */
|
|
9
|
+
const DEFAULT_POSTHOG_API_KEY = "phc_C6RmkdQQ3kWHgj6o7kby3aP6dbewjpLzfanw9WcmU65V";
|
|
10
|
+
function nonempty(value) {
|
|
11
|
+
const trimmed = value?.trim();
|
|
12
|
+
return trimmed ? trimmed : undefined;
|
|
13
|
+
}
|
|
14
|
+
/** `new URL` alone accepts `ftp:`/`file:`. Python's `capture_url` rejects them. */
|
|
15
|
+
function captureUrl(host) {
|
|
16
|
+
const url = new URL(`${host.replace(/\/+$/, "")}${POSTHOG_CAPTURE_PATH}`);
|
|
17
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
18
|
+
throw new Error("PostHog host must be a valid URL");
|
|
19
|
+
}
|
|
20
|
+
return url;
|
|
21
|
+
}
|
|
22
|
+
export function resolvePosthogConfig(env, bakedApiKey = DEFAULT_POSTHOG_API_KEY) {
|
|
23
|
+
const apiKey = nonempty(env[POSTHOG_API_KEY_ENV]) ?? nonempty(bakedApiKey);
|
|
24
|
+
if (apiKey === undefined) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
apiKey,
|
|
29
|
+
host: nonempty(env[POSTHOG_HOST_ENV]) ?? DEFAULT_POSTHOG_HOST,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export class PosthogTransport {
|
|
33
|
+
apiKey;
|
|
34
|
+
captureUrl;
|
|
35
|
+
fetchImpl;
|
|
36
|
+
constructor(options) {
|
|
37
|
+
if (!options.apiKey) {
|
|
38
|
+
throw new Error("PostHog project ingestion key is required");
|
|
39
|
+
}
|
|
40
|
+
this.apiKey = options.apiKey;
|
|
41
|
+
this.captureUrl = captureUrl(options.host ?? DEFAULT_POSTHOG_HOST);
|
|
42
|
+
this.fetchImpl = options.fetch ?? fetch;
|
|
43
|
+
}
|
|
44
|
+
async send(event) {
|
|
45
|
+
const response = await fetchWithTimeout(this.captureUrl.toString(), {
|
|
46
|
+
method: "POST",
|
|
47
|
+
headers: { "content-type": "application/json" },
|
|
48
|
+
body: JSON.stringify({
|
|
49
|
+
api_key: this.apiKey,
|
|
50
|
+
event: event.event_type,
|
|
51
|
+
distinct_id: event.distinct_id,
|
|
52
|
+
timestamp: event.created_at,
|
|
53
|
+
properties: {
|
|
54
|
+
// The subject is an organization, and the request leaves our
|
|
55
|
+
// infrastructure rather than the customer's, so a person profile
|
|
56
|
+
// and a geoip lookup would both describe the wrong thing.
|
|
57
|
+
$process_person_profile: false,
|
|
58
|
+
$geoip_disable: true,
|
|
59
|
+
...event,
|
|
60
|
+
},
|
|
61
|
+
}),
|
|
62
|
+
}, REQUEST_TIMEOUT_MS, this.fetchImpl);
|
|
63
|
+
try {
|
|
64
|
+
if (!response.ok) {
|
|
65
|
+
throw new Error(`PostHog rejected analytics event: ${response.status}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
finally {
|
|
69
|
+
await response.body?.cancel();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
export function posthogTransport(env = process.env) {
|
|
74
|
+
const config = resolvePosthogConfig(env);
|
|
75
|
+
if (config === undefined) {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
return new PosthogTransport({ apiKey: config.apiKey, host: config.host });
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// A malformed host must not take the runtime down with it.
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=posthog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"posthog.js","sourceRoot":"","sources":["../../../src/telemetry/transport/posthog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAIzD,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAClD,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAC5C,MAAM,oBAAoB,GAAG,0BAA0B,CAAC;AACxD,MAAM,oBAAoB,GAAG,UAAU,CAAC;AACxC,mFAAmF;AACnF,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAEjC,oFAAoF;AACpF,MAAM,uBAAuB,GAC3B,kDAAkD,CAAC;AAErD,SAAS,QAAQ,CAAC,KAAyB;IACzC,MAAM,OAAO,GAAG,KAAK,EAAE,IAAI,EAAE,CAAC;IAC9B,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AACvC,CAAC;AAED,mFAAmF;AACnF,SAAS,UAAU,CAAC,IAAY;IAC9B,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAA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O,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/telemetry/transport/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "managed-deepagents",
|
|
3
|
-
"version": "0.8.0-dev.
|
|
3
|
+
"version": "0.8.0-dev.8",
|
|
4
4
|
"description": "Managed Deep Agents — the `defineDeepAgent` authoring interface plus the CLI that compiles and deploys a code-first Deep Agent repository to a managed LangGraph runtime.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"langchain",
|
|
@@ -53,29 +53,29 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@langchain/core": "^1.2.10",
|
|
56
|
-
"@langchain/langgraph": "^1.4.
|
|
56
|
+
"@langchain/langgraph": "^1.4.17",
|
|
57
57
|
"@langchain/langgraph-sdk": "^1.10.2",
|
|
58
58
|
"@langchain/mcp-adapters": "^1.1.4",
|
|
59
59
|
"@standard-schema/spec": "^1.1.0",
|
|
60
60
|
"deepagents": "^1.13.4",
|
|
61
61
|
"hono": "^4.13.7",
|
|
62
62
|
"jose": "^6.2.12",
|
|
63
|
-
"langchain": "^1.5.
|
|
63
|
+
"langchain": "^1.5.12",
|
|
64
64
|
"langsmith": "^0.10.2",
|
|
65
65
|
"uuid": "^14.0.2",
|
|
66
66
|
"zod": "^4.6.2"
|
|
67
67
|
},
|
|
68
68
|
"optionalDependencies": {
|
|
69
|
-
"@langchain/managed-deepagents-darwin-arm64": "0.8.0-dev.
|
|
70
|
-
"@langchain/managed-deepagents-darwin-x64": "0.8.0-dev.
|
|
71
|
-
"@langchain/managed-deepagents-linux-arm64": "0.8.0-dev.
|
|
72
|
-
"@langchain/managed-deepagents-linux-x64": "0.8.0-dev.
|
|
73
|
-
"@langchain/managed-deepagents-win32-arm64": "0.8.0-dev.
|
|
74
|
-
"@langchain/managed-deepagents-win32-x64": "0.8.0-dev.
|
|
69
|
+
"@langchain/managed-deepagents-darwin-arm64": "0.8.0-dev.8",
|
|
70
|
+
"@langchain/managed-deepagents-darwin-x64": "0.8.0-dev.8",
|
|
71
|
+
"@langchain/managed-deepagents-linux-arm64": "0.8.0-dev.8",
|
|
72
|
+
"@langchain/managed-deepagents-linux-x64": "0.8.0-dev.8",
|
|
73
|
+
"@langchain/managed-deepagents-win32-arm64": "0.8.0-dev.8",
|
|
74
|
+
"@langchain/managed-deepagents-win32-x64": "0.8.0-dev.8"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@types/node": "^26.5.1",
|
|
78
|
-
"oxfmt": "^0.
|
|
78
|
+
"oxfmt": "^0.68.0",
|
|
79
79
|
"oxlint": "^1.82.0",
|
|
80
80
|
"typescript": "^7.0.2",
|
|
81
81
|
"vitest": "^5.0.0"
|