@dxos/blueprints 0.8.4-main.1da679c

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.
Files changed (41) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +3 -0
  3. package/dist/lib/browser/index.mjs +235 -0
  4. package/dist/lib/browser/index.mjs.map +7 -0
  5. package/dist/lib/browser/meta.json +1 -0
  6. package/dist/lib/node-esm/index.mjs +236 -0
  7. package/dist/lib/node-esm/index.mjs.map +7 -0
  8. package/dist/lib/node-esm/meta.json +1 -0
  9. package/dist/types/src/blueprint/blueprint.d.ts +73 -0
  10. package/dist/types/src/blueprint/blueprint.d.ts.map +1 -0
  11. package/dist/types/src/blueprint/index.d.ts +3 -0
  12. package/dist/types/src/blueprint/index.d.ts.map +1 -0
  13. package/dist/types/src/blueprint/registry.d.ts +11 -0
  14. package/dist/types/src/blueprint/registry.d.ts.map +1 -0
  15. package/dist/types/src/index.d.ts +4 -0
  16. package/dist/types/src/index.d.ts.map +1 -0
  17. package/dist/types/src/prompt/index.d.ts +2 -0
  18. package/dist/types/src/prompt/index.d.ts.map +1 -0
  19. package/dist/types/src/prompt/prompt.d.ts +72 -0
  20. package/dist/types/src/prompt/prompt.d.ts.map +1 -0
  21. package/dist/types/src/template/index.d.ts +3 -0
  22. package/dist/types/src/template/index.d.ts.map +1 -0
  23. package/dist/types/src/template/prompt.d.ts +5 -0
  24. package/dist/types/src/template/prompt.d.ts.map +1 -0
  25. package/dist/types/src/template/prompt.test.d.ts +2 -0
  26. package/dist/types/src/template/prompt.test.d.ts.map +1 -0
  27. package/dist/types/src/template/template.d.ts +39 -0
  28. package/dist/types/src/template/template.d.ts.map +1 -0
  29. package/dist/types/tsconfig.tsbuildinfo +1 -0
  30. package/package.json +46 -0
  31. package/src/blueprint/blueprint.ts +88 -0
  32. package/src/blueprint/index.ts +6 -0
  33. package/src/blueprint/registry.ts +36 -0
  34. package/src/index.ts +7 -0
  35. package/src/prompt/index.ts +5 -0
  36. package/src/prompt/prompt.ts +82 -0
  37. package/src/template/index.ts +6 -0
  38. package/src/template/prompt.test.ts +44 -0
  39. package/src/template/prompt.ts +19 -0
  40. package/src/template/template.ts +54 -0
  41. package/src/vite-env.d.ts +20 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blueprint.d.ts","sourceRoot":"","sources":["../../../../src/blueprint/blueprint.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAO,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAI1D;;;;GAIG;AACH,eAAO,MAAM,SAAS;IACpB;;;OAGG;;IAMH;;OAEG;;IAKH;;OAEG;;IAKH;;;OAGG;;;;;;;;;;;IAKH;;OAEG;;GAaJ,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC;CAAG;AAE1E;;GAEG;AACH,eAAO,MAAM,IAAI,GAAI,qBAA0B,IAAI,CAAC,SAAS,EAAE,KAAK,GAAG,MAAM,GAAG,cAAc,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;;;;;;;;;;;;;;;EAC1E,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,uBAG7B;IACD,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAClC,wDAAgG,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './blueprint';
2
+ export * from './registry';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blueprint/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { type Blueprint } from './blueprint';
2
+ /**
3
+ * Blueprint registry.
4
+ */
5
+ export declare class Registry {
6
+ private readonly _blueprints;
7
+ constructor(blueprints: Blueprint[]);
8
+ getByKey(key: string): Blueprint | undefined;
9
+ query(): Blueprint[];
10
+ }
11
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/blueprint/registry.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmB;gBAEnC,UAAU,EAAE,SAAS,EAAE;IAcnC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAI5C,KAAK,IAAI,SAAS,EAAE;CAGrB"}
@@ -0,0 +1,4 @@
1
+ export * as Blueprint from './blueprint';
2
+ export * as Template from './template';
3
+ export * as Prompt from './prompt';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './prompt';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/prompt/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,72 @@
1
+ import { Schema } from 'effect';
2
+ import { type Ref, Type } from '@dxos/echo';
3
+ import { Blueprint } from '../blueprint';
4
+ /**
5
+ * Executable instructions.
6
+ * Declare input and output schema.
7
+ * May utilize blueprints.
8
+ * May reference additional context.
9
+ */
10
+ declare const Prompt_: Type.obj<Schema.Struct<{
11
+ /**
12
+ * Name of the prompt.
13
+ */
14
+ name: typeof Schema.String;
15
+ /**
16
+ * Description of the prompt's purpose and functionality.
17
+ * Allows AI agents to execute prompts automatically as tools.
18
+ */
19
+ description: Schema.optional<typeof Schema.String>;
20
+ /**
21
+ * Input schema of the prompt.
22
+ */
23
+ input: Schema.Schema<Type.JsonSchema, Type.JsonSchema, never>;
24
+ /**
25
+ * Output schema of the prompt.
26
+ */
27
+ output: Schema.Schema<Type.JsonSchema, Type.JsonSchema, never>;
28
+ /**
29
+ * Natural language instructions for the prompt.
30
+ * These should provide concrete course of action for the AI to follow.
31
+ */
32
+ instructions: typeof Schema.String;
33
+ /**
34
+ * Blueprints that the prompt may utilize.
35
+ */
36
+ blueprints: Schema.Array$<Type.ref<Type.obj<Schema.Struct<{
37
+ key: Schema.SchemaClass<string, string, never>;
38
+ name: Schema.SchemaClass<string, string, never>;
39
+ description: Schema.optional<typeof Schema.String>;
40
+ instructions: Schema.mutable<Schema.Struct<{
41
+ source: Schema.SchemaClass<import("@dxos/echo-schema").Ref<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
42
+ content: string;
43
+ }>, import("@dxos/echo-protocol").EncodedReference, never>;
44
+ inputs: Schema.optional<Schema.mutable<Schema.Array$<Schema.mutable<Schema.Struct<{
45
+ name: typeof Schema.String;
46
+ kind: Schema.optional<Schema.Literal<["value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema"]>>;
47
+ default: Schema.optional<typeof Schema.Any>;
48
+ }>>>>>;
49
+ }>>;
50
+ tools: Schema.Array$<Schema.brand<typeof Schema.String, "ToolId">>;
51
+ }>>>>;
52
+ /**
53
+ * Additional context that the prompt may utilize.
54
+ */
55
+ context: Schema.Array$<typeof Schema.Any>;
56
+ }>>;
57
+ export interface Prompt extends Schema.Schema.Type<typeof Prompt_> {
58
+ }
59
+ export interface Prompt_Encoded extends Schema.Schema.Encoded<typeof Prompt_> {
60
+ }
61
+ export declare const Prompt: Schema.Schema<Prompt, Prompt_Encoded>;
62
+ export declare const make: (opts: {
63
+ name: string;
64
+ description?: string;
65
+ input: Schema.Schema.AnyNoContext;
66
+ output: Schema.Schema.AnyNoContext;
67
+ instructions: string;
68
+ blueprints?: Ref.Ref<Blueprint>[];
69
+ context?: any[];
70
+ }) => Prompt;
71
+ export {};
72
+ //# sourceMappingURL=prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../src/prompt/prompt.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAO,KAAK,GAAG,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGjD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC;;;;;GAKG;AACH,QAAA,MAAM,OAAO;IACX;;OAEG;;IAGH;;;OAGG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;;OAGG;;IAGH;;OAEG;;;;;;;;;;;;;;;;;IAGH;;OAEG;;GAOJ,CAAC;AACF,MAAM,WAAW,MAAO,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC;CAAG;AACrE,MAAM,WAAW,cAAe,SAAQ,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,OAAO,CAAC;CAAG;AAChF,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAW,CAAC;AAErE,eAAO,MAAM,IAAI,GAAI,MAAM;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;IAClC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;CACjB,KAAG,MASA,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './prompt';
2
+ export * from './template';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/template/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Process Handlebars template.
3
+ */
4
+ export declare const process: <Options extends {}>(source: string, variables?: Partial<Options>) => string;
5
+ //# sourceMappingURL=prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../src/template/prompt.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,SAAS,EAAE,EAAE,QAAQ,MAAM,EAAE,YAAW,OAAO,CAAC,OAAO,CAAM,KAAG,MAO9F,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=prompt.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.test.d.ts","sourceRoot":"","sources":["../../../../src/template/prompt.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,39 @@
1
+ import { Schema } from 'effect';
2
+ import { Type } from '@dxos/echo';
3
+ import { type ObjectId } from '@dxos/keys';
4
+ /**
5
+ * Template input kind determines how template variables are resolved.
6
+ */
7
+ export declare const InputKind: Schema.Literal<["value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema"]>;
8
+ export type InputKind = Schema.Schema.Type<typeof InputKind>;
9
+ /**
10
+ * Template input variable.
11
+ * E.g., {{foo}}
12
+ */
13
+ export declare const Input: Schema.mutable<Schema.Struct<{
14
+ name: typeof Schema.String;
15
+ kind: Schema.optional<Schema.Literal<["value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema"]>>;
16
+ default: Schema.optional<typeof Schema.Any>;
17
+ }>>;
18
+ export type Input = Schema.Schema.Type<typeof Input>;
19
+ /**
20
+ * Template type.
21
+ */
22
+ export declare const Template: Schema.mutable<Schema.Struct<{
23
+ source: Schema.SchemaClass<import("@dxos/echo-schema").Ref<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
24
+ content: string;
25
+ }>, import("@dxos/echo-protocol").EncodedReference, never>;
26
+ inputs: Schema.optional<Schema.mutable<Schema.Array$<Schema.mutable<Schema.Struct<{
27
+ name: typeof Schema.String;
28
+ kind: Schema.optional<Schema.Literal<["value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema"]>>;
29
+ default: Schema.optional<typeof Schema.Any>;
30
+ }>>>>>;
31
+ }>>;
32
+ export interface Template extends Schema.Schema.Type<typeof Template> {
33
+ }
34
+ export declare const make: ({ source, inputs, id }: {
35
+ source: string;
36
+ inputs?: Input[];
37
+ id?: ObjectId;
38
+ }) => Template;
39
+ //# sourceMappingURL=template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../../src/template/template.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAO,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C;;GAEG;AACH,eAAO,MAAM,SAAS,8GASrB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC,CAAC;AAE7D;;;GAGG;AACH,eAAO,MAAM,KAAK;;;;GAMjB,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,KAAK,CAAC,CAAC;AAErD;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;GAGE,CAAC;AAExB,MAAM,WAAW,QAAS,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC;CAAG;AAExE,eAAO,MAAM,IAAI,GAAI,wBAA6B;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IAAC,EAAE,CAAC,EAAE,QAAQ,CAAA;CAAE,KAAG,QAGtG,CAAC"}