Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ The project publishes 0.x prerelease versions; a stable release line is not yet

## [Unreleased]

### Added

- `mem put <path> --watch` one-way foreground directory watch: poll `--interval` (default 30s), ingest new files after one quiet interval, report changed files without re-ingesting, and never propagate local deletes. Refs #110.

### Changed

- Ingest cursor locks try non-blocking exclusive locks and give up after 5s so a wedged peer becomes a warning instead of a silent hang. Refs #139.
Expand Down
2 changes: 1 addition & 1 deletion GOAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ mem 只有一份数据和能力内核,但面向两类使用者:
- [x] 实现 API / CLI / Web 的 workspace export 与空目标 `fresh` import。
- [x] 实现导入前校验、幂等 ledger、冲突明细、失败补偿和导入后重新索引。
- [x] 实现 `merge_conservative`。
- [ ] 实现增量包、断点上传与完整本地同步盘体验。
- [ ] 实现增量包、断点上传与完整本地同步盘体验。 One-way `mem put --watch` is #110 and is not this item.

### P2 — 让全部 Agent 数据可见可控

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ curl --fail http://127.0.0.1:8080/healthz
export MEM_SERVER=http://localhost:8080
mem auth login
mem put ~/Photos --recursive
mem put ~/Photos --watch # one-way watch of new files (#110); not a sync drive
# 可选:同步端附带可信的拍摄时间、位置和来源;AI 建议稍后在 Web 中确认
mem put ~/Photos/IMG_0001.jpg \
--captured-at 2026-07-29T08:00:00+08:00 \
Expand Down
2 changes: 1 addition & 1 deletion SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ mem put <path> --tag <tag>...
mem put <path> --captured-at <rfc3339> --lat <lat> --lon <lon> \
[--location-accuracy <meters>] [--place <label>] \
[--source-kind mobile|ai_device|other] [--source-name <description>]
mem put <path> --watch # 守护,新文件自动入
mem put <path> --watch # 守护,新文件自动入(#110 单向监视:变更只上报不重摄,本地删除不传播)

# 取
mem get <file_id> -o <path>
Expand Down
24 changes: 24 additions & 0 deletions server/cmd/mem/cmds_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ import (
func newPutCmd() *cobra.Command {
var (
recursive bool
watch bool
interval time.Duration
dryRun bool
limit int
tag []string
name string
mimeFlag string
Expand Down Expand Up @@ -68,6 +72,22 @@ func newPutCmd() *cobra.Command {
}

target := args[0]
if watch {
if target == "-" {
return errors.New("--watch does not read stdin")
}
return runPutWatch(cmd, watchOptions{
root: target,
dest: toFolder,
interval: interval,
format: format,
dryRun: dryRun,
limit: limit,
tags: tag,
sourceMetadata: sourceMetadata,
client: c,
})
}
if target == "-" {
if name == "" {
return errors.New("--name required when reading from stdin")
Expand All @@ -89,6 +109,10 @@ func newPutCmd() *cobra.Command {
},
}
cmd.Flags().BoolVarP(&recursive, "recursive", "r", false, "recurse into directories")
cmd.Flags().BoolVar(&watch, "watch", false, "one-way foreground watch; ingest new files after one quiet interval")
cmd.Flags().DurationVar(&interval, "interval", 30*time.Second, "watch poll interval")
cmd.Flags().BoolVar(&dryRun, "dry-run", false, "watch: plan only; do not upload or advance cursors")
cmd.Flags().IntVar(&limit, "limit", 0, "watch: stop after this many uploads per cycle (0 = no limit)")
cmd.Flags().StringArrayVar(&tag, "tag", nil, "tag(s) to attach (repeatable)")
cmd.Flags().StringVar(&name, "name", "", "override file name (required for stdin)")
cmd.Flags().StringVar(&mimeFlag, "mime", "", "override MIME type")
Expand Down
Loading
Loading