@fragno-dev/pi-fragment 0.0.1 → 0.0.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 +39 -3
- package/dist/browser/client/react.d.ts +44 -36
- package/dist/browser/client/react.d.ts.map +1 -1
- package/dist/browser/client/react.js +105 -22
- package/dist/browser/client/react.js.map +1 -1
- package/dist/browser/client/solid.d.ts +42 -36
- package/dist/browser/client/solid.d.ts.map +1 -1
- package/dist/browser/client/solid.js +27 -13
- package/dist/browser/client/solid.js.map +1 -1
- package/dist/browser/client/svelte.d.ts +42 -36
- package/dist/browser/client/svelte.d.ts.map +1 -1
- package/dist/browser/client/svelte.js +14 -6
- package/dist/browser/client/svelte.js.map +1 -1
- package/dist/browser/client/vanilla.d.ts +99 -39
- package/dist/browser/client/vanilla.d.ts.map +1 -1
- package/dist/browser/client/vanilla.js +151 -3
- package/dist/browser/client/vanilla.js.map +1 -1
- package/dist/browser/client/vue.d.ts +54 -38
- package/dist/browser/client/vue.d.ts.map +1 -1
- package/dist/browser/client/vue.js +25 -17
- package/dist/browser/client/vue.js.map +1 -1
- package/dist/browser/{factory-DKoO_lRA.js → clients-BscY_HVe.js} +1051 -799
- package/dist/browser/clients-BscY_HVe.js.map +1 -0
- package/dist/browser/index.d.ts +3 -776
- package/dist/browser/index.js +801 -2
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/routes-CpL_YGWK.d.ts +1560 -0
- package/dist/browser/routes-CpL_YGWK.d.ts.map +1 -0
- package/dist/cli/mod.d.ts.map +1 -1
- package/dist/cli/mod.js +245 -7
- package/dist/cli/mod.js.map +1 -1
- package/dist/node/{pi → client}/clients.d.ts +46 -36
- package/dist/node/client/clients.d.ts.map +1 -0
- package/dist/node/client/clients.js +54 -0
- package/dist/node/client/clients.js.map +1 -0
- package/dist/node/client/session-controller.d.ts +31 -0
- package/dist/node/client/session-controller.d.ts.map +1 -0
- package/dist/node/client/session-controller.js +33 -0
- package/dist/node/client/session-controller.js.map +1 -0
- package/dist/node/client/session-store.d.ts +71 -0
- package/dist/node/client/session-store.d.ts.map +1 -0
- package/dist/node/client/session-store.js +637 -0
- package/dist/node/client/session-store.js.map +1 -0
- package/dist/node/debug-log.d.ts +9 -0
- package/dist/node/debug-log.d.ts.map +1 -0
- package/dist/node/debug-log.js +58 -0
- package/dist/node/debug-log.js.map +1 -0
- package/dist/node/index.d.ts +5 -4
- package/dist/node/index.js +5 -3
- package/dist/node/pi/definition.d.ts +1 -1
- package/dist/node/pi/definition.d.ts.map +1 -1
- package/dist/node/pi/dsl.d.ts +5 -2
- package/dist/node/pi/dsl.d.ts.map +1 -1
- package/dist/node/pi/dsl.js +22 -3
- package/dist/node/pi/dsl.js.map +1 -1
- package/dist/node/pi/factory.d.ts +37 -34
- package/dist/node/pi/factory.d.ts.map +1 -1
- package/dist/node/pi/factory.js.map +1 -1
- package/dist/node/pi/mappers.js +0 -1
- package/dist/node/pi/mappers.js.map +1 -1
- package/dist/node/pi/route-schemas.js +42 -10
- package/dist/node/pi/route-schemas.js.map +1 -1
- package/dist/node/pi/types.d.ts +155 -7
- package/dist/node/pi/types.d.ts.map +1 -1
- package/dist/node/pi/types.js +6 -0
- package/dist/node/pi/types.js.map +1 -0
- package/dist/node/pi/workflow/active-session.d.ts +2 -0
- package/dist/node/pi/workflow/active-session.js +107 -0
- package/dist/node/pi/workflow/active-session.js.map +1 -0
- package/dist/node/pi/workflow/agent-runner.d.ts +13 -0
- package/dist/node/pi/workflow/agent-runner.d.ts.map +1 -0
- package/dist/node/pi/workflow/agent-runner.js +228 -0
- package/dist/node/pi/workflow/agent-runner.js.map +1 -0
- package/dist/node/pi/workflow/tool-journal.js +157 -0
- package/dist/node/pi/workflow/tool-journal.js.map +1 -0
- package/dist/node/pi/workflow/workflow.d.ts +29 -0
- package/dist/node/pi/workflow/workflow.d.ts.map +1 -0
- package/dist/node/pi/workflow/workflow.js +219 -0
- package/dist/node/pi/workflow/workflow.js.map +1 -0
- package/dist/node/routes.d.ts +38 -35
- package/dist/node/routes.d.ts.map +1 -1
- package/dist/node/routes.js +203 -132
- package/dist/node/routes.js.map +1 -1
- package/dist/node/schema.js +1 -1
- package/dist/node/schema.js.map +1 -1
- package/package.json +30 -29
- package/dist/browser/client-Bk-J98pf.d.ts +0 -679
- package/dist/browser/client-Bk-J98pf.d.ts.map +0 -1
- package/dist/browser/factory-DKoO_lRA.js.map +0 -1
- package/dist/browser/index.d.ts.map +0 -1
- package/dist/node/pi/clients.d.ts.map +0 -1
- package/dist/node/pi/clients.js +0 -18
- package/dist/node/pi/clients.js.map +0 -1
- package/dist/node/pi/workflow.d.ts +0 -31
- package/dist/node/pi/workflow.d.ts.map +0 -1
- package/dist/node/pi/workflow.js +0 -242
- package/dist/node/pi/workflow.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "
|
|
3
|
-
import { computed, getCurrentScope, isRef, onScopeDispose, ref, shallowRef, watch } from "vue";
|
|
1
|
+
import { d as isStore, f as isReadableAtom, l as isGetHook, t as createPiFragmentClients, u as isMutatorHook } from "../clients-BscY_HVe.js";
|
|
2
|
+
import { atom } from "nanostores";
|
|
3
|
+
import { computed as computed$1, getCurrentScope, isRef, onScopeDispose, ref, shallowRef, watch } from "vue";
|
|
4
4
|
|
|
5
5
|
//#region ../fragno/dist/client/vue.js
|
|
6
6
|
/**
|
|
@@ -11,7 +11,7 @@ import { computed, getCurrentScope, isRef, onScopeDispose, ref, shallowRef, watc
|
|
|
11
11
|
* @private
|
|
12
12
|
*/
|
|
13
13
|
function refToAtom(ref$1) {
|
|
14
|
-
const a =
|
|
14
|
+
const a = atom(ref$1.value);
|
|
15
15
|
watch(ref$1, (newVal) => {
|
|
16
16
|
a.set(newVal);
|
|
17
17
|
});
|
|
@@ -74,23 +74,31 @@ function createVueMutator(hook) {
|
|
|
74
74
|
};
|
|
75
75
|
return {
|
|
76
76
|
mutate,
|
|
77
|
-
loading: computed(() => store.value.loading),
|
|
78
|
-
error: computed(() => store.value.error),
|
|
79
|
-
data: computed(() => store.value.data)
|
|
77
|
+
loading: computed$1(() => store.value.loading),
|
|
78
|
+
error: computed$1(() => store.value.error),
|
|
79
|
+
data: computed$1(() => store.value.data)
|
|
80
80
|
};
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
+
function unwrapVueStoreValue(value) {
|
|
84
|
+
if (isReadableAtom(value)) return useStore(value);
|
|
85
|
+
const result = {};
|
|
86
|
+
for (const key in value) {
|
|
87
|
+
if (!Object.prototype.hasOwnProperty.call(value, key)) continue;
|
|
88
|
+
const fieldValue = value[key];
|
|
89
|
+
if (isReadableAtom(fieldValue)) result[key] = useStore(fieldValue);
|
|
90
|
+
else result[key] = fieldValue;
|
|
91
|
+
}
|
|
92
|
+
return result;
|
|
93
|
+
}
|
|
83
94
|
function createVueStore(hook) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
else result[key] = value;
|
|
92
|
-
}
|
|
93
|
-
return result;
|
|
95
|
+
return (...args) => {
|
|
96
|
+
const value = "factory" in hook ? hook.factory(...args) : hook.obj;
|
|
97
|
+
const disposer = value[Symbol.dispose];
|
|
98
|
+
if (typeof disposer === "function" && getCurrentScope()) onScopeDispose(() => {
|
|
99
|
+
disposer.call(value);
|
|
100
|
+
});
|
|
101
|
+
return unwrapVueStoreValue(value);
|
|
94
102
|
};
|
|
95
103
|
}
|
|
96
104
|
function useFragno(clientObj) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vue.js","names":["isReadableAtom","isGetHook","isMutatorHook","isStore","atom","computed","computed$1","getCurrentScope","isRef","onScopeDispose","ref","shallowRef","watch","refToAtom","ref$1","a","value","newVal","set","createVueHook","hook","path","query","pathParams","queryParams","key","Object","entries","v","store","data","loading","error","unsubscribe","subscribe","updatedStoreValue","createVueMutator","useStore","mutatorStore","mutate","args","body","
|
|
1
|
+
{"version":3,"file":"vue.js","names":["isReadableAtom","isGetHook","isMutatorHook","isStore","atom","computed","computed$1","getCurrentScope","isRef","onScopeDispose","ref","shallowRef","watch","refToAtom","ref$1","a","value","newVal","set","createVueHook","hook","path","query","pathParams","queryParams","key","Object","entries","v","store","data","loading","error","unsubscribe","subscribe","updatedStoreValue","createVueMutator","useStore","mutatorStore","mutate","args","body","unwrapVueStoreValue","result","prototype","hasOwnProperty","call","fieldValue","createVueStore","factory","obj","disposer","Symbol","dispose","useFragno","clientObj","state","useFragno","createPiFragmentClients","PiFragmentClientConfig","createPiFragmentClient","config"],"sources":["../../../../fragno/dist/client/vue.js","../../../src/client/vue.ts"],"sourcesContent":["import { isReadableAtom } from \"../util/nanostores.js\";\nimport { isGetHook, isMutatorHook, isStore } from \"./client.js\";\nimport { atom } from \"nanostores\";\nimport { computed as computed$1, getCurrentScope, isRef, onScopeDispose, ref, shallowRef, watch } from \"vue\";\n\n//#region src/client/vue.ts\n/**\n* Converts a Vue Ref to a NanoStore Atom.\n*\n* This is used to convert Vue refs to atoms, so that we can use them in the store.\n*\n* @private\n*/\nfunction refToAtom(ref$1) {\n\tconst a = atom(ref$1.value);\n\twatch(ref$1, (newVal) => {\n\t\ta.set(newVal);\n\t});\n\treturn a;\n}\nfunction createVueHook(hook) {\n\treturn ({ path, query } = {}) => {\n\t\tconst pathParams = {};\n\t\tconst queryParams = {};\n\t\tfor (const [key, value] of Object.entries(path ?? {})) {\n\t\t\tconst v = value;\n\t\t\tpathParams[key] = isRef(v) ? refToAtom(v) : v;\n\t\t}\n\t\tfor (const [key, value] of Object.entries(query ?? {})) {\n\t\t\tconst v = value;\n\t\t\tqueryParams[key] = isRef(v) ? refToAtom(v) : v;\n\t\t}\n\t\tconst store = hook.store({\n\t\t\tpath: pathParams,\n\t\t\tquery: queryParams\n\t\t});\n\t\tconst data = ref();\n\t\tconst loading = ref();\n\t\tconst error = ref();\n\t\tconst unsubscribe = store.subscribe((updatedStoreValue) => {\n\t\t\tdata.value = updatedStoreValue.data;\n\t\t\tloading.value = updatedStoreValue.loading;\n\t\t\terror.value = updatedStoreValue.error;\n\t\t});\n\t\tif (getCurrentScope()) onScopeDispose(() => {\n\t\t\tunsubscribe();\n\t\t});\n\t\treturn {\n\t\t\tdata,\n\t\t\tloading,\n\t\t\terror\n\t\t};\n\t};\n}\nfunction createVueMutator(hook) {\n\treturn () => {\n\t\tconst store = useStore(hook.mutatorStore);\n\t\tconst mutate = async (args) => {\n\t\t\tconst { body, path, query } = args;\n\t\t\tconst pathParams = {};\n\t\t\tconst queryParams = {};\n\t\t\tfor (const [key, value] of Object.entries(path ?? {})) {\n\t\t\t\tconst v = value;\n\t\t\t\tpathParams[key] = isRef(v) ? v.value : v;\n\t\t\t}\n\t\t\tfor (const [key, value] of Object.entries(query ?? {})) {\n\t\t\t\tconst v = value;\n\t\t\t\tqueryParams[key] = isRef(v) ? v.value : v;\n\t\t\t}\n\t\t\treturn store.value.mutate({\n\t\t\t\tbody,\n\t\t\t\tpath: pathParams,\n\t\t\t\tquery: queryParams\n\t\t\t});\n\t\t};\n\t\treturn {\n\t\t\tmutate,\n\t\t\tloading: computed$1(() => store.value.loading),\n\t\t\terror: computed$1(() => store.value.error),\n\t\t\tdata: computed$1(() => store.value.data)\n\t\t};\n\t};\n}\nfunction unwrapVueStoreValue(value) {\n\tif (isReadableAtom(value)) return useStore(value);\n\tconst result = {};\n\tfor (const key in value) {\n\t\tif (!Object.prototype.hasOwnProperty.call(value, key)) continue;\n\t\tconst fieldValue = value[key];\n\t\tif (isReadableAtom(fieldValue)) result[key] = useStore(fieldValue);\n\t\telse result[key] = fieldValue;\n\t}\n\treturn result;\n}\nfunction createVueStore(hook) {\n\treturn ((...args) => {\n\t\tconst value = \"factory\" in hook ? hook.factory(...args) : hook.obj;\n\t\tconst disposer = value[Symbol.dispose];\n\t\tif (typeof disposer === \"function\" && getCurrentScope()) onScopeDispose(() => {\n\t\t\tdisposer.call(value);\n\t\t});\n\t\treturn unwrapVueStoreValue(value);\n\t});\n}\nfunction useFragno(clientObj) {\n\tconst result = {};\n\tfor (const key in clientObj) {\n\t\tif (!Object.prototype.hasOwnProperty.call(clientObj, key)) continue;\n\t\tconst hook = clientObj[key];\n\t\tif (isGetHook(hook)) result[key] = createVueHook(hook);\n\t\telse if (isMutatorHook(hook)) result[key] = createVueMutator(hook);\n\t\telse if (isStore(hook)) result[key] = createVueStore(hook);\n\t\telse result[key] = hook;\n\t}\n\treturn result;\n}\nfunction useStore(store) {\n\tconst state = shallowRef();\n\tconst unsubscribe = store.subscribe((value) => {\n\t\tstate.value = value;\n\t});\n\tif (getCurrentScope()) onScopeDispose(unsubscribe);\n\treturn state;\n}\n\n//#endregion\nexport { refToAtom, useFragno, useStore };\n//# sourceMappingURL=vue.js.map","import { useFragno } from \"@fragno-dev/core/vue\";\n\nimport { createPiFragmentClients, type PiFragmentClientConfig } from \"./clients\";\n\nexport function createPiFragmentClient(config: PiFragmentClientConfig = {}) {\n return useFragno(createPiFragmentClients(config));\n}\n"],"mappings":";;;;;;;;;;;;AAaA,SAASa,UAAUC,OAAO;CACzB,MAAMC,IAAIX,KAAKU,MAAME,MAAM;AAC3BJ,OAAME,QAAQG,WAAW;AACxBF,IAAEG,IAAID,OAAO;GACZ;AACF,QAAOF;;AAER,SAASI,cAAcC,MAAM;AAC5B,SAAQ,EAAEC,MAAMC,UAAU,EAAE,KAAK;EAChC,MAAMC,aAAa,EAAE;EACrB,MAAMC,cAAc,EAAE;AACtB,OAAK,MAAM,CAACC,KAAKT,UAAUU,OAAOC,QAAQN,QAAQ,EAAE,CAAC,EAAE;GACtD,MAAMO,IAAIZ;AACVO,cAAWE,OAAOjB,MAAMoB,EAAE,GAAGf,UAAUe,EAAE,GAAGA;;AAE7C,OAAK,MAAM,CAACH,KAAKT,UAAUU,OAAOC,QAAQL,SAAS,EAAE,CAAC,EAAE;GACvD,MAAMM,IAAIZ;AACVQ,eAA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