The best way to control Claude Code, Codex and more from any computer or phone

main
ts 57 lines 2.42 KB
Raw
1 import * as appsignals from "@distilled.cloud/aws/application-signals";
2 import * as Effect from "effect/Effect";
3 import * as Layer from "effect/Layer";
4 import * as AWSBindings from "../AWSBindings.ts";
5 import { GetInstrumentationConfigurationStatus } from "./GetInstrumentationConfigurationStatus.ts";
6 import type { InstrumentationConfiguration } from "./InstrumentationConfiguration.ts";
7
8 /**
9 * Bespoke implementation (not built on the shared scaffolding): the runtime
10 * callable injects the bound configuration's full identity — the
11 * type/service/environment/signal quadruple plus the location hash —
12 * rather than a single identifier field.
13 */
14 export const GetInstrumentationConfigurationStatusHttp = Layer.effect(
15 GetInstrumentationConfigurationStatus,
16 Effect.gen(function* () {
17 const bind = yield* AWSBindings.Bind;
18 const op = yield* AWSBindings.withCredentials(appsignals.getInstrumentationConfigurationStatus);
19 const tag = "AWS.ApplicationSignals.GetInstrumentationConfigurationStatus";
20
21 return Effect.fn(function* (configuration: InstrumentationConfiguration) {
22 const InstrumentationType = yield* configuration.instrumentationType;
23 const Service = yield* configuration.service;
24 const Environment = yield* configuration.environment;
25 const SignalType = yield* configuration.signalType;
26 const LocationHash = yield* configuration.locationHash;
27 if (!globalThis.__ALCHEMY_RUNTIME__) {
28 yield* bind`${tag}(${configuration})`({
29 policyStatements: [
30 {
31 Effect: "Allow",
32 Action: ["application-signals:GetInstrumentationConfigurationStatus"],
33 // The dynamic-instrumentation actions do not document
34 // resource-level permission support.
35 Resource: ["*"],
36 },
37 ],
38 });
39 }
40 return Effect.fn(`${tag}(${configuration.LogicalId})`)(function* (
41 request?: Omit<
42 appsignals.GetInstrumentationConfigurationStatusRequest,
43 "InstrumentationType" | "Service" | "Environment" | "SignalType" | "LocationIdentifier"
44 >,
45 ) {
46 return yield* op({
47 ...request,
48 InstrumentationType: yield* InstrumentationType,
49 Service: yield* Service,
50 Environment: yield* Environment,
51 SignalType: yield* SignalType,
52 LocationIdentifier: { LocationHash: yield* LocationHash },
53 });
54 });
55 });
56 }),
57 );