@fml-inc/fml 0.8.12 → 0.8.13-rc.2
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/.claude-plugin/plugin.json +1 -1
- package/README.md +58 -0
- package/dist/chunk-3RKICLMI.js +34 -0
- package/dist/{chunk-JK5JGPUN.js → chunk-56ABBKUE.js} +2 -2
- package/dist/chunk-74KOMQZO.js +505 -0
- package/dist/{chunk-4YLCUJ6C.js → chunk-AZSAAPRC.js} +20 -2
- package/dist/{chunk-IUFDFBU7.js → chunk-C4Z6RMQ5.js} +1 -1
- package/dist/chunk-F57IFY3K.js +21 -0
- package/dist/{chunk-5VP4C72Z.js → chunk-K2ANDHRQ.js} +1 -1
- package/dist/{chunk-VFZWTVPD.js → chunk-LYKMU7QR.js} +252 -343
- package/dist/{chunk-Z7MXNJ6X.js → chunk-PVOZYFMP.js} +1 -1
- package/dist/cli.js +12 -21
- package/dist/hook-handler.js +32 -13
- package/dist/mcp/server.js +61 -2
- package/dist/observer-server.js +9 -8
- package/dist/pi/extension.js +802 -354
- package/dist/sync-cycle.js +4 -3
- package/package.json +1 -1
- package/dist/chunk-CSOFP7MT.js +0 -67
- package/dist/chunk-EX5J3MPG.js +0 -142
|
@@ -53,7 +53,7 @@ var PACKAGE_NAME = "@fml-inc/fml";
|
|
|
53
53
|
var UPDATE_TIMEOUT_MS = 12e4;
|
|
54
54
|
var SETUP_TIMEOUT_MS = 3e5;
|
|
55
55
|
function getCurrentVersion() {
|
|
56
|
-
return true ? "0.8.
|
|
56
|
+
return true ? "0.8.13-rc.2+c00749ec" : "unknown";
|
|
57
57
|
}
|
|
58
58
|
function parseVersion(version) {
|
|
59
59
|
const match = SEMVER_PATTERN.exec(version);
|
package/dist/cli.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createFmlClient,
|
|
4
4
|
getAuthenticatedClient
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-C4Z6RMQ5.js";
|
|
6
6
|
import {
|
|
7
7
|
execBinSync,
|
|
8
8
|
handleUpdate,
|
|
9
9
|
resolveBin
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-PVOZYFMP.js";
|
|
11
11
|
import {
|
|
12
12
|
openObserverLog,
|
|
13
13
|
readJsonFile,
|
|
@@ -29,19 +29,21 @@ import {
|
|
|
29
29
|
readObserverAuthToken,
|
|
30
30
|
readObserverStateStatus,
|
|
31
31
|
removeObserverStateIfOwned
|
|
32
|
-
} from "./chunk-
|
|
33
|
-
import "./chunk-
|
|
32
|
+
} from "./chunk-K2ANDHRQ.js";
|
|
33
|
+
import "./chunk-3RKICLMI.js";
|
|
34
34
|
import {
|
|
35
35
|
claudeConfigDirectory,
|
|
36
36
|
createCliRawSync,
|
|
37
37
|
createRawArtifactSync,
|
|
38
38
|
geminiConfigDirectory,
|
|
39
39
|
initializeSyncSettings,
|
|
40
|
+
resolvePiAgentDir,
|
|
40
41
|
runRawSyncOnce
|
|
41
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-LYKMU7QR.js";
|
|
42
43
|
import {
|
|
43
44
|
resolvePackageRoot
|
|
44
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-F57IFY3K.js";
|
|
46
|
+
import "./chunk-74KOMQZO.js";
|
|
45
47
|
import {
|
|
46
48
|
DEFAULT_PROD_URL,
|
|
47
49
|
DEFAULT_TARGET_NAME,
|
|
@@ -132,7 +134,7 @@ var STOP_TIMEOUT_MS = 5e3;
|
|
|
132
134
|
var FORCE_STOP_TIMEOUT_MS = 2e3;
|
|
133
135
|
var POLL_INTERVAL_MS = 50;
|
|
134
136
|
function expectedObserverVersion() {
|
|
135
|
-
return true ? "0.8.
|
|
137
|
+
return true ? "0.8.13-rc.2+c00749ec" : "dev";
|
|
136
138
|
}
|
|
137
139
|
function delay(ms) {
|
|
138
140
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -2553,17 +2555,6 @@ var LEGACY_PI_EXTENSION_SIGNATURES = Object.freeze([
|
|
|
2553
2555
|
function pathApiFor(platform) {
|
|
2554
2556
|
return platform === "win32" ? path11.win32 : path11.posix;
|
|
2555
2557
|
}
|
|
2556
|
-
function resolvePiAgentDir(context, pathApi) {
|
|
2557
|
-
const configured = context.env.PI_CODING_AGENT_DIR?.trim();
|
|
2558
|
-
if (!configured) {
|
|
2559
|
-
return pathApi.join(context.homeDir, ".pi", "agent");
|
|
2560
|
-
}
|
|
2561
|
-
if (configured === "~") return context.homeDir;
|
|
2562
|
-
if (configured.startsWith("~/") || configured.startsWith("~\\")) {
|
|
2563
|
-
return pathApi.join(context.homeDir, configured.slice(2));
|
|
2564
|
-
}
|
|
2565
|
-
return pathApi.normalize(configured);
|
|
2566
|
-
}
|
|
2567
2558
|
function readFileIfPresent(filePath) {
|
|
2568
2559
|
try {
|
|
2569
2560
|
return fs6.readFileSync(filePath, "utf8");
|
|
@@ -2606,7 +2597,7 @@ var PI_EXTENSION_INSTALLER = Object.freeze({
|
|
|
2606
2597
|
resolvePaths(context) {
|
|
2607
2598
|
const pathApi = pathApiFor(context.platform);
|
|
2608
2599
|
const extensionsDir = pathApi.join(
|
|
2609
|
-
resolvePiAgentDir(context
|
|
2600
|
+
resolvePiAgentDir(context),
|
|
2610
2601
|
"extensions"
|
|
2611
2602
|
);
|
|
2612
2603
|
return {
|
|
@@ -9736,7 +9727,7 @@ async function handleConfigDetail(opts) {
|
|
|
9736
9727
|
// src/commands/tools.ts
|
|
9737
9728
|
import { readFileSync } from "fs";
|
|
9738
9729
|
import path31 from "path";
|
|
9739
|
-
var pluginVersion = true ? "0.8.
|
|
9730
|
+
var pluginVersion = true ? "0.8.13-rc.2+c00749ec" : void 0;
|
|
9740
9731
|
async function getApi() {
|
|
9741
9732
|
const api = await getAuthenticatedClient();
|
|
9742
9733
|
if (!api) {
|
|
@@ -9893,7 +9884,7 @@ if (process.argv.length <= 2 || process.argv.includes("--help") || process.argv.
|
|
|
9893
9884
|
printBanner();
|
|
9894
9885
|
}
|
|
9895
9886
|
var program = new Command().name("fml").description("FML CLI and agent tools").version(
|
|
9896
|
-
true ? "0.8.
|
|
9887
|
+
true ? "0.8.13-rc.2+c00749ec" : "dev"
|
|
9897
9888
|
);
|
|
9898
9889
|
function formatCommandInventory(cmd, prefix = "") {
|
|
9899
9890
|
const name = prefix ? `${prefix} ${cmd.name()}` : cmd.name();
|
package/dist/hook-handler.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./chunk-2ZCXGYI5.js";
|
|
6
6
|
import {
|
|
7
7
|
getActiveHookDestinationBinding
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-AZSAAPRC.js";
|
|
9
9
|
import {
|
|
10
10
|
HookInboxCapacityError,
|
|
11
11
|
OBSERVER_HEARTBEAT_STALE_MS,
|
|
@@ -19,14 +19,18 @@ import {
|
|
|
19
19
|
readObserverAuthToken,
|
|
20
20
|
readObserverState,
|
|
21
21
|
recordHookInboxLoss
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-K2ANDHRQ.js";
|
|
23
23
|
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} from "./chunk-
|
|
24
|
+
resolveGitStateFromCwd,
|
|
25
|
+
resolveRepositoryRootFromCwd
|
|
26
|
+
} from "./chunk-3RKICLMI.js";
|
|
27
27
|
import {
|
|
28
28
|
resolvePackageRoot
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-F57IFY3K.js";
|
|
30
|
+
import {
|
|
31
|
+
GIT_STATE_PAYLOAD_KEY,
|
|
32
|
+
capturedGitState
|
|
33
|
+
} from "./chunk-74KOMQZO.js";
|
|
30
34
|
import {
|
|
31
35
|
FML_HOOK_CONTEXT_STATE_DIR,
|
|
32
36
|
FML_HOOK_INBOX_DIR,
|
|
@@ -656,7 +660,8 @@ function hookOutput(request, injection) {
|
|
|
656
660
|
async function requestServerHookContext(target2, event, destination, opts = {}) {
|
|
657
661
|
const stateDir = opts.stateDir ?? FML_HOOK_CONTEXT_STATE_DIR;
|
|
658
662
|
pruneOldMarkers(stateDir, Date.now());
|
|
659
|
-
const
|
|
663
|
+
const snapshot = capturedGitState(event.payload);
|
|
664
|
+
const repositoryRoot = snapshot !== void 0 ? snapshot?.worktreeRoot ?? null : event.eventType === "PreToolUse" && event.cwd ? (opts.resolveRepositoryRoot ?? ((cwd) => resolveRepositoryRootFromCwd(cwd, 250)))(event.cwd) : null;
|
|
660
665
|
const request = buildServerHookContextRequest(
|
|
661
666
|
target2,
|
|
662
667
|
event,
|
|
@@ -799,7 +804,7 @@ async function processHookHandler(target2, opts, includeContext) {
|
|
|
799
804
|
return { captured: false, output: {} };
|
|
800
805
|
}
|
|
801
806
|
const cwd = opts.cwd ?? process.cwd();
|
|
802
|
-
|
|
807
|
+
let hookRequest = {
|
|
803
808
|
target: target2,
|
|
804
809
|
payload,
|
|
805
810
|
cwd
|
|
@@ -807,11 +812,25 @@ async function processHookHandler(target2, opts, includeContext) {
|
|
|
807
812
|
let event = normalizeObserverHookCapture(hookRequest);
|
|
808
813
|
if (event?.cwd) {
|
|
809
814
|
try {
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
+
if (opts.resolveRepository) {
|
|
816
|
+
const repository = opts.resolveRepository(event.cwd);
|
|
817
|
+
if (repository) event = { ...event, repository };
|
|
818
|
+
} else {
|
|
819
|
+
const gitState = resolveGitStateFromCwd(
|
|
820
|
+
event.cwd,
|
|
821
|
+
HOOK_REPO_RESOLUTION_TIMEOUT_MS
|
|
822
|
+
);
|
|
823
|
+
const enrichedPayload = {
|
|
824
|
+
...hookRequest.payload,
|
|
825
|
+
[GIT_STATE_PAYLOAD_KEY]: gitState
|
|
826
|
+
};
|
|
827
|
+
hookRequest = { ...hookRequest, payload: enrichedPayload };
|
|
828
|
+
event = {
|
|
829
|
+
...event,
|
|
830
|
+
payload: enrichedPayload,
|
|
831
|
+
...gitState?.repository ? { repository: gitState.repository } : {}
|
|
832
|
+
};
|
|
833
|
+
}
|
|
815
834
|
} catch {
|
|
816
835
|
}
|
|
817
836
|
}
|
package/dist/mcp/server.js
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createFmlClient,
|
|
4
4
|
getAuthenticatedClient
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-C4Z6RMQ5.js";
|
|
6
6
|
import {
|
|
7
7
|
resolveRepoFromCwd
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-3RKICLMI.js";
|
|
9
|
+
import "../chunk-74KOMQZO.js";
|
|
9
10
|
import {
|
|
10
11
|
FML_DATA_DIR,
|
|
11
12
|
FML_LOG_DIR,
|
|
@@ -95,6 +96,64 @@ function registerTools(server2, environment = getActiveEnv()) {
|
|
|
95
96
|
registerSessionTimelineTool();
|
|
96
97
|
return;
|
|
97
98
|
}
|
|
99
|
+
server2.tool(
|
|
100
|
+
"fml_get_attachment",
|
|
101
|
+
"Fetch an fml-ref attachment in chunks of up to 4 MiB decoded. Complete small images render natively; partial images and other files return base64 plus offset, totalBytes, nextOffset and SHA-256. Continue with offset=nextOffset until null. Decode each chunk separately before concatenating bytes in order.",
|
|
102
|
+
{
|
|
103
|
+
ref: z.string().max(512),
|
|
104
|
+
offset: z.number().int().nonnegative().optional().describe(
|
|
105
|
+
"Decoded byte offset; defaults to 0. Use nextOffset to continue."
|
|
106
|
+
),
|
|
107
|
+
maxBytes: z.number().int().positive().optional().describe(
|
|
108
|
+
"Maximum decoded bytes per chunk, up to 4 MiB; defaults to 4 MiB."
|
|
109
|
+
)
|
|
110
|
+
},
|
|
111
|
+
async ({ ref, offset, maxBytes }) => {
|
|
112
|
+
try {
|
|
113
|
+
const api = await getAuthenticatedClient(environment);
|
|
114
|
+
if (!api) return errorResult("Not authenticated. Run fml login.");
|
|
115
|
+
const response = await api.callBackend("get-attachment", {
|
|
116
|
+
ref,
|
|
117
|
+
...offset === void 0 ? {} : { offset },
|
|
118
|
+
...maxBytes === void 0 ? {} : { maxBytes }
|
|
119
|
+
});
|
|
120
|
+
if (!response.ok)
|
|
121
|
+
return errorResult(response.error ?? "Attachment unavailable");
|
|
122
|
+
const parsed = z.object({
|
|
123
|
+
success: z.literal(true),
|
|
124
|
+
data: z.object({
|
|
125
|
+
mediaType: z.string(),
|
|
126
|
+
data: z.string(),
|
|
127
|
+
// Optional for compatibility with backends predating chunking.
|
|
128
|
+
offset: z.number().optional(),
|
|
129
|
+
totalBytes: z.number().optional(),
|
|
130
|
+
nextOffset: z.number().nullable().optional(),
|
|
131
|
+
sha256: z.string().optional()
|
|
132
|
+
})
|
|
133
|
+
}).safeParse(response.result);
|
|
134
|
+
if (!parsed.success) return textResult(response.result);
|
|
135
|
+
const attachment = parsed.data.data;
|
|
136
|
+
if ((attachment.offset ?? 0) === 0 && attachment.nextOffset == null && ["image/png", "image/jpeg", "image/gif", "image/webp"].includes(
|
|
137
|
+
attachment.mediaType
|
|
138
|
+
)) {
|
|
139
|
+
return {
|
|
140
|
+
content: [
|
|
141
|
+
{
|
|
142
|
+
type: "image",
|
|
143
|
+
mimeType: attachment.mediaType,
|
|
144
|
+
data: attachment.data
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
return textResult(attachment);
|
|
150
|
+
} catch (error) {
|
|
151
|
+
return errorResult(
|
|
152
|
+
error instanceof Error ? error.message : "Attachment unavailable"
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
);
|
|
98
157
|
server2.tool(
|
|
99
158
|
"whoami",
|
|
100
159
|
"Show current authenticated user and available organizations",
|
package/dist/observer-server.js
CHANGED
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
isWinShim,
|
|
6
6
|
quoteWinArg,
|
|
7
7
|
resolveBin
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-PVOZYFMP.js";
|
|
9
9
|
import {
|
|
10
10
|
createHookSyncLoop,
|
|
11
11
|
getActiveHookDestinationBinding
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-AZSAAPRC.js";
|
|
13
13
|
import {
|
|
14
14
|
OBSERVER_PROTOCOL_VERSION,
|
|
15
15
|
OBSERVER_SERVICE_NAME,
|
|
@@ -30,17 +30,18 @@ import {
|
|
|
30
30
|
removeObserverStateIfOwned,
|
|
31
31
|
retireHookInboxEntry,
|
|
32
32
|
updateObserverState
|
|
33
|
-
} from "./chunk-
|
|
34
|
-
import "./chunk-
|
|
33
|
+
} from "./chunk-K2ANDHRQ.js";
|
|
34
|
+
import "./chunk-3RKICLMI.js";
|
|
35
35
|
import {
|
|
36
36
|
ObserverSyncCycleAbortedError,
|
|
37
37
|
runObserverSyncCycleSubprocess
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-56ABBKUE.js";
|
|
39
39
|
import {
|
|
40
40
|
createCliRawSync,
|
|
41
41
|
invalidateCliRawSyncDiscoveryCache
|
|
42
|
-
} from "./chunk-
|
|
43
|
-
import "./chunk-
|
|
42
|
+
} from "./chunk-LYKMU7QR.js";
|
|
43
|
+
import "./chunk-F57IFY3K.js";
|
|
44
|
+
import "./chunk-74KOMQZO.js";
|
|
44
45
|
import {
|
|
45
46
|
FML_OBSERVER_AUTH_TOKEN_FILE,
|
|
46
47
|
FML_OBSERVER_ENDPOINT_FILE,
|
|
@@ -1563,7 +1564,7 @@ var hookRejectionStatus = () => ({
|
|
|
1563
1564
|
...lastRejectedReason !== void 0 ? { lastRejectedReason } : {},
|
|
1564
1565
|
...lastRejectedTarget !== void 0 ? { lastRejectedTarget } : {}
|
|
1565
1566
|
});
|
|
1566
|
-
var packageVersion = true ? "0.8.
|
|
1567
|
+
var packageVersion = true ? "0.8.13-rc.2+c00749ec" : "dev";
|
|
1567
1568
|
var health = () => ({
|
|
1568
1569
|
status: "ok",
|
|
1569
1570
|
service: OBSERVER_SERVICE_NAME,
|